#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*/ sizes;
typedef int /*<<< orphan*/ exts;
typedef int GLint;

/* Variables and functions */
int GLUT_RGB;
int GLUT_SINGLE;
int /*<<< orphan*/ GL_EXTENSIONS;
int /*<<< orphan*/ GL_MAX_TEXTURE_SIZE;
int /*<<< orphan*/ GL_PROXY_TEXTURE_2D;
int /*<<< orphan*/ GL_RGBA;
int /*<<< orphan*/ GL_TEXTURE_HEIGHT;
int /*<<< orphan*/ GL_TEXTURE_WIDTH;
int /*<<< orphan*/ GL_UNSIGNED_BYTE;
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ glGetIntegerv(int /*<<< orphan*/, int *);
scalar_t__ glGetString(int /*<<< orphan*/);
int /*<<< orphan*/ glGetTexLevelParameteriv(int /*<<< orphan*/,
                                            int /*<<< orphan*/,
                                            int /*<<< orphan*/, int *);
int /*<<< orphan*/ glTexImage2D(int /*<<< orphan*/, int /*<<< orphan*/, int,
                                int, int, int /*<<< orphan*/,
                                int /*<<< orphan*/, int /*<<< orphan*/,
                                int /*<<< orphan*/ *);
int /*<<< orphan*/ glutCreateWindow(char *);
int /*<<< orphan*/ glutInit(int *, char **);
int /*<<< orphan*/ glutInitDisplayMode(int);
int /*<<< orphan*/ glutInitWindowPosition(int, int);
int /*<<< orphan*/ glutInitWindowSize(int, int);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ strstr(char const *, char const *);
int main(int argc, char **argv) {
  glutInit(&argc, argv);
  glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
  glutInitWindowSize(250, 250);
  glutInitWindowPosition(100, 100);
  glutCreateWindow("Hello World!");
  GLint size;
  glGetIntegerv(GL_MAX_TEXTURE_SIZE, &size);
  printf("\nGL_MAX_TEXTURE_SIZE = %d\n", size);
  const char *exts[] = {
      "GL_ARB_texture_rectangle",
      "GL_ARB_texture_non_power_of_two",
      "GL_ARB_does_not_exist",
  };
  printf("\nChecking some extensions...\n");
  const char *avail = (char *)glGetString(GL_EXTENSIONS);
  for (int i = 0; i < (sizeof(exts) / sizeof(exts[0])); i++)
    printf("\t%s: %s\n", exts[i], strstr(avail, exts[i]) ? "OK" : "Error");
  GLint sizes[][2] = {
      {120, 40},    {120, 120},   {128, 32},    {128, 64},    {128, 128},
      {3400, 1600}, {1024, 1024}, {4096, 4096}, {8192, 8192},
  };
  printf("\nTrying some sizes...\n");
  for (int i = 0; i < (sizeof(sizes) / sizeof(sizes[0])); i++) {
    GLint width = sizes[i][0];
    GLint height = sizes[i][1];
    printf("\t%dx%d: ", width, height);
    glTexImage2D(GL_PROXY_TEXTURE_2D, 0, 4, width, height, 0, GL_RGBA,
                 GL_UNSIGNED_BYTE, NULL);
    glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &width);
    glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT,
                             &height);
    printf("%s\n", width && height ? "OK" : "Error");
  }
  printf("\nPress any key to exit..\n");
  getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    -0x8(%rbp),%rdi
