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

/* Variables and functions */
int /*<<< orphan*/ clean_line(char *, char const *);
unsigned char decode_parameter(char *, int *, unsigned short *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned short *, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
int dcpu16_assemble(unsigned char *out, const char *unoline) {
  unsigned short wordA = 0, wordB = 0;
  int basic_opcode = 0;
  int non_basic_opcode = 0;
  char line[256], *param;
  int off = 0;
  clean_line(line, unoline);
  if (!(*line))
    return 0;
  if (!strlen(line) < 4)
    return 0;
  param = line + 3;
  if (!strncmp("SET", line, 3))
    basic_opcode = 0x1;
  else if (!strncmp("ADD", line, 3))
    basic_opcode = 0x2;
  else if (!strncmp("SUB", line, 3))
    basic_opcode = 0x3;
  else if (!strncmp("MUL", line, 3))
    basic_opcode = 0x4;
  else if (!strncmp("DIV", line, 3))
    basic_opcode = 0x5;
  else if (!strncmp("MOD", line, 3))
    basic_opcode = 0x6;
  else if (!strncmp("SHL", line, 3))
    basic_opcode = 0x7;
  else if (!strncmp("SHR", line, 3))
    basic_opcode = 0x8;
  else if (!strncmp("AND", line, 3))
    basic_opcode = 0x9;
  else if (!strncmp("BOR", line, 3))
    basic_opcode = 0xA;
  else if (!strncmp("XOR", line, 3))
    basic_opcode = 0xB;
  else if (!strncmp("IFE", line, 3))
    basic_opcode = 0xC;
  else if (!strncmp("IFN", line, 3))
    basic_opcode = 0xD;
  else if (!strncmp("IFG", line, 3))
    basic_opcode = 0xE;
  else if (!strncmp("IFB", line, 3))
    basic_opcode = 0xF;
  if (basic_opcode == 0) {
    if (!strncmp("JSR", line, 3)) {
      non_basic_opcode = 0x1;
    } else {
      fprintf(stderr, "Unknown instruction\n");
      return -1;
    }
  }
  if (basic_opcode != 0) {
    unsigned char paramA = 0, paramB = 0;
    int cn = 0;
    while (param[cn] != ',' && param[cn] != '\n' && param[cn] != 0 && cn < 256)
      cn++;
    if (param[cn] == ',') {
      unsigned short first_word;
      int extraA = 0;
      int extraB = 0;
      char *pa, *pb;
      param[cn] = 0;
      pa = param;
      pb = param + cn + 1;
      paramA = decode_parameter(pa, &extraA, &wordA);
      paramB = decode_parameter(pb, &extraB, &wordB);
      first_word = ((paramB & 0x3F) << 10) | ((paramA & 0x3F) << 4) |
                   (basic_opcode & 0xF);
      memcpy(out, &first_word, 2);
      if (extraA == 1) {
        memcpy(out + 2, &wordA, 2);
        off = 4;
      } else
        off = 2;
      if (extraB == 1) {
        memcpy(out + off, &wordB, 2);
        off += 2;
      }
    } else {
      fprintf(stderr, "Missing comma\n");
      return -1;
    }
  }
  if (non_basic_opcode == 0x1) {
    int extraX = 0;
    unsigned short first_word, wordX = 0;
    unsigned char p = decode_parameter(param, &extraX, &wordX);
    first_word = ((p & 0x3F) << 10) | ((non_basic_opcode & 0x3F) << 4) |
                 (basic_opcode & 0xF);
    memcpy(out, &first_word, 2);
    if (extraX == 1) {
      memcpy(out + 2, &wordX, 2);
      off = 4;
    } else
      off = 2;
  }
  return off;
}


x86 assembly (clang, -O0):
<dcpu16_assemble>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movw   $0x0,-0x1a(%rbp)
movw   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x13c(%rbp)
lea    -0x130(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <clean_line@plt>
cmpb   $0x0,-0x130(%rbp)
jne    11c0 <dcpu16_assemble+0x60>
movl   $0x0,-0x4(%rbp)
jmp    1850 <dcpu16_assemble+0x6f0>
lea    -0x130(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x4,%eax
jge    11ee <dcpu16_assemble+0x8e>
movl   $0x0,-0x4(%rbp)
jmp    1850 <dcpu16_assemble+0x6f0>
lea    -0x130(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x138(%rbp)
lea    -0x130(%rbp),%rsi
lea    0xdf2(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    122d <dcpu16_assemble+0xcd>
movl   $0x1,-0x20(%rbp)
jmp    14e4 <dcpu16_assemble+0x384>
lea    -0x130(%rbp),%rsi
lea    0xdc9(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    125a <dcpu16_assemble+0xfa>
movl   $0x2,-0x20(%rbp)
jmp    14df <dcpu16_assemble+0x37f>
lea    -0x130(%rbp),%rsi
lea    0xda0(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1287 <dcpu16_assemble+0x127>
movl   $0x3,-0x20(%rbp)
jmp    14da <dcpu16_assemble+0x37a>
lea    -0x130(%rbp),%rsi
lea    0xd77(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    12b4 <dcpu16_assemble+0x154>
movl   $0x4,-0x20(%rbp)
jmp    14d5 <dcpu16_assemble+0x375>
lea    -0x130(%rbp),%rsi
lea    0xd4e(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    12e1 <dcpu16_assemble+0x181>
movl   $0x5,-0x20(%rbp)
jmp    14d0 <dcpu16_assemble+0x370>
lea    -0x130(%rbp),%rsi
lea    0xd25(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    130e <dcpu16_assemble+0x1ae>
movl   $0x6,-0x20(%rbp)
jmp    14cb <dcpu16_assemble+0x36b>
lea    -0x130(%rbp),%rsi
lea    0xcfc(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    133b <dcpu16_assemble+0x1db>
movl   $0x7,-0x20(%rbp)
jmp    14c6 <dcpu16_assemble+0x366>
lea    -0x130(%rbp),%rsi
lea    0xcd3(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1368 <dcpu16_assemble+0x208>
movl   $0x8,-0x20(%rbp)
jmp    14c1 <dcpu16_assemble+0x361>
lea    -0x130(%rbp),%rsi
lea    0xcaa(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1395 <dcpu16_assemble+0x235>
movl   $0x9,-0x20(%rbp)
jmp    14bc <dcpu16_assemble+0x35c>
lea    -0x130(%rbp),%rsi
lea    0xc81(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    13c2 <dcpu16_assemble+0x262>
movl   $0xa,-0x20(%rbp)
jmp    14b7 <dcpu16_assemble+0x357>
lea    -0x130(%rbp),%rsi
lea    0xc58(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    13ef <dcpu16_assemble+0x28f>
movl   $0xb,-0x20(%rbp)
jmp    14b2 <dcpu16_assemble+0x352>
lea    -0x130(%rbp),%rsi
lea    0xc2f(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    141c <dcpu16_assemble+0x2bc>
movl   $0xc,-0x20(%rbp)
jmp    14ad <dcpu16_assemble+0x34d>
lea    -0x130(%rbp),%rsi
lea    0xc06(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1449 <dcpu16_assemble+0x2e9>
movl   $0xd,-0x20(%rbp)
jmp    14a8 <dcpu16_assemble+0x348>
lea    -0x130(%rbp),%rsi
lea    0xbdd(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    1476 <dcpu16_assemble+0x316>
movl   $0xe,-0x20(%rbp)
jmp    14a3 <dcpu16_assemble+0x343>
lea    -0x130(%rbp),%rsi
lea    0xbb4(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    149e <dcpu16_assemble+0x33e>
movl   $0xf,-0x20(%rbp)
jmp    14a3 <dcpu16_assemble+0x343>
jmp    14a8 <dcpu16_assemble+0x348>
jmp    14ad <dcpu16_assemble+0x34d>
jmp    14b2 <dcpu16_assemble+0x352>
jmp    14b7 <dcpu16_assemble+0x357>
jmp    14bc <dcpu16_assemble+0x35c>
jmp    14c1 <dcpu16_assemble+0x361>
jmp    14c6 <dcpu16_assemble+0x366>
jmp    14cb <dcpu16_assemble+0x36b>
jmp    14d0 <dcpu16_assemble+0x370>
jmp    14d5 <dcpu16_assemble+0x375>
jmp    14da <dcpu16_assemble+0x37a>
jmp    14df <dcpu16_assemble+0x37f>
jmp    14e4 <dcpu16_assemble+0x384>
cmpl   $0x0,-0x20(%rbp)
jne    1541 <dcpu16_assemble+0x3e1>
lea    -0x130(%rbp),%rsi
lea    0xb40(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    151b <dcpu16_assemble+0x3bb>
movl   $0x1,-0x24(%rbp)
jmp    153c <dcpu16_assemble+0x3dc>
mov    0x2abe(%rip),%rax
mov    (%rax),%edi
lea    0xb15(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1850 <dcpu16_assemble+0x6f0>
jmp    1541 <dcpu16_assemble+0x3e1>
cmpl   $0x0,-0x20(%rbp)
je     178a <dcpu16_assemble+0x62a>
movb   $0x0,-0x13d(%rbp)
movb   $0x0,-0x13e(%rbp)
movl   $0x0,-0x144(%rbp)
mov    -0x138(%rbp),%rax
movslq -0x144(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x2c,%ecx
mov    %al,-0x16a(%rbp)
je     15df <dcpu16_assemble+0x47f>
mov    -0x138(%rbp),%rax
movslq -0x144(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x16a(%rbp)
je     15df <dcpu16_assemble+0x47f>
mov    -0x138(%rbp),%rax
movslq -0x144(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x16a(%rbp)
je     15df <dcpu16_assemble+0x47f>
cmpl   $0x100,-0x144(%rbp)
setl   %al
mov    %al,-0x16a(%rbp)
mov    -0x16a(%rbp),%al
test   $0x1,%al
jne    15f2 <dcpu16_assemble+0x492>
jmp    1606 <dcpu16_assemble+0x4a6>
mov    -0x144(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x144(%rbp)
jmp    1563 <dcpu16_assemble+0x403>
mov    -0x138(%rbp),%rax
movslq -0x144(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2c,%eax
jne    1764 <dcpu16_assemble+0x604>
movl   $0x0,-0x14c(%rbp)
movl   $0x0,-0x150(%rbp)
mov    -0x138(%rbp),%rax
movslq -0x144(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x138(%rbp),%rax
mov    %rax,-0x158(%rbp)
mov    -0x138(%rbp),%rax
movslq -0x144(%rbp),%rcx
add    %rcx,%rax
add    $0x1,%rax
mov    %rax,-0x160(%rbp)
mov    -0x158(%rbp),%rdi
lea    -0x14c(%rbp),%rsi
lea    -0x1a(%rbp),%rdx
call   1080 <decode_parameter@plt>
mov    %al,-0x13d(%rbp)
mov    -0x160(%rbp),%rdi
lea    -0x150(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1080 <decode_parameter@plt>
mov    %al,-0x13e(%rbp)
movzbl -0x13e(%rbp),%eax
and    $0x3f,%eax
shl    $0xa,%eax
movzbl -0x13d(%rbp),%ecx
and    $0x3f,%ecx
shl    $0x4,%ecx
or     %ecx,%eax
mov    -0x20(%rbp),%ecx
and    $0xf,%ecx
or     %ecx,%eax
mov    %ax,-0x146(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x146(%rbp),%rsi
mov    $0x2,%edx
call   1060 <memcpy@plt>
cmpl   $0x1,-0x14c(%rbp)
jne    171d <dcpu16_assemble+0x5bd>
mov    -0x10(%rbp),%rdi
add    $0x2,%rdi
lea    -0x1a(%rbp),%rsi
mov    $0x2,%edx
call   1060 <memcpy@plt>
movl   $0x4,-0x13c(%rbp)
jmp    1727 <dcpu16_assemble+0x5c7>
movl   $0x2,-0x13c(%rbp)
cmpl   $0x1,-0x150(%rbp)
jne    175f <dcpu16_assemble+0x5ff>
mov    -0x10(%rbp),%rdi
movslq -0x13c(%rbp),%rax
add    %rax,%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x2,%edx
call   1060 <memcpy@plt>
mov    -0x13c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x13c(%rbp)
jmp    1785 <dcpu16_assemble+0x625>
mov    0x2875(%rip),%rax
mov    (%rax),%edi
lea    0x8e1(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1850 <dcpu16_assemble+0x6f0>
jmp    178a <dcpu16_assemble+0x62a>
cmpl   $0x1,-0x24(%rbp)
jne    1847 <dcpu16_assemble+0x6e7>
movl   $0x0,-0x164(%rbp)
movw   $0x0,-0x168(%rbp)
mov    -0x138(%rbp),%rdi
lea    -0x164(%rbp),%rsi
lea    -0x168(%rbp),%rdx
call   1080 <decode_parameter@plt>
mov    %al,-0x169(%rbp)
movzbl -0x169(%rbp),%eax
and    $0x3f,%eax
shl    $0xa,%eax
mov    -0x24(%rbp),%ecx
and    $0x3f,%ecx
shl    $0x4,%ecx
or     %ecx,%eax
mov    -0x20(%rbp),%ecx
and    $0xf,%ecx
or     %ecx,%eax
mov    %ax,-0x166(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x166(%rbp),%rsi
mov    $0x2,%edx
call   1060 <memcpy@plt>
cmpl   $0x1,-0x164(%rbp)
jne    1838 <dcpu16_assemble+0x6d8>
mov    -0x10(%rbp),%rdi
add    $0x2,%rdi
lea    -0x168(%rbp),%rsi
mov    $0x2,%edx
call   1060 <memcpy@plt>
movl   $0x4,-0x13c(%rbp)
jmp    1842 <dcpu16_assemble+0x6e2>
movl   $0x2,-0x13c(%rbp)
jmp    1847 <dcpu16_assemble+0x6e7>
mov    -0x13c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dcpu16_assemble>:
sub    $0x108,%rsp
mov    %rsp,%rdi
call   1040 <clean_line@plt>
cmpb   $0x0,(%rsp)
je     113d <dcpu16_assemble+0x1d>
mov    %rsp,%rdi
call   1030 <strlen@plt>
xor    %eax,%eax
add    $0x108,%rsp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"SET\00"
@.str.1 = [4 x i8] c"ADD\00"
@.str.2 = [4 x i8] c"SUB\00"
@.str.3 = [4 x i8] c"MUL\00"
@.str.4 = [4 x i8] c"DIV\00"
@.str.5 = [4 x i8] c"MOD\00"
@.str.6 = [4 x i8] c"SHL\00"
@.str.7 = [4 x i8] c"SHR\00"
@.str.8 = [4 x i8] c"AND\00"
@.str.9 = [4 x i8] c"BOR\00"
@.str.10 = [4 x i8] c"XOR\00"
@.str.11 = [4 x i8] c"IFE\00"
@.str.12 = [4 x i8] c"IFN\00"
@.str.13 = [4 x i8] c"IFG\00"
@.str.14 = [4 x i8] c"IFB\00"
@.str.15 = [4 x i8] c"JSR\00"
@stderr = global i32 0
@.str.16 = [21 x i8] c"Unknown instruction\0A\00"
@.str.17 = [15 x i8] c"Missing comma\0A\00"
define i32 @dcpu16_assemble(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i16
%7 = alloca i16
%8 = alloca i32
%9 = alloca i32
%10 = alloca [256 x i8]
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i8
%14 = alloca i8
%15 = alloca i32
%16 = alloca i16
%17 = alloca i32
%18 = alloca i32
%19 = alloca i8*
%20 = alloca i8*
%21 = alloca i32
%22 = alloca i16
%23 = alloca i16
%24 = alloca i8
store i8* %0, i8** %4
store i8* %1, i8** %5
store i16 0, i16* %6
store i16 0, i16* %7
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %12
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%26 = load i8*, i8** %5
%27 = call i32 @clean_line(i8* %25, i8* %26)
%28 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%29 = load i8, i8* %28
%30 = icmp ne i8 %29, 0
br i1 %30, label %32, label %31
31: ; preds = %2
store i32 0, i32* %3
br label %270
32: ; preds = %2
%33 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%34 = call i32 @strlen(i8* %33)
%35 = icmp ne i32 %34, 0
%36 = xor i1 %35, true
%37 = zext i1 %36 to i32
%38 = icmp slt i32 %37, 4
br i1 %38, label %39, label %40
39: ; preds = %32
store i32 0, i32* %3
br label %270
40: ; preds = %32
%41 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%42 = getelementptr inbounds i8, i8* %41, i64 3
store i8* %42, i8** %11
%43 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%44 = call i32 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %43, i32 3)
%45 = icmp ne i32 %44, 0
br i1 %45, label %47, label %46
46: ; preds = %40
store i32 1, i32* %8
br label %131
47: ; preds = %40
%48 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%49 = call i32 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %48, i32 3)
%50 = icmp ne i32 %49, 0
br i1 %50, label %52, label %51
51: ; preds = %47
store i32 2, i32* %8
br label %130
52: ; preds = %47
%53 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%54 = call i32 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %53, i32 3)
%55 = icmp ne i32 %54, 0
br i1 %55, label %57, label %56
56: ; preds = %52
store i32 3, i32* %8
br label %129
57: ; preds = %52
%58 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%59 = call i32 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %58, i32 3)
%60 = icmp ne i32 %59, 0
br i1 %60, label %62, label %61
61: ; preds = %57
store i32 4, i32* %8
br label %128
62: ; preds = %57
%63 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%64 = call i32 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %63, i32 3)
%65 = icmp ne i32 %64, 0
br i1 %65, label %67, label %66
66: ; preds = %62
store i32 5, i32* %8
br label %127
67: ; preds = %62
%68 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%69 = call i32 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %68, i32 3)
%70 = icmp ne i32 %69, 0
br i1 %70, label %72, label %71
71: ; preds = %67
store i32 6, i32* %8
br label %126
72: ; preds = %67
%73 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%74 = call i32 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* %73, i32 3)
%75 = icmp ne i32 %74, 0
br i1 %75, label %77, label %76
76: ; preds = %72
store i32 7, i32* %8
br label %125
77: ; preds = %72
%78 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%79 = call i32 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %78, i32 3)
%80 = icmp ne i32 %79, 0
br i1 %80, label %82, label %81
81: ; preds = %77
store i32 8, i32* %8
br label %124
82: ; preds = %77
%83 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%84 = call i32 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %83, i32 3)
%85 = icmp ne i32 %84, 0
br i1 %85, label %87, label %86
86: ; preds = %82
store i32 9, i32* %8
br label %123
87: ; preds = %82
%88 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%89 = call i32 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %88, i32 3)
%90 = icmp ne i32 %89, 0
br i1 %90, label %92, label %91
91: ; preds = %87
store i32 10, i32* %8
br label %122
92: ; preds = %87
%93 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%94 = call i32 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* %93, i32 3)
%95 = icmp ne i32 %94, 0
br i1 %95, label %97, label %96
96: ; preds = %92
store i32 11, i32* %8
br label %121
97: ; preds = %92
%98 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%99 = call i32 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i8* %98, i32 3)
%100 = icmp ne i32 %99, 0
br i1 %100, label %102, label %101
101: ; preds = %97
store i32 12, i32* %8
br label %120
102: ; preds = %97
%103 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%104 = call i32 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* %103, i32 3)
%105 = icmp ne i32 %104, 0
br i1 %105, label %107, label %106
106: ; preds = %102
store i32 13, i32* %8
br label %119
107: ; preds = %102
%108 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%109 = call i32 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i8* %108, i32 3)
%110 = icmp ne i32 %109, 0
br i1 %110, label %112, label %111
111: ; preds = %107
store i32 14, i32* %8
br label %118
112: ; preds = %107
%113 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%114 = call i32 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0), i8* %113, i32 3)
%115 = icmp ne i32 %114, 0
br i1 %115, label %117, label %116
116: ; preds = %112
store i32 15, i32* %8
br label %117
117: ; preds = %116, %112
br label %118
118: ; preds = %117, %111
br label %119
119: ; preds = %118, %106
br label %120
120: ; preds = %119, %101
br label %121
121: ; preds = %120, %96
br label %122
122: ; preds = %121, %91
br label %123
123: ; preds = %122, %86
br label %124
124: ; preds = %123, %81
br label %125
125: ; preds = %124, %76
br label %126
126: ; preds = %125, %71
br label %127
127: ; preds = %126, %66
br label %128
128: ; preds = %127, %61
br label %129
129: ; preds = %128, %56
br label %130
130: ; preds = %129, %51
br label %131
131: ; preds = %130, %46
%132 = load i32, i32* %8
%133 = icmp eq i32 %132, 0
br i1 %133, label %134, label %143
134: ; preds = %131
%135 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%136 = call i32 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i8* %135, i32 3)
%137 = icmp ne i32 %136, 0
br i1 %137, label %139, label %138
138: ; preds = %134
store i32 1, i32* %9
br label %142
139: ; preds = %134
%140 = load i32, i32* @stderr
%141 = call i32 @fprintf(i32 %140, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.16, i64 0, i64 0))
store i32 -1, i32* %3
br label %270
142: ; preds = %138
br label %143
143: ; preds = %142, %131
%144 = load i32, i32* %8
%145 = icmp ne i32 %144, 0
br i1 %145, label %146, label %240
146: ; preds = %143
store i8 0, i8* %13
store i8 0, i8* %14
store i32 0, i32* %15
br label %147
147: ; preds = %176, %146
%148 = load i8*, i8** %11
%149 = load i32, i32* %15
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds i8, i8* %148, i64 %150
%152 = load i8, i8* %151
%153 = sext i8 %152 to i32
%154 = icmp ne i32 %153, 44
br i1 %154, label %155, label %174
155: ; preds = %147
%156 = load i8*, i8** %11
%157 = load i32, i32* %15
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds i8, i8* %156, i64 %158
%160 = load i8, i8* %159
%161 = sext i8 %160 to i32
%162 = icmp ne i32 %161, 10
br i1 %162, label %163, label %174
163: ; preds = %155
%164 = load i8*, i8** %11
%165 = load i32, i32* %15
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds i8, i8* %164, i64 %166
%168 = load i8, i8* %167
%169 = sext i8 %168 to i32
%170 = icmp ne i32 %169, 0
br i1 %170, label %171, label %174
171: ; preds = %163
%172 = load i32, i32* %15
%173 = icmp slt i32 %172, 256
br label %174
174: ; preds = %171, %163, %155, %147
%175 = phi i1 [ false, %163 ], [ false, %155 ], [ false, %147 ], [ %173, %171 ]
br i1 %175, label %176, label %179
176: ; preds = %174
%177 = load i32, i32* %15
%178 = add nsw i32 %177, 1
store i32 %178, i32* %15
br label %147
179: ; preds = %174
%180 = load i8*, i8** %11
%181 = load i32, i32* %15
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds i8, i8* %180, i64 %182
%184 = load i8, i8* %183
%185 = sext i8 %184 to i32
%186 = icmp eq i32 %185, 44
br i1 %186, label %187, label %236
187: ; preds = %179
store i32 0, i32* %17
store i32 0, i32* %18
%188 = load i8*, i8** %11
%189 = load i32, i32* %15
%190 = sext i32 %189 to i64
%191 = getelementptr inbounds i8, i8* %188, i64 %190
store i8 0, i8* %191
%192 = load i8*, i8** %11
store i8* %192, i8** %19
%193 = load i8*, i8** %11
%194 = load i32, i32* %15
%195 = sext i32 %194 to i64
%196 = getelementptr inbounds i8, i8* %193, i64 %195
%197 = getelementptr inbounds i8, i8* %196, i64 1
store i8* %197, i8** %20
%198 = load i8*, i8** %19
%199 = call zeroext i8 @decode_parameter(i8* %198, i32* %17, i16* %6)
store i8 %199, i8* %13
%200 = load i8*, i8** %20
%201 = call zeroext i8 @decode_parameter(i8* %200, i32* %18, i16* %7)
store i8 %201, i8* %14
%202 = load i8, i8* %14
%203 = zext i8 %202 to i32
%204 = and i32 %203, 63
%205 = shl i32 %204, 10
%206 = load i8, i8* %13
%207 = zext i8 %206 to i32
%208 = and i32 %207, 63
%209 = shl i32 %208, 4
%210 = or i32 %205, %209
%211 = load i32, i32* %8
%212 = and i32 %211, 15
%213 = or i32 %210, %212
%214 = trunc i32 %213 to i16
store i16 %214, i16* %16
%215 = load i8*, i8** %4
%216 = call i32 @memcpy(i8* %215, i16* %16, i32 2)
%217 = load i32, i32* %17
%218 = icmp eq i32 %217, 1
br i1 %218, label %219, label %223
219: ; preds = %187
%220 = load i8*, i8** %4
%221 = getelementptr inbounds i8, i8* %220, i64 2
%222 = call i32 @memcpy(i8* %221, i16* %6, i32 2)
store i32 4, i32* %12
br label %224
223: ; preds = %187
store i32 2, i32* %12
br label %224
224: ; preds = %223, %219
%225 = load i32, i32* %18
%226 = icmp eq i32 %225, 1
br i1 %226, label %227, label %235
227: ; preds = %224
%228 = load i8*, i8** %4
%229 = load i32, i32* %12
%230 = sext i32 %229 to i64
%231 = getelementptr inbounds i8, i8* %228, i64 %230
%232 = call i32 @memcpy(i8* %231, i16* %7, i32 2)
%233 = load i32, i32* %12
%234 = add nsw i32 %233, 2
store i32 %234, i32* %12
br label %235
235: ; preds = %227, %224
br label %239
236: ; preds = %179
%237 = load i32, i32* @stderr
%238 = call i32 @fprintf(i32 %237, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.17, i64 0, i64 0))
store i32 -1, i32* %3
br label %270
239: ; preds = %235
br label %240
240: ; preds = %239, %143
%241 = load i32, i32* %9
%242 = icmp eq i32 %241, 1
br i1 %242, label %243, label %268
243: ; preds = %240
store i32 0, i32* %21
store i16 0, i16* %23
%244 = load i8*, i8** %11
%245 = call zeroext i8 @decode_parameter(i8* %244, i32* %21, i16* %23)
store i8 %245, i8* %24
%246 = load i8, i8* %24
%247 = zext i8 %246 to i32
%248 = and i32 %247, 63
%249 = shl i32 %248, 10
%250 = load i32, i32* %9
%251 = and i32 %250, 63
%252 = shl i32 %251, 4
%253 = or i32 %249, %252
%254 = load i32, i32* %8
%255 = and i32 %254, 15
%256 = or i32 %253, %255
%257 = trunc i32 %256 to i16
store i16 %257, i16* %22
%258 = load i8*, i8** %4
%259 = call i32 @memcpy(i8* %258, i16* %22, i32 2)
%260 = load i32, i32* %21
%261 = icmp eq i32 %260, 1
br i1 %261, label %262, label %266
262: ; preds = %243
%263 = load i8*, i8** %4
%264 = getelementptr inbounds i8, i8* %263, i64 2
%265 = call i32 @memcpy(i8* %264, i16* %23, i32 2)
store i32 4, i32* %12
br label %267
266: ; preds = %243
store i32 2, i32* %12
br label %267
267: ; preds = %266, %262
br label %268
268: ; preds = %267, %240
%269 = load i32, i32* %12
store i32 %269, i32* %3
br label %270
270: ; preds = %268, %236, %139, %39, %31
%271 = load i32, i32* %3
ret i32 %271
}

LLVM IR (-O2):
@stderr = global i32 0
define i32 @dcpu16_assemble(i8* nocapture readnone %0, i8* %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = call i32 @clean_line(i8* %4, i8* %1)
%6 = load i8, i8* %4
%7 = icmp eq i8 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = call i32 @strlen(i8* %4)
br label %10
10: ; preds = %2, %8
ret i32 0
}