int iso3166_alpha2(const char *cc) {
  static const unsigned char codes[85] = {
      0x78, 0x59, 0xDF, 0xEE, 0xEF, 0xBD, 0xDD, 0xDE, 0x27, 0x3F, 0x84,
      0x15, 0x80, 0xD4, 0x00, 0x0E, 0x00, 0x5C, 0x09, 0xB0, 0x9F, 0xFB,
      0x15, 0x00, 0x8D, 0x06, 0x18, 0x78, 0x0F, 0x40, 0x40, 0x03, 0x00,
      0x1D, 0x2B, 0xF4, 0x41, 0x81, 0x4F, 0xFD, 0xFC, 0xFF, 0xD7, 0x25,
      0x4B, 0x08, 0x00, 0x01, 0x40, 0x3C, 0x8F, 0x53, 0x01, 0x00, 0x00,
      0x40, 0x00, 0x51, 0xF1, 0xFD, 0xE7, 0x3A, 0xBB, 0x9F, 0x9A, 0x41,
      0x10, 0x04, 0x57, 0x85, 0x40, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00,
      0x00, 0x10, 0x00, 0x08, 0x04, 0x40, 0x00, 0x01,
  };
  int cc_int;
  if (cc[0] < 'A' || cc[0] > 'Z' || cc[1] < 'A' || cc[1] > 'Z') {
    return 0;
  }
  cc_int = (cc[0] - 'A') * 26 + (cc[1] - 'A');
  return codes[cc_int >> 3] & (1 << (cc_int & 0x7)) ? 1 : 0;
}


x86 assembly (clang, -O0):
<iso3166_alpha2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jl     114a <iso3166_alpha2+0x4a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5a,%eax
jg     114a <iso3166_alpha2+0x4a>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x41,%eax
jl     114a <iso3166_alpha2+0x4a>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x5a,%eax
jle    1156 <iso3166_alpha2+0x56>
movl   $0x0,-0x4(%rbp)
jmp    11a6 <iso3166_alpha2+0xa6>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
sub    $0x41,%eax
imul   $0x1a,%eax,%eax
mov    -0x10(%rbp),%rcx
movsbl 0x1(%rcx),%ecx
sub    $0x41,%ecx
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sar    $0x3,%eax
movslq %eax,%rcx
lea    0xe7d(%rip),%rax
movzbl (%rax,%rcx,1),%edx
mov    -0x14(%rbp),%ecx
and    $0x7,%ecx
mov    $0x1,%eax
shl    %cl,%eax
and    %eax,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<iso3166_alpha2>:
movsbl (%rdi),%ecx
lea    -0x5b(%rcx),%edx
xor    %eax,%eax
cmp    $0xe6,%dl
jb     1143 <iso3166_alpha2+0x43>
movzbl 0x1(%rdi),%edx
lea    -0x5b(%rdx),%esi
cmp    $0xe6,%sil
jb     1143 <iso3166_alpha2+0x43>
lea    (%rcx,%rcx,4),%eax
lea    (%rax,%rax,4),%eax
add    %ecx,%eax
lea    (%rdx,%rax,1),%ecx
add    $0xfffff925,%ecx
mov    %ecx,%eax
sar    $0x3,%eax
lea    0xec9(%rip),%rdx
movzbl (%rax,%rdx,1),%eax
and    $0x7,%cl
shr    %cl,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
@iso3166_alpha2.codes = internal constant [85 x i8] c"xY\DF\EE\EF\BD\DD\DE'?\84\15\80\D4\00\0E\00\\\09\B0\9F\FB\15\00\8D\06\18x\0F@@\03\00\1D+\F4A\81O\FD\FC\FF\D7%K\08\00\01@<\8FS\01\00\00@\00Q\F1\FD\E7:\BB\9F\9AA\10\04W\85@\00\02@\00\00\00\00\10\00\08\04@\00\01"
define i32 @iso3166_alpha2(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp slt i32 %8, 65
br i1 %9, label %28, label %10
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp sgt i32 %14, 90
br i1 %15, label %28, label %16
16: ; preds = %10
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp slt i32 %20, 65
br i1 %21, label %28, label %22
22: ; preds = %16
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i64 1
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp sgt i32 %26, 90
br i1 %27, label %28, label %29
28: ; preds = %22, %16, %10, %1
store i32 0, i32* %2
br label %55
29: ; preds = %22
%30 = load i8*, i8** %3
%31 = getelementptr inbounds i8, i8* %30, i64 0
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = sub nsw i32 %33, 65
%35 = mul nsw i32 %34, 26
%36 = load i8*, i8** %3
%37 = getelementptr inbounds i8, i8* %36, i64 1
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = sub nsw i32 %39, 65
%41 = add nsw i32 %35, %40
store i32 %41, i32* %4
%42 = load i32, i32* %4
%43 = ashr i32 %42, 3
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [85 x i8], [85 x i8]* @iso3166_alpha2.codes, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = zext i8 %46 to i32
%48 = load i32, i32* %4
%49 = and i32 %48, 7
%50 = shl i32 1, %49
%51 = and i32 %47, %50
%52 = icmp ne i32 %51, 0
%53 = zext i1 %52 to i64
%54 = select i1 %52, i32 1, i32 0
store i32 %54, i32* %2
br label %55
55: ; preds = %29, %28
%56 = load i32, i32* %2
ret i32 %56
}

LLVM IR (-O2):
@iso3166_alpha2.codes = internal unnamed_addr constant [85 x i8] c"xY\DF\EE\EF\BD\DD\DE'?\84\15\80\D4\00\0E\00\\\09\B0\9F\FB\15\00\8D\06\18x\0F@@\03\00\1D+\F4A\81O\FD\FC\FF\D7%K\08\00\01@<\8FS\01\00\00@\00Q\F1\FD\E7:\BB\9F\9AA\10\04W\85@\00\02@\00\00\00\00\10\00\08\04@\00\01"
define i32 @iso3166_alpha2(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = add i8 %2, -91
%5 = icmp ult i8 %4, -26
br i1 %5, label %24, label %6
6: ; preds = %1
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = load i8, i8* %7
%9 = add i8 %8, -91
%10 = icmp ult i8 %9, -26
br i1 %10, label %24, label %11
11: ; preds = %6
%12 = zext i8 %8 to i32
%13 = mul nsw i32 %3, 26
%14 = add nsw i32 %13, -1755
%15 = add nsw i32 %14, %12
%16 = ashr i32 %15, 3
%17 = zext i32 %16 to i64
%18 = getelementptr inbounds [85 x i8], [85 x i8]* @iso3166_alpha2.codes, i64 0, i64 %17
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = and i32 %15, 7
%22 = lshr i32 %20, %21
%23 = and i32 %22, 1
br label %24
24: ; preds = %1, %6, %11
%25 = phi i32 [ %23, %11 ], [ 0, %6 ], [ 0, %1 ]
ret i32 %25
}