int eval_operand(char **a, int spec) {
  int i;
  unsigned int want = spec & (0x8000 | 0x4000 | 0x2000);
  static struct {
    unsigned int what;
    char *name;
    int value;
  } jmptab[] = {
      0x8000, "jmp",  8,      0x8000, "jc",   9,      0x8000, "jnc",
      10,     0x8000, "call", 11,     0x4000, "jz",   15,     0x4000,
      "jnz",  13,     0x2000, "je",   14,     0x2000, "jne",  12,
  };
  spec &= ~(0x8000 | 0x4000 | 0x2000);
  for (i = 0; i < sizeof(jmptab) / sizeof(jmptab[0]); i++)
    if (jmptab[i].what == want && !strcmp(jmptab[i].name, a[spec])) {
      return (jmptab[i].value);
    }
  if (want)
    error("invalid jump");
  return (spec);
}


x86 assembly (clang, -O0):
<eval_operand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    $0xe000,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
and    $0xffff1fff,%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movslq -0x18(%rbp),%rax
cmp    $0x8,%rax
jae    11d7 <eval_operand+0xb7>
movslq -0x18(%rbp),%rcx
lea    0x2edb(%rip),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%eax
cmp    -0x1c(%rbp),%eax
jne    11c4 <eval_operand+0xa4>
movslq -0x18(%rbp),%rcx
lea    0x2ebe(%rip),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11c4 <eval_operand+0xa4>
movslq -0x18(%rbp),%rcx
lea    0x2e8e(%rip),%rax
imul   $0x18,%rcx,%rcx
add    %rcx,%rax
mov    0x10(%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11f5 <eval_operand+0xd5>
jmp    11c9 <eval_operand+0xa9>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    114c <eval_operand+0x2c>
cmpl   $0x0,-0x1c(%rbp)
je     11ef <eval_operand+0xcf>
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1040 <error@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eval_operand>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%ebx
and    $0xffff1fff,%ebx
shr    $0xd,%esi
and    $0x7,%esi
cmp    $0x4,%esi
ja     1212 <eval_operand+0xf2>
mov    %rdi,%r14
movslq %ebx,%r15
lea    0xeb7(%rip),%rax
movslq (%rax,%rsi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
mov    (%r14,%r15,8),%rsi
lea    0xece(%rip),%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1222 <eval_operand+0x102>
mov    (%r14,%r15,8),%rsi
lea    0xeb9(%rip),%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
jne    1212 <eval_operand+0xf2>
mov    $0x7,%eax
jmp    1247 <eval_operand+0x127>
mov    (%r14,%r15,8),%rsi
lea    0xe8d(%rip),%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1229 <eval_operand+0x109>
mov    (%r14,%r15,8),%rsi
lea    0xe78(%rip),%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
jne    1212 <eval_operand+0xf2>
mov    $0x5,%eax
jmp    1247 <eval_operand+0x127>
mov    (%r14,%r15,8),%rsi
lea    0xe47(%rip),%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1230 <eval_operand+0x110>
mov    (%r14,%r15,8),%rsi
lea    0xe37(%rip),%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1234 <eval_operand+0x114>
mov    (%r14,%r15,8),%rsi
lea    0xe26(%rip),%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     123b <eval_operand+0x11b>
mov    (%r14,%r15,8),%rsi
lea    0xe16(%rip),%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1242 <eval_operand+0x122>
lea    0xe19(%rip),%rdi
xor    %eax,%eax
call   1040 <error@plt>
jmp    1256 <eval_operand+0x136>
mov    $0x6,%eax
jmp    1247 <eval_operand+0x127>
mov    $0x4,%eax
jmp    1247 <eval_operand+0x127>
xor    %eax,%eax
jmp    1247 <eval_operand+0x127>
mov    $0x1,%eax
jmp    1247 <eval_operand+0x127>
mov    $0x2,%eax
jmp    1247 <eval_operand+0x127>
mov    $0x3,%eax
lea    (%rax,%rax,2),%rax
lea    0x2b0e(%rip),%rcx
mov    0x10(%rcx,%rax,8),%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.anon = type { i32, i8*, i32 }
@eval_operand.jmptab = internal global [8 x %struct.anon] [%struct.anon { i32 32768, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i32 8 }, %struct.anon { i32 32768, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0), i32 9 }, %struct.anon { i32 32768, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i32 10 }, %struct.anon { i32 32768, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i32 11 }, %struct.anon { i32 16384, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i32 0, i32 0), i32 15 }, %struct.anon { i32 16384, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i32 13 }, %struct.anon { i32 8192, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i32 0, i32 0), i32 14 }, %struct.anon { i32 8192, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i32 0, i32 0), i32 12 }]
@.str = [4 x i8] c"jmp\00"
@.str.1 = [3 x i8] c"jc\00"
@.str.2 = [4 x i8] c"jnc\00"
@.str.3 = [5 x i8] c"call\00"
@.str.4 = [3 x i8] c"jz\00"
@.str.5 = [4 x i8] c"jnz\00"
@.str.6 = [3 x i8] c"je\00"
@.str.7 = [4 x i8] c"jne\00"
@.str.8 = [13 x i8] c"invalid jump\00"
define i32 @eval_operand(i8** %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8** %0, i8*** %4
store i32 %1, i32* %5
%8 = load i32, i32* %5
%9 = and i32 %8, 57344
store i32 %9, i32* %7
%10 = load i32, i32* %5
%11 = and i32 %10, -57345
store i32 %11, i32* %5
store i32 0, i32* %6
br label %12
12: ; preds = %44, %2
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = icmp ult i64 %14, 8
br i1 %15, label %16, label %47
16: ; preds = %12
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [8 x %struct.anon], [8 x %struct.anon]* @eval_operand.jmptab, i64 0, i64 %18
%20 = getelementptr inbounds %struct.anon, %struct.anon* %19, i32 0, i32 0
%21 = load i32, i32* %20
%22 = load i32, i32* %7
%23 = icmp eq i32 %21, %22
br i1 %23, label %24, label %43
24: ; preds = %16
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [8 x %struct.anon], [8 x %struct.anon]* @eval_operand.jmptab, i64 0, i64 %26
%28 = getelementptr inbounds %struct.anon, %struct.anon* %27, i32 0, i32 1
%29 = load i8*, i8** %28
%30 = load i8**, i8*** %4
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %30, i64 %32
%34 = load i8*, i8** %33
%35 = call i32 @strcmp(i8* %29, i8* %34)
%36 = icmp ne i32 %35, 0
br i1 %36, label %43, label %37
37: ; preds = %24
%38 = load i32, i32* %6
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [8 x %struct.anon], [8 x %struct.anon]* @eval_operand.jmptab, i64 0, i64 %39
%41 = getelementptr inbounds %struct.anon, %struct.anon* %40, i32 0, i32 2
%42 = load i32, i32* %41
store i32 %42, i32* %3
br label %54
43: ; preds = %24, %16
br label %44
44: ; preds = %43
%45 = load i32, i32* %6
%46 = add nsw i32 %45, 1
store i32 %46, i32* %6
br label %12
47: ; preds = %12
%48 = load i32, i32* %7
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %47
%51 = call i32 (i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, ...)*)(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
br label %52
52: ; preds = %50, %47
%53 = load i32, i32* %5
store i32 %53, i32* %3
br label %54
54: ; preds = %52, %37
%55 = load i32, i32* %3
ret i32 %55
}

