int bc_iso3166_numeric(int cc) {
  static const short codes[249] = {
      4,   8,   10,  12,  16,  20,  24,  28,  31,  32,  36,  40,  44,  48,  50,
      51,  52,  56,  60,  64,  68,  70,  72,  74,  76,  84,  86,  90,  92,  96,
      100, 104, 108, 112, 116, 120, 124, 132, 136, 140, 144, 148, 152, 156, 158,
      162, 166, 170, 174, 175, 178, 180, 184, 188, 191, 192, 196, 203, 204, 208,
      212, 214, 218, 222, 226, 231, 232, 233, 234, 238, 239, 242, 246, 248, 250,
      254, 258, 260, 262, 266, 268, 270, 275, 276, 288, 292, 296, 300, 304, 308,
      312, 316, 320, 324, 328, 332, 334, 336, 340, 344, 348, 352, 356, 360, 364,
      368, 372, 376, 380, 384, 388, 392, 398, 400, 404, 408, 410, 414, 417, 418,
      422, 426, 428, 430, 434, 438, 440, 442, 446, 450, 454, 458, 462, 466, 470,
      474, 478, 480, 484, 492, 496, 498, 499, 500, 504, 508, 512, 516, 520, 524,
      528, 531, 533, 534, 535, 540, 548, 554, 558, 562, 566, 570, 574, 578, 580,
      581, 583, 584, 585, 586, 591, 598, 600, 604, 608, 612, 616, 620, 624, 626,
      630, 634, 638, 642, 643, 646, 652, 654, 659, 660, 662, 663, 666, 670, 674,
      678, 682, 686, 688, 690, 694, 702, 703, 704, 705, 706, 710, 716, 724, 728,
      729, 732, 740, 744, 748, 752, 756, 760, 762, 764, 768, 772, 776, 780, 784,
      788, 792, 795, 796, 798, 800, 804, 807, 818, 826, 831, 832, 833, 834, 840,
      850, 854, 858, 860, 862, 876, 882, 887, 894,
  };
  int s = 0, e = ((int)(sizeof(codes) / sizeof((codes)[0]))) - 1;
  while (s <= e) {
    int m = (s + e) / 2;
    if (codes[m] < cc) {
      s = m + 1;
    } else if (codes[m] > cc) {
      e = m - 1;
    } else {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<bc_iso3166_numeric>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0xf8,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1194 <bc_iso3166_numeric+0x94>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rcx
lea    0xec3(%rip),%rax
movswl (%rax,%rcx,2),%eax
cmp    -0x8(%rbp),%eax
jge    1158 <bc_iso3166_numeric+0x58>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118f <bc_iso3166_numeric+0x8f>
movslq -0x14(%rbp),%rcx
lea    0xe9d(%rip),%rax
movswl (%rax,%rcx,2),%eax
cmp    -0x8(%rbp),%eax
jle    117e <bc_iso3166_numeric+0x7e>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    118a <bc_iso3166_numeric+0x8a>
movl   $0x1,-0x4(%rbp)
jmp    119b <bc_iso3166_numeric+0x9b>
jmp    118f <bc_iso3166_numeric+0x8f>
jmp    1115 <bc_iso3166_numeric+0x15>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bc_iso3166_numeric>:
mov    $0xf8,%edx
xor    %ecx,%ecx
lea    0xef2(%rip),%r8
xchg   %ax,%ax
cmp    %edx,%ecx
jg     113e <bc_iso3166_numeric+0x3e>
lea    (%rdx,%rcx,1),%eax
mov    %eax,%esi
shr    $0x1f,%esi
add    %eax,%esi
sar    %esi
movslq %esi,%rax
movswl (%r8,%rax,2),%eax
cmp    %edi,%eax
jl     1137 <bc_iso3166_numeric+0x37>
add    $0xffffffff,%esi
mov    %esi,%edx
cmp    %edi,%eax
jg     1110 <bc_iso3166_numeric+0x10>
jmp    1141 <bc_iso3166_numeric+0x41>
add    $0x1,%esi
mov    %esi,%ecx
jmp    1110 <bc_iso3166_numeric+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
@bc_iso3166_numeric.codes = internal constant [249 x i16] [i16 4, i16 8, i16 10, i16 12, i16 16, i16 20, i16 24, i16 28, i16 31, i16 32, i16 36, i16 40, i16 44, i16 48, i16 50, i16 51, i16 52, i16 56, i16 60, i16 64, i16 68, i16 70, i16 72, i16 74, i16 76, i16 84, i16 86, i16 90, i16 92, i16 96, i16 100, i16 104, i16 108, i16 112, i16 116, i16 120, i16 124, i16 132, i16 136, i16 140, i16 144, i16 148, i16 152, i16 156, i16 158, i16 162, i16 166, i16 170, i16 174, i16 175, i16 178, i16 180, i16 184, i16 188, i16 191, i16 192, i16 196, i16 203, i16 204, i16 208, i16 212, i16 214, i16 218, i16 222, i16 226, i16 231, i16 232, i16 233, i16 234, i16 238, i16 239, i16 242, i16 246, i16 248, i16 250, i16 254, i16 258, i16 260, i16 262, i16 266, i16 268, i16 270, i16 275, i16 276, i16 288, i16 292, i16 296, i16 300, i16 304, i16 308, i16 312, i16 316, i16 320, i16 324, i16 328, i16 332, i16 334, i16 336, i16 340, i16 344, i16 348, i16 352, i16 356, i16 360, i16 364, i16 368, i16 372, i16 376, i16 380, i16 384, i16 388, i16 392, i16 398, i16 400, i16 404, i16 408, i16 410, i16 414, i16 417, i16 418, i16 422, i16 426, i16 428, i16 430, i16 434, i16 438, i16 440, i16 442, i16 446, i16 450, i16 454, i16 458, i16 462, i16 466, i16 470, i16 474, i16 478, i16 480, i16 484, i16 492, i16 496, i16 498, i16 499, i16 500, i16 504, i16 508, i16 512, i16 516, i16 520, i16 524, i16 528, i16 531, i16 533, i16 534, i16 535, i16 540, i16 548, i16 554, i16 558, i16 562, i16 566, i16 570, i16 574, i16 578, i16 580, i16 581, i16 583, i16 584, i16 585, i16 586, i16 591, i16 598, i16 600, i16 604, i16 608, i16 612, i16 616, i16 620, i16 624, i16 626, i16 630, i16 634, i16 638, i16 642, i16 643, i16 646, i16 652, i16 654, i16 659, i16 660, i16 662, i16 663, i16 666, i16 670, i16 674, i16 678, i16 682, i16 686, i16 688, i16 690, i16 694, i16 702, i16 703, i16 704, i16 705, i16 706, i16 710, i16 716, i16 724, i16 728, i16 729, i16 732, i16 740, i16 744, i16 748, i16 752, i16 756, i16 760, i16 762, i16 764, i16 768, i16 772, i16 776, i16 780, i16 784, i16 788, i16 792, i16 795, i16 796, i16 798, i16 800, i16 804, i16 807, i16 818, i16 826, i16 831, i16 832, i16 833, i16 834, i16 840, i16 850, i16 854, i16 858, i16 860, i16 862, i16 876, i16 882, i16 887, i16 894]
define i32 @bc_iso3166_numeric(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 0, i32* %4
store i32 248, i32* %5
br label %7
7: ; preds = %39, %1
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = icmp sle i32 %8, %9
br i1 %10, label %11, label %40
11: ; preds = %7
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = add nsw i32 %12, %13
%15 = sdiv i32 %14, 2
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [249 x i16], [249 x i16]* @bc_iso3166_numeric.codes, i64 0, i64 %17
%19 = load i16, i16* %18
%20 = sext i16 %19 to i32
%21 = load i32, i32* %3
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %26
23: ; preds = %11
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
br label %39
26: ; preds = %11
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [249 x i16], [249 x i16]* @bc_iso3166_numeric.codes, i64 0, i64 %28
%30 = load i16, i16* %29
%31 = sext i16 %30 to i32
%32 = load i32, i32* %3
%33 = icmp sgt i32 %31, %32
br i1 %33, label %34, label %37
34: ; preds = %26
%35 = load i32, i32* %6
%36 = sub nsw i32 %35, 1
store i32 %36, i32* %5
br label %38
37: ; preds = %26
store i32 1, i32* %2
br label %41
38: ; preds = %34
br label %39
39: ; preds = %38, %23
br label %7
40: ; preds = %7
store i32 0, i32* %2
br label %41
41: ; preds = %40, %37
%42 = load i32, i32* %2
ret i32 %42
}

LLVM IR (-O2):
@bc_iso3166_numeric.codes = internal unnamed_addr constant [249 x i16] [i16 4, i16 8, i16 10, i16 12, i16 16, i16 20, i16 24, i16 28, i16 31, i16 32, i16 36, i16 40, i16 44, i16 48, i16 50, i16 51, i16 52, i16 56, i16 60, i16 64, i16 68, i16 70, i16 72, i16 74, i16 76, i16 84, i16 86, i16 90, i16 92, i16 96, i16 100, i16 104, i16 108, i16 112, i16 116, i16 120, i16 124, i16 132, i16 136, i16 140, i16 144, i16 148, i16 152, i16 156, i16 158, i16 162, i16 166, i16 170, i16 174, i16 175, i16 178, i16 180, i16 184, i16 188, i16 191, i16 192, i16 196, i16 203, i16 204, i16 208, i16 212, i16 214, i16 218, i16 222, i16 226, i16 231, i16 232, i16 233, i16 234, i16 238, i16 239, i16 242, i16 246, i16 248, i16 250, i16 254, i16 258, i16 260, i16 262, i16 266, i16 268, i16 270, i16 275, i16 276, i16 288, i16 292, i16 296, i16 300, i16 304, i16 308, i16 312, i16 316, i16 320, i16 324, i16 328, i16 332, i16 334, i16 336, i16 340, i16 344, i16 348, i16 352, i16 356, i16 360, i16 364, i16 368, i16 372, i16 376, i16 380, i16 384, i16 388, i16 392, i16 398, i16 400, i16 404, i16 408, i16 410, i16 414, i16 417, i16 418, i16 422, i16 426, i16 428, i16 430, i16 434, i16 438, i16 440, i16 442, i16 446, i16 450, i16 454, i16 458, i16 462, i16 466, i16 470, i16 474, i16 478, i16 480, i16 484, i16 492, i16 496, i16 498, i16 499, i16 500, i16 504, i16 508, i16 512, i16 516, i16 520, i16 524, i16 528, i16 531, i16 533, i16 534, i16 535, i16 540, i16 548, i16 554, i16 558, i16 562, i16 566, i16 570, i16 574, i16 578, i16 580, i16 581, i16 583, i16 584, i16 585, i16 586, i16 591, i16 598, i16 600, i16 604, i16 608, i16 612, i16 616, i16 620, i16 624, i16 626, i16 630, i16 634, i16 638, i16 642, i16 643, i16 646, i16 652, i16 654, i16 659, i16 660, i16 662, i16 663, i16 666, i16 670, i16 674, i16 678, i16 682, i16 686, i16 688, i16 690, i16 694, i16 702, i16 703, i16 704, i16 705, i16 706, i16 710, i16 716, i16 724, i16 728, i16 729, i16 732, i16 740, i16 744, i16 748, i16 752, i16 756, i16 760, i16 762, i16 764, i16 768, i16 772, i16 776, i16 780, i16 784, i16 788, i16 792, i16 795, i16 796, i16 798, i16 800, i16 804, i16 807, i16 818, i16 826, i16 831, i16 832, i16 833, i16 834, i16 840, i16 850, i16 854, i16 858, i16 860, i16 862, i16 876, i16 882, i16 887, i16 894]
define i32 @bc_iso3166_numeric(i32 %0) {
br label %2
2: ; preds = %16, %1
%3 = phi i32 [ %17, %16 ], [ 0, %1 ]
%4 = phi i32 [ %6, %16 ], [ 248, %1 ]
br label %5
5: ; preds = %2, %18
%6 = phi i32 [ %20, %18 ], [ %4, %2 ]
%7 = icmp sgt i32 %3, %6
br i1 %7, label %21, label %8
8: ; preds = %5
%9 = add nsw i32 %6, %3
%10 = sdiv i32 %9, 2
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [249 x i16], [249 x i16]* @bc_iso3166_numeric.codes, i64 0, i64 %11
%13 = load i16, i16* %12
%14 = sext i16 %13 to i32
%15 = icmp slt i32 %14, %0
br i1 %15, label %16, label %18
16: ; preds = %8
%17 = add nsw i32 %10, 1
br label %2
18: ; preds = %8
%19 = icmp sgt i32 %14, %0
%20 = add nsw i32 %10, -1
br i1 %19, label %5, label %21
21: ; preds = %5, %18
%22 = phi i32 [ 1, %18 ], [ 0, %5 ]
ret i32 %22
}