#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 float GLfloat;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ GL_ALPHA_TEST;
int /*<<< orphan*/ GL_BLEND;
int /*<<< orphan*/ GL_DEPTH_TEST;
int /*<<< orphan*/ GL_DIFFUSE;
int /*<<< orphan*/ GL_FRONT_AND_BACK;
int /*<<< orphan*/ GL_GREATER;
int /*<<< orphan*/ GL_LIGHT0;
int /*<<< orphan*/ GL_LINEAR;
int /*<<< orphan*/ GL_MODELVIEW;
int /*<<< orphan*/ GL_ONE_MINUS_SRC_ALPHA;
int /*<<< orphan*/ GL_PROJECTION;
int /*<<< orphan*/ GL_REPEAT;
int /*<<< orphan*/ GL_RGBA;
int /*<<< orphan*/ GL_SRC_ALPHA;
int /*<<< orphan*/ GL_TEXTURE_2D;
int /*<<< orphan*/ GL_TEXTURE_MAG_FILTER;
int /*<<< orphan*/ GL_TEXTURE_MIN_FILTER;
int /*<<< orphan*/ GL_TEXTURE_WRAP_S;
int /*<<< orphan*/ GL_TEXTURE_WRAP_T;
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*/, int);
int /*<<< orphan*/ glBlendFunc(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ glClearColor(double, double, double, double);
int /*<<< orphan*/ glEnable(int /*<<< orphan*/);
int /*<<< orphan*/ glLoadIdentity();
int /*<<< orphan*/ glMaterialfv(int /*<<< orphan*/, int /*<<< orphan*/,
                                float *);
int /*<<< orphan*/ glMatrixMode(int /*<<< orphan*/);
int /*<<< orphan*/ glPixelStorei(int /*<<< orphan*/, int);
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 GLfloat plane_mat[] = {1.f, 1.f, .2f, 1.f};
  static unsigned *image;
  static int width, height, components, i;
  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);
    }
    for (i = 0; i < width * height; i++)
      image[i] = image[i] | 0xffffff00;
  } 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);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
  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, 10.);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  glTranslatef(0., 0., -5.5);
  glEnable(GL_LIGHT0);
  glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, plane_mat);
  glClearColor(0.1, 0.1, 0.6, 1.0);
  glEnable(GL_BLEND);
  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
  glEnable(GL_ALPHA_TEST);
  glAlphaFunc(GL_GREATER, 0. / 255.);
  glEnable(GL_DEPTH_TEST);
}


