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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void dump(const uint8_t *buf, size_t size) {
  size_t i;
  for (i = 1; i <= size; ++i) {
    fprintf(stderr, " %02x", buf[i - 1]);
    if (i % 16 == 0 || i == size)
      fprintf(stderr, "\n");
  }
}


x86 assembly (clang, -O0):
<dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
ja     11a9 <dump+0x99>
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
mov    (%rax,%rcx,4),%edx
lea    0xeab(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x18(%rbp),%rax
and    $0xf,%rax
cmp    $0x0,%rax
je     117c <dump+0x6c>
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    1193 <dump+0x83>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edi
lea    0xe7a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1198 <dump+0x88>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <dump+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     1189 <dump+0x79>
mov    %rsi,%r13
mov    %rdi,%r14
mov    $0x1,%ebx
mov    0x2eae(%rip),%rbp
lea    0xec7(%rip),%r15
lea    0xec6(%rip),%r12
jmp    1166 <dump+0x56>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x0(%rbp),%edi
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%rbx
cmp    %r13,%rbx
ja     1189 <dump+0x79>
mov    0x0(%rbp),%edi
mov    -0x4(%r14,%rbx,4),%edx
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
cmp    %rbx,%r13
je     1150 <dump+0x40>
mov    %ebx,%eax
and    $0xf,%eax
test   %rax,%rax
jne    115d <dump+0x4d>
jmp    1150 <dump+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [6 x i8] c" %02x\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @dump(i32* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %21, label %4
4: ; preds = %2, %18
%5 = phi i64 [ %19, %18 ], [ 1, %2 ]
%6 = load i32, i32* @stderr
%7 = add i64 %5, -1
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = and i64 %5, 15
%12 = icmp eq i64 %11, 0
%13 = icmp eq i64 %5, %1
%14 = or i1 %13, %12
br i1 %14, label %15, label %18
15: ; preds = %4
%16 = load i32, i32* @stderr
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %4, %15
%19 = add i64 %5, 1
%20 = icmp ugt i64 %19, %1
br i1 %20, label %21, label %4
21: ; preds = %18, %2
ret void
}