#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*/ hex32(int);
int /*<<< orphan*/ printf(char *, int, int);
int read_ram(int);
void show_ram(int start_address, int end_address) {
  int i;
  for (i = start_address; i <= end_address; ++i) {
    printf("Register %03d: %010u  ", i, read_ram(i));
    hex32(read_ram(i));
  }
}


x86 assembly (clang, -O0):
<show_ram>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     118c <show_ram+0x5c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <read_ram@plt>
mov    -0x10(%rbp),%esi
mov    %eax,%edx
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%edi
call   1040 <read_ram@plt>
mov    %eax,%edi
call   1050 <hex32@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1144 <show_ram+0x14>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_ram>:
push   %rbp
push   %r14
push   %rbx
cmp    %esi,%edi
jg     1178 <show_ram+0x48>
mov    %esi,%ebx
mov    %edi,%ebp
add    $0x1,%ebx
lea    0xeba(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1040 <read_ram@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    %ebp,%edi
call   1040 <read_ram@plt>
mov    %eax,%edi
call   1050 <hex32@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1150 <show_ram+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Register %03d: %010u \00"
define void @show_ram(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
store i32 %6, i32* %5
br label %7
7: ; preds = %19, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %22
11: ; preds = %7
%12 = load i32, i32* %5
%13 = load i32, i32* %5
%14 = call i32 @read_ram(i32 %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %14)
%16 = load i32, i32* %5
%17 = call i32 @read_ram(i32 %16)
%18 = call i32 @hex32(i32 %17)
br label %19
19: ; preds = %11
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %7
22: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"Register %03d: %010u \00"
define void @show_ram(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
br i1 %3, label %12, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %10, %4 ], [ %0, %2 ]
%6 = tail call i32 @read_ram(i32 %5)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
%8 = tail call i32 @read_ram(i32 %5)
%9 = tail call i32 @hex32(i32 %8)
%10 = add i32 %5, 1
%11 = icmp eq i32 %5, %1
br i1 %11, label %12, label %4
12: ; preds = %4, %2
ret void
}