#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 *);
print_byte(int mybyte) {
  int i;
  for (i = 7; i >= 0; i--) {
    (mybyte & (0x01 << i)) ? printf("1") : printf("0");
    if (i == 4)
      printf(" ");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x7,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     118c <print_byte+0x7c>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1157 <print_byte+0x47>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
jmp    1163 <print_byte+0x53>
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x4,-0xc(%rbp)
jne    1179 <print_byte+0x69>
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
jmp    117e <print_byte+0x6e>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1122 <print_byte+0x12>
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_byte>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    %edi,%eax
and    $0x80,%eax
cmp    $0x1,%eax
mov    $0x31,%ebp
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
mov    %ebx,%eax
and    $0x40,%eax
cmp    $0x1,%eax
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
mov    %ebx,%eax
and    $0x20,%eax
cmp    $0x1,%eax
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
mov    %ebx,%eax
and    $0x10,%eax
cmp    $0x1,%eax
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    %ebx,%eax
and    $0x8,%eax
cmp    $0x1,%eax
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
mov    %ebx,%eax
and    $0x4,%eax
cmp    $0x1,%eax
mov    $0x31,%edi
sbb    $0x0,%edi
call   1030 <putchar@plt>
mov    %ebx,%eax
and    $0x2,%eax
cmp    $0x1,%eax
sbb    $0x0,%ebp
mov    %ebp,%edi
call   1030 <putchar@plt>
and    $0x1,%ebx
or     $0x30,%ebx
mov    %ebx,%edi
call   1030 <putchar@plt>
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 i32 @print_byte(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 7, i32* %4
br label %5
5: ; preds = %25, %1
%6 = load i32, i32* %4
%7 = icmp sge i32 %6, 0
br i1 %7, label %8, label %28
8: ; preds = %5
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = shl i32 1, %10
%12 = and i32 %9, %11
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %8
%15 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %18
16: ; preds = %8
%17 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16, %14
%19 = phi i32 [ %15, %14 ], [ %17, %16 ]
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 4
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %24
24: ; preds = %22, %18
br label %25
25: ; preds = %24
%26 = load i32, i32* %4
%27 = add nsw i32 %26, -1
store i32 %27, i32* %4
br label %5
28: ; preds = %5
%29 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%30 = load i32, i32* %2
ret i32 %30
}

LLVM IR (-O2):
define i32 @print_byte(i32 %0) {
%2 = and i32 %0, 128
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 48, i32 49
%5 = tail call i32 @putchar(i32 %4)
%6 = and i32 %0, 64
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i32 48, i32 49
%9 = tail call i32 @putchar(i32 %8)
%10 = and i32 %0, 32
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i32 48, i32 49
%13 = tail call i32 @putchar(i32 %12)
%14 = and i32 %0, 16
%15 = icmp eq i32 %14, 0
%16 = select i1 %15, i32 48, i32 49
%17 = tail call i32 @putchar(i32 %16)
%18 = tail call i32 @putchar(i32 32)
%19 = and i32 %0, 8
%20 = icmp eq i32 %19, 0
%21 = select i1 %20, i32 48, i32 49
%22 = tail call i32 @putchar(i32 %21)
%23 = and i32 %0, 4
%24 = icmp eq i32 %23, 0
%25 = select i1 %24, i32 48, i32 49
%26 = tail call i32 @putchar(i32 %25)
%27 = and i32 %0, 2
%28 = icmp eq i32 %27, 0
%29 = select i1 %28, i32 48, i32 49
%30 = tail call i32 @putchar(i32 %29)
%31 = and i32 %0, 1
%32 = or i32 %31, 48
%33 = tail call i32 @putchar(i32 %32)
%34 = tail call i32 @putchar(i32 10)
ret i32 undef
}