#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*/ printf(char *, ...);
void dump_usb_ram(void) {
  int i, j;
  unsigned long *p = (unsigned long *)0x40006000;
  for (i = 0; i < 32; i++) {
    for (j = 0; j < 8; j++) {
      printf("%04x ", *p++);
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<dump_usb_ram>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x40006000,%eax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0x20,-0x4(%rbp)
jge    118d <dump_usb_ram+0x7d>
movl   $0x0,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jge    1171 <dump_usb_ram+0x61>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rsi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1139 <dump_usb_ram+0x29>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1128 <dump_usb_ram+0x18>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_usb_ram>:
push   %r15
push   %r14
push   %rbx
mov    $0x40006000,%ebx
lea    0xecf(%rip),%r14
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x40006000(%r15),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rbx),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rbx),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rbx),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x20(%rbx),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x28(%rbx),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x30(%rbx),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x38(%rbx),%rsi
add    $0x40,%rbx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x40,%r15
cmp    $0x800,%r15d
jne    1140 <dump_usb_ram+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%04x \00"
define void @dump_usb_ram() {
br label %1
1: ; preds = %0, %1
%2 = phi i64* [ inttoptr (i64 1073766400 to i64*), %0 ], [ %25, %1 ]
%3 = phi i32 [ 0, %0 ], [ %29, %1 ]
%4 = getelementptr inbounds i64, i64* %2, i64 1
%5 = load i64, i64* %2
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %5)
%7 = getelementptr inbounds i64, i64* %2, i64 2
%8 = load i64, i64* %4
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %8)
%10 = getelementptr inbounds i64, i64* %2, i64 3
%11 = load i64, i64* %7
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %11)
%13 = getelementptr inbounds i64, i64* %2, i64 4
%14 = load i64, i64* %10
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %14)
%16 = getelementptr inbounds i64, i64* %2, i64 5
%17 = load i64, i64* %13
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %17)
%19 = getelementptr inbounds i64, i64* %2, i64 6
%20 = load i64, i64* %16
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %20)
%22 = getelementptr inbounds i64, i64* %2, i64 7
%23 = load i64, i64* %19
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %23)
%25 = getelementptr inbounds i64, i64* %2, i64 8
%26 = load i64, i64* %22
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %26)
%28 = tail call i32 @putchar(i32 10)
%29 = add nuw nsw i32 %3, 1
%30 = icmp eq i32 %29, 32
br i1 %30, label %31, label %1
31: ; preds = %1
ret void
}