LLVM IR (-O2):
%struct.anon = type { i32, i8*, i32 }
@eval_operand.jmptab = internal unnamed_addr constant [8 x %struct.anon] [%struct.anon { i32 32768, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i32 8 }, %struct.anon { i32 32768, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0), i32 9 }, %struct.anon { i32 32768, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i32 10 }, %struct.anon { i32 32768, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i32 0, i32 0), i32 11 }, %struct.anon { i32 16384, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i32 0, i32 0), i32 15 }, %struct.anon { i32 16384, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i32 13 }, %struct.anon { i32 8192, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i32 0, i32 0), i32 14 }, %struct.anon { i32 8192, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i32 0, i32 0), i32 12 }]
@.str = [4 x i8] c"jmp\00"
@.str.1 = [3 x i8] c"jc\00"
@.str.2 = [4 x i8] c"jnc\00"
@.str.3 = [5 x i8] c"call\00"
@.str.4 = [3 x i8] c"jz\00"
@.str.5 = [4 x i8] c"jnz\00"
@.str.6 = [3 x i8] c"je\00"
@.str.7 = [4 x i8] c"jne\00"
@.str.8 = [13 x i8] c"invalid jump\00"
define i32 @eval_operand(i8** nocapture %0, i32 %1) {
%3 = and i32 %1, -57345
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8*, i8** %0, i64 %4
%6 = lshr i32 %1, 13
%7 = and i32 %6, 7
switch i32 %7, label %44 [
i32 4, label %8
i32 2, label %28
i32 1, label %36
i32 0, label %46
]
8: ; preds = %2
%9 = load i8*, i8** %5
%10 = tail call i32 @strcmp(i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* dereferenceable(1) %9)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %40, %36, %32, %28, %24, %20, %16, %8
%13 = phi i64 [ 0, %8 ], [ 1, %16 ], [ 2, %20 ], [ 3, %24 ], [ 4, %28 ], [ 5, %32 ], [ 6, %36 ], [ 7, %40 ]
%14 = getelementptr inbounds [8 x %struct.anon], [8 x %struct.anon]* @eval_operand.jmptab, i64 0, i64 %13, i32 2
%15 = load i32, i32* %14
br label %46
16: ; preds = %8
%17 = load i8*, i8** %5
%18 = tail call i32 @strcmp(i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* dereferenceable(1) %17)
%19 = icmp eq i32 %18, 0
br i1 %19, label %12, label %20
20: ; preds = %16
%21 = load i8*, i8** %5
%22 = tail call i32 @strcmp(i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* dereferenceable(1) %21)
%23 = icmp eq i32 %22, 0
br i1 %23, label %12, label %24
24: ; preds = %20
%25 = load i8*, i8** %5
%26 = tail call i32 @strcmp(i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* dereferenceable(1) %25)
%27 = icmp eq i32 %26, 0
br i1 %27, label %12, label %44
28: ; preds = %2
%29 = load i8*, i8** %5
%30 = tail call i32 @strcmp(i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* dereferenceable(1) %29)
%31 = icmp eq i32 %30, 0
br i1 %31, label %12, label %32
32: ; preds = %28
%33 = load i8*, i8** %5
%34 = tail call i32 @strcmp(i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* dereferenceable(1) %33)
%35 = icmp eq i32 %34, 0
br i1 %35, label %12, label %44
36: ; preds = %2
%37 = load i8*, i8** %5
%38 = tail call i32 @strcmp(i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8* dereferenceable(1) %37)
%39 = icmp eq i32 %38, 0
br i1 %39, label %12, label %40
40: ; preds = %36
%41 = load i8*, i8** %5
%42 = tail call i32 @strcmp(i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* dereferenceable(1) %41)
%43 = icmp eq i32 %42, 0
br i1 %43, label %12, label %44
44: ; preds = %2, %40, %24, %32
%45 = tail call i32 (i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, ...)*)(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
br label %46
46: ; preds = %2, %44, %12
%47 = phi i32 [ %15, %12 ], [ %3, %44 ], [ %3, %2 ]
ret i32 %47
}