#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 /*<<< orphan*/ GLuint;

/* Variables and functions */
int /*<<< orphan*/ GL_MODELVIEW;
int /*<<< orphan*/ GL_PROJECTION;
int /*<<< orphan*/ RenderCallback(int /*<<< orphan*/);
int /*<<< orphan*/ buildDemoArray();
int /*<<< orphan*/ glKosInit();
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ glTextureLoadPVR(char *, int /*<<< orphan*/,
                                    int /*<<< orphan*/);
int /*<<< orphan*/ gluPerspective(float, float, float, float);
int /*<<< orphan*/ glutSwapBuffers();
int main(int argc, char **argv) {
  glKosInit();
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(45.0f, 640.0f / 480.0f, 0.1f, 100.0f);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  GLuint texID = glTextureLoadPVR("/rd/wp001vq.pvr", 0, 0);
  buildDemoArray();
  while (1) {
    RenderCallback(texID);
    glutSwapBuffers();
  }
  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    $0x0,%al
call   1080 <glKosInit@plt>
mov    0x2e34(%rip),%rax
mov    (%rax),%edi
call   1060 <glMatrixMode@plt>
mov    $0x0,%al
call   10a0 <glLoadIdentity@plt>
movss  0xe46(%rip),%xmm0
movss  0xe42(%rip),%xmm1
movss  0xe3e(%rip),%xmm2
movss  0xe3a(%rip),%xmm3
call   1090 <gluPerspective@plt>
mov    0x2e0a(%rip),%rax
mov    (%rax),%edi
call   1060 <glMatrixMode@plt>
mov    $0x0,%al
call   10a0 <glLoadIdentity@plt>
lea    0xe1d(%rip),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1050 <glTextureLoadPVR@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1040 <buildDemoArray@plt>
mov    -0x14(%rbp),%edi
call   1030 <RenderCallback@plt>
mov    $0x0,%al
call   1070 <glutSwapBuffers@plt>
jmp    1206 <main+0x86>

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1080 <glKosInit@plt>
mov    0x2e49(%rip),%rax
mov    (%rax),%edi
call   1060 <glMatrixMode@plt>
xor    %eax,%eax
call   10a0 <glLoadIdentity@plt>
movss  0xe5b(%rip),%xmm0
movss  0xe57(%rip),%xmm1
movss  0xe53(%rip),%xmm2
movss  0xe4f(%rip),%xmm3
call   1090 <gluPerspective@plt>
mov    0x2e1f(%rip),%rax
mov    (%rax),%edi
call   1060 <glMatrixMode@plt>
xor    %eax,%eax
call   10a0 <glLoadIdentity@plt>
lea    0xe32(%rip),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <glTextureLoadPVR@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <buildDemoArray@plt>
mov    %ebx,%edi
call   1030 <RenderCallback@plt>
xor    %eax,%eax
call   1070 <glutSwapBuffers@plt>
jmp    11f0 <main+0x70>

LLVM IR (-O0):
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
@.str = [16 x i8] c"/rd/wp001vq.pvr\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (...) @glKosInit()
%8 = load i32, i32* @GL_PROJECTION
%9 = call i32 @glMatrixMode(i32 %8)
%10 = call i32 (...) @glLoadIdentity()
%11 = call i32 @gluPerspective(float 4.500000e+01, float 0x3FF5555560000000, float 0x3FB99999A0000000, float 1.000000e+02)
%12 = load i32, i32* @GL_MODELVIEW
%13 = call i32 @glMatrixMode(i32 %12)
%14 = call i32 (...) @glLoadIdentity()
%15 = call i32 @glTextureLoadPVR(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 0, i32 0)
store i32 %15, i32* %6
%16 = call i32 (...) @buildDemoArray()
br label %17
17: ; preds = %2, %17
%18 = load i32, i32* %6
%19 = call i32 @RenderCallback(i32 %18)
%20 = call i32 (...) @glutSwapBuffers()
br label %17
}

LLVM IR (-O2):
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
@.str = [16 x i8] c"/rd/wp001vq.pvr\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @glKosInit()
%4 = load i32, i32* @GL_PROJECTION
%5 = tail call i32 @glMatrixMode(i32 %4)
%6 = tail call i32 (...) @glLoadIdentity()
%7 = tail call i32 @gluPerspective(float 4.500000e+01, float 0x3FF5555560000000, float 0x3FB99999A0000000, float 1.000000e+02)
%8 = load i32, i32* @GL_MODELVIEW
%9 = tail call i32 @glMatrixMode(i32 %8)
%10 = tail call i32 (...) @glLoadIdentity()
%11 = tail call i32 @glTextureLoadPVR(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 0, i32 0)
%12 = tail call i32 (...) @buildDemoArray()
br label %13
13: ; preds = %13, %2
%14 = tail call i32 @RenderCallback(i32 %11)
%15 = tail call i32 (...) @glutSwapBuffers()
br label %13
}