int csr1212_check_minimal_ascii(const char *s) {
  static const char minimal_ascii_table[] = {
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x0a, 0x00,
      0x0C, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x21, 0x22, 0x00,
      0x00, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
      0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b,
      0x3c, 0x3d, 0x3e, 0x3f, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
      0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53,
      0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x00, 0x00, 0x00, 0x00, 0x5f,
      0x00, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
      0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
      0x78, 0x79, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00,
  };
  for (; *s; s++) {
    if (minimal_ascii_table[*s & 0x7F] != *s)
      return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<csr1212_check_minimal_ascii>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     115e <csr1212_check_minimal_ascii+0x5e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
and    $0x7f,%eax
movslq %eax,%rcx
lea    0xed7(%rip),%rax
movsbl (%rax,%rcx,1),%eax
mov    -0x10(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1148 <csr1212_check_minimal_ascii+0x48>
movl   $0xffffffff,-0x4(%rbp)
jmp    1165 <csr1212_check_minimal_ascii+0x65>
jmp    114d <csr1212_check_minimal_ascii+0x4d>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1108 <csr1212_check_minimal_ascii+0x8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<csr1212_check_minimal_ascii>:
mov    (%rdi),%dl
xor    %eax,%eax
test   %dl,%dl
je     1138 <csr1212_check_minimal_ascii+0x38>
add    $0x1,%rdi
lea    0xeed(%rip),%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl %dl,%edx
mov    %edx,%esi
and    $0x7f,%esi
cmp    %dl,(%rsi,%rcx,1)
jne    1139 <csr1212_check_minimal_ascii+0x39>
movzbl (%rdi),%edx
add    $0x1,%rdi
test   %dl,%dl
jne    1120 <csr1212_check_minimal_ascii+0x20>
ret
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@csr1212_check_minimal_ascii.minimal_ascii_table = internal constant [128 x i8] c"\00\00\00\00\00\00\00\07\00\00\0A\00\0C\0D\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00 !\22\00\00%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\00\00\00\00_\00abcdefghijklmnopqrstuvwxyz\00\00\00\00\00"
define i32 @csr1212_check_minimal_ascii(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
br label %4
4: ; preds = %23, %1
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %26
8: ; preds = %4
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = and i32 %11, 127
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [128 x i8], [128 x i8]* @csr1212_check_minimal_ascii.minimal_ascii_table, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = load i8*, i8** %3
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %16, %19
br i1 %20, label %21, label %22
21: ; preds = %8
store i32 -1, i32* %2
br label %27
22: ; preds = %8
br label %23
23: ; preds = %22
%24 = load i8*, i8** %3
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %3
br label %4
26: ; preds = %4
store i32 0, i32* %2
br label %27
27: ; preds = %26, %21
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
@csr1212_check_minimal_ascii.minimal_ascii_table = internal unnamed_addr constant [128 x i8] c"\00\00\00\00\00\00\00\07\00\00\0A\00\0C\0D\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00 !\22\00\00%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ\00\00\00\00_\00abcdefghijklmnopqrstuvwxyz\00\00\00\00\00"
define i32 @csr1212_check_minimal_ascii(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %7
4: ; preds = %7
%5 = load i8, i8* %15
%6 = icmp eq i8 %5, 0
br i1 %6, label %16, label %7
7: ; preds = %1, %4
%8 = phi i8 [ %5, %4 ], [ %2, %1 ]
%9 = phi i8* [ %15, %4 ], [ %0, %1 ]
%10 = and i8 %8, 127
%11 = zext i8 %10 to i64
%12 = getelementptr inbounds [128 x i8], [128 x i8]* @csr1212_check_minimal_ascii.minimal_ascii_table, i64 0, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, %8
%15 = getelementptr inbounds i8, i8* %9, i64 1
br i1 %14, label %4, label %16
16: ; preds = %7, %4, %1
%17 = phi i32 [ 0, %1 ], [ 0, %4 ], [ -1, %7 ]
ret i32 %17
}