#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 */
typedef int GLubyte;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, int);
int *vmwLoadTexture(int, int, int *, char *, int /*<<< orphan*/);
int main(int argc, char **argv) {
  GLubyte *texture;
  int i;
  texture = vmwLoadTexture(64, 64, texture, "./textures/brown.amg", 0);
  for (i = 0; i < 64; i++)
    printf("%i %i %i %i\n", *(texture + ((0 * 64) + i * 4) + 0),
           *(texture + ((0 * 64 * 4) + i * 4) + 1),
           *(texture + ((0 * 64 * 4) + i * 4) + 2),
           *(texture + ((0 * 64 * 4) + i * 4) + 3));
  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)
mov    -0x18(%rbp),%rdx
mov    $0x40,%esi
lea    0xeba(%rip),%rcx
xor    %r8d,%r8d
mov    %esi,%edi
call   1040 <vmwLoadTexture@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x40,-0x1c(%rbp)
jge    11cf <main+0xaf>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    $0x2,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    $0x2,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
mov    0x4(%rax,%rcx,4),%edx
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    $0x2,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
mov    0x8(%rax,%rcx,4),%ecx
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%edi
shl    $0x2,%edi
add    $0x0,%edi
movslq %edi,%rdi
mov    0xc(%rax,%rdi,4),%r8d
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115b <main+0x3b>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
lea    0xed4(%rip),%rcx
xor    %ebx,%ebx
mov    $0x40,%edi
mov    $0x40,%esi
xor    %r8d,%r8d
call   1040 <vmwLoadTexture@plt>
mov    %rax,%r15
lea    0xecb(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbx,1),%esi
mov    0x4(%r15,%rbx,1),%edx
mov    0x8(%r15,%rbx,1),%ecx
mov    0xc(%r15,%rbx,1),%r8d
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x10,%rbx
cmp    $0x400,%rbx
jne    1150 <main+0x30>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [21 x i8] c"./textures/brown.amg\00"
@.str.1 = [13 x i8] c"%i %i %i %i\0A\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
%8 = load i32*, i32** %6
%9 = call i32* @vmwLoadTexture(i32 64, i32 64, i32* %8, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 0)
store i32* %9, i32** %6
store i32 0, i32* %7
br label %10
10: ; preds = %47, %2
%11 = load i32, i32* %7
%12 = icmp slt i32 %11, 64
br i1 %12, label %13, label %50
13: ; preds = %10
%14 = load i32*, i32** %6
%15 = load i32, i32* %7
%16 = mul nsw i32 %15, 4
%17 = add nsw i32 0, %16
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %14, i64 %18
%20 = getelementptr inbounds i32, i32* %19, i64 0
%21 = load i32, i32* %20
%22 = load i32*, i32** %6
%23 = load i32, i32* %7
%24 = mul nsw i32 %23, 4
%25 = add nsw i32 0, %24
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %22, i64 %26
%28 = getelementptr inbounds i32, i32* %27, i64 1
%29 = load i32, i32* %28
%30 = load i32*, i32** %6
%31 = load i32, i32* %7
%32 = mul nsw i32 %31, 4
%33 = add nsw i32 0, %32
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %30, i64 %34
%36 = getelementptr inbounds i32, i32* %35, i64 2
%37 = load i32, i32* %36
%38 = load i32*, i32** %6
%39 = load i32, i32* %7
%40 = mul nsw i32 %39, 4
%41 = add nsw i32 0, %40
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i32, i32* %38, i64 %42
%44 = getelementptr inbounds i32, i32* %43, i64 3
%45 = load i32, i32* %44
%46 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %21, i32 %29, i32 %37, i32 %45)
br label %47
47: ; preds = %13
%48 = load i32, i32* %7
%49 = add nsw i32 %48, 1
store i32 %49, i32* %7
br label %10
50: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"./textures/brown.amg\00"
@.str.1 = [13 x i8] c"%i %i %i %i\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32* @vmwLoadTexture(i32 64, i32 64, i32* undef, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 0)
br label %4
4: ; preds = %2, %4
%5 = phi i64 [ 0, %2 ], [ %16, %4 ]
%6 = shl nuw nsw i64 %5, 2
%7 = getelementptr inbounds i32, i32* %3, i64 %6
%8 = load i32, i32* %7
%9 = getelementptr inbounds i32, i32* %7, i64 1
%10 = load i32, i32* %9
%11 = getelementptr inbounds i32, i32* %7, i64 2
%12 = load i32, i32* %11
%13 = getelementptr inbounds i32, i32* %7, i64 3
%14 = load i32, i32* %13
%15 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %8, i32 %10, i32 %12, i32 %14)
%16 = add nuw nsw i64 %5, 1
%17 = icmp eq i64 %16, 64
br i1 %17, label %18, label %4
18: ; preds = %4
ret i32 0
}