#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_byte(void *p, long count, unsigned long offset) {
  unsigned char *d = p;
  int i;
  while (count > 0) {
    printf("%08lx:", offset);
    for (i = 0; i < 16 && count--; i++)
      printf(" %02x", *d++);
    printf("\n");
    offset += 16;
  }
}


x86 assembly (clang, -O0):
<dump_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jle    11d5 <dump_byte+0xc5>
mov    -0x18(%rbp),%rsi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x24(%rbp)
xor    %eax,%eax
cmpl   $0x10,-0x24(%rbp)
mov    %al,-0x25(%rbp)
jge    1178 <dump_byte+0x68>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
cmp    $0x0,%rax
setne  %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
test   $0x1,%al
jne    1188 <dump_byte+0x78>
jmp    11b6 <dump_byte+0xa6>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movzbl (%rax),%esi
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1150 <dump_byte+0x40>
lea    0xe50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x18(%rbp)
jmp    112c <dump_byte+0x1c>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_byte>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,(%rsp)
test   %rsi,%rsi
jle    136e <dump_byte+0x24e>
mov    %rsi,%rbx
mov    %rdi,%r15
neg    %rbx
lea    0xeb8(%rip),%rdi
lea    0xeb8(%rip),%r13
xor    %ebp,%ebp
mov    (%rsp),%rax
lea    (%rax,%rbp,1),%rsi
lea    (%rbx,%rbp,1),%r12
mov    %rdi,%r14
xor    %eax,%eax
call   1040 <printf@plt>
movzbl (%r15,%rbp,1),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
inc    %r12
je     137d <dump_byte+0x25d>
lea    (%rbx,%rbp,1),%r12
add    $0x2,%r12
movzbl 0x1(%r15,%rbp,1),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r12,%r12
je     137d <dump_byte+0x25d>
lea    (%rbx,%rbp,1),%r12
add    $0x3,%r12
movzbl 0x2(%r15,%rbp,1),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r12,%r12
je     137d <dump_byte+0x25d>
lea    (%rbx,%rbp,1),%r12
add    $0x4,%r12
movzbl 0x3(%r15,%rbp,1),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r12,%r12
je     137d <dump_byte+0x25d>
lea    (%rbx,%rbp,1),%r12
add    $0x5,%r12
movzbl 0x4(%r15,%rbp,1),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r12,%r12
je     137d <dump_byte+0x25d>
lea    (%rbx,%rbp,1),%r12
add    $0x6,%r12
movzbl 0x5(%r15,%rbp,1),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r12,%r12
je     137d <dump_byte+0x25d>
lea    (%rbx,%rbp,1),%r12
add    $0x7,%r12
movzbl 0x6(%r15,%rbp,1),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r12,%r12
je     137d <dump_byte+0x25d>
lea    (%rbx,%rbp,1),%r12
add    $0x8,%r12
movzbl 0x7(%r15,%rbp,1),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r12,%r12
je     137d <dump_byte+0x25d>
lea    (%rbx,%rbp,1),%r12
add    $0x9,%r12
movzbl 0x8(%r15,%rbp,1),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r12,%r12
je     137d <dump_byte+0x25d>
lea    (%rbx,%rbp,1),%r12
add    $0xa,%r12
movzbl 0x9(%r15,%rbp,1),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r12,%r12
je     137d <dump_byte+0x25d>
lea    (%rbx,%rbp,1),%r12
add    $0xb,%r12
movzbl 0xa(%r15,%rbp,1),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r12,%r12
je     137d <dump_byte+0x25d>
lea    (%rbx,%rbp,1),%r12
add    $0xc,%r12
movzbl 0xb(%r15,%rbp,1),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r12,%r12
je     137d <dump_byte+0x25d>
lea    (%rbx,%rbp,1),%r12
add    $0xd,%r12
movzbl 0xc(%r15,%rbp,1),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r12,%r12
je     137d <dump_byte+0x25d>
lea    (%rbx,%rbp,1),%r12
add    $0xe,%r12
movzbl 0xd(%r15,%rbp,1),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r12,%r12
je     137d <dump_byte+0x25d>
lea    (%rbx,%rbp,1),%r12
add    $0xf,%r12
movzbl 0xe(%r15,%rbp,1),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
test   %r12,%r12
je     137d <dump_byte+0x25d>
movzbl 0xf(%r15,%rbp,1),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x10,%rbp
mov    %rbx,%rax
add    %rbp,%rax
mov    %r14,%rdi
jne    1151 <dump_byte+0x31>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

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