#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*/ printf(char *, ...);
void dump(const void *buf, int len) {
  int i, j, c;
  const uint8_t *pb = buf;
  for (i = 0; i < len; i += 16) {
    printf("%.5x ", i);
    for (j = 0; j < 16; j++) {
      printf("%.2x ", pb[i + j]);
    }
    printf("  ");
    for (j = 0; j < 16; j++) {
      c = pb[i + j];
      if (i + j >= len)
        c = 'Z';
      printf("%c", (c < ' ' || c > 'z') ? '.' : c);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1232 <dump+0x122>
mov    -0x10(%rbp),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jge    1188 <dump+0x78>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1152 <dump+0x42>
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jge    1216 <dump+0x106>
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    -0x14(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     11d0 <dump+0xc0>
movl   $0x5a,-0x18(%rbp)
cmpl   $0x20,-0x18(%rbp)
jl     11e4 <dump+0xd4>
cmpl   $0x7a,-0x18(%rbp)
jle    11f1 <dump+0xe1>
mov    $0x2e,%eax
mov    %eax,-0x24(%rbp)
jmp    11f7 <dump+0xe7>
mov    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    119d <dump+0x8d>
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x10(%rbp)
jmp    112e <dump+0x1e>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,0x10(%rsp)
mov    %esi,0xc(%rsp)
test   %esi,%esi
jle    1361 <dump+0x241>
mov    0xc(%rsp),%r14d
mov    $0x2e,%r12d
mov    0x10(%rsp),%r15
xor    %ebp,%ebp
jmp    117c <dump+0x5c>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rbp
add    $0x40,%r15
cmp    0xc(%rsp),%ebp
jge    1361 <dump+0x241>
lea    0xe7d(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x0(,%rbp,4),%r13
mov    0x10(%rsp),%rbx
mov    (%rbx,%rbp,4),%esi
lea    0xe63(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rax
or     $0x4,%rax
mov    (%rbx,%rax,1),%esi
lea    0xe4b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rax
or     $0x8,%rax
mov    (%rbx,%rax,1),%esi
lea    0xe33(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rax
or     $0xc,%rax
mov    (%rbx,%rax,1),%esi
lea    0xe1b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rax
or     $0x10,%rax
mov    (%rbx,%rax,1),%esi
lea    0xe03(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rax
or     $0x14,%rax
mov    (%rbx,%rax,1),%esi
lea    0xdeb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rax
or     $0x18,%rax
mov    (%rbx,%rax,1),%esi
lea    0xdd3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rax
or     $0x1c,%rax
mov    (%rbx,%rax,1),%esi
lea    0xdbb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rax
or     $0x20,%rax
mov    (%rbx,%rax,1),%esi
lea    0xda3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rax
or     $0x24,%rax
mov    (%rbx,%rax,1),%esi
lea    0xd8b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rax
or     $0x28,%rax
mov    (%rbx,%rax,1),%esi
lea    0xd73(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rax
or     $0x2c,%rax
mov    (%rbx,%rax,1),%esi
lea    0xd5b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rax
or     $0x30,%rax
mov    (%rbx,%rax,1),%esi
lea    0xd43(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rax
or     $0x34,%rax
mov    (%rbx,%rax,1),%esi
lea    0xd2b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r13,%rax
or     $0x38,%rax
mov    (%rbx,%rax,1),%esi
lea    0xd13(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
or     $0x3c,%r13
mov    (%rbx,%r13,1),%esi
lea    0xcfd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xcf5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %ebx,%ebx
jmp    134d <dump+0x22d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x7b(%rdi),%eax
cmp    $0xffffffa5,%eax
cmovb  %r12d,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    $0x10,%rbx
je     1160 <dump+0x40>
lea    (%rbx,%rbp,1),%rax
mov    $0x5a,%edi
cmp    %r14,%rax
jge    1330 <dump+0x210>
mov    (%r15,%rbx,4),%edi
jmp    1330 <dump+0x210>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%.5x \00"
@.str.1 = [6 x i8] c"%.2x \00"
@.str.2 = [3 x i8] c" \00"
@.str.3 = [3 x i8] c"%c\00"
@.str.4 = [2 x i8] c"\0A\00"
define void @dump(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
store i8* %0, i8** %3
store i32 %1, i32* %4
%9 = load i8*, i8** %3
%10 = bitcast i8* %9 to i32*
store i32* %10, i32** %8
store i32 0, i32* %5
br label %11
11: ; preds = %69, %2
%12 = load i32, i32* %5
%13 = load i32, i32* %4
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %72
15: ; preds = %11
%16 = load i32, i32* %5
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %16)
store i32 0, i32* %6
br label %18
18: ; preds = %30, %15
%19 = load i32, i32* %6
%20 = icmp slt i32 %19, 16
br i1 %20, label %21, label %33
21: ; preds = %18
%22 = load i32*, i32** %8
%23 = load i32, i32* %5
%24 = load i32, i32* %6
%25 = add nsw i32 %23, %24
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %22, i64 %26
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %21
%31 = load i32, i32* %6
%32 = add nsw i32 %31, 1
store i32 %32, i32* %6
br label %18
33: ; preds = %18
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %6
br label %35
35: ; preds = %64, %33
%36 = load i32, i32* %6
%37 = icmp slt i32 %36, 16
br i1 %37, label %38, label %67
38: ; preds = %35
%39 = load i32*, i32** %8
%40 = load i32, i32* %5
%41 = load i32, i32* %6
%42 = add nsw i32 %40, %41
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i32, i32* %39, i64 %43
%45 = load i32, i32* %44
store i32 %45, i32* %7
%46 = load i32, i32* %5
%47 = load i32, i32* %6
%48 = add nsw i32 %46, %47
%49 = load i32, i32* %4
%50 = icmp sge i32 %48, %49
br i1 %50, label %51, label %52
51: ; preds = %38
store i32 90, i32* %7
br label %52
52: ; preds = %51, %38
%53 = load i32, i32* %7
%54 = icmp slt i32 %53, 32
br i1 %54, label %58, label %55
55: ; preds = %52
%56 = load i32, i32* %7
%57 = icmp sgt i32 %56, 122
br i1 %57, label %58, label %59
58: ; preds = %55, %52
br label %61
59: ; preds = %55
%60 = load i32, i32* %7
br label %61
61: ; preds = %59, %58
%62 = phi i32 [ 46, %58 ], [ %60, %59 ]
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %62)
br label %64
64: ; preds = %61
%65 = load i32, i32* %6
%66 = add nsw i32 %65, 1
store i32 %66, i32* %6
br label %35
67: ; preds = %35
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %69
69: ; preds = %67
%70 = load i32, i32* %5
%71 = add nsw i32 %70, 16
store i32 %71, i32* %5
br label %11
72: ; preds = %11
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%.5x \00"
@.str.1 = [6 x i8] c"%.2x \00"
@.str.2 = [3 x i8] c" \00"
define void @dump(i8* nocapture %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %93
5: ; preds = %2
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %88
%8 = phi i64 [ 0, %5 ], [ %90, %88 ]
%9 = trunc i64 %8 to i32
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds i32, i32* %3, i64 %8
%12 = load i32, i32* %11
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = or i64 %8, 1
%15 = getelementptr inbounds i32, i32* %3, i64 %14
%16 = load i32, i32* %15
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = or i64 %8, 2
%19 = getelementptr inbounds i32, i32* %3, i64 %18
%20 = load i32, i32* %19
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = or i64 %8, 3
%23 = getelementptr inbounds i32, i32* %3, i64 %22
%24 = load i32, i32* %23
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = or i64 %8, 4
%27 = getelementptr inbounds i32, i32* %3, i64 %26
%28 = load i32, i32* %27
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = or i64 %8, 5
%31 = getelementptr inbounds i32, i32* %3, i64 %30
%32 = load i32, i32* %31
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = or i64 %8, 6
%35 = getelementptr inbounds i32, i32* %3, i64 %34
%36 = load i32, i32* %35
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %36)
%38 = or i64 %8, 7
%39 = getelementptr inbounds i32, i32* %3, i64 %38
%40 = load i32, i32* %39
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %40)
%42 = or i64 %8, 8
%43 = getelementptr inbounds i32, i32* %3, i64 %42
%44 = load i32, i32* %43
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %44)
%46 = or i64 %8, 9
%47 = getelementptr inbounds i32, i32* %3, i64 %46
%48 = load i32, i32* %47
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %48)
%50 = or i64 %8, 10
%51 = getelementptr inbounds i32, i32* %3, i64 %50
%52 = load i32, i32* %51
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %52)
%54 = or i64 %8, 11
%55 = getelementptr inbounds i32, i32* %3, i64 %54
%56 = load i32, i32* %55
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %56)
%58 = or i64 %8, 12
%59 = getelementptr inbounds i32, i32* %3, i64 %58
%60 = load i32, i32* %59
%61 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %60)
%62 = or i64 %8, 13
%63 = getelementptr inbounds i32, i32* %3, i64 %62
%64 = load i32, i32* %63
%65 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %64)
%66 = or i64 %8, 14
%67 = getelementptr inbounds i32, i32* %3, i64 %66
%68 = load i32, i32* %67
%69 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %68)
%70 = or i64 %8, 15
%71 = getelementptr inbounds i32, i32* %3, i64 %70
%72 = load i32, i32* %71
%73 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %72)
%74 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %75
75: ; preds = %7, %75
%76 = phi i64 [ 0, %7 ], [ %86, %75 ]
%77 = add nuw nsw i64 %76, %8
%78 = getelementptr inbounds i32, i32* %3, i64 %77
%79 = load i32, i32* %78
%80 = icmp slt i64 %77, %6
%81 = select i1 %80, i32 %79, i32 90
%82 = add i32 %81, -123
%83 = icmp ult i32 %82, -91
%84 = select i1 %83, i32 46, i32 %81
%85 = tail call i32 @putchar(i32 %84)
%86 = add nuw nsw i64 %76, 1
%87 = icmp eq i64 %86, 16
br i1 %87, label %88, label %75
88: ; preds = %75
%89 = tail call i32 @putchar(i32 10)
%90 = add nuw i64 %8, 16
%91 = trunc i64 %90 to i32
%92 = icmp slt i32 %91, %1
br i1 %92, label %7, label %93
93: ; preds = %88, %2
ret void
}