#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*/ strcpy(char *, char *);
void get_mnemonic(unsigned short opcode, char mnemonic[5]) {
  if (opcode == 0)
    strcpy(mnemonic, "ADD");
  else if (opcode == 1)
    strcpy(mnemonic, "SUB");
  else if (opcode == 2)
    strcpy(mnemonic, "AND");
  else if (opcode == 3)
    strcpy(mnemonic, "OR");
  else if (opcode == 4)
    strcpy(mnemonic, "XOR");
  else if (opcode == 5)
    strcpy(mnemonic, "NOT");
  else if (opcode == 6)
    strcpy(mnemonic, "LDM");
  else if (opcode == 7)
    strcpy(mnemonic, "LDI");
  else if (opcode == 8)
    strcpy(mnemonic, "STR");
  else if (opcode == 9)
    strcpy(mnemonic, "JMP");
  else if (opcode == 10)
    strcpy(mnemonic, "JMZ");
  else if (opcode == 11)
    strcpy(mnemonic, "JMN");
  else if (opcode == 12)
    strcpy(mnemonic, "CALL");
  else if (opcode == 13)
    strcpy(mnemonic, "RET");
  else if (opcode == 14)
    strcpy(mnemonic, "PUSH");
  else if (opcode == 15)
    strcpy(mnemonic, "POP");
}


