#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*/ print_debug(char *);
int /*<<< orphan*/ print_debug_hex32(unsigned int);
int /*<<< orphan*/ print_debug_hex8(unsigned char);
void dump_mem(unsigned start, unsigned end) {
  unsigned i;
  print_debug("dump_mem:");
  for (i = start; i < end; i++) {
    if ((i & 0xf) == 0) {
      print_debug("\n");
      print_debug_hex32(i);
      print_debug(":");
    }
    print_debug(" ");
    print_debug_hex8((unsigned char)*((unsigned char *)i));
  }
  print_debug("\n");
}


x86 assembly (clang, -O0):
<dump_mem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xebb(%rip),%rdi
call   1050 <print_debug@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    11b0 <dump_mem+0x80>
mov    -0xc(%rbp),%eax
and    $0xf,%eax
cmp    $0x0,%eax
jne    118b <dump_mem+0x5b>
lea    0xe98(%rip),%rdi
call   1050 <print_debug@plt>
mov    -0xc(%rbp),%edi
call   1040 <print_debug_hex32@plt>
lea    0xe82(%rip),%rdi
call   1050 <print_debug@plt>
lea    0xe7a(%rip),%rdi
call   1050 <print_debug@plt>
mov    -0xc(%rbp),%eax
movzbl (%rax),%edi
call   1030 <print_debug_hex8@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1150 <dump_mem+0x20>
lea    0xe53(%rip),%rdi
call   1050 <print_debug@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_mem>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xebd(%rip),%rdi
call   1050 <print_debug@plt>
cmp    %ebp,%ebx
jae    11a6 <dump_mem+0x76>
mov    %ebx,%ebx
mov    %ebp,%ebp
lea    0xeb3(%rip),%r14
lea    0xeaa(%rip),%r15
lea    0xea7(%rip),%r12
jmp    1188 <dump_mem+0x58>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1050 <print_debug@plt>
movzbl (%rbx),%edi
call   1030 <print_debug_hex8@plt>
add    $0x1,%rbx
cmp    %ebx,%ebp
je     11a6 <dump_mem+0x76>
test   $0xf,%bl
jne    1170 <dump_mem+0x40>
mov    %r14,%rdi
call   1050 <print_debug@plt>
mov    %ebx,%edi
call   1040 <print_debug_hex32@plt>
mov    %r15,%rdi
call   1050 <print_debug@plt>
jmp    1170 <dump_mem+0x40>
lea    0xe5d(%rip),%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <print_debug@plt>

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

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