x86 assembly (clang, -O0):
<init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1337 <init+0x127>
mov    -0x8(%rbp),%rdi
lea    0x2e9e(%rip),%rsi
lea    0x2e9b(%rip),%rdx
lea    0x2e98(%rip),%rcx
call   10f0 <read_texture@plt>
mov    %rax,0x2e7c(%rip)
cmpq   $0x0,0x2e74(%rip)
jne    1281 <init+0x71>
mov    0x2d1f(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xdb2(%rip),%rsi
call   10c0 <fprintf@plt>
mov    0x2cf6(%rip),%rax
mov    (%rax),%edi
call   1120 <exit@plt>
mov    0x2e49(%rip),%esi
mov    0x2e47(%rip),%edx
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpl   $0x2,0x2e36(%rip)
je     12d1 <init+0xc1>
cmpl   $0x4,0x2e29(%rip)
je     12d1 <init+0xc1>
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2ca6(%rip),%rax
mov    (%rax),%edi
call   1120 <exit@plt>
movl   $0x0,0x2e01(%rip)
mov    0x2dfb(%rip),%eax
mov    0x2de9(%rip),%ecx
imul   0x2de6(%rip),%ecx
cmp    %ecx,%eax
jge    1332 <init+0x122>
mov    0x2dcb(%rip),%rax
movslq 0x2dd8(%rip),%rcx
mov    (%rax,%rcx,4),%edx
or     $0xffffff00,%edx
mov    0x2db4(%rip),%rax
movslq 0x2dc1(%rip),%rcx
mov    %edx,(%rax,%rcx,4)
mov    0x2db8(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2daf(%rip)
jmp    12db <init+0xcb>
jmp    14f3 <init+0x2e3>
movl   $0x4,0x2d97(%rip)
movl   $0x200,0x2d89(%rip)
movl   $0x200,0x2d7b(%rip)
mov    0x2d75(%rip),%eax
imul   0x2d72(%rip),%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   10e0 <malloc@plt>
mov    %rax,0x2d52(%rip)
mov    0x2d4b(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    0x2d43(%rip),%eax
jge    14ee <init+0x2de>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    0x2d29(%rip),%eax
jge    14db <init+0x2cb>
mov    0x2d1d(%rip),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    0x2d10(%rip),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     1403 <init+0x1f3>
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%edx
imul   0x2ce1(%rip),%edx
add    %edx,%ecx
shl    $0x2,%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movb   $0xff,(%rax,%rcx,1)
jmp    1423 <init+0x213>
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%edx
imul   0x2cbc(%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     1452 <init+0x242>
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%edx
imul   0x2c8d(%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    14c8 <init+0x2b8>
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    14c8 <init+0x2b8>
mov    -0x18(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%edx
imul   0x2c17(%rip),%edx
add    %edx,%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movb   $0xff,(%rax,%rcx,1)
jmp    14cd <init+0x2bd>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    139e <init+0x18e>
jmp    14e0 <init+0x2d0>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1388 <init+0x178>
jmp    14f3 <init+0x2e3>
mov    0x2abe(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
call   1090 <glPixelStorei@plt>
mov    0x2a7b(%rip),%rax
mov    (%rax),%edi
mov    0x2aca(%rip),%rax
mov    (%rax),%esi
mov    0x2aa1(%rip),%rax
mov    (%rax),%edx
call   1050 <glTexParameteri@plt>
mov    0x2a5b(%rip),%rax
mov    (%rax),%edi
mov    0x2a02(%rip),%rax
mov    (%rax),%esi
mov    0x2a81(%rip),%rax
mov    (%rax),%edx
call   1050 <glTexParameteri@plt>
mov    0x2a3b(%rip),%rax
mov    (%rax),%edi
mov    0x2a42(%rip),%rax
mov    (%rax),%esi
mov    0x2a01(%rip),%rax
mov    (%rax),%edx
call   1050 <glTexParameteri@plt>
mov    0x2a1b(%rip),%rax
mov    (%rax),%edi
mov    0x29b2(%rip),%rax
mov    (%rax),%esi
mov    0x29e1(%rip),%rax
mov    (%rax),%edx
call   1050 <glTexParameteri@plt>
mov    0x29fb(%rip),%rax
mov    (%rax),%edi
mov    0x2b43(%rip),%edx
mov    0x2b35(%rip),%ecx
mov    0x2b32(%rip),%r8d
mov    0x2a47(%rip),%rax
mov    (%rax),%r11d
mov    0x299d(%rip),%rax
mov    (%rax),%r10d
mov    0x2b0b(%rip),%rax
xor    %r9d,%r9d
mov    %r9d,%esi
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1070 <glTexImage2D@plt>
mov    0x29ab(%rip),%rax
mov    (%rax),%edi
call   1080 <glEnable@plt>
mov    0x298d(%rip),%rax
mov    (%rax),%edi
call   1040 <glMatrixMode@plt>
mov    $0x0,%al
call   10d0 <glLoadIdentity@plt>
mov    $0x32,%edi
mov    $0x1,%esi
movsd  0x9f5(%rip),%xmm0
mov    $0xa,%edx
call   10a0 <gluPerspective@plt>
mov    0x2984(%rip),%rax
mov    (%rax),%edi
call   1040 <glMatrixMode@plt>
mov    $0x0,%al
call   10d0 <glLoadIdentity@plt>
xor    %esi,%esi
movsd  0x9e4(%rip),%xmm0
mov    %esi,%edi
call   1110 <glTranslatef@plt>
mov    0x2966(%rip),%rax
mov    (%rax),%edi
call   1080 <glEnable@plt>
mov    0x2978(%rip),%rax
mov    (%rax),%edi
mov    0x28ef(%rip),%rax
mov    (%rax),%esi
lea    0x2a4e(%rip),%rdx
call   1130 <glMaterialfv@plt>
movsd  0x991(%rip),%xmm1
movsd  0x991(%rip),%xmm2
movsd  0x991(%rip),%xmm3
movaps %xmm1,%xmm0
call   10b0 <glClearColor@plt>
mov    0x2942(%rip),%rax
mov    (%rax),%edi
call   1080 <glEnable@plt>
mov    0x28bc(%rip),%rax
mov    (%rax),%edi
mov    0x2933(%rip),%rax
mov    (%rax),%esi
call   1030 <glBlendFunc@plt>
mov    0x28fd(%rip),%rax
mov    (%rax),%edi
call   1080 <glEnable@plt>
mov    0x28a7(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1100 <glAlphaFunc@plt>
mov    0x286f(%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     12d7 <init+0xb7>
mov    %rdi,%rbx
lea    0x2ea9(%rip),%rsi
lea    0x2ea6(%rip),%rdx
lea    0x2ea3(%rip),%rcx
call   1100 <read_texture@plt>
mov    %rax,0x2e87(%rip)
test   %rax,%rax
je     1592 <init+0x372>
mov    0x2e80(%rip),%esi
mov    0x2e7e(%rip),%edx
lea    0xdd7(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x2e6e(%rip),%eax
cmp    $0x2,%eax
je     1288 <init+0x68>
cmp    $0x4,%eax
jne    15ac <init+0x38c>
mov    0x2e56(%rip),%eax
imul   0x2e4b(%rip),%eax
test   %eax,%eax
jle    13d9 <init+0x1b9>
mov    0x2e34(%rip),%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
orl    $0xffffff00,(%rax,%rcx,4)
add    $0x1,%rcx
movslq 0x2e1e(%rip),%rdx
movslq 0x2e1b(%rip),%rsi
imul   %rdx,%rsi
cmp    %rsi,%rcx
jl     12b0 <init+0x90>
jmp    13d9 <init+0x1b9>
movl   $0x4,0x2e07(%rip)
movl   $0x200,0x2df9(%rip)
movl   $0x200,0x2deb(%rip)
mov    $0x100000,%edi
call   10f0 <malloc@plt>
mov    %rax,0x2dd2(%rip)
mov    0x2dd8(%rip),%edi
test   %edi,%edi
jle    13d9 <init+0x1b9>
xor    %r8d,%r8d
mov    0x2dc3(%rip),%ebx
jmp    132d <init+0x10d>
nop
add    $0x1,%r8d
cmp    %edi,%r8d
jge    13d9 <init+0x1b9>
test   %ebx,%ebx
jle    1320 <init+0x100>
xor    %edx,%edx
jmp    1353 <init+0x133>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%edx
mov    0x2d97(%rip),%ebx
mov    0x2d95(%rip),%edi
cmp    %ebx,%edx
jge    1320 <init+0x100>
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     13a2 <init+0x182>
mov    0x2d4f(%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     1340 <init+0x120>
mov    0x2d1d(%rip),%ecx
imul   %r8d,%ecx
add    %edx,%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
movb   $0xff,0x3(%rax,%rcx,1)
jmp    1340 <init+0x120>
mov    0x2bd8(%rip),%rax
mov    (%rax),%edi
mov    $0x1,%esi
call   10a0 <glPixelStorei@plt>
mov    0x2b95(%rip),%r14
mov    (%r14),%edi
mov    0x2be3(%rip),%rax
mov    (%rax),%esi
mov    0x2bba(%rip),%rbx
mov    (%rbx),%edx
call   1060 <glTexParameteri@plt>
mov    (%r14),%edi
mov    0x2b21(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
call   1060 <glTexParameteri@plt>
mov    (%r14),%edi
mov    0x2b6e(%rip),%rax
mov    (%rax),%esi
mov    0x2b2d(%rip),%rbx
mov    (%rbx),%edx
call   1060 <glTexParameteri@plt>
mov    (%r14),%edi
mov    0x2ae4(%rip),%rax
mov    (%rax),%esi
mov    (%rbx),%edx
call   1060 <glTexParameteri@plt>
mov    (%r14),%edi
mov    0x2c92(%rip),%edx
mov    0x2c84(%rip),%ecx
mov    0x2c81(%rip),%r8d
mov    0x2b86(%rip),%rax
mov    (%rax),%eax
mov    0x2add(%rip),%rsi
mov    (%rsi),%ebx
sub    $0x8,%rsp
xor    %esi,%esi
xor    %r9d,%r9d
push   0x2c54(%rip)
push   %rbx
push   %rax
call   1080 <glTexImage2D@plt>
add    $0x20,%rsp
mov    (%r14),%edi
call   1090 <glEnable@plt>
mov    0x2ada(%rip),%rax
mov    (%rax),%edi
call   1050 <glMatrixMode@plt>
xor    %eax,%eax
call   10e0 <glLoadIdentity@plt>
movsd  0xb4c(%rip),%xmm0
mov    $0x32,%edi
mov    $0x1,%esi
mov    $0xa,%edx
call   10b0 <gluPerspective@plt>
mov    0x2ad1(%rip),%rax
mov    (%rax),%edi
call   1050 <glMatrixMode@plt>
xor    %eax,%eax
call   10e0 <glLoadIdentity@plt>
movsd  0xb23(%rip),%xmm0
xor    %edi,%edi
xor    %esi,%esi
call   1120 <glTranslatef@plt>
mov    0x2ab3(%rip),%rax
mov    (%rax),%edi
call   1090 <glEnable@plt>
mov    0x2ac5(%rip),%rax
mov    (%rax),%edi
mov    0x2a3c(%rip),%rax
mov    (%rax),%esi
lea    0x2bab(%rip),%rdx
call   1140 <glMaterialfv@plt>
movsd  0xaee(%rip),%xmm2
movsd  0xaee(%rip),%xmm3
movsd  0xace(%rip),%xmm0
movaps %xmm0,%xmm1
call   10c0 <glClearColor@plt>
mov    0x2a8f(%rip),%rax
mov    (%rax),%edi
call   1090 <glEnable@plt>
mov    0x2a09(%rip),%rax
mov    (%rax),%edi
mov    0x2a80(%rip),%rax
mov    (%rax),%esi
call   1030 <glBlendFunc@plt>
mov    0x2a4a(%rip),%rax
mov    (%rax),%edi
call   1090 <glEnable@plt>
mov    0x29f4(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1110 <glAlphaFunc@plt>
mov    0x29bc(%rip),%rax
mov    (%rax),%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1090 <glEnable@plt>
mov    0x29e7(%rip),%rax
mov    (%rax),%edi
lea    0xa7e(%rip),%rsi
mov    %rbx,%rdx
call   10d0 <fprintf@plt>
jmp    15b8 <init+0x398>
lea    0xaa7(%rip),%rdi
call   1040 <puts@plt>
mov    0x29b1(%rip),%rax
mov    (%rax),%edi
call   1130 <exit@plt>

LLVM IR (-O0):
@init.plane_mat = internal global [4 x float] [float 1.000000e+00, float 1.000000e+00, float 0x3FC99999A0000000, float 1.000000e+00]
@init.image = internal global i32* null
@init.width = internal global i32 0
@init.height = internal global i32 0
@init.components = internal global i32 0
@init.i = 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_2D = global i32 0
@GL_TEXTURE_MIN_FILTER = global i32 0
@GL_LINEAR = global i32 0
@GL_TEXTURE_MAG_FILTER = global i32 0
@GL_TEXTURE_WRAP_S = global i32 0
@GL_REPEAT = global i32 0
@GL_TEXTURE_WRAP_T = 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_LIGHT0 = global i32 0
@GL_FRONT_AND_BACK = global i32 0
@GL_DIFFUSE = global i32 0
@GL_BLEND = global i32 0
@GL_SRC_ALPHA = global i32 0
@GL_ONE_MINUS_SRC_ALPHA = global i32 0
@GL_ALPHA_TEST = global i32 0
@GL_GREATER = global i32 0
@GL_DEPTH_TEST = 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 %57
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
store i32 0, i32* @init.i
br label %36
36: ; preds = %53, %35
%37 = load i32, i32* @init.i
%38 = load i32, i32* @init.width
%39 = load i32, i32* @init.height
%40 = mul nsw i32 %38, %39
%41 = icmp slt i32 %37, %40
br i1 %41, label %42, label %56
42: ; preds = %36
%43 = load i32*, i32** @init.image
%44 = load i32, i32* @init.i
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i32, i32* %43, i64 %45
%47 = load i32, i32* %46
%48 = or i32 %47, -256
%49 = load i32*, i32** @init.image
%50 = load i32, i32* @init.i
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i32, i32* %49, i64 %51
store i32 %48, i32* %52
br label %53
53: ; preds = %42
%54 = load i32, i32* @init.i
%55 = add nsw i32 %54, 1
store i32 %55, i32* @init.i
br label %36
56: ; preds = %36
br label %176
57: ; preds = %1
store i32 4, i32* @init.components
store i32 512, i32* @init.height
store i32 512, i32* @init.width
%58 = load i32, i32* @init.width
%59 = load i32, i32* @init.height
%60 = mul nsw i32 %58, %59
%61 = sext i32 %60 to i64
%62 = mul i64 %61, 4
%63 = trunc i64 %62 to i32
%64 = call i64 @malloc(i32 %63)
%65 = inttoptr i64 %64 to i32*
store i32* %65, i32** @init.image
%66 = load i32*, i32** @init.image
%67 = bitcast i32* %66 to i8*
store i8* %67, i8** %5
store i32 0, i32* %4
br label %68
68: ; preds = %172, %57
%69 = load i32, i32* %4
%70 = load i32, i32* @init.height
%71 = icmp slt i32 %69, %70
br i1 %71, label %72, label %175
72: ; preds = %68
store i32 0, i32* %3
br label %73
73: ; preds = %168, %72
%74 = load i32, i32* %3
%75 = load i32, i32* @init.width
%76 = icmp slt i32 %74, %75
br i1 %76, label %77, label %171
77: ; preds = %73
%78 = load i32, i32* @init.width
%79 = sdiv i32 %78, 2
store i32 %79, i32* %6
%80 = load i32, i32* @init.height
%81 = sdiv i32 %80, 2
store i32 %81, i32* %7
%82 = load i32, i32* %3
%83 = and i32 %82, 32
%84 = icmp ne i32 %83, 0
br i1 %84, label %85, label %96
85: ; preds = %77
%86 = load i8*, i8** %5
%87 = load i32, i32* %3
%88 = load i32, i32* %4
%89 = load i32, i32* @init.width
%90 = mul nsw i32 %88, %89
%91 = add nsw i32 %87, %90
%92 = mul nsw i32 4, %91
%93 = add nsw i32 %92, 0
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds i8, i8* %86, i64 %94
store i8 -1, i8* %95
br label %107
96: ; preds = %77
%97 = load i8*, i8** %5
%98 = load i32, i32* %3
%99 = load i32, i32* %4
%100 = load i32, i32* @init.width
%101 = mul nsw i32 %99, %100
%102 = add nsw i32 %98, %101
%103 = mul nsw i32 4, %102
%104 = add nsw i32 %103, 1
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds i8, i8* %97, i64 %105
store i8 -1, i8* %106
br label %107
107: ; preds = %96, %85
%108 = load i32, i32* %4
%109 = and i32 %108, 32
%110 = icmp ne i32 %109, 0
br i1 %110, label %111, label %122
111: ; preds = %107
%112 = load i8*, i8** %5
%113 = load i32, i32* %3
%114 = load i32, i32* %4
%115 = load i32, i32* @init.width
%116 = mul nsw i32 %114, %115
%117 = add nsw i32 %113, %116
%118 = mul nsw i32 4, %117
%119 = add nsw i32 %118, 2
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds i8, i8* %112, i64 %120
store i8 -1, i8* %121
br label %122
122: ; preds = %111, %107
%123 = load i32, i32* %3
%124 = load i32, i32* %6
%125 = sub nsw i32 %123, %124
%126 = load i32, i32* %3
%127 = load i32, i32* %6
%128 = sub nsw i32 %126, %127
%129 = mul nsw i32 %125, %128
%130 = load i32, i32* %4
%131 = load i32, i32* %7
%132 = sub nsw i32 %130, %131
%133 = load i32, i32* %4
%134 = load i32, i32* %7
%135 = sub nsw i32 %133, %134
%136 = mul nsw i32 %132, %135
%137 = add nsw i32 %129, %136
%138 = icmp sgt i32 %137, 4096
br i1 %138, label %139, label %167
139: ; preds = %122
%140 = load i32, i32* %3
%141 = load i32, i32* %6
%142 = sub nsw i32 %140, %141
%143 = load i32, i32* %3
%144 = load i32, i32* %6
%145 = sub nsw i32 %143, %144
%146 = mul nsw i32 %142, %145
%147 = load i32, i32* %4
%148 = load i32, i32* %7
%149 = sub nsw i32 %147, %148
%150 = load i32, i32* %4
%151 = load i32, i32* %7
%152 = sub nsw i32 %150, %151
%153 = mul nsw i32 %149, %152
%154 = add nsw i32 %146, %153
%155 = icmp slt i32 %154, 90000
br i1 %155, label %156, label %167
156: ; preds = %139
%157 = load i8*, i8** %5
%158 = load i32, i32* %3
%159 = load i32, i32* %4
%160 = load i32, i32* @init.width
%161 = mul nsw i32 %159, %160
%162 = add nsw i32 %158, %161
%163 = mul nsw i32 4, %162
%164 = add nsw i32 %163, 3
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds i8, i8* %157, i64 %165
store i8 -1, i8* %166
br label %167
167: ; preds = %156, %139, %122
br label %168
168: ; preds = %167
%169 = load i32, i32* %3
%170 = add nsw i32 %169, 1
store i32 %170, i32* %3
br label %73
171: ; preds = %73
br label %172
172: ; preds = %171
%173 = load i32, i32* %4
%174 = add nsw i32 %173, 1
store i32 %174, i32* %4
br label %68
175: ; preds = %68
br label %176
176: ; preds = %175, %56
%177 = load i32, i32* @GL_UNPACK_ALIGNMENT
%178 = call i32 @glPixelStorei(i32 %177, i32 1)
%179 = load i32, i32* @GL_TEXTURE_2D
%180 = load i32, i32* @GL_TEXTURE_MIN_FILTER
%181 = load i32, i32* @GL_LINEAR
%182 = call i32 @glTexParameteri(i32 %179, i32 %180, i32 %181)
%183 = load i32, i32* @GL_TEXTURE_2D
%184 = load i32, i32* @GL_TEXTURE_MAG_FILTER
%185 = load i32, i32* @GL_LINEAR
%186 = call i32 @glTexParameteri(i32 %183, i32 %184, i32 %185)
%187 = load i32, i32* @GL_TEXTURE_2D
%188 = load i32, i32* @GL_TEXTURE_WRAP_S
%189 = load i32, i32* @GL_REPEAT
%190 = call i32 @glTexParameteri(i32 %187, i32 %188, i32 %189)
%191 = load i32, i32* @GL_TEXTURE_2D
%192 = load i32, i32* @GL_TEXTURE_WRAP_T
%193 = load i32, i32* @GL_REPEAT
%194 = call i32 @glTexParameteri(i32 %191, i32 %192, i32 %193)
%195 = load i32, i32* @GL_TEXTURE_2D
%196 = load i32, i32* @init.components
%197 = load i32, i32* @init.width
%198 = load i32, i32* @init.height
%199 = load i32, i32* @GL_RGBA
%200 = load i32, i32* @GL_UNSIGNED_BYTE
%201 = load i32*, i32** @init.image
%202 = call i32 @glTexImage2D(i32 %195, i32 0, i32 %196, i32 %197, i32 %198, i32 0, i32 %199, i32 %200, i32* %201)
%203 = load i32, i32* @GL_TEXTURE_2D
%204 = call i32 @glEnable(i32 %203)
%205 = load i32, i32* @GL_PROJECTION
%206 = call i32 @glMatrixMode(i32 %205)
%207 = call i32 (...) @glLoadIdentity()
%208 = call i32 @gluPerspective(i32 50, i32 1, double 1.000000e-01, i32 10)
%209 = load i32, i32* @GL_MODELVIEW
%210 = call i32 @glMatrixMode(i32 %209)
%211 = call i32 (...) @glLoadIdentity()
%212 = call i32 @glTranslatef(i32 0, i32 0, double -5.500000e+00)
%213 = load i32, i32* @GL_LIGHT0
%214 = call i32 @glEnable(i32 %213)
%215 = load i32, i32* @GL_FRONT_AND_BACK
%216 = load i32, i32* @GL_DIFFUSE
%217 = call i32 @glMaterialfv(i32 %215, i32 %216, float* getelementptr inbounds ([4 x float], [4 x float]* @init.plane_mat, i64 0, i64 0))
%218 = call i32 @glClearColor(double 1.000000e-01, double 1.000000e-01, double 6.000000e-01, double 1.000000e+00)
%219 = load i32, i32* @GL_BLEND
%220 = call i32 @glEnable(i32 %219)
%221 = load i32, i32* @GL_SRC_ALPHA
%222 = load i32, i32* @GL_ONE_MINUS_SRC_ALPHA
%223 = call i32 @glBlendFunc(i32 %221, i32 %222)
%224 = load i32, i32* @GL_ALPHA_TEST
%225 = call i32 @glEnable(i32 %224)
%226 = load i32, i32* @GL_GREATER
%227 = call i32 @glAlphaFunc(i32 %226, i32 0)
%228 = load i32, i32* @GL_DEPTH_TEST
%229 = call i32 @glEnable(i32 %228)
ret void
}

LLVM IR (-O2):
@init.plane_mat = internal global [4 x float] [float 1.000000e+00, float 1.000000e+00, float 0x3FC99999A0000000, float 1.000000e+00]
@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_2D = global i32 0
@GL_TEXTURE_MIN_FILTER = global i32 0
@GL_LINEAR = global i32 0
@GL_TEXTURE_MAG_FILTER = global i32 0
@GL_TEXTURE_WRAP_S = global i32 0
@GL_REPEAT = global i32 0
@GL_TEXTURE_WRAP_T = 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_LIGHT0 = global i32 0
@GL_FRONT_AND_BACK = global i32 0
@GL_DIFFUSE = global i32 0
@GL_BLEND = global i32 0
@GL_SRC_ALPHA = global i32 0
@GL_ONE_MINUS_SRC_ALPHA = global i32 0
@GL_ALPHA_TEST = global i32 0
@GL_GREATER = global i32 0
@GL_DEPTH_TEST = 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 %38, 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 %20
i32 2, label %20
]
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 = %11, %11
%21 = load i32, i32* @init.width
%22 = load i32, i32* @init.height
%23 = mul nsw i32 %22, %21
%24 = icmp sgt i32 %23, 0
br i1 %24, label %25, label %103
25: ; preds = %20
%26 = load i32*, i32** @init.image
br label %27
27: ; preds = %25, %27
%28 = phi i64 [ 0, %25 ], [ %32, %27 ]
%29 = getelementptr inbounds i32, i32* %26, i64 %28
%30 = load i32, i32* %29
%31 = or i32 %30, -256
store i32 %31, i32* %29
%32 = add nuw nsw i64 %28, 1
%33 = load i32, i32* @init.width
%34 = load i32, i32* @init.height
%35 = mul nsw i32 %34, %33
%36 = sext i32 %35 to i64
%37 = icmp slt i64 %32, %36
br i1 %37, label %27, label %103
38: ; preds = %1
store i32 4, i32* @init.components
store i32 512, i32* @init.height
store i32 512, i32* @init.width
%39 = tail call i64 @malloc(i32 1048576)
%40 = inttoptr i64 %39 to i32*
store i32* %40, i32** @init.image
%41 = inttoptr i64 %39 to i8*
%42 = load i32, i32* @init.height
%43 = icmp sgt i32 %42, 0
br i1 %43, label %44, label %103
44: ; preds = %38
%45 = load i32, i32* @init.width
br label %46
46: ; preds = %44, %98
%47 = phi i32 [ %99, %98 ], [ %42, %44 ]
%48 = phi i32 [ %100, %98 ], [ %45, %44 ]
%49 = phi i32 [ %101, %98 ], [ 0, %44 ]
%50 = icmp sgt i32 %48, 0
br i1 %50, label %51, label %98
51: ; preds = %46
%52 = and i32 %49, 32
%53 = icmp eq i32 %52, 0
br label %54
54: ; preds = %93, %51
%55 = phi i32 [ %47, %51 ], [ %97, %93 ]
%56 = phi i32 [ %48, %51 ], [ %95, %93 ]
%57 = phi i32 [ 0, %51 ], [ %94, %93 ]
%58 = sdiv i32 %56, -2
%59 = sdiv i32 %55, -2
%60 = mul nsw i32 %56, %49
%61 = add nsw i32 %60, %57
%62 = shl nsw i32 %61, 2
%63 = lshr i32 %57, 5
%64 = and i32 %63, 1
%65 = or i32 %64, %62
%66 = xor i32 %65, 1
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8, i8* %41, i64 %67
store i8 -1, i8* %68
br i1 %53, label %77, label %69
69: ; preds = %54
%70 = load i32, i32* @init.width
%71 = mul nsw i32 %70, %49
%72 = add nsw i32 %71, %57
%73 = shl nsw i32 %72, 2
%74 = or i32 %73, 2
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i8, i8* %41, i64 %75
store i8 -1, i8* %76
br label %77
77: ; preds = %69, %54
%78 = add i32 %58, %57
%79 = mul nsw i32 %78, %78
%80 = add i32 %59, %49
%81 = mul nsw i32 %80, %80
%82 = add nsw i32 %79, -4097
%83 = add i32 %82, %81
%84 = icmp ult i32 %83, 85903
br i1 %84, label %85, label %93
85: ; preds = %77
%86 = load i32, i32* @init.width
%87 = mul nsw i32 %86, %49
%88 = add nsw i32 %87, %57
%89 = shl nsw i32 %88, 2
%90 = or i32 %89, 3
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds i8, i8* %41, i64 %91
store i8 -1, i8* %92
br label %93
93: ; preds = %85, %77
%94 = add nuw nsw i32 %57, 1
%95 = load i32, i32* @init.width
%96 = icmp slt i32 %94, %95
%97 = load i32, i32* @init.height
br i1 %96, label %54, label %98
98: ; preds = %93, %46
%99 = phi i32 [ %47, %46 ], [ %97, %93 ]
%100 = phi i32 [ %48, %46 ], [ %95, %93 ]
%101 = add nuw nsw i32 %49, 1
%102 = icmp slt i32 %101, %99
br i1 %102, label %46, label %103
103: ; preds = %27, %98, %20, %38
%104 = load i32, i32* @GL_UNPACK_ALIGNMENT
%105 = tail call i32 @glPixelStorei(i32 %104, i32 1)
%106 = load i32, i32* @GL_TEXTURE_2D
%107 = load i32, i32* @GL_TEXTURE_MIN_FILTER
%108 = load i32, i32* @GL_LINEAR
%109 = tail call i32 @glTexParameteri(i32 %106, i32 %107, i32 %108)
%110 = load i32, i32* @GL_TEXTURE_2D
%111 = load i32, i32* @GL_TEXTURE_MAG_FILTER
%112 = load i32, i32* @GL_LINEAR
%113 = tail call i32 @glTexParameteri(i32 %110, i32 %111, i32 %112)
%114 = load i32, i32* @GL_TEXTURE_2D
%115 = load i32, i32* @GL_TEXTURE_WRAP_S
%116 = load i32, i32* @GL_REPEAT
%117 = tail call i32 @glTexParameteri(i32 %114, i32 %115, i32 %116)
%118 = load i32, i32* @GL_TEXTURE_2D
%119 = load i32, i32* @GL_TEXTURE_WRAP_T
%120 = load i32, i32* @GL_REPEAT
%121 = tail call i32 @glTexParameteri(i32 %118, i32 %119, i32 %120)
%122 = load i32, i32* @GL_TEXTURE_2D
%123 = load i32, i32* @init.components
%124 = load i32, i32* @init.width
%125 = load i32, i32* @init.height
%126 = load i32, i32* @GL_RGBA
%127 = load i32, i32* @GL_UNSIGNED_BYTE
%128 = load i32*, i32** @init.image
%129 = tail call i32 @glTexImage2D(i32 %122, i32 0, i32 %123, i32 %124, i32 %125, i32 0, i32 %126, i32 %127, i32* %128)
%130 = load i32, i32* @GL_TEXTURE_2D
%131 = tail call i32 @glEnable(i32 %130)
%132 = load i32, i32* @GL_PROJECTION
%133 = tail call i32 @glMatrixMode(i32 %132)
%134 = tail call i32 (...) @glLoadIdentity()
%135 = tail call i32 @gluPerspective(i32 50, i32 1, double 1.000000e-01, i32 10)
%136 = load i32, i32* @GL_MODELVIEW
%137 = tail call i32 @glMatrixMode(i32 %136)
%138 = tail call i32 (...) @glLoadIdentity()
%139 = tail call i32 @glTranslatef(i32 0, i32 0, double -5.500000e+00)
%140 = load i32, i32* @GL_LIGHT0
%141 = tail call i32 @glEnable(i32 %140)
%142 = load i32, i32* @GL_FRONT_AND_BACK
%143 = load i32, i32* @GL_DIFFUSE
%144 = tail call i32 @glMaterialfv(i32 %142, i32 %143, float* getelementptr inbounds ([4 x float], [4 x float]* @init.plane_mat, i64 0, i64 0))
%145 = tail call i32 @glClearColor(double 1.000000e-01, double 1.000000e-01, double 6.000000e-01, double 1.000000e+00)
%146 = load i32, i32* @GL_BLEND
%147 = tail call i32 @glEnable(i32 %146)
%148 = load i32, i32* @GL_SRC_ALPHA
%149 = load i32, i32* @GL_ONE_MINUS_SRC_ALPHA
%150 = tail call i32 @glBlendFunc(i32 %148, i32 %149)
%151 = load i32, i32* @GL_ALPHA_TEST
%152 = tail call i32 @glEnable(i32 %151)
%153 = load i32, i32* @GL_GREATER
%154 = tail call i32 @glAlphaFunc(i32 %153, i32 0)
%155 = load i32, i32* @GL_DEPTH_TEST
%156 = tail call i32 @glEnable(i32 %155)
ret void
}