call   10c0 <glutInit@plt>
mov    0x2dcb(%rip),%rax
mov    (%rax),%edi
mov    0x2dda(%rip),%rax
or     (%rax),%edi
call   1030 <glutInitDisplayMode@plt>
mov    $0xfa,%esi
mov    %esi,%edi
call   10d0 <glutInitWindowSize@plt>
mov    $0x64,%esi
mov    %esi,%edi
call   10b0 <glutInitWindowPosition@plt>
lea    0xdd4(%rip),%rdi
call   10a0 <glutCreateWindow@plt>
mov    0x2d68(%rip),%rax
mov    (%rax),%edi
lea    -0x14(%rbp),%rsi
call   10e0 <glGetIntegerv@plt>
mov    -0x14(%rbp),%esi
lea    0xdc0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2b65(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2b62(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2b5f(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d2e(%rip),%rax
mov    (%rax),%edi
call   1080 <glGetString@plt>
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movslq -0x3c(%rbp),%rax
cmp    $0x3,%rax
jae    1308 <main+0x138>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rax
mov    %rax,-0xa8(%rbp)
mov    -0x38(%rbp),%rdi
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,8),%rsi
call   10f0 <strstr@plt>
mov    -0xa8(%rbp),%rsi
mov    %rax,%rcx
lea    0xdc4(%rip),%rdx
lea    0xdba(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdx
lea    0xda2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    129c <main+0xcc>
lea    -0x90(%rbp),%rdi
lea    0xdda(%rip),%rsi
mov    $0x48,%edx
call   1070 <memcpy@plt>
lea    0xd80(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x94(%rbp)
movslq -0x94(%rbp),%rax
cmp    $0x9,%rax
jae    1479 <main+0x2a9>
movslq -0x94(%rbp),%rax
mov    -0x90(%rbp,%rax,8),%eax
mov    %eax,-0x98(%rbp)
movslq -0x94(%rbp),%rax
mov    -0x8c(%rbp,%rax,8),%eax
mov    %eax,-0x9c(%rbp)
mov    -0x98(%rbp),%esi
mov    -0x9c(%rbp),%edx
lea    0xd3a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2c1e(%rip),%rax
mov    (%rax),%edi
mov    -0x98(%rbp),%ecx
mov    -0x9c(%rbp),%r8d
mov    0x2c48(%rip),%rax
mov    (%rax),%r10d
mov    0x2bf6(%rip),%rax
mov    (%rax),%eax
xor    %r9d,%r9d
mov    $0x4,%edx
xor    %esi,%esi
mov    %r9d,%esi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
movq   $0x0,0x10(%rsp)
call   1050 <glTexImage2D@plt>
mov    0x2bd2(%rip),%rax
mov    (%rax),%edi
mov    0x2bf1(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
lea    -0x98(%rbp),%rcx
call   1090 <glGetTexLevelParameteriv@plt>
mov    0x2bb2(%rip),%rax
mov    (%rax),%edi
mov    0x2bc9(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
lea    -0x9c(%rbp),%rcx
call   1090 <glGetTexLevelParameteriv@plt>
xor    %eax,%eax
cmpl   $0x0,-0x98(%rbp)
mov    %al,-0xa9(%rbp)
je     143c <main+0x26c>
cmpl   $0x0,-0x9c(%rbp)
setne  %al
mov    %al,-0xa9(%rbp)
mov    -0xa9(%rbp),%cl
lea    0xc58(%rip),%rsi
lea    0xc4e(%rip),%rax
test   $0x1,%cl
cmovne %rax,%rsi
lea    0xc3c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x94(%rbp)
jmp    1338 <main+0x168>
lea    0xc47(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    -0x4(%rbp),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edi,0x14(%rsp)
lea    0x14(%rsp),%rdi
call   10c0 <glutInit@plt>
mov    0x2dd5(%rip),%rax
mov    0x2de6(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
call   1030 <glutInitDisplayMode@plt>
mov    $0xfa,%edi
mov    $0xfa,%esi
call   10d0 <glutInitWindowSize@plt>
mov    $0x64,%edi
mov    $0x64,%esi
call   10b0 <glutInitWindowPosition@plt>
lea    0xdd8(%rip),%rdi
call   10a0 <glutCreateWindow@plt>
mov    0x2d6c(%rip),%rax
mov    (%rax),%edi
lea    0x10(%rsp),%rsi
call   10e0 <glGetIntegerv@plt>
mov    0x10(%rsp),%esi
lea    0xdc2(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe39(%rip),%rdi
call   1040 <puts@plt>
mov    0x2d53(%rip),%rax
mov    (%rax),%edi
call   1080 <glGetString@plt>
mov    %rax,%r12
lea    0xdb2(%rip),%r15
mov    %rax,%rdi
mov    %r15,%rsi
call   10f0 <strstr@plt>
test   %rax,%rax
lea    0xdf8(%rip),%r14
lea    0xdee(%rip),%rbp
mov    %rbp,%rdx
cmove  %r14,%rdx
lea    0xdd7(%rip),%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd8d(%rip),%r15
mov    %r12,%rdi
mov    %r15,%rsi
call   10f0 <strstr@plt>
test   %rax,%rax
mov    %rbp,%rdx
cmove  %r14,%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd84(%rip),%r15
mov    %r12,%rdi
mov    %r15,%rsi
call   10f0 <strstr@plt>
test   %rax,%rax
mov    %rbp,%rdx
cmove  %r14,%rdx
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xda9(%rip),%rdi
call   1040 <puts@plt>
lea    0xdce(%rip),%rbp
mov    0x2c97(%rip),%r13
lea    0x8(%rsp),%r12
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x0(%rbp,%r15,8),%esi
mov    0x4(%rbp,%r15,8),%edx
mov    %esi,0xc(%rsp)
mov    %edx,0x8(%rsp)
lea    0xd40(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x0(%r13),%edi
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%r8d
mov    0x2c8c(%rip),%rax
mov    (%rax),%eax
mov    0x2c3b(%rip),%rdx
mov    (%rdx),%ebx
sub    $0x8,%rsp
xor    %esi,%esi
mov    $0x4,%edx
xor    %r9d,%r9d
push   $0x0
push   %rbx
push   %rax
call   1060 <glTexImage2D@plt>
add    $0x20,%rsp
mov    0x0(%r13),%edi
mov    0x2c43(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
lea    0xc(%rsp),%rcx
call   1090 <glGetTexLevelParameteriv@plt>
mov    0x0(%r13),%edi
mov    0x2c22(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
mov    %r12,%rcx
call   1090 <glGetTexLevelParameteriv@plt>
cmpl   $0x0,0x8(%rsp)
lea    0xcba(%rip),%rdi
cmove  %r14,%rdi
cmpl   $0x0,0xc(%rsp)
cmove  %r14,%rdi
call   1040 <puts@plt>
add    $0x1,%r15
cmp    $0x9,%r15
jne    1330 <main+0x160>
lea    0xcd8(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1070 <getchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@GLUT_SINGLE = global i32 0
@GLUT_RGB = global i32 0
@.str = [13 x i8] c"Hello World!\00"
@GL_MAX_TEXTURE_SIZE = global i32 0
@.str.1 = [27 x i8] c"\0AGL_MAX_TEXTURE_SIZE = %d\0A\00"
@.str.2 = [25 x i8] c"GL_ARB_texture_rectangle\00"
@.str.3 = [32 x i8] c"GL_ARB_texture_non_power_of_two\00"
@.str.4 = [22 x i8] c"GL_ARB_does_not_exist\00"
@__const.main.exts = [3 x i8*] [i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i32 0, i32 0)]
@.str.5 = [30 x i8] c"\0AChecking some extensions...\0A\00"
@GL_EXTENSIONS = global i32 0
@.str.6 = [9 x i8] c"\09%s: %s\0A\00"
@.str.7 = [3 x i8] c"OK\00"
@.str.8 = [6 x i8] c"Error\00"
@__const.main.sizes = [9 x [2 x i32]] [[2 x i32] [i32 120, i32 40], [2 x i32] [i32 120, i32 120], [2 x i32] [i32 128, i32 32], [2 x i32] [i32 128, i32 64], [2 x i32] [i32 128, i32 128], [2 x i32] [i32 3400, i32 1600], [2 x i32] [i32 1024, i32 1024], [2 x i32] [i32 4096, i32 4096], [2 x i32] [i32 8192, i32 8192]]
@.str.9 = [23 x i8] c"\0ATrying some sizes...\0A\00"
@.str.10 = [9 x i8] c"\09%dx%d: \00"
@GL_PROXY_TEXTURE_2D = global i32 0
@GL_RGBA = global i32 0
@GL_UNSIGNED_BYTE = global i32 0
@GL_TEXTURE_WIDTH = global i32 0
@GL_TEXTURE_HEIGHT = global i32 0
@.str.11 = [4 x i8] c"%s\0A\00"
@.str.12 = [26 x i8] c"\0APress any key to exit..\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [3 x i8*]
%8 = alloca i8*
%9 = alloca i32
%10 = alloca [9 x [2 x i32]]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i8**, i8*** %5
%15 = call i32 @glutInit(i32* %4, i8** %14)
%16 = load i32, i32* @GLUT_SINGLE
%17 = load i32, i32* @GLUT_RGB
%18 = or i32 %16, %17
%19 = call i32 @glutInitDisplayMode(i32 %18)
%20 = call i32 @glutInitWindowSize(i32 250, i32 250)
%21 = call i32 @glutInitWindowPosition(i32 100, i32 100)
%22 = call i32 @glutCreateWindow(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%23 = load i32, i32* @GL_MAX_TEXTURE_SIZE
%24 = call i32 @glGetIntegerv(i32 %23, i32* %6)
%25 = load i32, i32* %6
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = bitcast [3 x i8*]* %7 to i8*
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
%29 = load i32, i32* @GL_EXTENSIONS
%30 = call i64 @glGetString(i32 %29)
%31 = inttoptr i64 %30 to i8*
store i8* %31, i8** %8
store i32 0, i32* %9
br label %32
32: ; preds = %51, %2
%33 = load i32, i32* %9
%34 = sext i32 %33 to i64
%35 = icmp ult i64 %34, 3
br i1 %35, label %36, label %54
36: ; preds = %32
%37 = load i32, i32* %9
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [3 x i8*], [3 x i8*]* %7, i64 0, i64 %38
%40 = load i8*, i8** %39
%41 = load i8*, i8** %8
%42 = load i32, i32* %9
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [3 x i8*], [3 x i8*]* %7, i64 0, i64 %43
%45 = load i8*, i8** %44
%46 = call i64 @strstr(i8* %41, i8* %45)
%47 = icmp ne i64 %46, 0
%48 = zext i1 %47 to i64
%49 = select i1 %47, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0)
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* %40, i8* %49)
br label %51
51: ; preds = %36
%52 = load i32, i32* %9
%53 = add nsw i32 %52, 1
store i32 %53, i32* %9
br label %32
54: ; preds = %32
%55 = bitcast [9 x [2 x i32]]* %10 to i8*
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0))
store i32 0, i32* %11
br label %57
57: ; preds = %97, %54
%58 = load i32, i32* %11
%59 = sext i32 %58 to i64
%60 = icmp ult i64 %59, 9
br i1 %60, label %61, label %100
61: ; preds = %57
%62 = load i32, i32* %11
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %10, i64 0, i64 %63
%65 = getelementptr inbounds [2 x i32], [2 x i32]* %64, i64 0, i64 0
%66 = load i32, i32* %65
store i32 %66, i32* %12
%67 = load i32, i32* %11
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* %10, i64 0, i64 %68
%70 = getelementptr inbounds [2 x i32], [2 x i32]* %69, i64 0, i64 1
%71 = load i32, i32* %70
store i32 %71, i32* %13
%72 = load i32, i32* %12
%73 = load i32, i32* %13
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32 %72, i32 %73)
%75 = load i32, i32* @GL_PROXY_TEXTURE_2D
%76 = load i32, i32* %12
%77 = load i32, i32* %13
%78 = load i32, i32* @GL_RGBA
%79 = load i32, i32* @GL_UNSIGNED_BYTE
%80 = call i32 @glTexImage2D(i32 %75, i32 0, i32 4, i32 %76, i32 %77, i32 0, i32 %78, i32 %79, i32* null)
%81 = load i32, i32* @GL_PROXY_TEXTURE_2D
%82 = load i32, i32* @GL_TEXTURE_WIDTH
%83 = call i32 @glGetTexLevelParameteriv(i32 %81, i32 0, i32 %82, i32* %12)
%84 = load i32, i32* @GL_PROXY_TEXTURE_2D
%85 = load i32, i32* @GL_TEXTURE_HEIGHT
%86 = call i32 @glGetTexLevelParameteriv(i32 %84, i32 0, i32 %85, i32* %13)
%87 = load i32, i32* %12
%88 = icmp ne i32 %87, 0
br i1 %88, label %89, label %92
89: ; preds = %61
%90 = load i32, i32* %13
%91 = icmp ne i32 %90, 0
br label %92
92: ; preds = %89, %61
%93 = phi i1 [ false, %61 ], [ %91, %89 ]
%94 = zext i1 %93 to i64
%95 = select i1 %93, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0)
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i8* %95)
br label %97
97: ; preds = %92
%98 = load i32, i32* %11
%99 = add nsw i32 %98, 1
store i32 %99, i32* %11
br label %57
100: ; preds = %57
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.12, i64 0, i64 0))
%102 = call i32 (...) @getchar()
%103 = load i32, i32* %3
ret i32 %103
}

LLVM IR (-O2):
@GLUT_SINGLE = global i32 0
@GLUT_RGB = global i32 0
@.str = [13 x i8] c"Hello World!\00"
@GL_MAX_TEXTURE_SIZE = global i32 0
@.str.1 = [27 x i8] c"\0AGL_MAX_TEXTURE_SIZE = %d\0A\00"
@.str.2 = [25 x i8] c"GL_ARB_texture_rectangle\00"
@.str.3 = [32 x i8] c"GL_ARB_texture_non_power_of_two\00"
@.str.4 = [22 x i8] c"GL_ARB_does_not_exist\00"
@GL_EXTENSIONS = global i32 0
@.str.6 = [9 x i8] c"\09%s: %s\0A\00"
@.str.7 = [3 x i8] c"OK\00"
@.str.8 = [6 x i8] c"Error\00"
@__const.main.sizes = [9 x [2 x i32]] [[2 x i32] [i32 120, i32 40], [2 x i32] [i32 120, i32 120], [2 x i32] [i32 128, i32 32], [2 x i32] [i32 128, i32 64], [2 x i32] [i32 128, i32 128], [2 x i32] [i32 3400, i32 1600], [2 x i32] [i32 1024, i32 1024], [2 x i32] [i32 4096, i32 4096], [2 x i32] [i32 8192, i32 8192]]
@.str.10 = [9 x i8] c"\09%dx%d: \00"
@GL_PROXY_TEXTURE_2D = global i32 0
@GL_RGBA = global i32 0
@GL_UNSIGNED_BYTE = global i32 0
@GL_TEXTURE_WIDTH = global i32 0
@GL_TEXTURE_HEIGHT = global i32 0
@str = [29 x i8] c"\0AChecking some extensions...\00"
@str.13 = [22 x i8] c"\0ATrying some sizes...\00"
@str.14 = [25 x i8] c"\0APress any key to exit..\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
%7 = call i32 @glutInit(i32* %3, i8** %1)
%8 = load i32, i32* @GLUT_SINGLE
%9 = load i32, i32* @GLUT_RGB
%10 = or i32 %9, %8
%11 = call i32 @glutInitDisplayMode(i32 %10)
%12 = call i32 @glutInitWindowSize(i32 250, i32 250)
%13 = call i32 @glutInitWindowPosition(i32 100, i32 100)
%14 = call i32 @glutCreateWindow(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%15 = bitcast i32* %4 to i8*
%16 = load i32, i32* @GL_MAX_TEXTURE_SIZE
%17 = call i32 @glGetIntegerv(i32 %16, i32* %4)
%18 = load i32, i32* %4
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%21 = load i32, i32* @GL_EXTENSIONS
%22 = call i64 @glGetString(i32 %21)
%23 = inttoptr i64 %22 to i8*
%24 = call i64 @strstr(i8* %23, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
%26 = select i1 %25, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %26)
%28 = call i64 @strstr(i8* %23, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
%30 = select i1 %29, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i8* %30)
%32 = call i64 @strstr(i8* %23, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
%34 = select i1 %33, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i8* %34)
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.13, i64 0, i64 0))
%37 = bitcast i32* %5 to i8*
%38 = bitcast i32* %6 to i8*
br label %42
39: ; preds = %42
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.14, i64 0, i64 0))
%41 = call i32 (...) @getchar()
ret i32 0
42: ; preds = %2, %42
%43 = phi i64 [ 0, %2 ], [ %68, %42 ]
%44 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* @__const.main.sizes, i64 0, i64 %43, i64 0
%45 = load i32, i32* %44
store i32 %45, i32* %5
%46 = getelementptr inbounds [9 x [2 x i32]], [9 x [2 x i32]]* @__const.main.sizes, i64 0, i64 %43, i64 1
%47 = load i32, i32* %46
store i32 %47, i32* %6
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32 %45, i32 %47)
%49 = load i32, i32* @GL_PROXY_TEXTURE_2D
%50 = load i32, i32* %5
%51 = load i32, i32* %6
%52 = load i32, i32* @GL_RGBA
%53 = load i32, i32* @GL_UNSIGNED_BYTE
%54 = call i32 @glTexImage2D(i32 %49, i32 0, i32 4, i32 %50, i32 %51, i32 0, i32 %52, i32 %53, i32* null)
%55 = load i32, i32* @GL_PROXY_TEXTURE_2D
%56 = load i32, i32* @GL_TEXTURE_WIDTH
%57 = call i32 @glGetTexLevelParameteriv(i32 %55, i32 0, i32 %56, i32* %5)
%58 = load i32, i32* @GL_PROXY_TEXTURE_2D
%59 = load i32, i32* @GL_TEXTURE_HEIGHT
%60 = call i32 @glGetTexLevelParameteriv(i32 %58, i32 0, i32 %59, i32* %6)
%61 = load i32, i32* %5
%62 = icmp ne i32 %61, 0
%63 = load i32, i32* %6
%64 = icmp ne i32 %63, 0
%65 = select i1 %62, i1 %64, i1 false
%66 = select i1 %65, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0)
%67 = call i32 @puts(i8* dereferenceable(1) %66)
%68 = add nuw nsw i64 %43, 1
%69 = icmp eq i64 %68, 9
br i1 %69, label %39, label %42
}