int bc_iso4217_numeric(int cc) {
  static const short codes[179] = {
      8,   12,  32,  36,  44,  48,  50,  51,  52,  60,  64,  68,  72,  84,  90,
      96,  104, 108, 116, 124, 132, 136, 144, 152, 156, 170, 174, 188, 191, 192,
      203, 208, 214, 222, 230, 232, 238, 242, 262, 270, 292, 320, 324, 328, 332,
      340, 344, 348, 352, 356, 360, 364, 368, 376, 388, 392, 398, 400, 404, 408,
      410, 414, 417, 418, 422, 426, 430, 434, 446, 454, 458, 462, 480, 484, 496,
      498, 504, 512, 516, 524, 532, 533, 548, 554, 558, 566, 578, 586, 590, 598,
      600, 604, 608, 634, 643, 646, 654, 682, 690, 694, 702, 704, 706, 710, 728,
      748, 752, 756, 760, 764, 776, 780, 784, 788, 800, 807, 818, 826, 834, 840,
      858, 860, 882, 886, 901, 927, 928, 929, 930, 931, 932, 933, 934, 936, 938,
      940, 941, 943, 944, 946, 947, 948, 949, 950, 951, 952, 953, 955, 956, 957,
      958, 959, 960, 961, 962, 963, 964, 965, 967, 968, 969, 970, 971, 972, 973,
      975, 976, 977, 978, 979, 980, 981, 984, 985, 986, 990, 994, 997, 999,
  };
  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_iso4217_numeric>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0xb2,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jg     1194 <bc_iso4217_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_iso4217_numeric+0x58>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118f <bc_iso4217_numeric+0x8f>
movslq -0x14(%rbp),%rcx
lea    0xe9d(%rip),%rax
movswl (%rax,%rcx,2),%eax
cmp    -0x8(%rbp),%eax
jle    117e <bc_iso4217_numeric+0x7e>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    118a <bc_iso4217_numeric+0x8a>
movl   $0x1,-0x4(%rbp)
jmp    119b <bc_iso4217_numeric+0x9b>
jmp    118f <bc_iso4217_numeric+0x8f>
jmp    1115 <bc_iso4217_numeric+0x15>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bc_iso4217_numeric>:
mov    $0xb2,%edx
xor    %ecx,%ecx
lea    0xef2(%rip),%r8
xchg   %ax,%ax
cmp    %edx,%ecx
jg     113e <bc_iso4217_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_iso4217_numeric+0x37>
add    $0xffffffff,%esi
mov    %esi,%edx
cmp    %edi,%eax
jg     1110 <bc_iso4217_numeric+0x10>
jmp    1141 <bc_iso4217_numeric+0x41>
add    $0x1,%esi
mov    %esi,%ecx
jmp    1110 <bc_iso4217_numeric+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
@bc_iso4217_numeric.codes = internal constant [179 x i16] [i16 8, i16 12, i16 32, i16 36, i16 44, i16 48, i16 50, i16 51, i16 52, i16 60, i16 64, i16 68, i16 72, i16 84, i16 90, i16 96, i16 104, i16 108, i16 116, i16 124, i16 132, i16 136, i16 144, i16 152, i16 156, i16 170, i16 174, i16 188, i16 191, i16 192, i16 203, i16 208, i16 214, i16 222, i16 230, i16 232, i16 238, i16 242, i16 262, i16 270, i16 292, i16 320, i16 324, i16 328, i16 332, i16 340, i16 344, i16 348, i16 352, i16 356, i16 360, i16 364, i16 368, i16 376, 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 430, i16 434, i16 446, i16 454, i16 458, i16 462, i16 480, i16 484, i16 496, i16 498, i16 504, i16 512, i16 516, i16 524, i16 532, i16 533, i16 548, i16 554, i16 558, i16 566, i16 578, i16 586, i16 590, i16 598, i16 600, i16 604, i16 608, i16 634, i16 643, i16 646, i16 654, i16 682, i16 690, i16 694, i16 702, i16 704, i16 706, i16 710, i16 728, i16 748, i16 752, i16 756, i16 760, i16 764, i16 776, i16 780, i16 784, i16 788, i16 800, i16 807, i16 818, i16 826, i16 834, i16 840, i16 858, i16 860, i16 882, i16 886, i16 901, i16 927, i16 928, i16 929, i16 930, i16 931, i16 932, i16 933, i16 934, i16 936, i16 938, i16 940, i16 941, i16 943, i16 944, i16 946, i16 947, i16 948, i16 949, i16 950, i16 951, i16 952, i16 953, i16 955, i16 956, i16 957, i16 958, i16 959, i16 960, i16 961, i16 962, i16 963, i16 964, i16 965, i16 967, i16 968, i16 969, i16 970, i16 971, i16 972, i16 973, i16 975, i16 976, i16 977, i16 978, i16 979, i16 980, i16 981, i16 984, i16 985, i16 986, i16 990, i16 994, i16 997, i16 999]
define i32 @bc_iso4217_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 178, 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 [179 x i16], [179 x i16]* @bc_iso4217_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 [179 x i16], [179 x i16]* @bc_iso4217_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_iso4217_numeric.codes = internal unnamed_addr constant [179 x i16] [i16 8, i16 12, i16 32, i16 36, i16 44, i16 48, i16 50, i16 51, i16 52, i16 60, i16 64, i16 68, i16 72, i16 84, i16 90, i16 96, i16 104, i16 108, i16 116, i16 124, i16 132, i16 136, i16 144, i16 152, i16 156, i16 170, i16 174, i16 188, i16 191, i16 192, i16 203, i16 208, i16 214, i16 222, i16 230, i16 232, i16 238, i16 242, i16 262, i16 270, i16 292, i16 320, i16 324, i16 328, i16 332, i16 340, i16 344, i16 348, i16 352, i16 356, i16 360, i16 364, i16 368, i16 376, 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 430, i16 434, i16 446, i16 454, i16 458, i16 462, i16 480, i16 484, i16 496, i16 498, i16 504, i16 512, i16 516, i16 524, i16 532, i16 533, i16 548, i16 554, i16 558, i16 566, i16 578, i16 586, i16 590, i16 598, i16 600, i16 604, i16 608, i16 634, i16 643, i16 646, i16 654, i16 682, i16 690, i16 694, i16 702, i16 704, i16 706, i16 710, i16 728, i16 748, i16 752, i16 756, i16 760, i16 764, i16 776, i16 780, i16 784, i16 788, i16 800, i16 807, i16 818, i16 826, i16 834, i16 840, i16 858, i16 860, i16 882, i16 886, i16 901, i16 927, i16 928, i16 929, i16 930, i16 931, i16 932, i16 933, i16 934, i16 936, i16 938, i16 940, i16 941, i16 943, i16 944, i16 946, i16 947, i16 948, i16 949, i16 950, i16 951, i16 952, i16 953, i16 955, i16 956, i16 957, i16 958, i16 959, i16 960, i16 961, i16 962, i16 963, i16 964, i16 965, i16 967, i16 968, i16 969, i16 970, i16 971, i16 972, i16 973, i16 975, i16 976, i16 977, i16 978, i16 979, i16 980, i16 981, i16 984, i16 985, i16 986, i16 990, i16 994, i16 997, i16 999]
define i32 @bc_iso4217_numeric(i32 %0) {
br label %2
2: ; preds = %16, %1
%3 = phi i32 [ %17, %16 ], [ 0, %1 ]
%4 = phi i32 [ %6, %16 ], [ 178, %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 [179 x i16], [179 x i16]* @bc_iso4217_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
}