#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*/ uart_print_addr(int /*<<< orphan*/);
int /*<<< orphan*/ uart_print_hex(unsigned int);
int /*<<< orphan*/ uart_printf(char *);
int /*<<< orphan*/ uart_puts(char *);
void sdram_read(unsigned int start, unsigned int end) {
  unsigned int *start_addr = (unsigned int *)start;
  int column = 0;
  while (1) {
    if (start >= end)
      break;
    if (column == 0 || column == 4) {
      uart_puts("");
      uart_print_hex(start);
      uart_printf(" : ");
      column = 0;
    }
    uart_print_addr(*start_addr++);
    uart_printf("  ");
    ++column;
    start += 4;
  }
  uart_puts("");
  return;
}


x86 assembly (clang, -O0):
<sdram_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jb     116d <sdram_read+0x2d>
jmp    11e1 <sdram_read+0xa1>
cmpl   $0x0,-0x14(%rbp)
je     1181 <sdram_read+0x41>
cmpl   $0x4,-0x14(%rbp)
jne    11a8 <sdram_read+0x68>
lea    0xe7e(%rip),%rdi
call   1060 <uart_puts@plt>
mov    -0x4(%rbp),%edi
call   1050 <uart_print_hex@plt>
lea    0xe64(%rip),%rdi
call   1030 <uart_printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%edi
call   1040 <uart_print_addr@plt>
lea    0xe3f(%rip),%rdi
call   1030 <uart_printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x4(%rbp)
jmp    115c <sdram_read+0x1c>
lea    0xe1e(%rip),%rdi
call   1060 <uart_puts@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sdram_read>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
cmp    %esi,%edi
jae    11b8 <sdram_read+0x78>
mov    %esi,%r13d
mov    %edi,%ebp
mov    %edi,%ebx
xor    %r14d,%r14d
lea    0xea0(%rip),%r15
lea    0xe9d(%rip),%r12
jmp    118f <sdram_read+0x4f>
nopl   0x0(%rax)
mov    (%rbx),%edi
add    $0x4,%rbx
call   1040 <uart_print_addr@plt>
mov    %r12,%rdi
call   1030 <uart_printf@plt>
add    $0x1,%r14d
add    $0x4,%ebp
cmp    %r13d,%ebp
jae    11b8 <sdram_read+0x78>
test   $0xfffffffb,%r14d
jne    1170 <sdram_read+0x30>
lea    0xe67(%rip),%rdi
call   1060 <uart_puts@plt>
mov    %ebp,%edi
call   1050 <uart_print_hex@plt>
mov    %r15,%rdi
call   1030 <uart_printf@plt>
xor    %r14d,%r14d
jmp    1170 <sdram_read+0x30>
lea    0xe47(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <uart_puts@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c" : \00"
@.str.2 = [3 x i8] c" \00"
define void @sdram_read(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = zext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
store i32* %9, i32** %5
store i32 0, i32* %6
br label %10
10: ; preds = %2, %26
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = icmp uge i32 %11, %12
br i1 %13, label %14, label %15
14: ; preds = %10
br label %36
15: ; preds = %10
%16 = load i32, i32* %6
%17 = icmp eq i32 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = load i32, i32* %6
%20 = icmp eq i32 %19, 4
br i1 %20, label %21, label %26
21: ; preds = %18, %15
%22 = call i32 @uart_puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%23 = load i32, i32* %3
%24 = call i32 @uart_print_hex(i32 %23)
%25 = call i32 @uart_printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %6
br label %26
26: ; preds = %21, %18
%27 = load i32*, i32** %5
%28 = getelementptr inbounds i32, i32* %27, i32 1
store i32* %28, i32** %5
%29 = load i32, i32* %27
%30 = call i32 @uart_print_addr(i32 %29)
%31 = call i32 @uart_printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%32 = load i32, i32* %6
%33 = add nsw i32 %32, 1
store i32 %33, i32* %6
%34 = load i32, i32* %3
%35 = add i32 %34, 4
store i32 %35, i32* %3
br label %10
36: ; preds = %14
%37 = call i32 @uart_puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret void
}

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