#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 uint8_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
scalar_t__ compare_tile(int *, int *, int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fread(int *, int, size_t, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
size_t ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite(int *, int, int, int /*<<< orphan*/ *);
int *malloc(int);
int /*<<< orphan*/ printf(char *, int, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  FILE *flevel, *ftilemap, *foutput;
  size_t tilemap_size, level_size;
  uint8_t *tilemap, *level, *output;
  int x, y, t;
  char output_name[256];
  if (argc < 2) {
    fprintf(stderr, "error: must supply tilemap...\n");
    exit(1);
  }
  ftilemap = fopen(argv[1], "rb");
  fseek(ftilemap, 0, SEEK_END);
  tilemap_size = ftell(ftilemap);
  fseek(ftilemap, 0, SEEK_SET);
  tilemap = malloc(tilemap_size);
  fread(tilemap, 1, tilemap_size, ftilemap);
  fclose(ftilemap);
  if (tilemap_size < 4 * 8 * 93) {
  }
  flevel = fopen(argv[2], "rb");
  fseek(flevel, 0, SEEK_END);
  level_size = ftell(flevel);
  fseek(flevel, 0, SEEK_SET);
  level = malloc(level_size);
  fread(level, 1, level_size, flevel);
  fclose(flevel);
  if (level_size < 32 * 32 * 4 * 8) {
    fprintf(stderr, "error: level not big enough...\n");
    exit(1);
  }
  sprintf(output_name, "%s.map", argv[2]);
  foutput = fopen(output_name, "wb");
  output = malloc(32 * 32);
  for (y = 0; y < 32; ++y) {
    for (x = 0; x < 32; ++x) {
      for (t = 0; t < 93; ++t) {
        if (compare_tile(tilemap + t * 4 * 8, level, x, y)) {
          int solid = (t == 1 || t == 2 || t == 3 || t == 4 || t == 5 ||
                       t == 6 || t == 7 || t == 8 || t == 12 || t == 14 ||
                       t == 15 || t == 16 || t == 17 || t == 35 || t == 36)
                      << 6;
          int end = (t == 31 || t == 32 || t == 33 || t == 34) << 7;
          output[y * 32 + x] = end | solid | t;
          break;
        }
      }
      if (t == 93) {
        fprintf(stderr, "error: no matching tile found at (%d,%d)\n", x, y);
        return 1;
      }
    }
  }
  fwrite(output, 32 * 32, 1, foutput);
  fclose(foutput);
  printf("wrote %d bytes to %s\n", 32 * 32, output_name);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1204 <main+0x44>
mov    0x2dee(%rip),%rax
mov    (%rax),%edi
lea    0xe0d(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe0c(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    0x2dc1(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    -0x20(%rbp),%rdi
call   1080 <ftell@plt>
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    0x2d88(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    -0x30(%rbp),%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
mov    -0x20(%rbp),%rdi
call   1050 <fclose@plt>
cmpq   $0xba0,-0x30(%rbp)
jae    1292 <main+0xd2>
jmp    1292 <main+0xd2>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xd7e(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2d33(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    -0x18(%rbp),%rdi
call   1080 <ftell@plt>
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
mov    0x2cfa(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    -0x38(%rbp),%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
mov    -0x38(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
cmpq   $0x8000,-0x38(%rbp)
jae    133c <main+0x17c>
mov    0x2cb6(%rip),%rax
mov    (%rax),%edi
lea    0xcf7(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>
lea    -0x160(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xcf0(%rip),%rsi
call   10c0 <sprintf@plt>
lea    -0x160(%rbp),%rdi
lea    0xce4(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    $0x400,%edi
call   1090 <malloc@plt>
mov    %rax,-0x50(%rbp)
movl   $0x0,-0x58(%rbp)
cmpl   $0x20,-0x58(%rbp)
jge    15e5 <main+0x425>
movl   $0x0,-0x54(%rbp)
cmpl   $0x20,-0x54(%rbp)
jge    15d2 <main+0x412>
movl   $0x0,-0x5c(%rbp)
cmpl   $0x5d,-0x5c(%rbp)
jge    158c <main+0x3cc>
mov    -0x40(%rbp),%rdi
mov    -0x5c(%rbp),%eax
shl    $0x2,%eax
shl    $0x3,%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x48(%rbp),%rsi
mov    -0x54(%rbp),%edx
mov    -0x58(%rbp),%ecx
call   1030 <compare_tile@plt>
cmp    $0x0,%rax
je     1579 <main+0x3b9>
mov    $0x1,%al
cmpl   $0x1,-0x5c(%rbp)
mov    %al,-0x169(%rbp)
je     14e7 <main+0x327>
mov    $0x1,%al
cmpl   $0x2,-0x5c(%rbp)
mov    %al,-0x169(%rbp)
je     14e7 <main+0x327>
mov    $0x1,%al
cmpl   $0x3,-0x5c(%rbp)
mov    %al,-0x169(%rbp)
je     14e7 <main+0x327>
mov    $0x1,%al
cmpl   $0x4,-0x5c(%rbp)
mov    %al,-0x169(%rbp)
je     14e7 <main+0x327>
mov    $0x1,%al
cmpl   $0x5,-0x5c(%rbp)
mov    %al,-0x169(%rbp)
je     14e7 <main+0x327>
mov    $0x1,%al
cmpl   $0x6,-0x5c(%rbp)
mov    %al,-0x169(%rbp)
je     14e7 <main+0x327>
mov    $0x1,%al
cmpl   $0x7,-0x5c(%rbp)
mov    %al,-0x169(%rbp)
je     14e7 <main+0x327>
mov    $0x1,%al
cmpl   $0x8,-0x5c(%rbp)
mov    %al,-0x169(%rbp)
je     14e7 <main+0x327>
mov    $0x1,%al
cmpl   $0xc,-0x5c(%rbp)
mov    %al,-0x169(%rbp)
je     14e7 <main+0x327>
mov    $0x1,%al
cmpl   $0xe,-0x5c(%rbp)
mov    %al,-0x169(%rbp)
je     14e7 <main+0x327>
mov    $0x1,%al
cmpl   $0xf,-0x5c(%rbp)
mov    %al,-0x169(%rbp)
je     14e7 <main+0x327>
mov    $0x1,%al
cmpl   $0x10,-0x5c(%rbp)
mov    %al,-0x169(%rbp)
je     14e7 <main+0x327>
mov    $0x1,%al
cmpl   $0x11,-0x5c(%rbp)
mov    %al,-0x169(%rbp)
je     14e7 <main+0x327>
mov    $0x1,%al
cmpl   $0x23,-0x5c(%rbp)
mov    %al,-0x169(%rbp)
je     14e7 <main+0x327>
cmpl   $0x24,-0x5c(%rbp)
sete   %al
mov    %al,-0x169(%rbp)
mov    -0x169(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
shl    $0x6,%eax
mov    %eax,-0x164(%rbp)
mov    $0x1,%al
cmpl   $0x1f,-0x5c(%rbp)
mov    %al,-0x16a(%rbp)
je     153e <main+0x37e>
mov    $0x1,%al
cmpl   $0x20,-0x5c(%rbp)
mov    %al,-0x16a(%rbp)
je     153e <main+0x37e>
mov    $0x1,%al
cmpl   $0x21,-0x5c(%rbp)
mov    %al,-0x16a(%rbp)
je     153e <main+0x37e>
cmpl   $0x22,-0x5c(%rbp)
sete   %al
mov    %al,-0x16a(%rbp)
mov    -0x16a(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
shl    $0x7,%eax
mov    %eax,-0x168(%rbp)
mov    -0x168(%rbp),%edx
or     -0x164(%rbp),%edx
or     -0x5c(%rbp),%edx
mov    -0x50(%rbp),%rax
mov    -0x58(%rbp),%ecx
shl    $0x5,%ecx
add    -0x54(%rbp),%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
jmp    158c <main+0x3cc>
jmp    157e <main+0x3be>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    13a5 <main+0x1e5>
cmpl   $0x5d,-0x5c(%rbp)
jne    15bf <main+0x3ff>
mov    0x2a3b(%rip),%rax
mov    (%rax),%edi
mov    -0x54(%rbp),%edx
mov    -0x58(%rbp),%ecx
lea    0xaa0(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1624 <main+0x464>
jmp    15c4 <main+0x404>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1394 <main+0x1d4>
jmp    15d7 <main+0x417>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1383 <main+0x1c3>
mov    -0x50(%rbp),%rdi
mov    -0x28(%rbp),%rcx
mov    $0x400,%esi
mov    $0x1,%edx
call   10e0 <fwrite@plt>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
lea    -0x160(%rbp),%rdx
lea    0xa63(%rip),%rdi
mov    $0x400,%esi
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x128,%rsp
cmp    $0x1,%edi
jle    1449 <main+0x289>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
lea    0xe37(%rip),%r15
mov    %r15,%rsi
call   10b0 <fopen@plt>
mov    %rax,%rbp
mov    0x2dee(%rip),%r12
mov    (%r12),%edx
mov    %rax,%rdi
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    %rbp,%rdi
call   1080 <ftell@plt>
mov    %rax,%rbx
mov    0x2db6(%rip),%r13
mov    0x0(%r13),%edx
mov    %rbp,%rdi
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    %ebx,%edi
call   1090 <malloc@plt>
mov    %rax,0x18(%rsp)
mov    %rax,%rdi
mov    $0x1,%esi
mov    %rbx,%rdx
mov    %rbp,%rcx
call   1040 <fread@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
mov    0x10(%r14),%rdi
mov    %r15,%rsi
call   10b0 <fopen@plt>
mov    %rax,%rbp
mov    (%r12),%edx
mov    %rax,%rdi
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    %rbp,%rdi
call   1080 <ftell@plt>
mov    %rax,%rbx
mov    0x0(%r13),%edx
mov    %rbp,%rdi
xor    %esi,%esi
call   10a0 <fseek@plt>
mov    %ebx,%edi
call   1090 <malloc@plt>
mov    %rax,%r12
mov    %rax,%rdi
mov    $0x1,%esi
mov    %rbx,%rdx
mov    %rbp,%rcx
call   1040 <fread@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
cmp    $0x7fff,%rbx
jbe    145b <main+0x29b>
mov    0x10(%r14),%rdx
lea    0xd80(%rip),%rsi
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   10c0 <sprintf@plt>
lea    0xd73(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <fopen@plt>
mov    %rax,0x10(%rsp)
mov    $0x400,%edi
call   1090 <malloc@plt>
mov    %rax,0x8(%rsp)
xor    %ebx,%ebx
mov    %rbx,%r15
shl    $0x5,%r15
xor    %ebp,%ebp
mov    0x18(%rsp),%r14
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %r12,%rsi
mov    %ebp,%edx
mov    %ebx,%ecx
call   1030 <compare_tile@plt>
test   %rax,%rax
jne    1340 <main+0x180>
add    $0xffffffffffffffff,%r13
sub    $0xffffffffffffff80,%r14
cmp    $0xffffffffffffffa3,%r13
jne    1310 <main+0x150>
jmp    1417 <main+0x257>
nopw   0x0(%rax,%rax,1)
mov    %r13d,%edi
neg    %edi
mov    %r13d,%ecx
not    %ecx
cmp    $0x8,%ecx
setb   %sil
mov    %edi,%edx
and    $0x7ffffffd,%edx
cmp    $0xc,%edx
sete   %dl
cmp    $0xfffffff1,%r13d
sete   %cl
or     %sil,%cl
or     %dl,%cl
cmp    $0xfffffff0,%r13d
sete   %sil
cmp    $0xffffffef,%r13d
sete   %dl
or     %sil,%dl
cmp    $0xffffffdd,%r13d
sete   %al
or     %dl,%al
cmp    $0xffffffdc,%r13d
sete   %dl
or     %al,%dl
or     %cl,%dl
movzbl %dl,%eax
and    $0x1,%eax
shl    $0x6,%eax
mov    $0xffffffe1,%ecx
sub    %r13d,%ecx
xor    %edx,%edx
cmp    $0x4,%ecx
setb   %dl
shl    $0x7,%edx
or     %edi,%edx
or     %eax,%edx
lea    (%r15,%rbp,1),%rax
mov    0x8(%rsp),%rcx
mov    %edx,(%rcx,%rax,4)
add    $0x1,%rbp
cmp    $0x20,%rbp
jne    12fd <main+0x13d>
add    $0x1,%rbx
cmp    $0x20,%rbx
jne    12f4 <main+0x134>
mov    0x8(%rsp),%rdi
mov    $0x400,%esi
mov    $0x1,%edx
mov    0x10(%rsp),%rbx
mov    %rbx,%rcx
call   10e0 <fwrite@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
lea    0xc72(%rip),%rdi
lea    0x20(%rsp),%rdx
mov    $0x400,%esi
call   1060 <printf@plt>
xor    %eax,%eax
jmp    1437 <main+0x277>
mov    0x2bba(%rip),%rax
mov    (%rax),%edi
lea    0xc25(%rip),%rsi
mov    %ebp,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%eax
add    $0x128,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2b88(%rip),%rax
mov    (%rax),%edi
lea    0xba7(%rip),%rsi
jmp    146b <main+0x2ab>
mov    0x2b76(%rip),%rax
mov    (%rax),%edi
lea    0xbb7(%rip),%rsi
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    $0x1,%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [31 x i8] c"error: must supply tilemap...\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.2 = [32 x i8] c"error: level not big enough...\0A\00"
@.str.3 = [7 x i8] c"%s.map\00"
@.str.4 = [3 x i8] c"wb\00"
@.str.5 = [42 x i8] c"error: no matching tile found at (%d,%d)\0A\00"
@.str.6 = [22 x i8] c"wrote %d bytes to %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i64
%10 = alloca i64
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca [256 x i8]
%18 = alloca i32
%19 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 2
br i1 %21, label %22, label %26
22: ; preds = %2
%23 = load i32, i32* @stderr
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %23, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%25 = call i32 @exit(i32 1)
unreachable
26: ; preds = %2
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32* @fopen(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %30, i32** %7
%31 = load i32*, i32** %7
%32 = load i32, i32* @SEEK_END
%33 = call i32 @fseek(i32* %31, i32 0, i32 %32)
%34 = load i32*, i32** %7
%35 = call i64 @ftell(i32* %34)
store i64 %35, i64* %9
%36 = load i32*, i32** %7
%37 = load i32, i32* @SEEK_SET
%38 = call i32 @fseek(i32* %36, i32 0, i32 %37)
%39 = load i64, i64* %9
%40 = trunc i64 %39 to i32
%41 = call i32* @malloc(i32 %40)
store i32* %41, i32** %11
%42 = load i32*, i32** %11
%43 = load i64, i64* %9
%44 = load i32*, i32** %7
%45 = call i32 @fread(i32* %42, i32 1, i64 %43, i32* %44)
%46 = load i32*, i32** %7
%47 = call i32 @fclose(i32* %46)
%48 = load i64, i64* %9
%49 = icmp ult i64 %48, 2976
br i1 %49, label %50, label %51
50: ; preds = %26
br label %51
51: ; preds = %50, %26
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 2
%54 = load i8*, i8** %53
%55 = call i32* @fopen(i8* %54, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %55, i32** %6
%56 = load i32*, i32** %6
%57 = load i32, i32* @SEEK_END
%58 = call i32 @fseek(i32* %56, i32 0, i32 %57)
%59 = load i32*, i32** %6
%60 = call i64 @ftell(i32* %59)
store i64 %60, i64* %10
%61 = load i32*, i32** %6
%62 = load i32, i32* @SEEK_SET
%63 = call i32 @fseek(i32* %61, i32 0, i32 %62)
%64 = load i64, i64* %10
%65 = trunc i64 %64 to i32
%66 = call i32* @malloc(i32 %65)
store i32* %66, i32** %12
%67 = load i32*, i32** %12
%68 = load i64, i64* %10
%69 = load i32*, i32** %6
%70 = call i32 @fread(i32* %67, i32 1, i64 %68, i32* %69)
%71 = load i32*, i32** %6
%72 = call i32 @fclose(i32* %71)
%73 = load i64, i64* %10
%74 = icmp ult i64 %73, 32768
br i1 %74, label %75, label %79
75: ; preds = %51
%76 = load i32, i32* @stderr
%77 = call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%78 = call i32 @exit(i32 1)
unreachable
79: ; preds = %51
%80 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%81 = load i8**, i8*** %5
%82 = getelementptr inbounds i8*, i8** %81, i64 2
%83 = load i8*, i8** %82
%84 = call i32 @sprintf(i8* %80, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %83)
%85 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%86 = call i32* @fopen(i8* %85, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %86, i32** %8
%87 = call i32* @malloc(i32 1024)
store i32* %87, i32** %13
store i32 0, i32* %15
br label %88
88: ; preds = %204, %79
%89 = load i32, i32* %15
%90 = icmp slt i32 %89, 32
br i1 %90, label %91, label %207
91: ; preds = %88
store i32 0, i32* %14
br label %92
92: ; preds = %200, %91
%93 = load i32, i32* %14
%94 = icmp slt i32 %93, 32
br i1 %94, label %95, label %203
95: ; preds = %92
store i32 0, i32* %16
br label %96
96: ; preds = %188, %95
%97 = load i32, i32* %16
%98 = icmp slt i32 %97, 93
br i1 %98, label %99, label %191
99: ; preds = %96
%100 = load i32*, i32** %11
%101 = load i32, i32* %16
%102 = mul nsw i32 %101, 4
%103 = mul nsw i32 %102, 8
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds i32, i32* %100, i64 %104
%106 = load i32*, i32** %12
%107 = load i32, i32* %14
%108 = load i32, i32* %15
%109 = call i64 @compare_tile(i32* %105, i32* %106, i32 %107, i32 %108)
%110 = icmp ne i64 %109, 0
br i1 %110, label %111, label %187
111: ; preds = %99
%112 = load i32, i32* %16
%113 = icmp eq i32 %112, 1
br i1 %113, label %156, label %114
114: ; preds = %111
%115 = load i32, i32* %16
%116 = icmp eq i32 %115, 2
br i1 %116, label %156, label %117
117: ; preds = %114
%118 = load i32, i32* %16
%119 = icmp eq i32 %118, 3
br i1 %119, label %156, label %120
120: ; preds = %117
%121 = load i32, i32* %16
%122 = icmp eq i32 %121, 4
br i1 %122, label %156, label %123
123: ; preds = %120
%124 = load i32, i32* %16
%125 = icmp eq i32 %124, 5
br i1 %125, label %156, label %126
126: ; preds = %123
%127 = load i32, i32* %16
%128 = icmp eq i32 %127, 6
br i1 %128, label %156, label %129
129: ; preds = %126
%130 = load i32, i32* %16
%131 = icmp eq i32 %130, 7
br i1 %131, label %156, label %132
132: ; preds = %129
%133 = load i32, i32* %16
%134 = icmp eq i32 %133, 8
br i1 %134, label %156, label %135
135: ; preds = %132
%136 = load i32, i32* %16
%137 = icmp eq i32 %136, 12
br i1 %137, label %156, label %138
138: ; preds = %135
%139 = load i32, i32* %16
%140 = icmp eq i32 %139, 14
br i1 %140, label %156, label %141
141: ; preds = %138
%142 = load i32, i32* %16
%143 = icmp eq i32 %142, 15
br i1 %143, label %156, label %144
144: ; preds = %141
%145 = load i32, i32* %16
%146 = icmp eq i32 %145, 16
br i1 %146, label %156, label %147
147: ; preds = %144
%148 = load i32, i32* %16
%149 = icmp eq i32 %148, 17
br i1 %149, label %156, label %150
150: ; preds = %147
%151 = load i32, i32* %16
%152 = icmp eq i32 %151, 35
br i1 %152, label %156, label %153
153: ; preds = %150
%154 = load i32, i32* %16
%155 = icmp eq i32 %154, 36
br label %156
156: ; preds = %153, %150, %147, %144, %141, %138, %135, %132, %129, %126, %123, %120, %117, %114, %111
%157 = phi i1 [ true, %150 ], [ true, %147 ], [ true, %144 ], [ true, %141 ], [ true, %138 ], [ true, %135 ], [ true, %132 ], [ true, %129 ], [ true, %126 ], [ true, %123 ], [ true, %120 ], [ true, %117 ], [ true, %114 ], [ true, %111 ], [ %155, %153 ]
%158 = zext i1 %157 to i32
%159 = shl i32 %158, 6
store i32 %159, i32* %18
%160 = load i32, i32* %16
%161 = icmp eq i32 %160, 31
br i1 %161, label %171, label %162
162: ; preds = %156
%163 = load i32, i32* %16
%164 = icmp eq i32 %163, 32
br i1 %164, label %171, label %165
165: ; preds = %162
%166 = load i32, i32* %16
%167 = icmp eq i32 %166, 33
br i1 %167, label %171, label %168
168: ; preds = %165
%169 = load i32, i32* %16
%170 = icmp eq i32 %169, 34
br label %171
171: ; preds = %168, %165, %162, %156
%172 = phi i1 [ true, %165 ], [ true, %162 ], [ true, %156 ], [ %170, %168 ]
%173 = zext i1 %172 to i32
%174 = shl i32 %173, 7
store i32 %174, i32* %19
%175 = load i32, i32* %19
%176 = load i32, i32* %18
%177 = or i32 %175, %176
%178 = load i32, i32* %16
%179 = or i32 %177, %178
%180 = load i32*, i32** %13
%181 = load i32, i32* %15
%182 = mul nsw i32 %181, 32
%183 = load i32, i32* %14
%184 = add nsw i32 %182, %183
%185 = sext i32 %184 to i64
%186 = getelementptr inbounds i32, i32* %180, i64 %185
store i32 %179, i32* %186
br label %191
187: ; preds = %99
br label %188
188: ; preds = %187
%189 = load i32, i32* %16
%190 = add nsw i32 %189, 1
store i32 %190, i32* %16
br label %96
191: ; preds = %171, %96
%192 = load i32, i32* %16
%193 = icmp eq i32 %192, 93
br i1 %193, label %194, label %199
194: ; preds = %191
%195 = load i32, i32* @stderr
%196 = load i32, i32* %14
%197 = load i32, i32* %15
%198 = call i32 (i32, i8*, ...) @fprintf(i32 %195, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i32 %196, i32 %197)
store i32 1, i32* %3
br label %215
199: ; preds = %191
br label %200
200: ; preds = %199
%201 = load i32, i32* %14
%202 = add nsw i32 %201, 1
store i32 %202, i32* %14
br label %92
203: ; preds = %92
br label %204
204: ; preds = %203
%205 = load i32, i32* %15
%206 = add nsw i32 %205, 1
store i32 %206, i32* %15
br label %88
207: ; preds = %88
%208 = load i32*, i32** %13
%209 = load i32*, i32** %8
%210 = call i32 @fwrite(i32* %208, i32 1024, i32 1, i32* %209)
%211 = load i32*, i32** %8
%212 = call i32 @fclose(i32* %211)
%213 = getelementptr inbounds [256 x i8], [256 x i8]* %17, i64 0, i64 0
%214 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i32 1024, i8* %213)
store i32 0, i32* %3
br label %215
215: ; preds = %207, %194
%216 = load i32, i32* %3
ret i32 %216
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [31 x i8] c"error: must supply tilemap...\0A\00"
@.str.1 = [3 x i8] c"rb\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.2 = [32 x i8] c"error: level not big enough...\0A\00"
@.str.3 = [7 x i8] c"%s.map\00"
@.str.4 = [3 x i8] c"wb\00"
@.str.5 = [42 x i8] c"error: no matching tile found at (%d,%d)\0A\00"
@.str.6 = [22 x i8] c"wrote %d bytes to %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 (i32, i8*, ...) @fprintf(i32 %7, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32, i32* @SEEK_END
%15 = tail call i32 @fseek(i32* %13, i32 0, i32 %14)
%16 = tail call i64 @ftell(i32* %13)
%17 = load i32, i32* @SEEK_SET
%18 = tail call i32 @fseek(i32* %13, i32 0, i32 %17)
%19 = trunc i64 %16 to i32
%20 = tail call i32* @malloc(i32 %19)
%21 = tail call i32 @fread(i32* %20, i32 1, i64 %16, i32* %13)
%22 = tail call i32 @fclose(i32* %13)
%23 = getelementptr inbounds i8*, i8** %1, i64 2
%24 = load i8*, i8** %23
%25 = tail call i32* @fopen(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%26 = load i32, i32* @SEEK_END
%27 = tail call i32 @fseek(i32* %25, i32 0, i32 %26)
%28 = tail call i64 @ftell(i32* %25)
%29 = load i32, i32* @SEEK_SET
%30 = tail call i32 @fseek(i32* %25, i32 0, i32 %29)
%31 = trunc i64 %28 to i32
%32 = tail call i32* @malloc(i32 %31)
%33 = tail call i32 @fread(i32* %32, i32 1, i64 %28, i32* %25)
%34 = tail call i32 @fclose(i32* %25)
%35 = icmp ult i64 %28, 32768
br i1 %35, label %36, label %40
36: ; preds = %10
%37 = load i32, i32* @stderr
%38 = tail call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%39 = tail call i32 @exit(i32 1)
unreachable
40: ; preds = %10
%41 = load i8*, i8** %23
%42 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %41)
%43 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%44 = tail call i32* @malloc(i32 1024)
br label %45
45: ; preds = %40, %93
%46 = phi i64 [ 0, %40 ], [ %94, %93 ]
%47 = shl nsw i64 %46, 5
%48 = trunc i64 %46 to i32
br label %49
49: ; preds = %45, %66
%50 = phi i64 [ 0, %45 ], [ %91, %66 ]
%51 = trunc i64 %50 to i32
br label %52
52: ; preds = %49, %58
%53 = phi i64 [ 0, %49 ], [ %59, %58 ]
%54 = shl nuw nsw i64 %53, 5
%55 = getelementptr inbounds i32, i32* %20, i64 %54
%56 = tail call i64 @compare_tile(i32* %55, i32* %32, i32 %51, i32 %48)
%57 = icmp eq i64 %56, 0
br i1 %57, label %58, label %66
58: ; preds = %52
%59 = add nuw nsw i64 %53, 1
%60 = icmp eq i64 %59, 93
br i1 %60, label %61, label %52
61: ; preds = %58
%62 = trunc i64 %50 to i32
%63 = trunc i64 %46 to i32
%64 = load i32, i32* @stderr
%65 = tail call i32 (i32, i8*, ...) @fprintf(i32 %64, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.5, i64 0, i64 0), i32 %62, i32 %63)
br label %100
66: ; preds = %52
%67 = trunc i64 %53 to i32
%68 = add nsw i32 %67, -1
%69 = icmp ult i32 %68, 8
%70 = and i32 %67, 2147483645
%71 = icmp eq i32 %70, 12
%72 = or i1 %71, %69
%73 = icmp eq i32 %67, 15
%74 = select i1 %72, i1 true, i1 %73
%75 = icmp eq i32 %67, 16
%76 = select i1 %74, i1 true, i1 %75
%77 = icmp eq i32 %67, 17
%78 = select i1 %76, i1 true, i1 %77
%79 = icmp eq i32 %67, 35
%80 = select i1 %78, i1 true, i1 %79
%81 = icmp eq i32 %67, 36
%82 = select i1 %80, i1 true, i1 %81
%83 = select i1 %82, i32 64, i32 0
%84 = add nsw i32 %67, -31
%85 = icmp ult i32 %84, 4
%86 = select i1 %85, i32 128, i32 0
%87 = or i32 %86, %67
%88 = or i32 %87, %83
%89 = add nuw nsw i64 %50, %47
%90 = getelementptr inbounds i32, i32* %44, i64 %89
store i32 %88, i32* %90
%91 = add nuw nsw i64 %50, 1
%92 = icmp eq i64 %91, 32
br i1 %92, label %93, label %49
93: ; preds = %66
%94 = add nuw nsw i64 %46, 1
%95 = icmp eq i64 %94, 32
br i1 %95, label %96, label %45
96: ; preds = %93
%97 = tail call i32 @fwrite(i32* %44, i32 1024, i32 1, i32* %43)
%98 = tail call i32 @fclose(i32* %43)
%99 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), i32 1024, i8* %4)
br label %100
100: ; preds = %96, %61
%101 = phi i32 [ 1, %61 ], [ 0, %96 ]
ret i32 %101
}