#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 mem_read_32(int);
int /*<<< orphan*/ printf(char *, ...);
void mdump(int start, int stop) {
  int address;
  printf("\nMemory content [0x%08x..0x%08x] :\n", start, stop);
  printf("-------------------------------------\n");
  for (address = start; address <= stop; address += 4)
    printf("  0x%08x (%d) : 0x%08x\n", address, address, mem_read_32(address));
  printf("\n");
}


x86 assembly (clang, -O0):
<mdump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     119a <mdump+0x7a>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <mem_read_32@plt>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    %eax,%ecx
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0xc(%rbp)
jmp    1156 <mdump+0x36>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mdump>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xeb1(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xedb(%rip),%rdi
call   1040 <puts@plt>
cmp    %ebx,%ebp
jg     119e <mdump+0x5e>
lea    0xeb3(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1060 <mem_read_32@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebp,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x4,%ebp
cmp    %ebx,%ebp
jle    1180 <mdump+0x40>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"\0AMemory content [0x%08x..0x%08x] :\0A\00"
@.str.1 = [39 x i8] c"-------------------------------------\0A\00"
@.str.2 = [24 x i8] c" 0x%08x (%d) : 0x%08x\0A\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @mdump(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%10 = load i32, i32* %3
store i32 %10, i32* %5
br label %11
11: ; preds = %21, %2
%12 = load i32, i32* %5
%13 = load i32, i32* %4
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %24
15: ; preds = %11
%16 = load i32, i32* %5
%17 = load i32, i32* %5
%18 = load i32, i32* %5
%19 = call i32 @mem_read_32(i32 %18)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %16, i32 %17, i32 %19)
br label %21
21: ; preds = %15
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 4
store i32 %23, i32* %5
br label %11
24: ; preds = %11
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"\0AMemory content [0x%08x..0x%08x] :\0A\00"
@.str.2 = [24 x i8] c" 0x%08x (%d) : 0x%08x\0A\00"
@str = [38 x i8] c"-------------------------------------\00"
define void @mdump(i32 %0, i32 %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%5 = icmp sgt i32 %0, %1
br i1 %5, label %12, label %6
6: ; preds = %2, %6
%7 = phi i32 [ %10, %6 ], [ %0, %2 ]
%8 = tail call i32 @mem_read_32(i32 %7)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %7, i32 %8)
%10 = add nsw i32 %7, 4
%11 = icmp sgt i32 %10, %1
br i1 %11, label %12, label %6
12: ; preds = %6, %2
%13 = tail call i32 @putchar(i32 10)
ret void
}