#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*/ print_byte(unsigned char);
int /*<<< orphan*/ printf(char *);
void print_num_byte(unsigned char *byte, int len) {
  int i, x;
  x = 0;
  for (i = 0; i < len; i++) {
    print_byte(byte[i]);
    x++;
    if (x == 8) {
      printf("\n");
      x = 0;
    }
  }
}


x86 assembly (clang, -O0):
<print_num_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1193 <print_num_byte+0x73>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1030 <print_byte@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jne    1180 <print_num_byte+0x60>
lea    0xe8c(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
jmp    1185 <print_num_byte+0x65>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113d <print_num_byte+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_num_byte>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %esi,%esi
jle    1169 <print_num_byte+0x49>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    1149 <print_num_byte+0x29>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%r15
je     1169 <print_num_byte+0x49>
movzbl (%r14,%rbx,1),%edi
call   1040 <print_byte@plt>
add    $0x1,%ebp
cmp    $0x8,%ebp
jne    1140 <print_num_byte+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %ebp,%ebp
jmp    1140 <print_num_byte+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define void @print_num_byte(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %6
store i32 0, i32* %5
br label %7
7: ; preds = %25, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %28
11: ; preds = %7
%12 = load i8*, i8** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = call i32 @print_byte(i8 zeroext %16)
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
%20 = load i32, i32* %6
%21 = icmp eq i32 %20, 8
br i1 %21, label %22, label %24
22: ; preds = %11
%23 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
br label %24
24: ; preds = %22, %11
br label %25
25: ; preds = %24
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %7
28: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @print_num_byte(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %20
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %16
%7 = phi i64 [ 0, %4 ], [ %18, %16 ]
%8 = phi i32 [ 0, %4 ], [ %17, %16 ]
%9 = getelementptr inbounds i8, i8* %0, i64 %7
%10 = load i8, i8* %9
%11 = tail call i32 @print_byte(i8 zeroext %10)
%12 = add nsw i32 %8, 1
%13 = icmp eq i32 %12, 8
br i1 %13, label %14, label %16
14: ; preds = %6
%15 = tail call i32 @putchar(i32 10)
br label %16
16: ; preds = %6, %14
%17 = phi i32 [ 0, %14 ], [ %12, %6 ]
%18 = add nuw nsw i64 %7, 1
%19 = icmp eq i64 %18, %5
br i1 %19, label %20, label %6
20: ; preds = %16, %2
ret void
}