int alleleEncode(const char allele_a, const char allele_b) {
  switch (allele_a) {
  case 'A':
    switch (allele_b) {
    case 'A':
      return 0;
    case 'C':
      return 1;
    case 'G':
      return 2;
    case 'T':
      return 3;
    case 'N':
    default:
      return 10;
    }
  case 'C':
    switch (allele_b) {
    case 'A':
      return 1;
    case 'C':
      return 4;
    case 'G':
      return 5;
    case 'T':
      return 6;
    case 'N':
    default:
      return 10;
    }
  case 'G':
    switch (allele_b) {
    case 'A':
      return 2;
    case 'C':
      return 5;
    case 'G':
      return 7;
    case 'T':
      return 8;
    case 'N':
    default:
      return 10;
    }
  case 'T':
    switch (allele_b) {
    case 'A':
      return 3;
    case 'C':
      return 6;
    case 'G':
      return 8;
    case 'T':
      return 9;
    case 'N':
    default:
      return 10;
    }
  case 'N':
  default:
    return 10;
  }
}


x86 assembly (clang, -O0):
<alleleEncode>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x13,%eax
ja     12eb <alleleEncode+0x1eb>
mov    -0x10(%rbp),%rax
lea    0xecf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsbl -0x6(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x13,%eax
ja     1199 <alleleEncode+0x99>
mov    -0x18(%rbp),%rax
lea    0xfe5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x4(%rbp)
jmp    12f2 <alleleEncode+0x1f2>
movl   $0x1,-0x4(%rbp)
jmp    12f2 <alleleEncode+0x1f2>
movl   $0x2,-0x4(%rbp)
jmp    12f2 <alleleEncode+0x1f2>
movl   $0x3,-0x4(%rbp)
jmp    12f2 <alleleEncode+0x1f2>
jmp    1199 <alleleEncode+0x99>
movl   $0xa,-0x4(%rbp)
jmp    12f2 <alleleEncode+0x1f2>
movsbl -0x6(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x13,%eax
ja     1204 <alleleEncode+0x104>
mov    -0x20(%rbp),%rax
lea    0xf2a(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x4(%rbp)
jmp    12f2 <alleleEncode+0x1f2>
movl   $0x4,-0x4(%rbp)
jmp    12f2 <alleleEncode+0x1f2>
movl   $0x5,-0x4(%rbp)
jmp    12f2 <alleleEncode+0x1f2>
movl   $0x6,-0x4(%rbp)
jmp    12f2 <alleleEncode+0x1f2>
jmp    1204 <alleleEncode+0x104>
movl   $0xa,-0x4(%rbp)
jmp    12f2 <alleleEncode+0x1f2>
movsbl -0x6(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x13,%eax
ja     126f <alleleEncode+0x16f>
mov    -0x28(%rbp),%rax
lea    0xe6f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x2,-0x4(%rbp)
jmp    12f2 <alleleEncode+0x1f2>
movl   $0x5,-0x4(%rbp)
jmp    12f2 <alleleEncode+0x1f2>
movl   $0x7,-0x4(%rbp)
jmp    12f2 <alleleEncode+0x1f2>
movl   $0x8,-0x4(%rbp)
jmp    12f2 <alleleEncode+0x1f2>
jmp    126f <alleleEncode+0x16f>
movl   $0xa,-0x4(%rbp)
jmp    12f2 <alleleEncode+0x1f2>
movsbl -0x6(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x13,%eax
ja     12da <alleleEncode+0x1da>
mov    -0x30(%rbp),%rax
lea    0xdb4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x3,-0x4(%rbp)
jmp    12f2 <alleleEncode+0x1f2>
movl   $0x6,-0x4(%rbp)
jmp    12f2 <alleleEncode+0x1f2>
movl   $0x8,-0x4(%rbp)
jmp    12f2 <alleleEncode+0x1f2>
movl   $0x9,-0x4(%rbp)
jmp    12f2 <alleleEncode+0x1f2>
jmp    12da <alleleEncode+0x1da>
movl   $0xa,-0x4(%rbp)
jmp    12f2 <alleleEncode+0x1f2>
jmp    12eb <alleleEncode+0x1eb>
movl   $0xa,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<alleleEncode>:
mov    $0xa,%eax
add    $0xffffffbf,%edi
cmp    $0x13,%edi
ja     11c8 <alleleEncode+0xc8>
lea    0xee8(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
mov    $0xa,%eax
jmp    *%rcx
movsbl %sil,%ecx
add    $0xffffffbf,%ecx
cmp    $0x13,%ecx
ja     11c3 <alleleEncode+0xc3>
xor    %eax,%eax
lea    0x1001(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x1,%eax
ret
movsbl %sil,%ecx
add    $0xffffffbf,%ecx
cmp    $0x13,%ecx
ja     11c3 <alleleEncode+0xc3>
mov    $0x1,%eax
lea    0xf8a(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x4,%eax
ret
movsbl %sil,%ecx
add    $0xffffffbf,%ecx
cmp    $0x13,%ecx
ja     11c3 <alleleEncode+0xc3>
mov    $0x2,%eax
lea    0xf13(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x5,%eax
ret
movsbl %sil,%ecx
add    $0xffffffbf,%ecx
cmp    $0x13,%ecx
ja     11c3 <alleleEncode+0xc3>
mov    $0x3,%eax
lea    0xe9c(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x6,%eax
ret
mov    $0xa,%eax
ret
mov    $0x8,%eax
ret
mov    $0x2,%eax
ret
mov    $0x3,%eax
ret
mov    $0x7,%eax
ret
mov    $0x9,%eax
ret

LLVM IR (-O0):
define i32 @alleleEncode(i8 signext %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8
store i8 %0, i8* %4
store i8 %1, i8* %5
%6 = load i8, i8* %4
%7 = sext i8 %6 to i32
switch i32 %7, label %45 [
i32 65, label %8
i32 67, label %17
i32 71, label %26
i32 84, label %35
i32 78, label %44
]
8: ; preds = %2
%9 = load i8, i8* %5
%10 = sext i8 %9 to i32
switch i32 %10, label %16 [
i32 65, label %11
i32 67, label %12
i32 71, label %13
i32 84, label %14
i32 78, label %15
]
11: ; preds = %8
store i32 0, i32* %3
br label %46
12: ; preds = %8
store i32 1, i32* %3
br label %46
13: ; preds = %8
store i32 2, i32* %3
br label %46
14: ; preds = %8
store i32 3, i32* %3
br label %46
15: ; preds = %8
br label %16
16: ; preds = %8, %15
store i32 10, i32* %3
br label %46
17: ; preds = %2
%18 = load i8, i8* %5
%19 = sext i8 %18 to i32
switch i32 %19, label %25 [
i32 65, label %20
i32 67, label %21
i32 71, label %22
i32 84, label %23
i32 78, label %24
]
20: ; preds = %17
store i32 1, i32* %3
br label %46
21: ; preds = %17
store i32 4, i32* %3
br label %46
22: ; preds = %17
store i32 5, i32* %3
br label %46
23: ; preds = %17
store i32 6, i32* %3
br label %46
24: ; preds = %17
br label %25
25: ; preds = %17, %24
store i32 10, i32* %3
br label %46
26: ; preds = %2
%27 = load i8, i8* %5
%28 = sext i8 %27 to i32
switch i32 %28, label %34 [
i32 65, label %29
i32 67, label %30
i32 71, label %31
i32 84, label %32
i32 78, label %33
]
29: ; preds = %26
store i32 2, i32* %3
br label %46
30: ; preds = %26
store i32 5, i32* %3
br label %46
31: ; preds = %26
store i32 7, i32* %3
br label %46
32: ; preds = %26
store i32 8, i32* %3
br label %46
33: ; preds = %26
br label %34
34: ; preds = %26, %33
store i32 10, i32* %3
br label %46
35: ; preds = %2
%36 = load i8, i8* %5
%37 = sext i8 %36 to i32
switch i32 %37, label %43 [
i32 65, label %38
i32 67, label %39
i32 71, label %40
i32 84, label %41
i32 78, label %42
]
38: ; preds = %35
store i32 3, i32* %3
br label %46
39: ; preds = %35
store i32 6, i32* %3
br label %46
40: ; preds = %35
store i32 8, i32* %3
br label %46
41: ; preds = %35
store i32 9, i32* %3
br label %46
42: ; preds = %35
br label %43
43: ; preds = %35, %42
store i32 10, i32* %3
br label %46
44: ; preds = %2
br label %45
45: ; preds = %2, %44
store i32 10, i32* %3
br label %46
46: ; preds = %45, %43, %41, %40, %39, %38, %34, %32, %31, %30, %29, %25, %23, %22, %21, %20, %16, %14, %13, %12, %11
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
define i32 @alleleEncode(i8 signext %0, i8 signext %1) {
%3 = sext i8 %0 to i32
switch i32 %3, label %28 [
i32 65, label %4
i32 67, label %10
i32 71, label %16
i32 84, label %22
]
4: ; preds = %2
%5 = sext i8 %1 to i32
switch i32 %5, label %9 [
i32 65, label %28
i32 67, label %6
i32 71, label %7
i32 84, label %8
]
6: ; preds = %4
br label %28
7: ; preds = %4
br label %28
8: ; preds = %4
br label %28
9: ; preds = %4
br label %28
10: ; preds = %2
%11 = sext i8 %1 to i32
switch i32 %11, label %15 [
i32 65, label %28
i32 67, label %12
i32 71, label %13
i32 84, label %14
]
12: ; preds = %10
br label %28
13: ; preds = %10
br label %28
14: ; preds = %10
br label %28
15: ; preds = %10
br label %28
16: ; preds = %2
%17 = sext i8 %1 to i32
switch i32 %17, label %21 [
i32 65, label %28
i32 67, label %18
i32 71, label %19
i32 84, label %20
]
18: ; preds = %16
br label %28
19: ; preds = %16
br label %28
20: ; preds = %16
br label %28
21: ; preds = %16
br label %28
22: ; preds = %2
%23 = sext i8 %1 to i32
switch i32 %23, label %27 [
i32 65, label %28
i32 67, label %24
i32 71, label %25
i32 84, label %26
]
24: ; preds = %22
br label %28
25: ; preds = %22
br label %28
26: ; preds = %22
br label %28
27: ; preds = %22
br label %28
28: ; preds = %2, %22, %16, %10, %4, %27, %26, %25, %24, %21, %20, %19, %18, %15, %14, %13, %12, %9, %8, %7, %6
%29 = phi i32 [ 10, %27 ], [ 9, %26 ], [ 8, %25 ], [ 6, %24 ], [ 10, %21 ], [ 8, %20 ], [ 7, %19 ], [ 5, %18 ], [ 10, %15 ], [ 6, %14 ], [ 5, %13 ], [ 4, %12 ], [ 10, %9 ], [ 3, %8 ], [ 2, %7 ], [ 1, %6 ], [ 0, %4 ], [ 1, %10 ], [ 2, %16 ], [ 3, %22 ], [ 10, %2 ]
ret i32 %29
}