#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 __printblock(unsigned char *block) {
  for (int i = 0; i < 16; i++) {
    if (i % 8 == 0) {
      printf("%s", "\n");
    } else if (i % 4 == 0) {
      printf("%s", "\t");
    }
    printf("%x\t", block[i]);
  }
  printf("%c", '\n');
}


x86 assembly (clang, -O0):
<__printblock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x10,-0xc(%rbp)
jge    11b1 <__printblock+0xa1>
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    115b <__printblock+0x4b>
lea    0xeb8(%rip),%rdi
lea    0xeb4(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1189 <__printblock+0x79>
mov    -0xc(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1184 <__printblock+0x74>
lea    0xe8a(%rip),%rdi
lea    0xe8a(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1189 <__printblock+0x79>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <__printblock+0x13>
lea    0xe51(%rip),%rdi
mov    $0xa,%esi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__printblock>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
lea    0xed1(%rip),%r14
xor    %ebx,%ebx
jmp    1163 <__printblock+0x43>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
movzbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    $0x10,%rbx
je     1174 <__printblock+0x54>
test   $0x7,%bl
je     1140 <__printblock+0x20>
test   $0x3,%bl
jne    114a <__printblock+0x2a>
mov    $0x9,%edi
jmp    1145 <__printblock+0x25>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str.3 = [4 x i8] c"%x\09\00"
define void @__printblock(i8* nocapture %0) {
br label %4
2: ; preds = %15
%3 = tail call i32 @putchar(i32 10)
ret void
4: ; preds = %1, %15
%5 = phi i64 [ 0, %1 ], [ %20, %15 ]
%6 = trunc i64 %5 to i32
%7 = and i32 %6, 7
%8 = icmp eq i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = and i32 %6, 3
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %9, %4
%13 = phi i32 [ 10, %4 ], [ 9, %9 ]
%14 = tail call i32 @putchar(i32 %13)
br label %15
15: ; preds = %12, %9
%16 = getelementptr inbounds i8, i8* %0, i64 %5
%17 = load i8, i8* %16
%18 = zext i8 %17 to i32
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %18)
%20 = add nuw nsw i64 %5, 1
%21 = icmp eq i64 %20, 16
br i1 %21, label %2, label %4
}