int triplet_ind(const char *s) {
  static const int mask1[128] = {
      64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
      64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
      64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
      64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
      64, 2,  64, 1,  64, 64, 64, 3,  64, 64, 64, 64, 64, 64, 64, 64,
      64, 64, 64, 64, 0,  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
      64, 2,  64, 1,  64, 64, 64, 3,  64, 64, 64, 64, 64, 64, 64, 64,
      64, 64, 64, 64, 0,  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64};
  static const int mask2[128] = {
      64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
      64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
      64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
      64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
      64, 8,  64, 4,  64, 64, 64, 12, 64, 64, 64, 64, 64, 64, 64, 64,
      64, 64, 64, 64, 0,  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
      64, 8,  64, 4,  64, 64, 64, 12, 64, 64, 64, 64, 64, 64, 64, 64,
      64, 64, 64, 64, 0,  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64};
  static const int mask3[128] = {
      64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
      64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
      64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
      64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
      64, 32, 64, 16, 64, 64, 64, 48, 64, 64, 64, 64, 64, 64, 64, 64,
      64, 64, 64, 64, 0,  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
      64, 32, 64, 16, 64, 64, 64, 48, 64, 64, 64, 64, 64, 64, 64, 64,
      64, 64, 64, 64, 0,  64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64};
  return mask1[(int)s[0]] | mask2[(int)s[1]] | mask3[(int)s[2]];
}


x86 assembly (clang, -O0):
<triplet_ind>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
movslq %eax,%rcx
lea    0xee7(%rip),%rax
mov    (%rax,%rcx,4),%eax
mov    -0x8(%rbp),%rcx
movsbl 0x1(%rcx),%ecx
movslq %ecx,%rdx
lea    0x10d2(%rip),%rcx
or     (%rcx,%rdx,4),%eax
mov    -0x8(%rbp),%rcx
movsbl 0x2(%rcx),%ecx
movslq %ecx,%rdx
lea    0x12bd(%rip),%rcx
or     (%rcx,%rdx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<triplet_ind>:
movsbq (%rdi),%rcx
lea    0xef5(%rip),%rdx
movsbq 0x1(%rdi),%rax
lea    0x10e9(%rip),%rsi
mov    (%rsi,%rax,4),%eax
or     (%rdx,%rcx,4),%eax
movsbq 0x2(%rdi),%rcx
lea    0x12d7(%rip),%rdx
or     (%rdx,%rcx,4),%eax
ret

LLVM IR (-O0):
@triplet_ind.mask1 = internal constant [128 x i32] [i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 2, i32 64, i32 1, i32 64, i32 64, i32 64, i32 3, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 0, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 2, i32 64, i32 1, i32 64, i32 64, i32 64, i32 3, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 0, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64]
@triplet_ind.mask2 = internal constant [128 x i32] [i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 8, i32 64, i32 4, i32 64, i32 64, i32 64, i32 12, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 0, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 8, i32 64, i32 4, i32 64, i32 64, i32 64, i32 12, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 0, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64]
@triplet_ind.mask3 = internal constant [128 x i32] [i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 32, i32 64, i32 16, i32 64, i32 64, i32 64, i32 48, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 0, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 32, i32 64, i32 16, i32 64, i32 64, i32 64, i32 48, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 0, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64]
define i32 @triplet_ind(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds [128 x i32], [128 x i32]* @triplet_ind.mask1, i64 0, i64 %7
%9 = load i32, i32* %8
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [128 x i32], [128 x i32]* @triplet_ind.mask2, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = or i32 %9, %16
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i64 2
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [128 x i32], [128 x i32]* @triplet_ind.mask3, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = or i32 %17, %24
ret i32 %25
}

LLVM IR (-O2):
@triplet_ind.mask1 = internal unnamed_addr constant [128 x i32] [i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 2, i32 64, i32 1, i32 64, i32 64, i32 64, i32 3, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 0, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 2, i32 64, i32 1, i32 64, i32 64, i32 64, i32 3, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 0, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64]
@triplet_ind.mask2 = internal unnamed_addr constant [128 x i32] [i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 8, i32 64, i32 4, i32 64, i32 64, i32 64, i32 12, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 0, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 8, i32 64, i32 4, i32 64, i32 64, i32 64, i32 12, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 0, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64]
@triplet_ind.mask3 = internal unnamed_addr constant [128 x i32] [i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 32, i32 64, i32 16, i32 64, i32 64, i32 64, i32 48, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 0, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 32, i32 64, i32 16, i32 64, i32 64, i32 64, i32 48, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 0, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64, i32 64]
define i32 @triplet_ind(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i64
%4 = getelementptr inbounds [128 x i32], [128 x i32]* @triplet_ind.mask1, i64 0, i64 %3
%5 = load i32, i32* %4
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
%8 = sext i8 %7 to i64
%9 = getelementptr inbounds [128 x i32], [128 x i32]* @triplet_ind.mask2, i64 0, i64 %8
%10 = load i32, i32* %9
%11 = or i32 %10, %5
%12 = getelementptr inbounds i8, i8* %0, i64 2
%13 = load i8, i8* %12
%14 = sext i8 %13 to i64
%15 = getelementptr inbounds [128 x i32], [128 x i32]* @triplet_ind.mask3, i64 0, i64 %14
%16 = load i32, i32* %15
%17 = or i32 %11, %16
ret i32 %17
}