#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*/ EXIT_FAILURE;
int /*<<< orphan*/ GL_ALPHA_TEST;
int /*<<< orphan*/ GL_BLEND;
int /*<<< orphan*/ GL_DEPTH_TEST;
int /*<<< orphan*/ GL_GREATER;
int /*<<< orphan*/ GL_LIGHT0;
int /*<<< orphan*/ GL_LINEAR;
int /*<<< orphan*/ GL_MODELVIEW;
int /*<<< orphan*/ GL_MODULATE;
int /*<<< orphan*/ GL_NORMALIZE;
int /*<<< orphan*/ GL_ONE_MINUS_SRC_ALPHA;
int /*<<< orphan*/ GL_PROJECTION;
int /*<<< orphan*/ GL_RGBA;
int /*<<< orphan*/ GL_SRC_ALPHA;
int /*<<< orphan*/ GL_TEXTURE_2D;
int /*<<< orphan*/ GL_TEXTURE_ENV;
int /*<<< orphan*/ GL_TEXTURE_ENV_MODE;
int /*<<< orphan*/ GL_TEXTURE_MAG_FILTER;
int /*<<< orphan*/ GL_TEXTURE_MIN_FILTER;
int /*<<< orphan*/ GL_UNPACK_ALIGNMENT;
int /*<<< orphan*/ GL_UNSIGNED_BYTE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ glAlphaFunc(int /*<<< orphan*/, double);
int /*<<< orphan*/ glBlendFunc(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ glClearColor(float, float, float, float);
int /*<<< orphan*/ glEnable(int /*<<< orphan*/);
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ glPixelStorei(int /*<<< orphan*/, int);
int /*<<< orphan*/ glTexEnvf(int /*<<< orphan*/, int /*<<< orphan*/,
                             int /*<<< orphan*/);
int /*<<< orphan*/ glTexImage2D(int /*<<< orphan*/, int /*<<< orphan*/, int,
                                int, int, int /*<<< orphan*/,
                                int /*<<< orphan*/, int /*<<< orphan*/,
                                unsigned int *);
int /*<<< orphan*/ glTexParameteri(int /*<<< orphan*/, int /*<<< orphan*/,
                                   int /*<<< orphan*/);
int /*<<< orphan*/ glTranslatef(int, int, double);
int /*<<< orphan*/ gluPerspective(int, int, double, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
unsigned int *read_texture(char *, int *, int *, int *);
int /*<<< orphan*/ stderr;
void init(char *filename) {
  static unsigned *image;
  static int width, height, components;
  if (filename) {
    image = read_texture(filename, &width, &height, &components);
    if (image == NULL) {
      fprintf(stderr, "Error: Can't load image file \"%s\".\n", filename);
      exit(EXIT_FAILURE);
    } else {
      printf("%d x %d image loaded\n", width, height);
    }
    if (components != 2 && components != 4) {
      printf("must be an RGBA or LA image\n");
      exit(EXIT_FAILURE);
    }
  } else {
    int i, j;
    unsigned char *img;
    components = 4;
    width = height = 512;
    image = (unsigned *)malloc(width * height * sizeof(unsigned));
    img = (unsigned char *)image;
    for (j = 0; j < height; j++)
      for (i = 0; i < width; i++) {
        int w2 = width / 2, h2 = height / 2;
        if (i & 32)
          img[4 * (i + j * width) + 0] = 0xff;
        else
          img[4 * (i + j * width) + 1] = 0xff;
        if (j & 32)
          img[4 * (i + j * width) + 2] = 0xff;
        if ((i - w2) * (i - w2) + (j - h2) * (j - h2) > 64 * 64 &&
            (i - w2) * (i - w2) + (j - h2) * (j - h2) < 300 * 300)
          img[4 * (i + j * width) + 3] = 0xff;
      }
  }
  glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
  glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  glTexImage2D(GL_TEXTURE_2D, 0, components, width, height, 0, GL_RGBA,
               GL_UNSIGNED_BYTE, image);
  glEnable(GL_TEXTURE_2D);
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  gluPerspective(50., 1., .1, 20.);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  glTranslatef(0., 0., -5.5);
  glClearColor(.25f, .25f, .75f, .25f);
  glAlphaFunc(GL_GREATER, 0.016);
  glEnable(GL_ALPHA_TEST);
  glEnable(GL_BLEND);
  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  glEnable(GL_DEPTH_TEST);
  glEnable(GL_LIGHT0);
  glEnable(GL_NORMALIZE);
}


x86 assembly (clang, -O0):
<init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     12d6 <init+0xc6>
mov    -0x8(%rbp),%rdi
lea    0x2e86(%rip),%rsi
lea    0x2e83(%rip),%rdx
lea    0x2e80(%rip),%rcx
call   1100 <read_texture@plt>
mov    %rax,0x2e64(%rip)
cmpq   $0x0,0x2e5c(%rip)
jne    1281 <init+0x71>
mov    0x2d17(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xdb2(%rip),%rsi
call   10d0 <fprintf@plt>
mov    0x2ce6(%rip),%rax
mov    (%rax),%edi
call   1130 <exit@plt>
mov    0x2e31(%rip),%esi
mov    0x2e2f(%rip),%edx
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpl   $0x2,0x2e1e(%rip)
je     12d1 <init+0xc1>
cmpl   $0x4,0x2e11(%rip)
je     12d1 <init+0xc1>
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2c96(%rip),%rax
mov    (%rax),%edi
call   1130 <exit@plt>
jmp    1492 <init+0x282>
movl   $0x4,0x2de0(%rip)
movl   $0x200,0x2dd2(%rip)
movl   $0x200,0x2dc4(%rip)
mov    0x2dbe(%rip),%eax
imul   0x2dbb(%rip),%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   10f0 <malloc@plt>
mov    %rax,0x2d9b(%rip)
mov    0x2d94(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    0x2d8c(%rip),%eax
jge    148d <init+0x27d>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    0x2d72(%rip),%eax
jge    147a <init+0x26a>
mov    0x2d66(%rip),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    0x2d59(%rip),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     13a2 <init+0x192>
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%edx
imul   0x2d2a(%rip),%edx
add    %edx,%ecx
shl    $0x2,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movb   $0xff,(%rax,%rcx,1)
jmp    13c2 <init+0x1b2>
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%edx
imul   0x2d05(%rip),%edx
add    %edx,%ecx
shl    $0x2,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movb   $0xff,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     13f1 <init+0x1e1>
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%edx
imul   0x2cd6(%rip),%edx
add    %edx,%ecx
shl    $0x2,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movb   $0xff,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
sub    -0x1c(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    -0x1c(%rbp),%ecx
imul   %ecx,%eax
mov    -0x10(%rbp),%ecx
sub    -0x20(%rbp),%ecx
mov    -0x10(%rbp),%edx
sub    -0x20(%rbp),%edx
imul   %edx,%ecx
add    %ecx,%eax
cmp    $0x1000,%eax
jle    1467 <init+0x257>
mov    -0xc(%rbp),%eax
sub    -0x1c(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    -0x1c(%rbp),%ecx
imul   %ecx,%eax
mov    -0x10(%rbp),%ecx
sub    -0x20(%rbp),%ecx
mov    -0x10(%rbp),%edx
sub    -0x20(%rbp),%edx
imul   %edx,%ecx
add    %ecx,%eax
cmp    $0x15f90,%eax
jge    1467 <init+0x257>
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%edx
imul   0x2c60(%rip),%edx
add    %edx,%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movb   $0xff,(%rax,%rcx,1)
jmp    146c <init+0x25c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    133d <init+0x12d>
jmp    147f <init+0x26f>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1327 <init+0x117>
jmp    1492 <init+0x282>
mov    0x2b27(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
call   1090 <glPixelStorei@plt>
mov    0x2b04(%rip),%rax
mov    (%rax),%edi
mov    0x2aeb(%rip),%rax
mov    (%rax),%esi
mov    0x2ad2(%rip),%rax
mov    (%rax),%edx
call   10b0 <glTexEnvf@plt>
mov    0x2ab4(%rip),%rax
mov    (%rax),%edi
mov    0x2b0b(%rip),%rax
mov    (%rax),%esi
mov    0x2aea(%rip),%rax
mov    (%rax),%edx
call   1050 <glTexParameteri@plt>
mov    0x2a94(%rip),%rax
mov    (%rax),%edi
mov    0x2a43(%rip),%rax
mov    (%rax),%esi
mov    0x2aca(%rip),%rax
mov    (%rax),%edx
call   1050 <glTexParameteri@plt>
mov    0x2a74(%rip),%rax
mov    (%rax),%edi
mov    0x2bac(%rip),%edx
mov    0x2b9e(%rip),%ecx
mov    0x2b9b(%rip),%r8d
mov    0x2ac8(%rip),%rax
mov    (%rax),%r11d
mov    0x2a16(%rip),%rax
mov    (%rax),%r10d
mov    0x2b74(%rip),%rax
xor    %r9d,%r9d
mov    %r9d,%esi
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1070 <glTexImage2D@plt>
mov    0x2a24(%rip),%rax
mov    (%rax),%edi
call   1080 <glEnable@plt>
mov    0x29fe(%rip),%rax
mov    (%rax),%edi
call   1040 <glMatrixMode@plt>
mov    $0x0,%al
call   10e0 <glLoadIdentity@plt>
mov    $0x32,%edi
mov    $0x1,%esi
movsd  0xa86(%rip),%xmm0
mov    $0x14,%edx
call   10a0 <gluPerspective@plt>
mov    0x29fd(%rip),%rax
mov    (%rax),%edi
call   1040 <glMatrixMode@plt>
mov    $0x0,%al
call   10e0 <glLoadIdentity@plt>
xor    %esi,%esi
movsd  0xa55(%rip),%xmm0
mov    %esi,%edi
call   1120 <glTranslatef@plt>
movss  0xa56(%rip),%xmm3
movss  0xa52(%rip),%xmm2
movaps %xmm3,%xmm0
movaps %xmm3,%xmm1
call   10c0 <glClearColor@plt>
mov    0x297c(%rip),%rax
mov    (%rax),%edi
movsd  0xa1a(%rip),%xmm0
call   1110 <glAlphaFunc@plt>
mov    0x29c6(%rip),%rax
mov    (%rax),%edi
call   1080 <glEnable@plt>
mov    0x29d0(%rip),%rax
mov    (%rax),%edi
call   1080 <glEnable@plt>
mov    0x2942(%rip),%rax
mov    (%rax),%edi
mov    0x29c1(%rip),%rax
mov    (%rax),%esi
call   1030 <glBlendFunc@plt>
mov    0x291b(%rip),%rax
mov    (%rax),%edi
call   1080 <glEnable@plt>
mov    0x2975(%rip),%rax
mov    (%rax),%edi
call   1080 <glEnable@plt>
mov    0x292f(%rip),%rax
mov    (%rax),%edi
call   1080 <glEnable@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
je     1299 <init+0x79>
mov    %rdi,%rbx
lea    0x2e8d(%rip),%rsi
lea    0x2e8a(%rip),%rdx
lea    0x2e87(%rip),%rcx
call   1110 <read_texture@plt>
mov    %rax,0x2e6b(%rip)
test   %rax,%rax
je     1546 <init+0x326>
mov    0x2e64(%rip),%esi
mov    0x2e62(%rip),%edx
lea    0xddb(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2e52(%rip),%eax
cmp    $0x2,%eax
je     13a9 <init+0x189>
cmp    $0x4,%eax
je     13a9 <init+0x189>
lea    0xdcb(%rip),%rdi
call   1040 <puts@plt>
jmp    155e <init+0x33e>
movl   $0x4,0x2e25(%rip)
movl   $0x200,0x2e17(%rip)
movl   $0x200,0x2e09(%rip)
mov    $0x100000,%edi
call   1100 <malloc@plt>
mov    %rax,0x2df0(%rip)
mov    0x2df6(%rip),%edi
test   %edi,%edi
jle    13a9 <init+0x189>
xor    %r8d,%r8d
mov    0x2de1(%rip),%ebx
jmp    12fd <init+0xdd>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%r8d
cmp    %edi,%r8d
jge    13a9 <init+0x189>
test   %ebx,%ebx
jle    12f0 <init+0xd0>
xor    %edx,%edx
jmp    1323 <init+0x103>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%edx
mov    0x2da7(%rip),%ebx
mov    0x2da5(%rip),%edi
cmp    %ebx,%edx
jge    12f0 <init+0xd0>
mov    %ebx,%esi
shr    $0x1f,%esi
add    %ebx,%esi
sar    %esi
neg    %esi
mov    %edi,%ecx
shr    $0x1f,%ecx
add    %edi,%ecx
sar    %ecx
neg    %ecx
imul   %r8d,%ebx
add    %edx,%ebx
mov    %edx,%edi
shr    $0x5,%edi
and    $0x1,%edi
lea    (%rdi,%rbx,4),%edi
movslq %edi,%rdi
xor    $0x1,%rdi
movb   $0xff,(%rax,%rdi,1)
test   $0x20,%r8b
je     1372 <init+0x152>
mov    0x2d5f(%rip),%edi
imul   %r8d,%edi
add    %edx,%edi
shl    $0x2,%edi
movslq %edi,%rdi
movb   $0xff,0x2(%rax,%rdi,1)
add    %edx,%esi
imul   %esi,%esi
add    %r8d,%ecx
imul   %ecx,%ecx
add    %esi,%ecx
add    $0xffffefff,%ecx
cmp    $0x14f8e,%ecx
ja     1310 <init+0xf0>
mov    0x2d2d(%rip),%ecx
imul   %r8d,%ecx
add    %edx,%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
movb   $0xff,0x3(%rax,%rcx,1)
jmp    1310 <init+0xf0>
mov    0x2c10(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
call   10a0 <glPixelStorei@plt>
mov    0x2bed(%rip),%rax
mov    (%rax),%edi
mov    0x2bd4(%rip),%rax
mov    (%rax),%esi
mov    0x2bbb(%rip),%rax
mov    (%rax),%edx
call   10c0 <glTexEnvf@plt>
mov    0x2b9d(%rip),%r14
mov    (%r14),%edi
mov    0x2bf3(%rip),%rax
mov    (%rax),%esi
mov    0x2bd2(%rip),%rbx
mov    (%rbx),%edx
call   1060 <glTexParameteri@plt>
mov    (%r14),%edi
mov    0x2b31(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
call   1060 <glTexParameteri@plt>
mov    (%r14),%edi
mov    0x2caf(%rip),%edx
mov    0x2ca1(%rip),%ecx
mov    0x2c9e(%rip),%r8d
mov    0x2bc3(%rip),%rax
mov    (%rax),%eax
mov    0x2b12(%rip),%rsi
mov    (%rsi),%ebx
sub    $0x8,%rsp
xor    %esi,%esi
xor    %r9d,%r9d
push   0x2c71(%rip)
push   %rbx
push   %rax
call   1080 <glTexImage2D@plt>
add    $0x20,%rsp
mov    (%r14),%edi
call   1090 <glEnable@plt>
mov    0x2b07(%rip),%rax
mov    (%rax),%edi
call   1050 <glMatrixMode@plt>
xor    %eax,%eax
call   10f0 <glLoadIdentity@plt>
movsd  0xb89(%rip),%xmm0
mov    $0x32,%edi
mov    $0x1,%esi
mov    $0x14,%edx
call   10b0 <gluPerspective@plt>
mov    0x2b06(%rip),%rax
mov    (%rax),%edi
call   1050 <glMatrixMode@plt>
xor    %eax,%eax
call   10f0 <glLoadIdentity@plt>
movsd  0xb60(%rip),%xmm0
xor    %edi,%edi
xor    %esi,%esi
call   1130 <glTranslatef@plt>
movss  0xb5f(%rip),%xmm2
movss  0xb5b(%rip),%xmm0
movaps %xmm0,%xmm1
movaps %xmm0,%xmm3
call   10d0 <glClearColor@plt>
mov    0x2a85(%rip),%rax
mov    (%rax),%edi
movsd  0xb33(%rip),%xmm0
call   1120 <glAlphaFunc@plt>
mov    0x2acf(%rip),%rax
mov    (%rax),%edi
call   1090 <glEnable@plt>
mov    0x2ad9(%rip),%rax
mov    (%rax),%edi
call   1090 <glEnable@plt>
mov    0x2a4b(%rip),%rax
mov    (%rax),%edi
mov    0x2aca(%rip),%rax
mov    (%rax),%esi
call   1030 <glBlendFunc@plt>
mov    0x2a24(%rip),%rax
mov    (%rax),%edi
call   1090 <glEnable@plt>
mov    0x2a7e(%rip),%rax
mov    (%rax),%edi
call   1090 <glEnable@plt>
mov    0x2a38(%rip),%rax
mov    (%rax),%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1090 <glEnable@plt>
mov    0x2a2b(%rip),%rax
mov    (%rax),%edi
lea    0xaca(%rip),%rsi
mov    %rbx,%rdx
call   10e0 <fprintf@plt>
mov    0x29fb(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>

LLVM IR (-O0):
@init.image = internal global i32* null
@init.width = internal global i32 0
@init.height = internal global i32 0
@init.components = internal global i32 0
@stderr = global i32 0
@.str = [36 x i8] c"Error: Can't load image file \22%s\22.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [22 x i8] c"%d x %d image loaded\0A\00"
@.str.2 = [29 x i8] c"must be an RGBA or LA image\0A\00"
@GL_UNPACK_ALIGNMENT = global i32 0
@GL_TEXTURE_ENV = global i32 0
@GL_TEXTURE_ENV_MODE = global i32 0
@GL_MODULATE = global i32 0
@GL_TEXTURE_2D = global i32 0
@GL_TEXTURE_MIN_FILTER = global i32 0
@GL_LINEAR = global i32 0
@GL_TEXTURE_MAG_FILTER = global i32 0
@GL_RGBA = global i32 0
@GL_UNSIGNED_BYTE = global i32 0
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
@GL_GREATER = global i32 0
@GL_ALPHA_TEST = global i32 0
@GL_BLEND = global i32 0
@GL_SRC_ALPHA = global i32 0
@GL_ONE_MINUS_SRC_ALPHA = global i32 0
@GL_DEPTH_TEST = global i32 0
@GL_LIGHT0 = global i32 0
@GL_NORMALIZE = global i32 0
define void @init(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %2
%8 = load i8*, i8** %2
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %36
10: ; preds = %1
%11 = load i8*, i8** %2
%12 = call i32* @read_texture(i8* %11, i32* @init.width, i32* @init.height, i32* @init.components)
store i32* %12, i32** @init.image
%13 = load i32*, i32** @init.image
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %21
15: ; preds = %10
%16 = load i32, i32* @stderr
%17 = load i8*, i8** %2
%18 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = load i32, i32* @EXIT_FAILURE
%20 = call i32 @exit(i32 %19)
unreachable
21: ; preds = %10
%22 = load i32, i32* @init.width
%23 = load i32, i32* @init.height
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %22, i32 %23)
br label %25
25: ; preds = %21
%26 = load i32, i32* @init.components
%27 = icmp ne i32 %26, 2
br i1 %27, label %28, label %35
28: ; preds = %25
%29 = load i32, i32* @init.components
%30 = icmp ne i32 %29, 4
br i1 %30, label %31, label %35
31: ; preds = %28
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%33 = load i32, i32* @EXIT_FAILURE
%34 = call i32 @exit(i32 %33)
unreachable
35: ; preds = %28, %25
br label %155
36: ; preds = %1
store i32 4, i32* @init.components
store i32 512, i32* @init.height
store i32 512, i32* @init.width
%37 = load i32, i32* @init.width
%38 = load i32, i32* @init.height
%39 = mul nsw i32 %37, %38
%40 = sext i32 %39 to i64
%41 = mul i64 %40, 4
%42 = trunc i64 %41 to i32
%43 = call i64 @malloc(i32 %42)
%44 = inttoptr i64 %43 to i32*
store i32* %44, i32** @init.image
%45 = load i32*, i32** @init.image
%46 = bitcast i32* %45 to i8*
store i8* %46, i8** %5
store i32 0, i32* %4
br label %47
47: ; preds = %151, %36
%48 = load i32, i32* %4
%49 = load i32, i32* @init.height
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %154
51: ; preds = %47
store i32 0, i32* %3
br label %52
52: ; preds = %147, %51
%53 = load i32, i32* %3
%54 = load i32, i32* @init.width
%55 = icmp slt i32 %53, %54
br i1 %55, label %56, label %150
56: ; preds = %52
%57 = load i32, i32* @init.width
%58 = sdiv i32 %57, 2
store i32 %58, i32* %6
%59 = load i32, i32* @init.height
%60 = sdiv i32 %59, 2
store i32 %60, i32* %7
%61 = load i32, i32* %3
%62 = and i32 %61, 32
%63 = icmp ne i32 %62, 0
br i1 %63, label %64, label %75
64: ; preds = %56
%65 = load i8*, i8** %5
%66 = load i32, i32* %3
%67 = load i32, i32* %4
%68 = load i32, i32* @init.width
%69 = mul nsw i32 %67, %68
%70 = add nsw i32 %66, %69
%71 = mul nsw i32 4, %70
%72 = add nsw i32 %71, 0
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i8, i8* %65, i64 %73
store i8 -1, i8* %74
br label %86
75: ; preds = %56
%76 = load i8*, i8** %5
%77 = load i32, i32* %3
%78 = load i32, i32* %4
%79 = load i32, i32* @init.width
%80 = mul nsw i32 %78, %79
%81 = add nsw i32 %77, %80
%82 = mul nsw i32 4, %81
%83 = add nsw i32 %82, 1
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds i8, i8* %76, i64 %84
store i8 -1, i8* %85
br label %86
86: ; preds = %75, %64
%87 = load i32, i32* %4
%88 = and i32 %87, 32
%89 = icmp ne i32 %88, 0
br i1 %89, label %90, label %101
90: ; preds = %86
%91 = load i8*, i8** %5
%92 = load i32, i32* %3
%93 = load i32, i32* %4
%94 = load i32, i32* @init.width
%95 = mul nsw i32 %93, %94
%96 = add nsw i32 %92, %95
%97 = mul nsw i32 4, %96
%98 = add nsw i32 %97, 2
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds i8, i8* %91, i64 %99
store i8 -1, i8* %100
br label %101
101: ; preds = %90, %86
%102 = load i32, i32* %3
%103 = load i32, i32* %6
%104 = sub nsw i32 %102, %103
%105 = load i32, i32* %3
%106 = load i32, i32* %6
%107 = sub nsw i32 %105, %106
%108 = mul nsw i32 %104, %107
%109 = load i32, i32* %4
%110 = load i32, i32* %7
%111 = sub nsw i32 %109, %110
%112 = load i32, i32* %4
%113 = load i32, i32* %7
%114 = sub nsw i32 %112, %113
%115 = mul nsw i32 %111, %114
%116 = add nsw i32 %108, %115
%117 = icmp sgt i32 %116, 4096
br i1 %117, label %118, label %146
118: ; preds = %101
%119 = load i32, i32* %3
%120 = load i32, i32* %6
%121 = sub nsw i32 %119, %120
%122 = load i32, i32* %3
%123 = load i32, i32* %6
%124 = sub nsw i32 %122, %123
%125 = mul nsw i32 %121, %124
%126 = load i32, i32* %4
%127 = load i32, i32* %7
%128 = sub nsw i32 %126, %127
%129 = load i32, i32* %4
%130 = load i32, i32* %7
%131 = sub nsw i32 %129, %130
%132 = mul nsw i32 %128, %131
%133 = add nsw i32 %125, %132
%134 = icmp slt i32 %133, 90000
br i1 %134, label %135, label %146
135: ; preds = %118
%136 = load i8*, i8** %5
%137 = load i32, i32* %3
%138 = load i32, i32* %4
%139 = load i32, i32* @init.width
%140 = mul nsw i32 %138, %139
%141 = add nsw i32 %137, %140
%142 = mul nsw i32 4, %141
%143 = add nsw i32 %142, 3
%144 = sext i32 %143 to i64
%145 = getelementptr inbounds i8, i8* %136, i64 %144
store i8 -1, i8* %145
br label %146
146: ; preds = %135, %118, %101
br label %147
147: ; preds = %146
%148 = load i32, i32* %3
%149 = add nsw i32 %148, 1
store i32 %149, i32* %3
br label %52
150: ; preds = %52
br label %151
151: ; preds = %150
%152 = load i32, i32* %4
%153 = add nsw i32 %152, 1
store i32 %153, i32* %4
br label %47
154: ; preds = %47
br label %155
155: ; preds = %154, %35
%156 = load i32, i32* @GL_UNPACK_ALIGNMENT
%157 = call i32 @glPixelStorei(i32 %156, i32 1)
%158 = load i32, i32* @GL_TEXTURE_ENV
%159 = load i32, i32* @GL_TEXTURE_ENV_MODE
%160 = load i32, i32* @GL_MODULATE
%161 = call i32 @glTexEnvf(i32 %158, i32 %159, i32 %160)
%162 = load i32, i32* @GL_TEXTURE_2D
%163 = load i32, i32* @GL_TEXTURE_MIN_FILTER
%164 = load i32, i32* @GL_LINEAR
%165 = call i32 @glTexParameteri(i32 %162, i32 %163, i32 %164)
%166 = load i32, i32* @GL_TEXTURE_2D
%167 = load i32, i32* @GL_TEXTURE_MAG_FILTER
%168 = load i32, i32* @GL_LINEAR
%169 = call i32 @glTexParameteri(i32 %166, i32 %167, i32 %168)
%170 = load i32, i32* @GL_TEXTURE_2D
%171 = load i32, i32* @init.components
%172 = load i32, i32* @init.width
%173 = load i32, i32* @init.height
%174 = load i32, i32* @GL_RGBA
%175 = load i32, i32* @GL_UNSIGNED_BYTE
%176 = load i32*, i32** @init.image
%177 = call i32 @glTexImage2D(i32 %170, i32 0, i32 %171, i32 %172, i32 %173, i32 0, i32 %174, i32 %175, i32* %176)
%178 = load i32, i32* @GL_TEXTURE_2D
%179 = call i32 @glEnable(i32 %178)
%180 = load i32, i32* @GL_PROJECTION
%181 = call i32 @glMatrixMode(i32 %180)
%182 = call i32 (...) @glLoadIdentity()
%183 = call i32 @gluPerspective(i32 50, i32 1, double 1.000000e-01, i32 20)
%184 = load i32, i32* @GL_MODELVIEW
%185 = call i32 @glMatrixMode(i32 %184)
%186 = call i32 (...) @glLoadIdentity()
%187 = call i32 @glTranslatef(i32 0, i32 0, double -5.500000e+00)
%188 = call i32 @glClearColor(float 2.500000e-01, float 2.500000e-01, float 7.500000e-01, float 2.500000e-01)
%189 = load i32, i32* @GL_GREATER
%190 = call i32 @glAlphaFunc(i32 %189, double 1.600000e-02)
%191 = load i32, i32* @GL_ALPHA_TEST
%192 = call i32 @glEnable(i32 %191)
%193 = load i32, i32* @GL_BLEND
%194 = call i32 @glEnable(i32 %193)
%195 = load i32, i32* @GL_SRC_ALPHA
%196 = load i32, i32* @GL_ONE_MINUS_SRC_ALPHA
%197 = call i32 @glBlendFunc(i32 %195, i32 %196)
%198 = load i32, i32* @GL_DEPTH_TEST
%199 = call i32 @glEnable(i32 %198)
%200 = load i32, i32* @GL_LIGHT0
%201 = call i32 @glEnable(i32 %200)
%202 = load i32, i32* @GL_NORMALIZE
%203 = call i32 @glEnable(i32 %202)
ret void
}

LLVM IR (-O2):
@init.image = internal unnamed_addr global i32* null
@init.width = internal global i32 0
@init.height = internal global i32 0
@init.components = internal global i32 0
@stderr = global i32 0
@.str = [36 x i8] c"Error: Can't load image file \22%s\22.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [22 x i8] c"%d x %d image loaded\0A\00"
@GL_UNPACK_ALIGNMENT = global i32 0
@GL_TEXTURE_ENV = global i32 0
@GL_TEXTURE_ENV_MODE = global i32 0
@GL_MODULATE = global i32 0
@GL_TEXTURE_2D = global i32 0
@GL_TEXTURE_MIN_FILTER = global i32 0
@GL_LINEAR = global i32 0
@GL_TEXTURE_MAG_FILTER = global i32 0
@GL_RGBA = global i32 0
@GL_UNSIGNED_BYTE = global i32 0
@GL_PROJECTION = global i32 0
@GL_MODELVIEW = global i32 0
@GL_GREATER = global i32 0
@GL_ALPHA_TEST = global i32 0
@GL_BLEND = global i32 0
@GL_SRC_ALPHA = global i32 0
@GL_ONE_MINUS_SRC_ALPHA = global i32 0
@GL_DEPTH_TEST = global i32 0
@GL_LIGHT0 = global i32 0
@GL_NORMALIZE = global i32 0
@str = [28 x i8] c"must be an RGBA or LA image\00"
define void @init(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %20, label %3
3: ; preds = %1
%4 = tail call i32* @read_texture(i8* %0, i32* @init.width, i32* @init.height, i32* @init.components)
store i32* %4, i32** @init.image
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %0)
%9 = load i32, i32* @EXIT_FAILURE
%10 = tail call i32 @exit(i32 %9)
unreachable
11: ; preds = %3
%12 = load i32, i32* @init.width
%13 = load i32, i32* @init.height
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 %13)
%15 = load i32, i32* @init.components
switch i32 %15, label %16 [
i32 4, label %85
i32 2, label %85
]
16: ; preds = %11
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%18 = load i32, i32* @EXIT_FAILURE
%19 = tail call i32 @exit(i32 %18)
unreachable
20: ; preds = %1
store i32 4, i32* @init.components
store i32 512, i32* @init.height
store i32 512, i32* @init.width
%21 = tail call i64 @malloc(i32 1048576)
%22 = inttoptr i64 %21 to i32*
store i32* %22, i32** @init.image
%23 = inttoptr i64 %21 to i8*
%24 = load i32, i32* @init.height
%25 = icmp sgt i32 %24, 0
br i1 %25, label %26, label %85
26: ; preds = %20
%27 = load i32, i32* @init.width
br label %28
28: ; preds = %26, %80
%29 = phi i32 [ %81, %80 ], [ %24, %26 ]
%30 = phi i32 [ %82, %80 ], [ %27, %26 ]
%31 = phi i32 [ %83, %80 ], [ 0, %26 ]
%32 = icmp sgt i32 %30, 0
br i1 %32, label %33, label %80
33: ; preds = %28
%34 = and i32 %31, 32
%35 = icmp eq i32 %34, 0
br label %36
36: ; preds = %75, %33
%37 = phi i32 [ %29, %33 ], [ %79, %75 ]
%38 = phi i32 [ %30, %33 ], [ %77, %75 ]
%39 = phi i32 [ 0, %33 ], [ %76, %75 ]
%40 = sdiv i32 %38, -2
%41 = sdiv i32 %37, -2
%42 = mul nsw i32 %38, %31
%43 = add nsw i32 %42, %39
%44 = shl nsw i32 %43, 2
%45 = lshr i32 %39, 5
%46 = and i32 %45, 1
%47 = or i32 %46, %44
%48 = xor i32 %47, 1
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8, i8* %23, i64 %49
store i8 -1, i8* %50
br i1 %35, label %59, label %51
51: ; preds = %36
%52 = load i32, i32* @init.width
%53 = mul nsw i32 %52, %31
%54 = add nsw i32 %53, %39
%55 = shl nsw i32 %54, 2
%56 = or i32 %55, 2
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i8, i8* %23, i64 %57
store i8 -1, i8* %58
br label %59
59: ; preds = %51, %36
%60 = add i32 %40, %39
%61 = mul nsw i32 %60, %60
%62 = add i32 %41, %31
%63 = mul nsw i32 %62, %62
%64 = add nsw i32 %61, -4097
%65 = add i32 %64, %63
%66 = icmp ult i32 %65, 85903
br i1 %66, label %67, label %75
67: ; preds = %59
%68 = load i32, i32* @init.width
%69 = mul nsw i32 %68, %31
%70 = add nsw i32 %69, %39
%71 = shl nsw i32 %70, 2
%72 = or i32 %71, 3
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i8, i8* %23, i64 %73
store i8 -1, i8* %74
br label %75
75: ; preds = %67, %59
%76 = add nuw nsw i32 %39, 1
%77 = load i32, i32* @init.width
%78 = icmp slt i32 %76, %77
%79 = load i32, i32* @init.height
br i1 %78, label %36, label %80
80: ; preds = %75, %28
%81 = phi i32 [ %29, %28 ], [ %79, %75 ]
%82 = phi i32 [ %30, %28 ], [ %77, %75 ]
%83 = add nuw nsw i32 %31, 1
%84 = icmp slt i32 %83, %81
br i1 %84, label %28, label %85
85: ; preds = %80, %20, %11, %11
%86 = load i32, i32* @GL_UNPACK_ALIGNMENT
%87 = tail call i32 @glPixelStorei(i32 %86, i32 1)
%88 = load i32, i32* @GL_TEXTURE_ENV
%89 = load i32, i32* @GL_TEXTURE_ENV_MODE
%90 = load i32, i32* @GL_MODULATE
%91 = tail call i32 @glTexEnvf(i32 %88, i32 %89, i32 %90)
%92 = load i32, i32* @GL_TEXTURE_2D
%93 = load i32, i32* @GL_TEXTURE_MIN_FILTER
%94 = load i32, i32* @GL_LINEAR
%95 = tail call i32 @glTexParameteri(i32 %92, i32 %93, i32 %94)
%96 = load i32, i32* @GL_TEXTURE_2D
%97 = load i32, i32* @GL_TEXTURE_MAG_FILTER
%98 = load i32, i32* @GL_LINEAR
%99 = tail call i32 @glTexParameteri(i32 %96, i32 %97, i32 %98)
%100 = load i32, i32* @GL_TEXTURE_2D
%101 = load i32, i32* @init.components
%102 = load i32, i32* @init.width
%103 = load i32, i32* @init.height
%104 = load i32, i32* @GL_RGBA
%105 = load i32, i32* @GL_UNSIGNED_BYTE
%106 = load i32*, i32** @init.image
%107 = tail call i32 @glTexImage2D(i32 %100, i32 0, i32 %101, i32 %102, i32 %103, i32 0, i32 %104, i32 %105, i32* %106)
%108 = load i32, i32* @GL_TEXTURE_2D
%109 = tail call i32 @glEnable(i32 %108)
%110 = load i32, i32* @GL_PROJECTION
%111 = tail call i32 @glMatrixMode(i32 %110)
%112 = tail call i32 (...) @glLoadIdentity()
%113 = tail call i32 @gluPerspective(i32 50, i32 1, double 1.000000e-01, i32 20)
%114 = load i32, i32* @GL_MODELVIEW
%115 = tail call i32 @glMatrixMode(i32 %114)
%116 = tail call i32 (...) @glLoadIdentity()
%117 = tail call i32 @glTranslatef(i32 0, i32 0, double -5.500000e+00)
%118 = tail call i32 @glClearColor(float 2.500000e-01, float 2.500000e-01, float 7.500000e-01, float 2.500000e-01)
%119 = load i32, i32* @GL_GREATER
%120 = tail call i32 @glAlphaFunc(i32 %119, double 1.600000e-02)
%121 = load i32, i32* @GL_ALPHA_TEST
%122 = tail call i32 @glEnable(i32 %121)
%123 = load i32, i32* @GL_BLEND
%124 = tail call i32 @glEnable(i32 %123)
%125 = load i32, i32* @GL_SRC_ALPHA
%126 = load i32, i32* @GL_ONE_MINUS_SRC_ALPHA
%127 = tail call i32 @glBlendFunc(i32 %125, i32 %126)
%128 = load i32, i32* @GL_DEPTH_TEST
%129 = tail call i32 @glEnable(i32 %128)
%130 = load i32, i32* @GL_LIGHT0
%131 = tail call i32 @glEnable(i32 %130)
%132 = load i32, i32* @GL_NORMALIZE
%133 = tail call i32 @glEnable(i32 %132)
ret void
}