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

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(unsigned char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  unsigned char rom[1500];
  unsigned char ram[65536];
  FILE *arch;
  unsigned char c, opcode, flag;
  int ptr, oldptr, siz, count, scan;
  arch = fopen("opcodes.bin", "rb");
  if (arch == NULL) {
    printf("\n***Problem opening Opcode List!***\n");
    return -1;
  }
  fseek(arch, 0, SEEK_END);
  siz = ftell(arch);
  fseek(arch, 0, SEEK_SET);
  fread(rom, siz, 1, arch);
  ptr = 0;
  arch = fopen("test.bin", "rb");
  if (arch == NULL) {
    printf("\n***Problem opening CODE!***\n");
    return -1;
  }
  fseek(arch, 0, SEEK_END);
  siz = ftell(arch);
  fseek(arch, 0, SEEK_SET);
  fread(&(ram[ptr]), siz, 1, arch);
  printf("Go!\n");
  do {
    opcode = ram[ptr];
    oldptr = ptr;
    printf("%04x: ", ptr);
    count = 0;
    scan = 0;
    while (opcode != count && count < 256) {
      while (rom[scan] < 128)
        scan++;
      scan++;
      count++;
    }
    siz = 1;
    do {
      flag = rom[scan] & 128;
      c = rom[scan] & 127;
      switch (c) {
      case '%':
      case '@':
        printf("$%02x", ram[++ptr]);
        siz = 2;
        break;
      case '&':
        printf("$%04x", ram[++ptr] + 256 * ram[++ptr]);
        siz = 3;
        break;
      default:
        printf("%c", c);
      }
      scan++;
    } while (!flag);
    ptr++;
    printf("  [ ");
    for (count = 0; count < siz; count++) {
      printf("%02x ", ram[oldptr + count]);
    }
    printf("]\n");
  } while (ram[ptr]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10610,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rdi
lea    0xe9c(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x105e8(%rbp)
cmpq   $0x0,-0x105e8(%rbp)
jne    11a4 <main+0x54>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1579 <main+0x429>
mov    -0x105e8(%rbp),%rdi
mov    0x2e36(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1060 <fseek@plt>
mov    -0x105e8(%rbp),%rdi
call   1050 <ftell@plt>
mov    %eax,-0x105f8(%rbp)
mov    -0x105e8(%rbp),%rdi
mov    0x2dfd(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1060 <fseek@plt>
lea    -0x5e0(%rbp),%rdi
mov    -0x105f8(%rbp),%esi
mov    -0x105e8(%rbp),%rcx
mov    $0x1,%edx
call   1030 <fread@plt>
movl   $0x0,-0x105f0(%rbp)
lea    0xe21(%rip),%rdi
lea    0xdf2(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x105e8(%rbp)
cmpq   $0x0,-0x105e8(%rbp)
jne    124e <main+0xfe>
lea    0xe02(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1579 <main+0x429>
mov    -0x105e8(%rbp),%rdi
mov    0x2d8c(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1060 <fseek@plt>
mov    -0x105e8(%rbp),%rdi
call   1050 <ftell@plt>
mov    %eax,-0x105f8(%rbp)
mov    -0x105e8(%rbp),%rdi
mov    0x2d53(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1060 <fseek@plt>
movslq -0x105f0(%rbp),%rax
lea    -0x105e0(%rbp),%rdi
add    %rax,%rdi
mov    -0x105f8(%rbp),%esi
mov    -0x105e8(%rbp),%rcx
mov    $0x1,%edx
call   1030 <fread@plt>
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x105f0(%rbp),%rax
mov    -0x105e0(%rbp,%rax,1),%al
mov    %al,-0x105ea(%rbp)
mov    -0x105f0(%rbp),%eax
mov    %eax,-0x105f4(%rbp)
mov    -0x105f0(%rbp),%esi
lea    0xd6f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x105fc(%rbp)
movl   $0x0,-0x10600(%rbp)
movzbl -0x105ea(%rbp),%ecx
xor    %eax,%eax
cmp    -0x105fc(%rbp),%ecx
mov    %al,-0x10601(%rbp)
je     133a <main+0x1ea>
cmpl   $0x100,-0x105fc(%rbp)
setl   %al
mov    %al,-0x10601(%rbp)
mov    -0x10601(%rbp),%al
test   $0x1,%al
jne    134d <main+0x1fd>
jmp    13a3 <main+0x253>
jmp    1352 <main+0x202>
movslq -0x10600(%rbp),%rax
movzbl -0x5e0(%rbp,%rax,1),%eax
ff
cmp    $0x80,%eax
jge    1380 <main+0x230>
mov    -0x10600(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10600(%rbp)
jmp    1352 <main+0x202>
mov    -0x10600(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10600(%rbp)
mov    -0x105fc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x105fc(%rbp)
jmp    130c <main+0x1bc>
movl   $0x1,-0x105f8(%rbp)
movslq -0x10600(%rbp),%rax
mov    -0x5e0(%rbp,%rax,1),%al
and    $0x80,%al
mov    %al,-0x105eb(%rbp)
movslq -0x10600(%rbp),%rax
mov    -0x5e0(%rbp,%rax,1),%al
and    $0x7f,%al
mov    %al,-0x105e9(%rbp)
movzbl -0x105e9(%rbp),%eax
mov    %eax,-0x10608(%rbp)
sub    $0x25,%eax
je     141c <main+0x2cc>
jmp    13f4 <main+0x2a4>
mov    -0x10608(%rbp),%eax
sub    $0x26,%eax
je     1452 <main+0x302>
jmp    1408 <main+0x2b8>
mov    -0x10608(%rbp),%eax
sub    $0x40,%eax
jne    14a6 <main+0x356>
jmp    141c <main+0x2cc>
mov    -0x105f0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x105f0(%rbp)
cltq
movzbl -0x105e0(%rbp,%rax,1),%esi
ff
lea    0xc2b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x2,-0x105f8(%rbp)
jmp    14bb <main+0x36b>
mov    -0x105f0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x105f0(%rbp)
cltq
movzbl -0x105e0(%rbp,%rax,1),%esi
ff
mov    -0x105f0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x105f0(%rbp)
cltq
movzbl -0x105e0(%rbp,%rax,1),%eax
ff
shl    $0x8,%eax
add    %eax,%esi
lea    0xbdd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x3,-0x105f8(%rbp)
jmp    14bb <main+0x36b>
movzbl -0x105e9(%rbp),%esi
lea    0xbbf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10600(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10600(%rbp)
cmpb   $0x0,-0x105eb(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    13ad <main+0x25d>
mov    -0x105f0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x105f0(%rbp)
lea    0xb82(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x105fc(%rbp)
mov    -0x105fc(%rbp),%eax
cmp    -0x105f8(%rbp),%eax
jge    154f <main+0x3ff>
mov    -0x105f4(%rbp),%eax
add    -0x105fc(%rbp),%eax
cltq
movzbl -0x105e0(%rbp,%rax,1),%esi
ff
lea    0xb47(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x105fc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x105fc(%rbp)
jmp    1505 <main+0x3b5>
lea    0xb2b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x105f0(%rbp),%rax
cmpb   $0x0,-0x105e0(%rbp,%rax,1)
jne    12c4 <main+0x174>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10610,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x105f8,%rsp
lea    0xe78(%rip),%rdi
lea    0xe7d(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     1408 <main+0x298>
mov    %rax,%rbx
mov    0x2e41(%rip),%r14
mov    (%r14),%edx
mov    %rax,%rdi
xor    %esi,%esi
call   1080 <fseek@plt>
mov    %rbx,%rdi
call   1070 <ftell@plt>
mov    %eax,%ebp
mov    0x2e13(%rip),%r15
mov    (%r15),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <fseek@plt>
lea    0x10(%rsp),%rdi
mov    %ebp,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fread@plt>
lea    0xe22(%rip),%rdi
lea    0xe18(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     1411 <main+0x2a1>
mov    %rax,%rbx
mov    (%r14),%edx
mov    %rax,%rdi
xor    %esi,%esi
call   1080 <fseek@plt>
mov    %rbx,%rdi
call   1070 <ftell@plt>
mov    %eax,%ebp
mov    (%r15),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1080 <fseek@plt>
lea    0x5f0(%rsp),%rdi
mov    %ebp,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fread@plt>
lea    0xdef(%rip),%rdi
call   1040 <puts@plt>
mov    0x5f0(%rsp),%bl
lea    0xdd6(%rip),%r13
movabs $0x100000000,%r15
xor    %r12d,%r12d
nopw   0x0(%rax,%rax,1)
xor    %r14d,%r14d
lea    0xd9e(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
test   %bl,%bl
je     12fd <main+0x18d>
xor    %r14d,%r14d
cmp    $0x1,%bl
je     12d3 <main+0x163>
movzbl %bl,%eax
and    $0xfffffffe,%eax
xor    %r14d,%r14d
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
movslq %r14d,%r14
lea    (%rsp,%r14,1),%rdx
add    $0x10,%rdx
shl    $0x20,%r14
nop
add    %r15,%r14
cmpb   $0x0,(%rdx)
lea    0x1(%rdx),%rdx
jns    12b0 <main+0x140>
sar    $0x20,%r14
cmpb   $0x0,0x10(%rsp,%r14,1)
lea    0x1(%r14),%r14
jns    12c0 <main+0x150>
add    $0x2,%ecx
cmp    %eax,%ecx
jne    12a0 <main+0x130>
test   $0x1,%bl
je     12fd <main+0x18d>
movslq %r14d,%rax
add    %rsp,%rax
add    $0x10,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r14d
cmpb   $0x0,(%rax)
lea    0x1(%rax),%rax
jns    12f0 <main+0x180>
movslq %r12d,%rax
mov    %rax,0x8(%rsp)
movslq %r14d,%rax
lea    (%rsp,%rax,1),%rbx
add    $0x10,%rbx
mov    $0x1,%r14d
jmp    134d <main+0x1dd>
nopl   0x0(%rax,%rax,1)
movslq %r12d,%r12
movzbl 0x5f1(%rsp,%r12,1),%esi
add    $0x1,%r12
lea    0xce8(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x2,%r14d
add    $0x1,%rbx
test   %bpl,%bpl
js     13a0 <main+0x230>
movzbl (%rbx),%ebp
mov    %ebp,%edi
and    $0x7f,%edi
cmp    $0x40,%edi
je     1320 <main+0x1b0>
cmp    $0x26,%edi
je     1370 <main+0x200>
cmp    $0x25,%edi
je     1320 <main+0x1b0>
call   1030 <putchar@plt>
jmp    1344 <main+0x1d4>
nopl   0x0(%rax,%rax,1)
movslq %r12d,%rax
lea    0x2(%rax),%r12d
lea    0x5f0(%rsp),%rcx
movzwl 0x1(%rax,%rcx,1),%esi
lea    0xc9a(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x3,%r14d
jmp    1344 <main+0x1d4>
nopw   0x0(%rax,%rax,1)
movslq %r12d,%r12
add    $0x1,%r12
lea    0xc7d(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r14d,%r14d
mov    0x8(%rsp),%rax
lea    (%rsp,%rax,1),%rbp
add    $0x5f0,%rbp
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movzbl 0x0(%rbp,%rbx,1),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r14
jne    13d0 <main+0x260>
lea    0xc4b(%rip),%rdi
call   1040 <puts@plt>
mov    0x5f0(%rsp,%r12,1),%bl
test   %bl,%bl
jne    1270 <main+0x100>
xor    %eax,%eax
jmp    1422 <main+0x2b2>
lea    0xc4a(%rip),%rdi
jmp    1418 <main+0x2a8>
lea    0xc24(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%eax
add    $0x105f8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"opcodes.bin\00"
@.str.1 = [3 x i8] c"rb\00"
@.str.2 = [37 x i8] c"\0A***Problem opening Opcode List!***\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.3 = [9 x i8] c"test.bin\00"
@.str.4 = [30 x i8] c"\0A***Problem opening CODE!***\0A\00"
@.str.5 = [5 x i8] c"Go!\0A\00"
@.str.6 = [7 x i8] c"%04x: \00"
@.str.7 = [6 x i8] c"$%02x\00"
@.str.8 = [6 x i8] c"$%04x\00"
@.str.9 = [3 x i8] c"%c\00"
@.str.10 = [5 x i8] c" [ \00"
@.str.11 = [6 x i8] c"%02x \00"
@.str.12 = [3 x i8] c"]\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1500 x i8]
%3 = alloca [65536 x i8]
%4 = alloca i32*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %1
%13 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %13, i32** %4
%14 = load i32*, i32** %4
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %1
br label %168
18: ; preds = %0
%19 = load i32*, i32** %4
%20 = load i32, i32* @SEEK_END
%21 = call i32 @fseek(i32* %19, i32 0, i32 %20)
%22 = load i32*, i32** %4
%23 = call i32 @ftell(i32* %22)
store i32 %23, i32* %10
%24 = load i32*, i32** %4
%25 = load i32, i32* @SEEK_SET
%26 = call i32 @fseek(i32* %24, i32 0, i32 %25)
%27 = getelementptr inbounds [1500 x i8], [1500 x i8]* %2, i64 0, i64 0
%28 = load i32, i32* %10
%29 = load i32*, i32** %4
%30 = call i32 @fread(i8* %27, i32 %28, i32 1, i32* %29)
store i32 0, i32* %8
%31 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %31, i32** %4
%32 = load i32*, i32** %4
%33 = icmp eq i32* %32, null
br i1 %33, label %34, label %36
34: ; preds = %18
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0))
store i32 -1, i32* %1
br label %168
36: ; preds = %18
%37 = load i32*, i32** %4
%38 = load i32, i32* @SEEK_END
%39 = call i32 @fseek(i32* %37, i32 0, i32 %38)
%40 = load i32*, i32** %4
%41 = call i32 @ftell(i32* %40)
store i32 %41, i32* %10
%42 = load i32*, i32** %4
%43 = load i32, i32* @SEEK_SET
%44 = call i32 @fseek(i32* %42, i32 0, i32 %43)
%45 = load i32, i32* %8
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [65536 x i8], [65536 x i8]* %3, i64 0, i64 %46
%48 = load i32, i32* %10
%49 = load i32*, i32** %4
%50 = call i32 @fread(i8* %47, i32 %48, i32 1, i32* %49)
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %52
52: ; preds = %161, %36
%53 = load i32, i32* %8
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [65536 x i8], [65536 x i8]* %3, i64 0, i64 %54
%56 = load i8, i8* %55
store i8 %56, i8* %6
%57 = load i32, i32* %8
store i32 %57, i32* %9
%58 = load i32, i32* %8
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32 %58)
store i32 0, i32* %11
store i32 0, i32* %12
br label %60
60: ; preds = %81, %52
%61 = load i8, i8* %6
%62 = zext i8 %61 to i32
%63 = load i32, i32* %11
%64 = icmp ne i32 %62, %63
br i1 %64, label %65, label %68
65: ; preds = %60
%66 = load i32, i32* %11
%67 = icmp slt i32 %66, 256
br label %68
68: ; preds = %65, %60
%69 = phi i1 [ false, %60 ], [ %67, %65 ]
br i1 %69, label %70, label %86
70: ; preds = %68
br label %71
71: ; preds = %78, %70
%72 = load i32, i32* %12
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [1500 x i8], [1500 x i8]* %2, i64 0, i64 %73
%75 = load i8, i8* %74
%76 = zext i8 %75 to i32
%77 = icmp slt i32 %76, 128
br i1 %77, label %78, label %81
78: ; preds = %71
%79 = load i32, i32* %12
%80 = add nsw i32 %79, 1
store i32 %80, i32* %12
br label %71
81: ; preds = %71
%82 = load i32, i32* %12
%83 = add nsw i32 %82, 1
store i32 %83, i32* %12
%84 = load i32, i32* %11
%85 = add nsw i32 %84, 1
store i32 %85, i32* %11
br label %60
86: ; preds = %68
store i32 1, i32* %10
br label %87
87: ; preds = %135, %86
%88 = load i32, i32* %12
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds [1500 x i8], [1500 x i8]* %2, i64 0, i64 %89
%91 = load i8, i8* %90
%92 = zext i8 %91 to i32
%93 = and i32 %92, 128
%94 = trunc i32 %93 to i8
store i8 %94, i8* %7
%95 = load i32, i32* %12
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds [1500 x i8], [1500 x i8]* %2, i64 0, i64 %96
%98 = load i8, i8* %97
%99 = zext i8 %98 to i32
%100 = and i32 %99, 127
%101 = trunc i32 %100 to i8
store i8 %101, i8* %5
%102 = load i8, i8* %5
%103 = zext i8 %102 to i32
switch i32 %103, label %128 [
i32 37, label %104
i32 64, label %104
i32 38, label %112
]
104: ; preds = %87, %87
%105 = load i32, i32* %8
%106 = add nsw i32 %105, 1
store i32 %106, i32* %8
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds [65536 x i8], [65536 x i8]* %3, i64 0, i64 %107
%109 = load i8, i8* %108
%110 = zext i8 %109 to i32
%111 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %110)
store i32 2, i32* %10
br label %132
112: ; preds = %87
%113 = load i32, i32* %8
%114 = add nsw i32 %113, 1
store i32 %114, i32* %8
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds [65536 x i8], [65536 x i8]* %3, i64 0, i64 %115
%117 = load i8, i8* %116
%118 = zext i8 %117 to i32
%119 = load i32, i32* %8
%120 = add nsw i32 %119, 1
store i32 %120, i32* %8
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds [65536 x i8], [65536 x i8]* %3, i64 0, i64 %121
%123 = load i8, i8* %122
%124 = zext i8 %123 to i32
%125 = mul nsw i32 256, %124
%126 = add nsw i32 %118, %125
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32 %126)
store i32 3, i32* %10
br label %132
128: ; preds = %87
%129 = load i8, i8* %5
%130 = zext i8 %129 to i32
%131 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0), i32 %130)
br label %132
132: ; preds = %128, %112, %104
%133 = load i32, i32* %12
%134 = add nsw i32 %133, 1
store i32 %134, i32* %12
br label %135
135: ; preds = %132
%136 = load i8, i8* %7
%137 = icmp ne i8 %136, 0
%138 = xor i1 %137, true
br i1 %138, label %87, label %139
139: ; preds = %135
%140 = load i32, i32* %8
%141 = add nsw i32 %140, 1
store i32 %141, i32* %8
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %11
br label %143
143: ; preds = %156, %139
%144 = load i32, i32* %11
%145 = load i32, i32* %10
%146 = icmp slt i32 %144, %145
br i1 %146, label %147, label %159
147: ; preds = %143
%148 = load i32, i32* %9
%149 = load i32, i32* %11
%150 = add nsw i32 %148, %149
%151 = sext i32 %150 to i64
%152 = getelementptr inbounds [65536 x i8], [65536 x i8]* %3, i64 0, i64 %151
%153 = load i8, i8* %152
%154 = zext i8 %153 to i32
%155 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i32 %154)
br label %156
156: ; preds = %147
%157 = load i32, i32* %11
%158 = add nsw i32 %157, 1
store i32 %158, i32* %11
br label %143
159: ; preds = %143
%160 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i64 0, i64 0))
br label %161
161: ; preds = %159
%162 = load i32, i32* %8
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds [65536 x i8], [65536 x i8]* %3, i64 0, i64 %163
%165 = load i8, i8* %164
%166 = icmp ne i8 %165, 0
br i1 %166, label %52, label %167
167: ; preds = %161
store i32 0, i32* %1
br label %168
168: ; preds = %167, %34, %16
%169 = load i32, i32* %1
ret i32 %169
}

LLVM IR (-O2):
@.str = [12 x i8] c"opcodes.bin\00"
@.str.1 = [3 x i8] c"rb\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.3 = [9 x i8] c"test.bin\00"
@.str.6 = [7 x i8] c"%04x: \00"
@.str.7 = [6 x i8] c"$%02x\00"
@.str.8 = [6 x i8] c"$%04x\00"
@.str.10 = [5 x i8] c" [ \00"
@.str.11 = [6 x i8] c"%02x \00"
@str = [4 x i8] c"Go!\00"
@str.13 = [2 x i8] c"]\00"
@str.14 = [29 x i8] c"\0A***Problem opening CODE!***\00"
@str.15 = [36 x i8] c"\0A***Problem opening Opcode List!***\00"
define i32 @main() {
%1 = alloca [1500 x i8]
%2 = alloca [65536 x i8]
%3 = getelementptr inbounds [1500 x i8], [1500 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [65536 x i8], [65536 x i8]* %2, i64 0, i64 0
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %135, label %7
7: ; preds = %0
%8 = load i32, i32* @SEEK_END
%9 = tail call i32 @fseek(i32* %5, i32 0, i32 %8)
%10 = tail call i32 @ftell(i32* %5)
%11 = load i32, i32* @SEEK_SET
%12 = tail call i32 @fseek(i32* %5, i32 0, i32 %11)
%13 = call i32 @fread(i8* %3, i32 %10, i32 1, i32* %5)
%14 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i32* %14, null
br i1 %15, label %135, label %16
16: ; preds = %7
%17 = load i32, i32* @SEEK_END
%18 = tail call i32 @fseek(i32* %14, i32 0, i32 %17)
%19 = tail call i32 @ftell(i32* %14)
%20 = load i32, i32* @SEEK_SET
%21 = tail call i32 @fseek(i32* %14, i32 0, i32 %20)
%22 = call i32 @fread(i8* %4, i32 %19, i32 1, i32* %14)
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
%24 = load i8, i8* %4
br label %25
25: ; preds = %129, %16
%26 = phi i8 [ %24, %16 ], [ %133, %129 ]
%27 = phi i32 [ 0, %16 ], [ %117, %129 ]
%28 = sext i32 %27 to i64
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32 %27)
%30 = icmp eq i8 %26, 0
br i1 %30, label %52, label %31
31: ; preds = %25
%32 = zext i8 %26 to i32
%33 = and i32 %32, 1
%34 = icmp eq i8 %26, 1
br i1 %34, label %37, label %35
35: ; preds = %31
%36 = and i32 %32, 254
br label %55
37: ; preds = %75, %31
%38 = phi i32 [ undef, %31 ], [ %77, %75 ]
%39 = phi i32 [ 0, %31 ], [ %77, %75 ]
%40 = icmp eq i32 %33, 0
br i1 %40, label %52, label %41
41: ; preds = %37
%42 = sext i32 %39 to i64
br label %43
43: ; preds = %43, %41
%44 = phi i64 [ %48, %43 ], [ %42, %41 ]
%45 = getelementptr inbounds [1500 x i8], [1500 x i8]* %1, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = icmp sgt i8 %46, -1
%48 = add i64 %44, 1
br i1 %47, label %43, label %49
49: ; preds = %43
%50 = trunc i64 %44 to i32
%51 = add nsw i32 %50, 1
br label %52
52: ; preds = %49, %37, %25
%53 = phi i32 [ 0, %25 ], [ %38, %37 ], [ %51, %49 ]
%54 = sext i32 %53 to i64
br label %80
55: ; preds = %75, %35
%56 = phi i32 [ 0, %35 ], [ %77, %75 ]
%57 = phi i32 [ 0, %35 ], [ %78, %75 ]
%58 = sext i32 %56 to i64
br label %59
59: ; preds = %59, %55
%60 = phi i64 [ %64, %59 ], [ %58, %55 ]
%61 = getelementptr inbounds [1500 x i8], [1500 x i8]* %1, i64 0, i64 %60
%62 = load i8, i8* %61
%63 = icmp sgt i8 %62, -1
%64 = add i64 %60, 1
br i1 %63, label %59, label %65
65: ; preds = %59
%66 = shl i64 %60, 32
%67 = add i64 %66, 4294967296
%68 = ashr exact i64 %67, 32
br label %69
69: ; preds = %69, %65
%70 = phi i64 [ %74, %69 ], [ %68, %65 ]
%71 = getelementptr inbounds [1500 x i8], [1500 x i8]* %1, i64 0, i64 %70
%72 = load i8, i8* %71
%73 = icmp sgt i8 %72, -1
%74 = add i64 %70, 1
br i1 %73, label %69, label %75
75: ; preds = %69
%76 = trunc i64 %70 to i32
%77 = add nsw i32 %76, 1
%78 = add i32 %57, 2
%79 = icmp eq i32 %78, %36
br i1 %79, label %37, label %55
80: ; preds = %52, %111
%81 = phi i64 [ %54, %52 ], [ %114, %111 ]
%82 = phi i32 [ %27, %52 ], [ %112, %111 ]
%83 = phi i32 [ 1, %52 ], [ %113, %111 ]
%84 = getelementptr inbounds [1500 x i8], [1500 x i8]* %1, i64 0, i64 %81
%85 = load i8, i8* %84
%86 = and i8 %85, 127
%87 = zext i8 %86 to i32
switch i32 %87, label %109 [
i32 37, label %88
i32 64, label %88
i32 38, label %95
]
88: ; preds = %80, %80
%89 = add nsw i32 %82, 1
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds [65536 x i8], [65536 x i8]* %2, i64 0, i64 %90
%92 = load i8, i8* %91
%93 = zext i8 %92 to i32
%94 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 %93)
br label %111
95: ; preds = %80
%96 = add nsw i32 %82, 1
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds [65536 x i8], [65536 x i8]* %2, i64 0, i64 %97
%99 = load i8, i8* %98
%100 = zext i8 %99 to i32
%101 = add nsw i32 %82, 2
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds [65536 x i8], [65536 x i8]* %2, i64 0, i64 %102
%104 = load i8, i8* %103
%105 = zext i8 %104 to i32
%106 = shl nuw nsw i32 %105, 8
%107 = or i32 %106, %100
%108 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32 %107)
br label %111
109: ; preds = %80
%110 = tail call i32 @putchar(i32 %87)
br label %111
111: ; preds = %109, %95, %88
%112 = phi i32 [ %82, %109 ], [ %101, %95 ], [ %89, %88 ]
%113 = phi i32 [ %83, %109 ], [ 3, %95 ], [ 2, %88 ]
%114 = add i64 %81, 1
%115 = icmp sgt i8 %85, -1
br i1 %115, label %80, label %116
116: ; preds = %111
%117 = add nsw i32 %112, 1
%118 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%119 = zext i32 %113 to i64
br label %120
120: ; preds = %116, %120
%121 = phi i64 [ 0, %116 ], [ %127, %120 ]
%122 = add nsw i64 %121, %28
%123 = getelementptr inbounds [65536 x i8], [65536 x i8]* %2, i64 0, i64 %122
%124 = load i8, i8* %123
%125 = zext i8 %124 to i32
%126 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.11, i64 0, i64 0), i32 %125)
%127 = add nuw nsw i64 %121, 1
%128 = icmp eq i64 %127, %119
br i1 %128, label %129, label %120
129: ; preds = %120
%130 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.13, i64 0, i64 0))
%131 = sext i32 %117 to i64
%132 = getelementptr inbounds [65536 x i8], [65536 x i8]* %2, i64 0, i64 %131
%133 = load i8, i8* %132
%134 = icmp eq i8 %133, 0
br i1 %134, label %138, label %25
135: ; preds = %7, %0
%136 = phi i8* [ getelementptr inbounds ([36 x i8], [36 x i8]* @str.15, i64 0, i64 0), %0 ], [ getelementptr inbounds ([29 x i8], [29 x i8]* @str.14, i64 0, i64 0), %7 ]
%137 = tail call i32 @puts(i8* dereferenceable(1) %136)
br label %138
138: ; preds = %129, %135
%139 = phi i32 [ -1, %135 ], [ 0, %129 ]
ret i32 %139
}