#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 *, int, char);
int vmem_read(int);
int /*<<< orphan*/ vmem_write(int, int);
int main(int argc, char *argv[]) {
  int i, l = (128 / 8) + 1;
  for (i = 0; i < l * 8; ++i) {
    vmem_write(i, i);
  }
  for (i = 0; i < l * 8; ++i) {
    printf("%08x%c", vmem_read(i), (i + 1) % 8 ? ' ' : '\n');
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x11,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    $0x3,%ecx
cmp    %ecx,%eax
jge    117e <main+0x4e>
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1050 <vmem_write@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1154 <main+0x24>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    $0x3,%ecx
cmp    %ecx,%eax
jge    11db <main+0xab>
mov    -0x14(%rbp),%edi
call   1030 <vmem_read@plt>
mov    %eax,%esi
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    $0xa,%eax
mov    $0x20,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
lea    0xe3b(%rip),%rdi
movsbl %al,%edx
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1185 <main+0x55>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %ebx,%esi
call   1050 <vmem_write@plt>
add    $0x1,%ebx
cmp    $0x88,%ebx
jne    1140 <main+0x10>
mov    $0x1,%ebx
mov    $0xa,%ebp
lea    0xe9b(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
lea    -0x1(%rbx),%edi
call   1030 <vmem_read@plt>
test   $0x7,%bl
mov    $0x20,%edx
cmove  %ebp,%edx
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
add    $0x1,%ebx
cmp    $0x89,%ebx
jne    1170 <main+0x40>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%08x%c\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 17, i32* %7
store i32 0, i32* %6
br label %8
8: ; preds = %17, %2
%9 = load i32, i32* %6
%10 = load i32, i32* %7
%11 = mul nsw i32 %10, 8
%12 = icmp slt i32 %9, %11
br i1 %12, label %13, label %20
13: ; preds = %8
%14 = load i32, i32* %6
%15 = load i32, i32* %6
%16 = call i32 @vmem_write(i32 %14, i32 %15)
br label %17
17: ; preds = %13
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
br label %8
20: ; preds = %8
store i32 0, i32* %6
br label %21
21: ; preds = %37, %20
%22 = load i32, i32* %6
%23 = load i32, i32* %7
%24 = mul nsw i32 %23, 8
%25 = icmp slt i32 %22, %24
br i1 %25, label %26, label %40
26: ; preds = %21
%27 = load i32, i32* %6
%28 = call i32 @vmem_read(i32 %27)
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
%31 = srem i32 %30, 8
%32 = icmp ne i32 %31, 0
%33 = zext i1 %32 to i64
%34 = select i1 %32, i32 32, i32 10
%35 = trunc i32 %34 to i8
%36 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %28, i8 signext %35)
br label %37
37: ; preds = %26
%38 = load i32, i32* %6
%39 = add nsw i32 %38, 1
store i32 %39, i32* %6
br label %21
40: ; preds = %21
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%08x%c\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %3
%4 = phi i32 [ 0, %2 ], [ %6, %3 ]
%5 = tail call i32 @vmem_write(i32 %4, i32 %4)
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, 136
br i1 %7, label %8, label %3
8: ; preds = %3, %8
%9 = phi i32 [ %11, %8 ], [ 0, %3 ]
%10 = tail call i32 @vmem_read(i32 %9)
%11 = add nuw nsw i32 %9, 1
%12 = and i32 %11, 7
%13 = icmp eq i32 %12, 0
%14 = select i1 %13, i8 10, i8 32
%15 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %10, i8 signext %14)
%16 = icmp eq i32 %11, 136
br i1 %16, label %17, label %8
17: ; preds = %8
ret i32 0
}