#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 */
scalar_t__ isprint(int);
int read_data_byte(unsigned long *);
int /*<<< orphan*/ tx_printf(char *, ...);
void dump_data(unsigned long start_addr, unsigned long end_addr) {
  int i, c;
  unsigned long addr, save_addr, low_addr, high_addr;
  low_addr = start_addr & ~15;
  high_addr = (end_addr + 15) & ~15;
  for (addr = low_addr; addr < high_addr;) {
    tx_printf("%5lx: ", (unsigned long)addr);
    save_addr = addr;
    for (i = 0; i < 16; i++) {
      if (addr < start_addr || addr > end_addr) {
        tx_printf("   ");
        addr++;
      } else
        tx_printf("%02x ", (unsigned int)read_data_byte(&addr));
    }
    addr = save_addr;
    for (i = 0; i < 16; i++) {
      if (addr < start_addr || addr > end_addr) {
        tx_printf(" ");
        addr++;
      } else {
        c = read_data_byte(&addr);
        tx_printf("%c", (char)((isprint(c)) ? c : '.'));
      }
    }
    tx_printf("\n");
  }
}


x86 assembly (clang, -O0):
<dump_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
and    $0xfffffffffffffff0,%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x38(%rbp),%rax
jae    12c8 <dump_data+0x198>
mov    -0x20(%rbp),%rsi
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1050 <tx_printf@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jge    1204 <dump_data+0xd4>
mov    -0x20(%rbp),%rax
cmp    -0x8(%rbp),%rax
jb     11b9 <dump_data+0x89>
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    11d8 <dump_data+0xa8>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1050 <tx_printf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11f1 <dump_data+0xc1>
lea    -0x20(%rbp),%rdi
call   1040 <read_data_byte@plt>
mov    %eax,%esi
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1050 <tx_printf@plt>
jmp    11f6 <dump_data+0xc6>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1193 <dump_data+0x63>
mov    -0x28(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x10,-0x14(%rbp)
jge    12b5 <dump_data+0x185>
mov    -0x20(%rbp),%rax
cmp    -0x8(%rbp),%rax
jb     1239 <dump_data+0x109>
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    1258 <dump_data+0x128>
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1050 <tx_printf@plt>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    12a2 <dump_data+0x172>
lea    -0x20(%rbp),%rdi
call   1040 <read_data_byte@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1030 <isprint@plt>
cmp    $0x0,%rax
je     1281 <dump_data+0x151>
mov    -0x18(%rbp),%eax
mov    %eax,-0x3c(%rbp)
jmp    128e <dump_data+0x15e>
mov    $0x2e,%eax
mov    %eax,-0x3c(%rbp)
jmp    128e <dump_data+0x15e>
mov    -0x3c(%rbp),%eax
movsbl %al,%esi
lea    0xd76(%rip),%rdi
mov    $0x0,%al
call   1050 <tx_printf@plt>
jmp    12a7 <dump_data+0x177>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1213 <dump_data+0xe3>
lea    0xd58(%rip),%rdi
mov    $0x0,%al
call   1050 <tx_printf@plt>
jmp    1164 <dump_data+0x34>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_data>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %rdi,%rsi
and    $0xfffffffffffffff0,%rsi
lea    0xf(%r14),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsi,0x8(%rsp)
mov    %rax,0x10(%rsp)
cmp    %rax,%rsi
jae    12ca <dump_data+0x19a>
mov    %rdi,%r15
lea    0xe9a(%rip),%r12
lea    0x8(%rsp),%r13
jmp    11a1 <dump_data+0x71>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xe8d(%rip),%rdi
xor    %eax,%eax
call   1050 <tx_printf@plt>
mov    0x8(%rsp),%rsi
cmp    0x10(%rsp),%rsi
mov    %rbx,%r12
jae    12ca <dump_data+0x19a>
lea    0xe58(%rip),%rdi
xor    %eax,%eax
call   1050 <tx_printf@plt>
mov    $0xf,%ebx
mov    0x8(%rsp),%rbp
mov    %rbp,%rax
cmp    %r15,%rax
jb     1200 <dump_data+0xd0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
cmp    %r14,%rax
ja     1200 <dump_data+0xd0>
mov    %r13,%rdi
call   1040 <read_data_byte@plt>
lea    0xe27(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <tx_printf@plt>
sub    $0x1,%ebx
jae    1215 <dump_data+0xe5>
jmp    1230 <dump_data+0x100>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12,%rdi
xor    %eax,%eax
call   1050 <tx_printf@plt>
addq   $0x1,0x8(%rsp)
sub    $0x1,%ebx
jb     1230 <dump_data+0x100>
mov    0x8(%rsp),%rax
cmp    %r15,%rax
jae    11d0 <dump_data+0xa0>
jmp    1200 <dump_data+0xd0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r12,%rbx
mov    %rbp,0x8(%rsp)
mov    $0xf,%r12d
cmp    %r15,%rbp
jb     12a0 <dump_data+0x170>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    %r14,%rbp
ja     12a0 <dump_data+0x170>
mov    %r13,%rdi
call   1040 <read_data_byte@plt>
mov    %r13,%rbp
mov    %eax,%r13d
mov    %eax,%edi
call   1030 <isprint@plt>
test   %rax,%rax
movsbl %r13b,%esi
mov    %rbp,%r13
mov    $0x2e,%eax
cmove  %eax,%esi
lea    0xd8e(%rip),%rdi
xor    %eax,%eax
call   1050 <tx_printf@plt>
sub    $0x1,%r12d
jae    12be <dump_data+0x18e>
jmp    1180 <dump_data+0x50>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xd62(%rip),%rdi
xor    %eax,%eax
call   1050 <tx_printf@plt>
addq   $0x1,0x8(%rsp)
sub    $0x1,%r12d
jb     1180 <dump_data+0x50>
mov    0x8(%rsp),%rbp
cmp    %r15,%rbp
jae    1250 <dump_data+0x120>
jmp    12a0 <dump_data+0x170>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%5lx: \00"
@.str.1 = [4 x i8] c" \00"
@.str.2 = [6 x i8] c"%02x \00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [3 x i8] c"%c\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @dump_data(i64 %0, i64 %1) {
%3 = alloca i64
%4 = bitcast i64* %3 to i8*
%5 = and i64 %0, -16
%6 = add i64 %1, 15
%7 = and i64 %6, -16
store i64 %5, i64* %3
%8 = icmp ult i64 %5, %7
br i1 %8, label %9, label %59
9: ; preds = %2, %55
%10 = phi i64 [ %57, %55 ], [ %5, %2 ]
%11 = call i32 (i8*, ...) @tx_printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %10)
%12 = load i64, i64* %3
br label %13
13: ; preds = %29, %9
%14 = phi i64 [ %12, %9 ], [ %30, %29 ]
%15 = phi i32 [ 0, %9 ], [ %27, %29 ]
%16 = icmp ult i64 %14, %0
%17 = icmp ugt i64 %14, %1
%18 = or i1 %16, %17
br i1 %18, label %19, label %23
19: ; preds = %13
%20 = call i32 (i8*, ...) @tx_printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%21 = load i64, i64* %3
%22 = add i64 %21, 1
store i64 %22, i64* %3
br label %26
23: ; preds = %13
%24 = call i32 @read_data_byte(i64* %3)
%25 = call i32 (i8*, ...) @tx_printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %19, %23
%27 = add nuw nsw i32 %15, 1
%28 = icmp eq i32 %27, 16
br i1 %28, label %31, label %29
29: ; preds = %26
%30 = load i64, i64* %3
br label %13
31: ; preds = %26
store i64 %12, i64* %3
br label %32
32: ; preds = %53, %31
%33 = phi i64 [ %12, %31 ], [ %54, %53 ]
%34 = phi i32 [ 0, %31 ], [ %51, %53 ]
%35 = icmp ult i64 %33, %0
%36 = icmp ugt i64 %33, %1
%37 = or i1 %35, %36
br i1 %37, label %38, label %42
38: ; preds = %32
%39 = call i32 (i8*, ...) @tx_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%40 = load i64, i64* %3
%41 = add i64 %40, 1
store i64 %41, i64* %3
br label %50
42: ; preds = %32
%43 = call i32 @read_data_byte(i64* %3)
%44 = call i64 @isprint(i32 %43)
%45 = icmp eq i64 %44, 0
%46 = shl i32 %43, 24
%47 = ashr exact i32 %46, 24
%48 = select i1 %45, i32 46, i32 %47
%49 = call i32 (i8*, ...) @tx_printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32 %48)
br label %50
50: ; preds = %38, %42
%51 = add nuw nsw i32 %34, 1
%52 = icmp eq i32 %51, 16
br i1 %52, label %55, label %53
53: ; preds = %50
%54 = load i64, i64* %3
br label %32
55: ; preds = %50
%56 = call i32 (i8*, ...) @tx_printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%57 = load i64, i64* %3
%58 = icmp ult i64 %57, %7
br i1 %58, label %9, label %59
59: ; preds = %55, %2
ret void
}