x86 assembly (clang, -O0):
<get_mnemonic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
movzwl -0x2(%rbp),%eax
cmp    $0x0,%eax
jne    1145 <get_mnemonic+0x35>
mov    -0x10(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1389 <get_mnemonic+0x279>
movzwl -0x2(%rbp),%eax
cmp    $0x1,%eax
jne    1167 <get_mnemonic+0x57>
mov    -0x10(%rbp),%rdi
lea    0xea7(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1384 <get_mnemonic+0x274>
movzwl -0x2(%rbp),%eax
cmp    $0x2,%eax
jne    1189 <get_mnemonic+0x79>
mov    -0x10(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1030 <strcpy@plt>
jmp    137f <get_mnemonic+0x26f>
movzwl -0x2(%rbp),%eax
cmp    $0x3,%eax
jne    11ab <get_mnemonic+0x9b>
mov    -0x10(%rbp),%rdi
lea    0xe6c(%rip),%rsi
call   1030 <strcpy@plt>
jmp    137a <get_mnemonic+0x26a>
movzwl -0x2(%rbp),%eax
cmp    $0x4,%eax
jne    11cd <get_mnemonic+0xbd>
mov    -0x10(%rbp),%rdi
lea    0xe49(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1375 <get_mnemonic+0x265>
movzwl -0x2(%rbp),%eax
cmp    $0x5,%eax
jne    11ef <get_mnemonic+0xdf>
mov    -0x10(%rbp),%rdi
lea    0xe2b(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1370 <get_mnemonic+0x260>
movzwl -0x2(%rbp),%eax
cmp    $0x6,%eax
jne    1211 <get_mnemonic+0x101>
mov    -0x10(%rbp),%rdi
lea    0xe0d(%rip),%rsi
call   1030 <strcpy@plt>
jmp    136b <get_mnemonic+0x25b>
movzwl -0x2(%rbp),%eax
cmp    $0x7,%eax
jne    1233 <get_mnemonic+0x123>
mov    -0x10(%rbp),%rdi
lea    0xdef(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1366 <get_mnemonic+0x256>
movzwl -0x2(%rbp),%eax
cmp    $0x8,%eax
jne    1255 <get_mnemonic+0x145>
mov    -0x10(%rbp),%rdi
lea    0xdd1(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1361 <get_mnemonic+0x251>
movzwl -0x2(%rbp),%eax
cmp    $0x9,%eax
jne    1277 <get_mnemonic+0x167>
mov    -0x10(%rbp),%rdi
lea    0xdb3(%rip),%rsi
call   1030 <strcpy@plt>
jmp    135c <get_mnemonic+0x24c>
movzwl -0x2(%rbp),%eax
cmp    $0xa,%eax
jne    1299 <get_mnemonic+0x189>
mov    -0x10(%rbp),%rdi
lea    0xd95(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1357 <get_mnemonic+0x247>
movzwl -0x2(%rbp),%eax
cmp    $0xb,%eax
jne    12bb <get_mnemonic+0x1ab>
mov    -0x10(%rbp),%rdi
lea    0xd77(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1352 <get_mnemonic+0x242>
movzwl -0x2(%rbp),%eax
cmp    $0xc,%eax
jne    12dd <get_mnemonic+0x1cd>
mov    -0x10(%rbp),%rdi
lea    0xd59(%rip),%rsi
call   1030 <strcpy@plt>
jmp    134d <get_mnemonic+0x23d>
movzwl -0x2(%rbp),%eax
cmp    $0xd,%eax
jne    12ff <get_mnemonic+0x1ef>
mov    -0x10(%rbp),%rdi
lea    0xd3c(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1348 <get_mnemonic+0x238>
movzwl -0x2(%rbp),%eax
cmp    $0xe,%eax
jne    1321 <get_mnemonic+0x211>
mov    -0x10(%rbp),%rdi
lea    0xd1e(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1343 <get_mnemonic+0x233>
movzwl -0x2(%rbp),%eax
cmp    $0xf,%eax
jne    133e <get_mnemonic+0x22e>
mov    -0x10(%rbp),%rdi
lea    0xd01(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1343 <get_mnemonic+0x233>
jmp    1348 <get_mnemonic+0x238>
jmp    134d <get_mnemonic+0x23d>
jmp    1352 <get_mnemonic+0x242>
jmp    1357 <get_mnemonic+0x247>
jmp    135c <get_mnemonic+0x24c>
jmp    1361 <get_mnemonic+0x251>
jmp    1366 <get_mnemonic+0x256>
jmp    136b <get_mnemonic+0x25b>
jmp    1370 <get_mnemonic+0x260>
jmp    1375 <get_mnemonic+0x265>
jmp    137a <get_mnemonic+0x26a>
jmp    137f <get_mnemonic+0x26f>
jmp    1384 <get_mnemonic+0x274>
jmp    1389 <get_mnemonic+0x279>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_mnemonic>:
cmp    $0xf,%di
ja     1133 <get_mnemonic+0x23>
movswq %di,%rax
lea    0xf1f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
jmp    1030 <strcpy@plt>
ret

LLVM IR (-O0):
@.str = [4 x i8] c"ADD\00"
@.str.1 = [4 x i8] c"SUB\00"
@.str.2 = [4 x i8] c"AND\00"
@.str.3 = [3 x i8] c"OR\00"
@.str.4 = [4 x i8] c"XOR\00"
@.str.5 = [4 x i8] c"NOT\00"
@.str.6 = [4 x i8] c"LDM\00"
@.str.7 = [4 x i8] c"LDI\00"
@.str.8 = [4 x i8] c"STR\00"
@.str.9 = [4 x i8] c"JMP\00"
@.str.10 = [4 x i8] c"JMZ\00"
@.str.11 = [4 x i8] c"JMN\00"
@.str.12 = [5 x i8] c"CALL\00"
@.str.13 = [4 x i8] c"RET\00"
@.str.14 = [5 x i8] c"PUSH\00"
@.str.15 = [4 x i8] c"POP\00"
define void @get_mnemonic(i16 zeroext %0, i8* %1) {
%3 = alloca i16
%4 = alloca i8*
store i16 %0, i16* %3
store i8* %1, i8** %4
%5 = load i16, i16* %3
%6 = zext i16 %5 to i32
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8*, i8** %4
%10 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %131
11: ; preds = %2
%12 = load i16, i16* %3
%13 = zext i16 %12 to i32
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load i8*, i8** %4
%17 = call i32 @strcpy(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %130
18: ; preds = %11
%19 = load i16, i16* %3
%20 = zext i16 %19 to i32
%21 = icmp eq i32 %20, 2
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = load i8*, i8** %4
%24 = call i32 @strcpy(i8* %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %129
25: ; preds = %18
%26 = load i16, i16* %3
%27 = zext i16 %26 to i32
%28 = icmp eq i32 %27, 3
br i1 %28, label %29, label %32
29: ; preds = %25
%30 = load i8*, i8** %4
%31 = call i32 @strcpy(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %128
32: ; preds = %25
%33 = load i16, i16* %3
%34 = zext i16 %33 to i32
%35 = icmp eq i32 %34, 4
br i1 %35, label %36, label %39
36: ; preds = %32
%37 = load i8*, i8** %4
%38 = call i32 @strcpy(i8* %37, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %127
39: ; preds = %32
%40 = load i16, i16* %3
%41 = zext i16 %40 to i32
%42 = icmp eq i32 %41, 5
br i1 %42, label %43, label %46
43: ; preds = %39
%44 = load i8*, i8** %4
%45 = call i32 @strcpy(i8* %44, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %126
46: ; preds = %39
%47 = load i16, i16* %3
%48 = zext i16 %47 to i32
%49 = icmp eq i32 %48, 6
br i1 %49, label %50, label %53
50: ; preds = %46
%51 = load i8*, i8** %4
%52 = call i32 @strcpy(i8* %51, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
br label %125
53: ; preds = %46
%54 = load i16, i16* %3
%55 = zext i16 %54 to i32
%56 = icmp eq i32 %55, 7
br i1 %56, label %57, label %60
57: ; preds = %53
%58 = load i8*, i8** %4
%59 = call i32 @strcpy(i8* %58, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %124
60: ; preds = %53
%61 = load i16, i16* %3
%62 = zext i16 %61 to i32
%63 = icmp eq i32 %62, 8
br i1 %63, label %64, label %67
64: ; preds = %60
%65 = load i8*, i8** %4
%66 = call i32 @strcpy(i8* %65, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
br label %123
67: ; preds = %60
%68 = load i16, i16* %3
%69 = zext i16 %68 to i32
%70 = icmp eq i32 %69, 9
br i1 %70, label %71, label %74
71: ; preds = %67
%72 = load i8*, i8** %4
%73 = call i32 @strcpy(i8* %72, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
br label %122
74: ; preds = %67
%75 = load i16, i16* %3
%76 = zext i16 %75 to i32
%77 = icmp eq i32 %76, 10
br i1 %77, label %78, label %81
78: ; preds = %74
%79 = load i8*, i8** %4
%80 = call i32 @strcpy(i8* %79, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
br label %121
81: ; preds = %74
%82 = load i16, i16* %3
%83 = zext i16 %82 to i32
%84 = icmp eq i32 %83, 11
br i1 %84, label %85, label %88
85: ; preds = %81
%86 = load i8*, i8** %4
%87 = call i32 @strcpy(i8* %86, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
br label %120
88: ; preds = %81
%89 = load i16, i16* %3
%90 = zext i16 %89 to i32
%91 = icmp eq i32 %90, 12
br i1 %91, label %92, label %95
92: ; preds = %88
%93 = load i8*, i8** %4
%94 = call i32 @strcpy(i8* %93, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
br label %119
95: ; preds = %88
%96 = load i16, i16* %3
%97 = zext i16 %96 to i32
%98 = icmp eq i32 %97, 13
br i1 %98, label %99, label %102
99: ; preds = %95
%100 = load i8*, i8** %4
%101 = call i32 @strcpy(i8* %100, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0))
br label %118
102: ; preds = %95
%103 = load i16, i16* %3
%104 = zext i16 %103 to i32
%105 = icmp eq i32 %104, 14
br i1 %105, label %106, label %109
106: ; preds = %102
%107 = load i8*, i8** %4
%108 = call i32 @strcpy(i8* %107, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
br label %117
109: ; preds = %102
%110 = load i16, i16* %3
%111 = zext i16 %110 to i32
%112 = icmp eq i32 %111, 15
br i1 %112, label %113, label %116
113: ; preds = %109
%114 = load i8*, i8** %4
%115 = call i32 @strcpy(i8* %114, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0))
br label %116
116: ; preds = %113, %109
br label %117
117: ; preds = %116, %106
br label %118
118: ; preds = %117, %99
br label %119
119: ; preds = %118, %92
br label %120
120: ; preds = %119, %85
br label %121
121: ; preds = %120, %78
br label %122
122: ; preds = %121, %71
br label %123
123: ; preds = %122, %64
br label %124
124: ; preds = %123, %57
br label %125
125: ; preds = %124, %50
br label %126
126: ; preds = %125, %43
br label %127
127: ; preds = %126, %36
br label %128
128: ; preds = %127, %29
br label %129
129: ; preds = %128, %22
br label %130
130: ; preds = %129, %15
br label %131
131: ; preds = %130, %8
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"ADD\00"
@.str.1 = [4 x i8] c"SUB\00"
@.str.2 = [4 x i8] c"AND\00"
@.str.3 = [3 x i8] c"OR\00"
@.str.4 = [4 x i8] c"XOR\00"
@.str.5 = [4 x i8] c"NOT\00"
@.str.6 = [4 x i8] c"LDM\00"
@.str.7 = [4 x i8] c"LDI\00"
@.str.8 = [4 x i8] c"STR\00"
@.str.9 = [4 x i8] c"JMP\00"
@.str.10 = [4 x i8] c"JMZ\00"
@.str.11 = [4 x i8] c"JMN\00"
@.str.12 = [5 x i8] c"CALL\00"
@.str.13 = [4 x i8] c"RET\00"
@.str.14 = [5 x i8] c"PUSH\00"
@.str.15 = [4 x i8] c"POP\00"
@reltable.get_mnemonic = [16 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str to i64), i64 ptrtoint ([16 x i32]* @reltable.get_mnemonic to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.1 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_mnemonic to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.2 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_mnemonic to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.3 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_mnemonic to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.4 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_mnemonic to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.5 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_mnemonic to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.6 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_mnemonic to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.7 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_mnemonic to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.8 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_mnemonic to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.9 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_mnemonic to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.10 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_mnemonic to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.11 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_mnemonic to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.12 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_mnemonic to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.13 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_mnemonic to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.14 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_mnemonic to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.15 to i64), i64 ptrtoint ([16 x i32]* @reltable.get_mnemonic to i64)) to i32)]
define void @get_mnemonic(i16 zeroext %0, i8* %1) {
%3 = icmp ult i16 %0, 16
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = sext i16 %0 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([16 x i32]* @reltable.get_mnemonic to i8*), i64 %6)
%8 = tail call i32 @strcpy(i8* %1, i8* %7)
br label %9
9: ; preds = %2, %4
ret void
}