#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 _dump_buf(const unsigned char *buf, int stride) {
  int i, base = 0;
  for (i = 0; i < 64; i++) {
    printf("%02x ", buf[base++]);
    if (i && (i + 1) % 8 == 0) {
      printf("\n");
      base += stride - 8;
    }
  }
}


x86 assembly (clang, -O0):
<_dump_buf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x40,-0x10(%rbp)
jge    11a9 <_dump_buf+0x99>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%esi
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x10(%rbp)
je     1196 <_dump_buf+0x86>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1196 <_dump_buf+0x86>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
sub    $0x8,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    119b <_dump_buf+0x8b>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <_dump_buf+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_dump_buf>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %rdi,%r12
add    $0xfffffff8,%r14d
movzbl (%rdi),%esi
lea    0xec4(%rip),%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebp
mov    $0x2,%ebx
jmp    1168 <_dump_buf+0x48>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebx
cmp    $0x41,%ebx
je     1191 <_dump_buf+0x71>
movslq %ebp,%rax
add    $0x1,%ebp
movzbl (%r12,%rax,1),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   $0x7,%bl
jne    1160 <_dump_buf+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    %r14d,%ebp
jmp    1160 <_dump_buf+0x40>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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