#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 int16_t;

/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, ...);
scalar_t__ read(int, char *, int);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  int imagefd = open("image.sdm", O_RDONLY);
  union {
    int16_t word;
    char bytesInWord[2];
  } instruction;
  char temp = 0;
  int addr = 0;
  while (read(imagefd, &instruction.bytesInWord[1], 1) > 0) {
    read(imagefd, &instruction.bytesInWord[0], 1);
    temp = instruction.bytesInWord[1] & 0xF0;
    switch (temp) {
    case '\x00':
      printf("%x\tnop\n", addr);
      break;
    case '\x10':
      printf("%x\tadda 0x%x\n", addr, instruction.word & 0x0FFF);
      break;
    case '\x20':
      printf("%x\taddm 0x%x\n", addr, instruction.word & 0x0FFF);
      break;
    case '\x30':
      printf("%x\tsuba 0x%x\n", addr, instruction.word & 0x0FFF);
      break;
    case '\x40':
      printf("%x\tsubm 0x%x\n", addr, instruction.word & 0x0FFF);
      break;
    case '\x50':
      printf("%x\tcla\n", addr);
      break;
    case '\x60':
      printf("%x\tclm 0x%x\n", addr, instruction.word & 0x0FFF);
      break;
    case '\x70':
      printf("%x\tjmp 0x%x\n", addr, instruction.word & 0x0FFF);
      break;
    case '\x80':
      printf("%x\tjin 0x%x\n", addr, instruction.word & 0x0FFF);
      break;
    case '\x90':
      printf("%x\tout 0x%x\n", addr, instruction.word & 0x0FFF);
      break;
    case '\xA0':
      printf("%x\tin 0x%x\n", addr, instruction.word & 0x0FFF);
      break;
    case '\xB0':
      printf("%x\tmova 0x%x\n", addr, instruction.word & 0x0FFF);
      break;
    case '\xC0':
      printf("%x\tmovm 0x%x\n", addr, instruction.word & 0x0FFF);
      break;
    case '\xD0':
      printf("%x\tstoa 0x%x\n", addr, instruction.word & 0x0FFF);
      break;
    case '\xE0':
      printf("%x\teq 0x%x\n", addr, instruction.word & 0x0FFF);
      break;
    case '\xF0':
      printf("%x\thlt\n", addr);
      break;
    default:
      fprintf(stderr, "%s: opcode value out of range\n", argv[0]);
      exit(1);
      break;
    }
    addr++;
    addr++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e7b(%rip),%rax
mov    (%rax),%esi
lea    0xe8a(%rip),%rdi
call   1060 <open@plt>
mov    %eax,-0x14(%rbp)
movb   $0x0,-0x19(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x18(%rbp),%rsi
add    $0x1,%rsi
mov    $0x1,%edx
call   1040 <read@plt>
cmp    $0x0,%rax
jle    14e6 <main+0x396>
mov    -0x14(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    $0x1,%edx
call   1040 <read@plt>
mov    -0x17(%rbp),%al
and    $0xf0,%al
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0xffffff80,%eax
je     13ba <main+0x26a>
jmp    11d6 <main+0x86>
mov    -0x24(%rbp),%eax
sub    $0xffffff90,%eax
je     13d9 <main+0x289>
jmp    11e7 <main+0x97>
mov    -0x24(%rbp),%eax
sub    $0xffffffa0,%eax
je     13f8 <main+0x2a8>
jmp    11f8 <main+0xa8>
mov    -0x24(%rbp),%eax
sub    $0xffffffb0,%eax
je     1417 <main+0x2c7>
jmp    1209 <main+0xb9>
mov    -0x24(%rbp),%eax
sub    $0xffffffc0,%eax
je     1436 <main+0x2e6>
jmp    121a <main+0xca>
mov    -0x24(%rbp),%eax
sub    $0xffffffd0,%eax
je     1455 <main+0x305>
jmp    122b <main+0xdb>
mov    -0x24(%rbp),%eax
sub    $0xffffffe0,%eax
je     1474 <main+0x324>
jmp    123c <main+0xec>
mov    -0x24(%rbp),%eax
sub    $0xfffffff0,%eax
je     1493 <main+0x343>
jmp    124d <main+0xfd>
mov    -0x24(%rbp),%eax
test   %eax,%eax
je     12d4 <main+0x184>
jmp    125d <main+0x10d>
mov    -0x24(%rbp),%eax
sub    $0x10,%eax
je     12ea <main+0x19a>
jmp    126e <main+0x11e>
mov    -0x24(%rbp),%eax
sub    $0x20,%eax
je     1309 <main+0x1b9>
jmp    127f <main+0x12f>
mov    -0x24(%rbp),%eax
sub    $0x30,%eax
je     1328 <main+0x1d8>
jmp    1290 <main+0x140>
mov    -0x24(%rbp),%eax
sub    $0x40,%eax
je     1347 <main+0x1f7>
jmp    12a1 <main+0x151>
mov    -0x24(%rbp),%eax
sub    $0x50,%eax
je     1366 <main+0x216>
jmp    12b2 <main+0x162>
mov    -0x24(%rbp),%eax
sub    $0x60,%eax
je     137c <main+0x22c>
jmp    12c3 <main+0x173>
mov    -0x24(%rbp),%eax
sub    $0x70,%eax
je     139b <main+0x24b>
jmp    14a9 <main+0x359>
mov    -0x20(%rbp),%esi
lea    0xd2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14cf <main+0x37f>
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%edx
and    $0xfff,%edx
lea    0xd15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14cf <main+0x37f>
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%edx
and    $0xfff,%edx
lea    0xd04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14cf <main+0x37f>
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%edx
and    $0xfff,%edx
lea    0xcf3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14cf <main+0x37f>
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%edx
and    $0xfff,%edx
lea    0xce2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14cf <main+0x37f>
mov    -0x20(%rbp),%esi
lea    0xcda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14cf <main+0x37f>
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%edx
and    $0xfff,%edx
lea    0xcc3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14cf <main+0x37f>
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%edx
and    $0xfff,%edx
lea    0xcb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14cf <main+0x37f>
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%edx
and    $0xfff,%edx
lea    0xc9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14cf <main+0x37f>
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%edx
and    $0xfff,%edx
lea    0xc8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14cf <main+0x37f>
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%edx
and    $0xfff,%edx
lea    0xc7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14cf <main+0x37f>
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%edx
and    $0xfff,%edx
lea    0xc68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14cf <main+0x37f>
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%edx
and    $0xfff,%edx
lea    0xc57(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14cf <main+0x37f>
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%edx
and    $0xfff,%edx
lea    0xc46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14cf <main+0x37f>
mov    -0x20(%rbp),%esi
mov    -0x18(%rbp),%edx
and    $0xfff,%edx
lea    0xc35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14cf <main+0x37f>
mov    -0x20(%rbp),%esi
lea    0xc2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    14cf <main+0x37f>
mov    0x2b28(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xc10(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1189 <main+0x39>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,0x10(%rsp)
mov    0x2e7e(%rip),%rax
mov    (%rax),%esi
lea    0xecd(%rip),%rdi
call   1060 <open@plt>
mov    %eax,%ebp
lea    0x9(%rsp),%rbx
mov    %eax,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1040 <read@plt>
test   %rax,%rax
jle    131b <main+0x1cb>
lea    0x8(%rsp),%r15
lea    0xe5d(%rip),%r14
mov    $0xfff,%r12d
xor    %r13d,%r13d
jmp    11e6 <main+0x96>
mov    0x8(%rsp),%edx
and    %r12d,%edx
lea    0xe96(%rip),%rdi
nopl   0x0(%rax)
mov    %r13d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x2,%r13d
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1040 <read@plt>
test   %rax,%rax
jle    131b <main+0x1cb>
mov    %ebp,%edi
mov    %r15,%rsi
mov    $0x1,%edx
call   1040 <read@plt>
movsbl 0x9(%rsp),%eax
and    $0xfffffff0,%eax
sub    $0xffffff80,%eax
shr    $0x4,%eax
cmp    $0xf,%eax
ja     132c <main+0x1dc>
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
mov    0x8(%rsp),%edx
and    %r12d,%edx
lea    0xe89(%rip),%rdi
jmp    11c0 <main+0x70>
mov    0x8(%rsp),%edx
and    %r12d,%edx
lea    0xe93(%rip),%rdi
jmp    11c0 <main+0x70>
mov    0x8(%rsp),%edx
and    %r12d,%edx
lea    0xe9d(%rip),%rdi
jmp    11c0 <main+0x70>
mov    0x8(%rsp),%edx
and    %r12d,%edx
lea    0xe18(%rip),%rdi
jmp    11c0 <main+0x70>
mov    0x8(%rsp),%edx
and    %r12d,%edx
lea    0xe13(%rip),%rdi
jmp    11c0 <main+0x70>
mov    0x8(%rsp),%edx
and    %r12d,%edx
lea    0xe16(%rip),%rdi
jmp    11c0 <main+0x70>
mov    0x8(%rsp),%edx
and    %r12d,%edx
lea    0xe10(%rip),%rdi
jmp    11c0 <main+0x70>
mov    0x8(%rsp),%edx
and    %r12d,%edx
lea    0xe17(%rip),%rdi
jmp    11c0 <main+0x70>
mov    0x8(%rsp),%edx
and    %r12d,%edx
lea    0xe1d(%rip),%rdi
jmp    11c0 <main+0x70>
mov    0x8(%rsp),%edx
and    %r12d,%edx
lea    0xe26(%rip),%rdi
jmp    11c0 <main+0x70>
mov    0x8(%rsp),%edx
and    %r12d,%edx
lea    0xe21(%rip),%rdi
jmp    11c0 <main+0x70>
lea    0xe21(%rip),%rdi
jmp    130c <main+0x1bc>
lea    0xd5a(%rip),%rdi
jmp    130c <main+0x1bc>
mov    0x8(%rsp),%edx
and    %r12d,%edx
lea    0xd60(%rip),%rdi
jmp    11c0 <main+0x70>
lea    0xd7e(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11ca <main+0x7a>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2ca5(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rsp),%rax
mov    (%rax),%rdx
lea    0xdcc(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
%union.anon = type { i32 }
@.str = [10 x i8] c"image.sdm\00"
@O_RDONLY = global i32 0
@.str.1 = [8 x i8] c"%x\09nop\0A\00"
@.str.2 = [14 x i8] c"%x\09adda 0x%x\0A\00"
@.str.3 = [14 x i8] c"%x\09addm 0x%x\0A\00"
@.str.4 = [14 x i8] c"%x\09suba 0x%x\0A\00"
@.str.5 = [14 x i8] c"%x\09subm 0x%x\0A\00"
@.str.6 = [8 x i8] c"%x\09cla\0A\00"
@.str.7 = [13 x i8] c"%x\09clm 0x%x\0A\00"
@.str.8 = [13 x i8] c"%x\09jmp 0x%x\0A\00"
@.str.9 = [13 x i8] c"%x\09jin 0x%x\0A\00"
@.str.10 = [13 x i8] c"%x\09out 0x%x\0A\00"
@.str.11 = [12 x i8] c"%x\09in 0x%x\0A\00"
@.str.12 = [14 x i8] c"%x\09mova 0x%x\0A\00"
@.str.13 = [14 x i8] c"%x\09movm 0x%x\0A\00"
@.str.14 = [14 x i8] c"%x\09stoa 0x%x\0A\00"
@.str.15 = [12 x i8] c"%x\09eq 0x%x\0A\00"
@.str.16 = [8 x i8] c"%x\09hlt\0A\00"
@stderr = global i32 0
@.str.17 = [31 x i8] c"%s: opcode value out of range\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %union.anon
%8 = alloca i8
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* @O_RDONLY
%11 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %10)
store i32 %11, i32* %6
store i8 0, i8* %8
store i32 0, i32* %9
br label %12
12: ; preds = %125, %2
%13 = load i32, i32* %6
%14 = bitcast %union.anon* %7 to [2 x i8]*
%15 = getelementptr inbounds [2 x i8], [2 x i8]* %14, i64 0, i64 1
%16 = call i64 @read(i32 %13, i8* %15, i32 1)
%17 = icmp sgt i64 %16, 0
br i1 %17, label %18, label %130
18: ; preds = %12
%19 = load i32, i32* %6
%20 = bitcast %union.anon* %7 to [2 x i8]*
%21 = getelementptr inbounds [2 x i8], [2 x i8]* %20, i64 0, i64 0
%22 = call i64 @read(i32 %19, i8* %21, i32 1)
%23 = bitcast %union.anon* %7 to [2 x i8]*
%24 = getelementptr inbounds [2 x i8], [2 x i8]* %23, i64 0, i64 1
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = and i32 %26, 240
%28 = trunc i32 %27 to i8
store i8 %28, i8* %8
%29 = load i8, i8* %8
%30 = sext i8 %29 to i32
switch i32 %30, label %118 [
i32 0, label %31
i32 16, label %34
i32 32, label %40
i32 48, label %46
i32 64, label %52
i32 80, label %58
i32 96, label %61
i32 112, label %67
i32 -128, label %73
i32 -112, label %79
i32 -96, label %85
i32 -80, label %91
i32 -64, label %97
i32 -48, label %103
i32 -32, label %109
i32 -16, label %115
]
31: ; preds = %18
%32 = load i32, i32* %9
%33 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %32)
br label %125
34: ; preds = %18
%35 = load i32, i32* %9
%36 = bitcast %union.anon* %7 to i32*
%37 = load i32, i32* %36
%38 = and i32 %37, 4095
%39 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %35, i32 %38)
br label %125
40: ; preds = %18
%41 = load i32, i32* %9
%42 = bitcast %union.anon* %7 to i32*
%43 = load i32, i32* %42
%44 = and i32 %43, 4095
%45 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %41, i32 %44)
br label %125
46: ; preds = %18
%47 = load i32, i32* %9
%48 = bitcast %union.anon* %7 to i32*
%49 = load i32, i32* %48
%50 = and i32 %49, 4095
%51 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %47, i32 %50)
br label %125
52: ; preds = %18
%53 = load i32, i32* %9
%54 = bitcast %union.anon* %7 to i32*
%55 = load i32, i32* %54
%56 = and i32 %55, 4095
%57 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %53, i32 %56)
br label %125
58: ; preds = %18
%59 = load i32, i32* %9
%60 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 %59)
br label %125
61: ; preds = %18
%62 = load i32, i32* %9
%63 = bitcast %union.anon* %7 to i32*
%64 = load i32, i32* %63
%65 = and i32 %64, 4095
%66 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %62, i32 %65)
br label %125
67: ; preds = %18
%68 = load i32, i32* %9
%69 = bitcast %union.anon* %7 to i32*
%70 = load i32, i32* %69
%71 = and i32 %70, 4095
%72 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i32 %68, i32 %71)
br label %125
73: ; preds = %18
%74 = load i32, i32* %9
%75 = bitcast %union.anon* %7 to i32*
%76 = load i32, i32* %75
%77 = and i32 %76, 4095
%78 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 %74, i32 %77)
br label %125
79: ; preds = %18
%80 = load i32, i32* %9
%81 = bitcast %union.anon* %7 to i32*
%82 = load i32, i32* %81
%83 = and i32 %82, 4095
%84 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i32 %80, i32 %83)
br label %125
85: ; preds = %18
%86 = load i32, i32* %9
%87 = bitcast %union.anon* %7 to i32*
%88 = load i32, i32* %87
%89 = and i32 %88, 4095
%90 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i32 %86, i32 %89)
br label %125
91: ; preds = %18
%92 = load i32, i32* %9
%93 = bitcast %union.anon* %7 to i32*
%94 = load i32, i32* %93
%95 = and i32 %94, 4095
%96 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0), i32 %92, i32 %95)
br label %125
97: ; preds = %18
%98 = load i32, i32* %9
%99 = bitcast %union.anon* %7 to i32*
%100 = load i32, i32* %99
%101 = and i32 %100, 4095
%102 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0), i32 %98, i32 %101)
br label %125
103: ; preds = %18
%104 = load i32, i32* %9
%105 = bitcast %union.anon* %7 to i32*
%106 = load i32, i32* %105
%107 = and i32 %106, 4095
%108 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0), i32 %104, i32 %107)
br label %125
109: ; preds = %18
%110 = load i32, i32* %9
%111 = bitcast %union.anon* %7 to i32*
%112 = load i32, i32* %111
%113 = and i32 %112, 4095
%114 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0), i32 %110, i32 %113)
br label %125
115: ; preds = %18
%116 = load i32, i32* %9
%117 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0), i32 %116)
br label %125
118: ; preds = %18
%119 = load i32, i32* @stderr
%120 = load i8**, i8*** %5
%121 = getelementptr inbounds i8*, i8** %120, i64 0
%122 = load i8*, i8** %121
%123 = call i32 @fprintf(i32 %119, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.17, i64 0, i64 0), i8* %122)
%124 = call i32 @exit(i32 1)
unreachable
125: ; preds = %115, %109, %103, %97, %91, %85, %79, %73, %67, %61, %58, %52, %46, %40, %34, %31
%126 = load i32, i32* %9
%127 = add nsw i32 %126, 1
store i32 %127, i32* %9
%128 = load i32, i32* %9
%129 = add nsw i32 %128, 1
store i32 %129, i32* %9
br label %12
130: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
%union.anon = type { i32 }
@.str = [10 x i8] c"image.sdm\00"
@O_RDONLY = global i32 0
@.str.1 = [8 x i8] c"%x\09nop\0A\00"
@.str.2 = [14 x i8] c"%x\09adda 0x%x\0A\00"
@.str.3 = [14 x i8] c"%x\09addm 0x%x\0A\00"
@.str.4 = [14 x i8] c"%x\09suba 0x%x\0A\00"
@.str.5 = [14 x i8] c"%x\09subm 0x%x\0A\00"
@.str.6 = [8 x i8] c"%x\09cla\0A\00"
@.str.7 = [13 x i8] c"%x\09clm 0x%x\0A\00"
@.str.8 = [13 x i8] c"%x\09jmp 0x%x\0A\00"
@.str.9 = [13 x i8] c"%x\09jin 0x%x\0A\00"
@.str.10 = [13 x i8] c"%x\09out 0x%x\0A\00"
@.str.11 = [12 x i8] c"%x\09in 0x%x\0A\00"
@.str.12 = [14 x i8] c"%x\09mova 0x%x\0A\00"
@.str.13 = [14 x i8] c"%x\09movm 0x%x\0A\00"
@.str.14 = [14 x i8] c"%x\09stoa 0x%x\0A\00"
@.str.15 = [12 x i8] c"%x\09eq 0x%x\0A\00"
@.str.16 = [8 x i8] c"%x\09hlt\0A\00"
@stderr = global i32 0
@.str.17 = [31 x i8] c"%s: opcode value out of range\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %union.anon
%4 = load i32, i32* @O_RDONLY
%5 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = bitcast %union.anon* %3 to i8*
%7 = bitcast %union.anon* %3 to [2 x i8]*
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %7, i64 0, i64 1
%9 = call i64 @read(i32 %5, i8* %8, i32 1)
%10 = icmp sgt i64 %9, 0
br i1 %10, label %11, label %88
11: ; preds = %2
%12 = getelementptr inbounds %union.anon, %union.anon* %3, i64 0, i32 0
br label %13
13: ; preds = %11, %84
%14 = phi i32 [ 0, %11 ], [ %85, %84 ]
%15 = call i64 @read(i32 %5, i8* %6, i32 1)
%16 = load i8, i8* %8
%17 = and i8 %16, -16
%18 = sext i8 %17 to i32
%19 = add nsw i32 %18, 128
%20 = lshr exact i32 %19, 4
switch i32 %20, label %79 [
i32 8, label %21
i32 9, label %23
i32 10, label %27
i32 11, label %31
i32 12, label %35
i32 13, label %39
i32 14, label %41
i32 15, label %45
i32 0, label %49
i32 1, label %53
i32 2, label %57
i32 3, label %61
i32 4, label %65
i32 5, label %69
i32 6, label %73
i32 7, label %77
]
21: ; preds = %13
%22 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %14)
br label %84
23: ; preds = %13
%24 = load i32, i32* %12
%25 = and i32 %24, 4095
%26 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %14, i32 %25)
br label %84
27: ; preds = %13
%28 = load i32, i32* %12
%29 = and i32 %28, 4095
%30 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %14, i32 %29)
br label %84
31: ; preds = %13
%32 = load i32, i32* %12
%33 = and i32 %32, 4095
%34 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %14, i32 %33)
br label %84
35: ; preds = %13
%36 = load i32, i32* %12
%37 = and i32 %36, 4095
%38 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i32 %14, i32 %37)
br label %84
39: ; preds = %13
%40 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0), i32 %14)
br label %84
41: ; preds = %13
%42 = load i32, i32* %12
%43 = and i32 %42, 4095
%44 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0), i32 %14, i32 %43)
br label %84
45: ; preds = %13
%46 = load i32, i32* %12
%47 = and i32 %46, 4095
%48 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i32 %14, i32 %47)
br label %84
49: ; preds = %13
%50 = load i32, i32* %12
%51 = and i32 %50, 4095
%52 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i32 %14, i32 %51)
br label %84
53: ; preds = %13
%54 = load i32, i32* %12
%55 = and i32 %54, 4095
%56 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i32 %14, i32 %55)
br label %84
57: ; preds = %13
%58 = load i32, i32* %12
%59 = and i32 %58, 4095
%60 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i32 %14, i32 %59)
br label %84
61: ; preds = %13
%62 = load i32, i32* %12
%63 = and i32 %62, 4095
%64 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0), i32 %14, i32 %63)
br label %84
65: ; preds = %13
%66 = load i32, i32* %12
%67 = and i32 %66, 4095
%68 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0), i32 %14, i32 %67)
br label %84
69: ; preds = %13
%70 = load i32, i32* %12
%71 = and i32 %70, 4095
%72 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.14, i64 0, i64 0), i32 %14, i32 %71)
br label %84
73: ; preds = %13
%74 = load i32, i32* %12
%75 = and i32 %74, 4095
%76 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0), i32 %14, i32 %75)
br label %84
77: ; preds = %13
%78 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.16, i64 0, i64 0), i32 %14)
br label %84
79: ; preds = %13
%80 = load i32, i32* @stderr
%81 = load i8*, i8** %1
%82 = tail call i32 @fprintf(i32 %80, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.17, i64 0, i64 0), i8* %81)
%83 = tail call i32 @exit(i32 1)
unreachable
84: ; preds = %77, %73, %69, %65, %61, %57, %53, %49, %45, %41, %39, %35, %31, %27, %23, %21
%85 = add nuw nsw i32 %14, 2
%86 = call i64 @read(i32 %5, i8* %8, i32 1)
%87 = icmp sgt i64 %86, 0
br i1 %87, label %13, label %88
88: ; preds = %84, %2
ret i32 0
}