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

/* Variables and functions */
int O_CREAT;
int O_WRONLY;
int S_IRUSR;
int S_IWUSR;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int getline(char **, size_t *, int /*<<< orphan*/ *);
int open(char *, int, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
char *strtok(char *, char *);
scalar_t__ strtol(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ write(int, char *, int);
int main(int argc, char **argv) {
  FILE *asmsource;
  char *line = NULL;
  size_t len = 0;
  int outputImageFD;
  char *mnemonic;
  union {
    int16_t word;
    char bytesInWord[2];
  } instruction;
  char *addressString = "a";
  char delimitor[3] = {' ', '\x0A', '\0'};
  if (argv[1] == NULL) {
    fprintf(stderr, "Usage: %s filename\n", argv[0]);
    exit(4);
  }
  asmsource = fopen(argv[1], "r");
  if (asmsource == NULL) {
    perror("input file error");
    exit(1);
  }
  outputImageFD = open("image.sdm", O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
  if (outputImageFD == -1) {
    perror("cannot create output file");
    exit(2);
  }
  while (getline(&line, &len, asmsource) != -1) {
    mnemonic = strtok(line, delimitor);
    addressString = strtok(NULL, delimitor);
    if (!strcmp(mnemonic, "nop")) {
      instruction.word = 0;
    } else if (!strcmp(mnemonic, "adda")) {
      instruction.word = 0x1000 + (int16_t)strtol(addressString, NULL, 0);
    } else if (!strcmp(mnemonic, "addm")) {
      instruction.word = 0x2000 + (int16_t)strtol(addressString, NULL, 0);
    } else if (!strcmp(mnemonic, "suba")) {
      instruction.word = 0x3000 + (int16_t)strtol(addressString, NULL, 0);
    } else if (!strcmp(mnemonic, "subm")) {
      instruction.word = 0x4000 + (int16_t)strtol(addressString, NULL, 0);
    } else if (!strcmp(mnemonic, "cla")) {
      instruction.word = 0x5000;
    } else if (!strcmp(mnemonic, "clm")) {
      instruction.word = 0x6000 + (int16_t)strtol(addressString, NULL, 0);
    } else if (!strcmp(mnemonic, "jmp")) {
      instruction.word = 0x7000 + (int16_t)strtol(addressString, NULL, 0);
    } else if (!strcmp(mnemonic, "jin")) {
      instruction.word = 0x8000 + (int16_t)strtol(addressString, NULL, 0);
    } else if (!strcmp(mnemonic, "out")) {
      instruction.word = 0x9000 + (int16_t)strtol(addressString, NULL, 0);
    } else if (!strcmp(mnemonic, "in")) {
      instruction.word = 0xA000 + (int16_t)strtol(addressString, NULL, 0);
    } else if (!strcmp(mnemonic, "mova")) {
      instruction.word = 0xB000 + (int16_t)strtol(addressString, NULL, 0);
    } else if (!strcmp(mnemonic, "movm")) {
      instruction.word = 0xC000 + (int16_t)strtol(addressString, NULL, 0);
    } else if (!strcmp(mnemonic, "stoa")) {
      instruction.word = 0xD000 + (int16_t)strtol(addressString, NULL, 0);
    } else if (!strcmp(mnemonic, "eq")) {
      instruction.word = 0xE000 + (int16_t)strtol(addressString, NULL, 0);
    } else if (!strcmp(mnemonic, "hlt")) {
      instruction.word = 0xF000;
    } else {
      fprintf(stderr, "%s: invalid instruction %s, exiting\n", argv[0],
              mnemonic);
      exit(3);
    }
    write(outputImageFD, &instruction.bytesInWord[1], sizeof(char));
    write(outputImageFD, &instruction.bytesInWord[0], sizeof(char));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
lea    0xe90(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xe28(%rip),%ax
mov    %ax,-0x4b(%rbp)
mov    0xe20(%rip),%al
mov    %al,-0x49(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,0x8(%rax)
jne    121c <main+0x7c>
mov    0x2dd5(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdf8(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x4,%edi
call   10c0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdfb(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1255 <main+0xb5>
lea    0xdd1(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    0x2d5c(%rip),%rax
mov    (%rax),%esi
mov    0x2d93(%rip),%rax
or     (%rax),%esi
mov    0x2d5a(%rip),%rax
mov    (%rax),%edx
mov    0x2d69(%rip),%rax
or     (%rax),%edx
lea    0xda8(%rip),%rdi
call   1070 <open@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0xffffffff,-0x2c(%rbp)
jne    12a8 <main+0x108>
lea    0xd99(%rip),%rdi
call   1090 <perror@plt>
mov    $0x2,%edi
call   10c0 <exit@plt>
jmp    12ad <main+0x10d>
mov    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   10b0 <getline@plt>
cmp    $0xffffffff,%eax
je     16ca <main+0x52a>
mov    -0x20(%rbp),%rdi
lea    -0x4b(%rbp),%rsi
call   10a0 <strtok@plt>
mov    %rax,-0x38(%rbp)
lea    -0x4b(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <strtok@plt>
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%rdi
lea    0xd58(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    130f <main+0x16f>
movq   $0x0,-0x40(%rbp)
jmp    169f <main+0x4ff>
mov    -0x38(%rbp),%rdi
lea    0xd36(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1346 <main+0x1a6>
mov    -0x48(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0x1000,%rax
mov    %rax,-0x40(%rbp)
jmp    169a <main+0x4fa>
mov    -0x38(%rbp),%rdi
lea    0xd04(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    137d <main+0x1dd>
mov    -0x48(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0x2000,%rax
mov    %rax,-0x40(%rbp)
jmp    1695 <main+0x4f5>
mov    -0x38(%rbp),%rdi
lea    0xcd2(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    13b4 <main+0x214>
mov    -0x48(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0x3000,%rax
mov    %rax,-0x40(%rbp)
jmp    1690 <main+0x4f0>
mov    -0x38(%rbp),%rdi
lea    0xca0(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    13eb <main+0x24b>
mov    -0x48(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0x4000,%rax
mov    %rax,-0x40(%rbp)
jmp    168b <main+0x4eb>
mov    -0x38(%rbp),%rdi
lea    0xc6e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1412 <main+0x272>
mov    $0x5000,%eax
mov    %rax,-0x40(%rbp)
jmp    1686 <main+0x4e6>
mov    -0x38(%rbp),%rdi
lea    0xc4b(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1449 <main+0x2a9>
mov    -0x48(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0x6000,%rax
mov    %rax,-0x40(%rbp)
jmp    1681 <main+0x4e1>
mov    -0x38(%rbp),%rdi
lea    0xc18(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1480 <main+0x2e0>
mov    -0x48(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0x7000,%rax
mov    %rax,-0x40(%rbp)
jmp    167c <main+0x4dc>
mov    -0x38(%rbp),%rdi
lea    0xbe5(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    14b7 <main+0x317>
mov    -0x48(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0x8000,%rax
mov    %rax,-0x40(%rbp)
jmp    1677 <main+0x4d7>
mov    -0x38(%rbp),%rdi
lea    0xbb2(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    14ee <main+0x34e>
mov    -0x48(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0x9000,%rax
mov    %rax,-0x40(%rbp)
jmp    1672 <main+0x4d2>
mov    -0x38(%rbp),%rdi
lea    0xb78(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1525 <main+0x385>
mov    -0x48(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0xa000,%rax
mov    %rax,-0x40(%rbp)
jmp    166d <main+0x4cd>
mov    -0x38(%rbp),%rdi
lea    0xb48(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    155c <main+0x3bc>
mov    -0x48(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0xb000,%rax
mov    %rax,-0x40(%rbp)
jmp    1668 <main+0x4c8>
mov    -0x38(%rbp),%rdi
lea    0xb16(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1593 <main+0x3f3>
mov    -0x48(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0xc000,%rax
mov    %rax,-0x40(%rbp)
jmp    1663 <main+0x4c3>
mov    -0x38(%rbp),%rdi
lea    0xae4(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    15ca <main+0x42a>
mov    -0x48(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0xd000,%rax
mov    %rax,-0x40(%rbp)
jmp    165e <main+0x4be>
mov    -0x38(%rbp),%rdi
lea    0xab2(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1601 <main+0x461>
mov    -0x48(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0xe000,%rax
mov    %rax,-0x40(%rbp)
jmp    1659 <main+0x4b9>
mov    -0x38(%rbp),%rdi
lea    0xa7e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1628 <main+0x488>
mov    $0xf000,%eax
mov    %rax,-0x40(%rbp)
jmp    1654 <main+0x4b4>
mov    0x29a1(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x38(%rbp),%rcx
lea    0xa4b(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x3,%edi
call   10c0 <exit@plt>
jmp    1659 <main+0x4b9>
jmp    165e <main+0x4be>
jmp    1663 <main+0x4c3>
jmp    1668 <main+0x4c8>
jmp    166d <main+0x4cd>
jmp    1672 <main+0x4d2>
jmp    1677 <main+0x4d7>
jmp    167c <main+0x4dc>
jmp    1681 <main+0x4e1>
jmp    1686 <main+0x4e6>
jmp    168b <main+0x4eb>
jmp    1690 <main+0x4f0>
jmp    1695 <main+0x4f5>
jmp    169a <main+0x4fa>
jmp    169f <main+0x4ff>
mov    -0x2c(%rbp),%edi
lea    -0x40(%rbp),%rsi
add    $0x1,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    -0x2c(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
jmp    12ad <main+0x10d>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbp
movq   $0x0,0x10(%rsp)
movq   $0x0,0x18(%rsp)
movb   $0x0,0xe(%rsp)
movw   $0xa20,0xc(%rsp)
mov    0x8(%rsi),%rdi
test   %rdi,%rdi
je     15bd <main+0x41d>
lea    0xe43(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     15e2 <main+0x442>
mov    %rax,%rbx
mov    %rbp,0x20(%rsp)
mov    0x2db8(%rip),%rax
mov    0x2df1(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2db6(%rip),%rax
mov    0x2dc7(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
lea    0xe04(%rip),%rdi
call   1070 <open@plt>
cmp    $0xffffffff,%eax
je     15f8 <main+0x458>
mov    %eax,%ebp
lea    0x10(%rsp),%rdi
lea    0x18(%rsp),%rsi
mov    %rbx,%rdx
call   10b0 <getline@plt>
cmp    $0xffffffff,%eax
je     15ac <main+0x40c>
lea    0xc(%rsp),%r12
lea    0x18(%rsp),%r13
jmp    12a1 <main+0x101>
nopl   0x0(%rax,%rax,1)
movq   $0x0,(%rsp)
mov    %ebp,%edi
lea    0x1(%rsp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    %ebp,%edi
mov    %rsp,%rsi
mov    $0x1,%edx
call   1030 <write@plt>
lea    0x10(%rsp),%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   10b0 <getline@plt>
cmp    $0xffffffff,%eax
je     15ac <main+0x40c>
mov    0x10(%rsp),%rdi
mov    %r12,%rsi
call   10a0 <strtok@plt>
mov    %rax,%r15
xor    %edi,%edi
mov    %r12,%rsi
call   10a0 <strtok@plt>
mov    %rax,%r14
mov    %r15,%rdi
lea    0xd84(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1260 <main+0xc0>
mov    %r15,%rdi
lea    0xd75(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1440 <main+0x2a0>
mov    %r15,%rdi
lea    0xd63(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     145b <main+0x2bb>
mov    %r15,%rdi
lea    0xd51(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1476 <main+0x2d6>
mov    %r15,%rdi
lea    0xd3f(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1491 <main+0x2f1>
mov    %r15,%rdi
lea    0xd2d(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     14ac <main+0x30c>
mov    %r15,%rdi
lea    0xd1a(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     14b9 <main+0x319>
mov    %r15,%rdi
lea    0xd07(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     14d4 <main+0x334>
mov    %r15,%rdi
lea    0xcf4(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     14ef <main+0x34f>
mov    %r15,%rdi
lea    0xce1(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     150a <main+0x36a>
mov    %r15,%rdi
lea    0xcc7(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1525 <main+0x385>
mov    %r15,%rdi
lea    0xcb7(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1540 <main+0x3a0>
mov    %r15,%rdi
lea    0xca5(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     155b <main+0x3bb>
mov    %r15,%rdi
lea    0xc93(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1576 <main+0x3d6>
mov    %r15,%rdi
lea    0xc81(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1591 <main+0x3f1>
mov    %r15,%rdi
lea    0xc6d(%rip),%rsi
call   1040 <strcmp@plt>
test   %eax,%eax
jne    160e <main+0x46e>
movq   $0xf000,(%rsp)
jmp    1268 <main+0xc8>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0x1000,%rax
mov    %rax,(%rsp)
jmp    1268 <main+0xc8>
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0x2000,%rax
mov    %rax,(%rsp)
jmp    1268 <main+0xc8>
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0x3000,%rax
mov    %rax,(%rsp)
jmp    1268 <main+0xc8>
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0x4000,%rax
mov    %rax,(%rsp)
jmp    1268 <main+0xc8>
movq   $0x5000,(%rsp)
jmp    1268 <main+0xc8>
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0x6000,%rax
mov    %rax,(%rsp)
jmp    1268 <main+0xc8>
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0x7000,%rax
mov    %rax,(%rsp)
jmp    1268 <main+0xc8>
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0x8000,%rax
mov    %rax,(%rsp)
jmp    1268 <main+0xc8>
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0x9000,%rax
mov    %rax,(%rsp)
jmp    1268 <main+0xc8>
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0xa000,%rax
mov    %rax,(%rsp)
jmp    1268 <main+0xc8>
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0xb000,%rax
mov    %rax,(%rsp)
jmp    1268 <main+0xc8>
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0xc000,%rax
mov    %rax,(%rsp)
jmp    1268 <main+0xc8>
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0xd000,%rax
mov    %rax,(%rsp)
jmp    1268 <main+0xc8>
mov    %r14,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <strtol@plt>
add    $0xe000,%rax
mov    %rax,(%rsp)
jmp    1268 <main+0xc8>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2a0c(%rip),%rax
mov    (%rax),%edi
mov    0x0(%rbp),%rdx
lea    0xa32(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x4,%edi
call   10c0 <exit@plt>
lea    0xa2e(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
lea    0xa33(%rip),%rdi
call   1090 <perror@plt>
mov    $0x2,%edi
call   10c0 <exit@plt>
mov    0x29bb(%rip),%rax
mov    (%rax),%edi
mov    0x20(%rsp),%rax
mov    (%rax),%rdx
lea    0xa68(%rip),%rsi
mov    %r15,%rcx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x3,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
%union.anon = type { i8* }
@.str = [2 x i8] c"a\00"
@__const.main.delimitor = [3 x i8] c" \0A\00"
@stderr = global i32 0
@.str.1 = [20 x i8] c"Usage: %s filename\0A\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [17 x i8] c"input file error\00"
@.str.4 = [10 x i8] c"image.sdm\00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@.str.5 = [26 x i8] c"cannot create output file\00"
@.str.6 = [4 x i8] c"nop\00"
@.str.7 = [5 x i8] c"adda\00"
@.str.8 = [5 x i8] c"addm\00"
@.str.9 = [5 x i8] c"suba\00"
@.str.10 = [5 x i8] c"subm\00"
@.str.11 = [4 x i8] c"cla\00"
@.str.12 = [4 x i8] c"clm\00"
@.str.13 = [4 x i8] c"jmp\00"
@.str.14 = [4 x i8] c"jin\00"
@.str.15 = [4 x i8] c"out\00"
@.str.16 = [3 x i8] c"in\00"
@.str.17 = [5 x i8] c"mova\00"
@.str.18 = [5 x i8] c"movm\00"
@.str.19 = [5 x i8] c"stoa\00"
@.str.20 = [3 x i8] c"eq\00"
@.str.21 = [4 x i8] c"hlt\00"
@.str.22 = [37 x i8] c"%s: invalid instruction %s, exiting\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
%10 = alloca i8*
%11 = alloca %union.anon
%12 = alloca i8*
%13 = alloca [3 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %7
store i64 0, i64* %8
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %12
%14 = bitcast [3 x i8]* %13 to i8*
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %26
19: ; preds = %2
%20 = load i32, i32* @stderr
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 0
%23 = load i8*, i8** %22
%24 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %23)
%25 = call i32 @exit(i32 4)
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 ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %30, i32** %6
%31 = load i32*, i32** %6
%32 = icmp eq i32* %31, null
br i1 %32, label %33, label %36
33: ; preds = %26
%34 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%35 = call i32 @exit(i32 1)
unreachable
36: ; preds = %26
%37 = load i32, i32* @O_WRONLY
%38 = load i32, i32* @O_CREAT
%39 = or i32 %37, %38
%40 = load i32, i32* @S_IRUSR
%41 = load i32, i32* @S_IWUSR
%42 = or i32 %40, %41
%43 = call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %39, i32 %42)
store i32 %43, i32* %9
%44 = load i32, i32* %9
%45 = icmp eq i32 %44, -1
br i1 %45, label %46, label %49
46: ; preds = %36
%47 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%48 = call i32 @exit(i32 2)
unreachable
49: ; preds = %36
br label %50
50: ; preds = %230, %49
%51 = load i32*, i32** %6
%52 = call i32 @getline(i8** %7, i64* %8, i32* %51)
%53 = icmp ne i32 %52, -1
br i1 %53, label %54, label %239
54: ; preds = %50
%55 = load i8*, i8** %7
%56 = getelementptr inbounds [3 x i8], [3 x i8]* %13, i64 0, i64 0
%57 = call i8* @strtok(i8* %55, i8* %56)
store i8* %57, i8** %10
%58 = getelementptr inbounds [3 x i8], [3 x i8]* %13, i64 0, i64 0
%59 = call i8* @strtok(i8* null, i8* %58)
store i8* %59, i8** %12
%60 = load i8*, i8** %10
%61 = call i32 @strcmp(i8* %60, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%62 = icmp ne i32 %61, 0
br i1 %62, label %65, label %63
63: ; preds = %54
%64 = bitcast %union.anon* %11 to i8**
store i8* null, i8** %64
br label %230
65: ; preds = %54
%66 = load i8*, i8** %10
%67 = call i32 @strcmp(i8* %66, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%68 = icmp ne i32 %67, 0
br i1 %68, label %75, label %69
69: ; preds = %65
%70 = load i8*, i8** %12
%71 = call i64 @strtol(i8* %70, i32* null, i32 0)
%72 = inttoptr i64 %71 to i8*
%73 = getelementptr i8, i8* %72, i64 4096
%74 = bitcast %union.anon* %11 to i8**
store i8* %73, i8** %74
br label %229
75: ; preds = %65
%76 = load i8*, i8** %10
%77 = call i32 @strcmp(i8* %76, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%78 = icmp ne i32 %77, 0
br i1 %78, label %85, label %79
79: ; preds = %75
%80 = load i8*, i8** %12
%81 = call i64 @strtol(i8* %80, i32* null, i32 0)
%82 = inttoptr i64 %81 to i8*
%83 = getelementptr i8, i8* %82, i64 8192
%84 = bitcast %union.anon* %11 to i8**
store i8* %83, i8** %84
br label %228
85: ; preds = %75
%86 = load i8*, i8** %10
%87 = call i32 @strcmp(i8* %86, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%88 = icmp ne i32 %87, 0
br i1 %88, label %95, label %89
89: ; preds = %85
%90 = load i8*, i8** %12
%91 = call i64 @strtol(i8* %90, i32* null, i32 0)
%92 = inttoptr i64 %91 to i8*
%93 = getelementptr i8, i8* %92, i64 12288
%94 = bitcast %union.anon* %11 to i8**
store i8* %93, i8** %94
br label %227
95: ; preds = %85
%96 = load i8*, i8** %10
%97 = call i32 @strcmp(i8* %96, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%98 = icmp ne i32 %97, 0
br i1 %98, label %105, label %99
99: ; preds = %95
%100 = load i8*, i8** %12
%101 = call i64 @strtol(i8* %100, i32* null, i32 0)
%102 = inttoptr i64 %101 to i8*
%103 = getelementptr i8, i8* %102, i64 16384
%104 = bitcast %union.anon* %11 to i8**
store i8* %103, i8** %104
br label %226
105: ; preds = %95
%106 = load i8*, i8** %10
%107 = call i32 @strcmp(i8* %106, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%108 = icmp ne i32 %107, 0
br i1 %108, label %111, label %109
109: ; preds = %105
%110 = bitcast %union.anon* %11 to i8**
store i8* inttoptr (i64 20480 to i8*), i8** %110
br label %225
111: ; preds = %105
%112 = load i8*, i8** %10
%113 = call i32 @strcmp(i8* %112, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
%114 = icmp ne i32 %113, 0
br i1 %114, label %121, label %115
115: ; preds = %111
%116 = load i8*, i8** %12
%117 = call i64 @strtol(i8* %116, i32* null, i32 0)
%118 = inttoptr i64 %117 to i8*
%119 = getelementptr i8, i8* %118, i64 24576
%120 = bitcast %union.anon* %11 to i8**
store i8* %119, i8** %120
br label %224
121: ; preds = %111
%122 = load i8*, i8** %10
%123 = call i32 @strcmp(i8* %122, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0))
%124 = icmp ne i32 %123, 0
br i1 %124, label %131, label %125
125: ; preds = %121
%126 = load i8*, i8** %12
%127 = call i64 @strtol(i8* %126, i32* null, i32 0)
%128 = inttoptr i64 %127 to i8*
%129 = getelementptr i8, i8* %128, i64 28672
%130 = bitcast %union.anon* %11 to i8**
store i8* %129, i8** %130
br label %223
131: ; preds = %121
%132 = load i8*, i8** %10
%133 = call i32 @strcmp(i8* %132, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0))
%134 = icmp ne i32 %133, 0
br i1 %134, label %141, label %135
135: ; preds = %131
%136 = load i8*, i8** %12
%137 = call i64 @strtol(i8* %136, i32* null, i32 0)
%138 = inttoptr i64 %137 to i8*
%139 = getelementptr i8, i8* %138, i64 32768
%140 = bitcast %union.anon* %11 to i8**
store i8* %139, i8** %140
br label %222
141: ; preds = %131
%142 = load i8*, i8** %10
%143 = call i32 @strcmp(i8* %142, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0))
%144 = icmp ne i32 %143, 0
br i1 %144, label %151, label %145
145: ; preds = %141
%146 = load i8*, i8** %12
%147 = call i64 @strtol(i8* %146, i32* null, i32 0)
%148 = inttoptr i64 %147 to i8*
%149 = getelementptr i8, i8* %148, i64 36864
%150 = bitcast %union.anon* %11 to i8**
store i8* %149, i8** %150
br label %221
151: ; preds = %141
%152 = load i8*, i8** %10
%153 = call i32 @strcmp(i8* %152, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0))
%154 = icmp ne i32 %153, 0
br i1 %154, label %161, label %155
155: ; preds = %151
%156 = load i8*, i8** %12
%157 = call i64 @strtol(i8* %156, i32* null, i32 0)
%158 = inttoptr i64 %157 to i8*
%159 = getelementptr i8, i8* %158, i64 40960
%160 = bitcast %union.anon* %11 to i8**
store i8* %159, i8** %160
br label %220
161: ; preds = %151
%162 = load i8*, i8** %10
%163 = call i32 @strcmp(i8* %162, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0))
%164 = icmp ne i32 %163, 0
br i1 %164, label %171, label %165
165: ; preds = %161
%166 = load i8*, i8** %12
%167 = call i64 @strtol(i8* %166, i32* null, i32 0)
%168 = inttoptr i64 %167 to i8*
%169 = getelementptr i8, i8* %168, i64 45056
%170 = bitcast %union.anon* %11 to i8**
store i8* %169, i8** %170
br label %219
171: ; preds = %161
%172 = load i8*, i8** %10
%173 = call i32 @strcmp(i8* %172, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0))
%174 = icmp ne i32 %173, 0
br i1 %174, label %181, label %175
175: ; preds = %171
%176 = load i8*, i8** %12
%177 = call i64 @strtol(i8* %176, i32* null, i32 0)
%178 = inttoptr i64 %177 to i8*
%179 = getelementptr i8, i8* %178, i64 49152
%180 = bitcast %union.anon* %11 to i8**
store i8* %179, i8** %180
br label %218
181: ; preds = %171
%182 = load i8*, i8** %10
%183 = call i32 @strcmp(i8* %182, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0))
%184 = icmp ne i32 %183, 0
br i1 %184, label %191, label %185
185: ; preds = %181
%186 = load i8*, i8** %12
%187 = call i64 @strtol(i8* %186, i32* null, i32 0)
%188 = inttoptr i64 %187 to i8*
%189 = getelementptr i8, i8* %188, i64 53248
%190 = bitcast %union.anon* %11 to i8**
store i8* %189, i8** %190
br label %217
191: ; preds = %181
%192 = load i8*, i8** %10
%193 = call i32 @strcmp(i8* %192, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0))
%194 = icmp ne i32 %193, 0
br i1 %194, label %201, label %195
195: ; preds = %191
%196 = load i8*, i8** %12
%197 = call i64 @strtol(i8* %196, i32* null, i32 0)
%198 = inttoptr i64 %197 to i8*
%199 = getelementptr i8, i8* %198, i64 57344
%200 = bitcast %union.anon* %11 to i8**
store i8* %199, i8** %200
br label %216
201: ; preds = %191
%202 = load i8*, i8** %10
%203 = call i32 @strcmp(i8* %202, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.21, i64 0, i64 0))
%204 = icmp ne i32 %203, 0
br i1 %204, label %207, label %205
205: ; preds = %201
%206 = bitcast %union.anon* %11 to i8**
store i8* inttoptr (i64 61440 to i8*), i8** %206
br label %215
207: ; preds = %201
%208 = load i32, i32* @stderr
%209 = load i8**, i8*** %5
%210 = getelementptr inbounds i8*, i8** %209, i64 0
%211 = load i8*, i8** %210
%212 = load i8*, i8** %10
%213 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %208, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.22, i64 0, i64 0), i8* %211, i8* %212)
%214 = call i32 @exit(i32 3)
unreachable
215: ; preds = %205
br label %216
216: ; preds = %215, %195
br label %217
217: ; preds = %216, %185
br label %218
218: ; preds = %217, %175
br label %219
219: ; preds = %218, %165
br label %220
220: ; preds = %219, %155
br label %221
221: ; preds = %220, %145
br label %222
222: ; preds = %221, %135
br label %223
223: ; preds = %222, %125
br label %224
224: ; preds = %223, %115
br label %225
225: ; preds = %224, %109
br label %226
226: ; preds = %225, %99
br label %227
227: ; preds = %226, %89
br label %228
228: ; preds = %227, %79
br label %229
229: ; preds = %228, %69
br label %230
230: ; preds = %229, %63
%231 = load i32, i32* %9
%232 = bitcast %union.anon* %11 to [2 x i8]*
%233 = getelementptr inbounds [2 x i8], [2 x i8]* %232, i64 0, i64 1
%234 = call i32 @write(i32 %231, i8* %233, i32 1)
%235 = load i32, i32* %9
%236 = bitcast %union.anon* %11 to [2 x i8]*
%237 = getelementptr inbounds [2 x i8], [2 x i8]* %236, i64 0, i64 0
%238 = call i32 @write(i32 %235, i8* %237, i32 1)
br label %50
239: ; preds = %50
ret i32 0
}

LLVM IR (-O2):
%union.anon = type { i8* }
@__const.main.delimitor = [3 x i8] c" \0A\00"
@stderr = global i32 0
@.str.1 = [20 x i8] c"Usage: %s filename\0A\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [17 x i8] c"input file error\00"
@.str.4 = [10 x i8] c"image.sdm\00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@.str.5 = [26 x i8] c"cannot create output file\00"
@.str.6 = [4 x i8] c"nop\00"
@.str.7 = [5 x i8] c"adda\00"
@.str.8 = [5 x i8] c"addm\00"
@.str.9 = [5 x i8] c"suba\00"
@.str.10 = [5 x i8] c"subm\00"
@.str.11 = [4 x i8] c"cla\00"
@.str.12 = [4 x i8] c"clm\00"
@.str.13 = [4 x i8] c"jmp\00"
@.str.14 = [4 x i8] c"jin\00"
@.str.15 = [4 x i8] c"out\00"
@.str.16 = [3 x i8] c"in\00"
@.str.17 = [5 x i8] c"mova\00"
@.str.18 = [5 x i8] c"movm\00"
@.str.19 = [5 x i8] c"stoa\00"
@.str.20 = [3 x i8] c"eq\00"
@.str.21 = [4 x i8] c"hlt\00"
@.str.22 = [37 x i8] c"%s: invalid instruction %s, exiting\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca %union.anon
%6 = alloca [3 x i8]
%7 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%8 = bitcast i64* %4 to i8*
store i64 0, i64* %4
%9 = bitcast %union.anon* %5 to i8*
%10 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %19
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %1
%17 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = tail call i32 @exit(i32 4)
unreachable
19: ; preds = %2
%20 = tail call i32* @fopen(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = tail call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%24 = tail call i32 @exit(i32 1)
unreachable
25: ; preds = %19
%26 = load i32, i32* @O_WRONLY
%27 = load i32, i32* @O_CREAT
%28 = or i32 %27, %26
%29 = load i32, i32* @S_IRUSR
%30 = load i32, i32* @S_IWUSR
%31 = or i32 %30, %29
%32 = tail call i32 @open(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %28, i32 %31)
%33 = icmp eq i32 %32, -1
br i1 %33, label %41, label %34
34: ; preds = %25
%35 = call i32 @getline(i8** %3, i64* %4, i32* %20)
%36 = icmp eq i32 %35, -1
br i1 %36, label %160, label %37
37: ; preds = %34
%38 = getelementptr inbounds %union.anon, %union.anon* %5, i64 0, i32 0
%39 = bitcast %union.anon* %5 to [2 x i8]*
%40 = getelementptr inbounds [2 x i8], [2 x i8]* %39, i64 0, i64 1
br label %44
41: ; preds = %25
%42 = tail call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0))
%43 = tail call i32 @exit(i32 2)
unreachable
44: ; preds = %37, %155
%45 = load i8*, i8** %3
%46 = call i8* @strtok(i8* %45, i8* %10)
%47 = call i8* @strtok(i8* null, i8* %10)
%48 = call i32 @strcmp(i8* dereferenceable(1) %46, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %51
50: ; preds = %44
store i8* null, i8** %38
br label %155
51: ; preds = %44
%52 = call i32 @strcmp(i8* dereferenceable(1) %46, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%53 = icmp eq i32 %52, 0
br i1 %53, label %54, label %58
54: ; preds = %51
%55 = call i64 @strtol(i8* nocapture %47, i32* null, i32 0)
%56 = inttoptr i64 %55 to i8*
%57 = getelementptr i8, i8* %56, i64 4096
store i8* %57, i8** %38
br label %155
58: ; preds = %51
%59 = call i32 @strcmp(i8* dereferenceable(1) %46, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%60 = icmp eq i32 %59, 0
br i1 %60, label %61, label %65
61: ; preds = %58
%62 = call i64 @strtol(i8* nocapture %47, i32* null, i32 0)
%63 = inttoptr i64 %62 to i8*
%64 = getelementptr i8, i8* %63, i64 8192
store i8* %64, i8** %38
br label %155
65: ; preds = %58
%66 = call i32 @strcmp(i8* dereferenceable(1) %46, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%67 = icmp eq i32 %66, 0
br i1 %67, label %68, label %72
68: ; preds = %65
%69 = call i64 @strtol(i8* nocapture %47, i32* null, i32 0)
%70 = inttoptr i64 %69 to i8*
%71 = getelementptr i8, i8* %70, i64 12288
store i8* %71, i8** %38
br label %155
72: ; preds = %65
%73 = call i32 @strcmp(i8* dereferenceable(1) %46, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%74 = icmp eq i32 %73, 0
br i1 %74, label %75, label %79
75: ; preds = %72
%76 = call i64 @strtol(i8* nocapture %47, i32* null, i32 0)
%77 = inttoptr i64 %76 to i8*
%78 = getelementptr i8, i8* %77, i64 16384
store i8* %78, i8** %38
br label %155
79: ; preds = %72
%80 = call i32 @strcmp(i8* dereferenceable(1) %46, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%81 = icmp eq i32 %80, 0
br i1 %81, label %82, label %83
82: ; preds = %79
store i8* inttoptr (i64 20480 to i8*), i8** %38
br label %155
83: ; preds = %79
%84 = call i32 @strcmp(i8* dereferenceable(1) %46, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
%85 = icmp eq i32 %84, 0
br i1 %85, label %86, label %90
86: ; preds = %83
%87 = call i64 @strtol(i8* nocapture %47, i32* null, i32 0)
%88 = inttoptr i64 %87 to i8*
%89 = getelementptr i8, i8* %88, i64 24576
store i8* %89, i8** %38
br label %155
90: ; preds = %83
%91 = call i32 @strcmp(i8* dereferenceable(1) %46, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0))
%92 = icmp eq i32 %91, 0
br i1 %92, label %93, label %97
93: ; preds = %90
%94 = call i64 @strtol(i8* nocapture %47, i32* null, i32 0)
%95 = inttoptr i64 %94 to i8*
%96 = getelementptr i8, i8* %95, i64 28672
store i8* %96, i8** %38
br label %155
97: ; preds = %90
%98 = call i32 @strcmp(i8* dereferenceable(1) %46, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0))
%99 = icmp eq i32 %98, 0
br i1 %99, label %100, label %104
100: ; preds = %97
%101 = call i64 @strtol(i8* nocapture %47, i32* null, i32 0)
%102 = inttoptr i64 %101 to i8*
%103 = getelementptr i8, i8* %102, i64 32768
store i8* %103, i8** %38
br label %155
104: ; preds = %97
%105 = call i32 @strcmp(i8* dereferenceable(1) %46, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0))
%106 = icmp eq i32 %105, 0
br i1 %106, label %107, label %111
107: ; preds = %104
%108 = call i64 @strtol(i8* nocapture %47, i32* null, i32 0)
%109 = inttoptr i64 %108 to i8*
%110 = getelementptr i8, i8* %109, i64 36864
store i8* %110, i8** %38
br label %155
111: ; preds = %104
%112 = call i32 @strcmp(i8* dereferenceable(1) %46, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0))
%113 = icmp eq i32 %112, 0
br i1 %113, label %114, label %118
114: ; preds = %111
%115 = call i64 @strtol(i8* nocapture %47, i32* null, i32 0)
%116 = inttoptr i64 %115 to i8*
%117 = getelementptr i8, i8* %116, i64 40960
store i8* %117, i8** %38
br label %155
118: ; preds = %111
%119 = call i32 @strcmp(i8* dereferenceable(1) %46, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.17, i64 0, i64 0))
%120 = icmp eq i32 %119, 0
br i1 %120, label %121, label %125
121: ; preds = %118
%122 = call i64 @strtol(i8* nocapture %47, i32* null, i32 0)
%123 = inttoptr i64 %122 to i8*
%124 = getelementptr i8, i8* %123, i64 45056
store i8* %124, i8** %38
br label %155
125: ; preds = %118
%126 = call i32 @strcmp(i8* dereferenceable(1) %46, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0))
%127 = icmp eq i32 %126, 0
br i1 %127, label %128, label %132
128: ; preds = %125
%129 = call i64 @strtol(i8* nocapture %47, i32* null, i32 0)
%130 = inttoptr i64 %129 to i8*
%131 = getelementptr i8, i8* %130, i64 49152
store i8* %131, i8** %38
br label %155
132: ; preds = %125
%133 = call i32 @strcmp(i8* dereferenceable(1) %46, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0))
%134 = icmp eq i32 %133, 0
br i1 %134, label %135, label %139
135: ; preds = %132
%136 = call i64 @strtol(i8* nocapture %47, i32* null, i32 0)
%137 = inttoptr i64 %136 to i8*
%138 = getelementptr i8, i8* %137, i64 53248
store i8* %138, i8** %38
br label %155
139: ; preds = %132
%140 = call i32 @strcmp(i8* dereferenceable(1) %46, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0))
%141 = icmp eq i32 %140, 0
br i1 %141, label %142, label %146
142: ; preds = %139
%143 = call i64 @strtol(i8* nocapture %47, i32* null, i32 0)
%144 = inttoptr i64 %143 to i8*
%145 = getelementptr i8, i8* %144, i64 57344
store i8* %145, i8** %38
br label %155
146: ; preds = %139
%147 = call i32 @strcmp(i8* dereferenceable(1) %46, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.21, i64 0, i64 0))
%148 = icmp eq i32 %147, 0
br i1 %148, label %149, label %150
149: ; preds = %146
store i8* inttoptr (i64 61440 to i8*), i8** %38
br label %155
150: ; preds = %146
%151 = load i32, i32* @stderr
%152 = load i8*, i8** %1
%153 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %151, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.22, i64 0, i64 0), i8* %152, i8* %46)
%154 = call i32 @exit(i32 3)
unreachable
155: ; preds = %54, %68, %82, %93, %107, %121, %135, %149, %142, %128, %114, %100, %86, %75, %61, %50
%156 = call i32 @write(i32 %32, i8* %40, i32 1)
%157 = call i32 @write(i32 %32, i8* %9, i32 1)
%158 = call i32 @getline(i8** %3, i64* %4, i32* %20)
%159 = icmp eq i32 %158, -1
br i1 %159, label %160, label %44
160: ; preds = %155, %34
ret i32 0
}