signed char code128b_ascii_to_code(char value) {
  if (value >= 32)
    return value - 32;
  else if (value == '\xf1')
    return 102;
  else if (value == '\xf2')
    return 97;
  else if (value == '\xf3')
    return 96;
  else if (value == '\xf4')
    return 100;
  else
    return -1;
}


x86 assembly (clang, -O0):
<code128b_ascii_to_code>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x20,%eax
jl     1126 <code128b_ascii_to_code+0x26>
movsbl -0x2(%rbp),%eax
sub    $0x20,%eax
mov    %al,-0x1(%rbp)
jmp    1182 <code128b_ascii_to_code+0x82>
movsbl -0x2(%rbp),%eax
cmp    $0xfffffff1,%eax
jne    113c <code128b_ascii_to_code+0x3c>
movb   $0x66,-0x1(%rbp)
jmp    1182 <code128b_ascii_to_code+0x82>
movsbl -0x2(%rbp),%eax
cmp    $0xfffffff2,%eax
jne    1152 <code128b_ascii_to_code+0x52>
movb   $0x61,-0x1(%rbp)
jmp    1182 <code128b_ascii_to_code+0x82>
movsbl -0x2(%rbp),%eax
cmp    $0xfffffff3,%eax
jne    1168 <code128b_ascii_to_code+0x68>
movb   $0x60,-0x1(%rbp)
jmp    1182 <code128b_ascii_to_code+0x82>
movsbl -0x2(%rbp),%eax
cmp    $0xfffffff4,%eax
jne    117e <code128b_ascii_to_code+0x7e>
movb   $0x64,-0x1(%rbp)
jmp    1182 <code128b_ascii_to_code+0x82>
movb   $0xff,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<code128b_ascii_to_code>:
cmp    $0x20,%dil
jl     110d <code128b_ascii_to_code+0xd>
add    $0xe0,%dil
mov    %edi,%eax
ret
add    $0xf,%dil
mov    $0xff,%al
cmp    $0x3,%dil
ja     1127 <code128b_ascii_to_code+0x27>
movzbl %dil,%ecx
shl    $0x3,%ecx
mov    $0x64606166,%eax
shr    %cl,%eax
ret

LLVM IR (-O0):
define signext i8 @code128b_ascii_to_code(i8 signext %0) {
%2 = alloca i8
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 32
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = sub nsw i32 %9, 32
%11 = trunc i32 %10 to i8
store i8 %11, i8* %2
br label %33
12: ; preds = %1
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, -15
br i1 %15, label %16, label %17
16: ; preds = %12
store i8 102, i8* %2
br label %33
17: ; preds = %12
%18 = load i8, i8* %3
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, -14
br i1 %20, label %21, label %22
21: ; preds = %17
store i8 97, i8* %2
br label %33
22: ; preds = %17
%23 = load i8, i8* %3
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, -13
br i1 %25, label %26, label %27
26: ; preds = %22
store i8 96, i8* %2
br label %33
27: ; preds = %22
%28 = load i8, i8* %3
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, -12
br i1 %30, label %31, label %32
31: ; preds = %27
store i8 100, i8* %2
br label %33
32: ; preds = %27
store i8 -1, i8* %2
br label %33
33: ; preds = %32, %31, %26, %21, %16, %7
%34 = load i8, i8* %2
ret i8 %34
}

LLVM IR (-O2):
define signext i8 @code128b_ascii_to_code(i8 signext %0) {
%2 = icmp sgt i8 %0, 31
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = add nsw i8 %0, -32
br label %13
5: ; preds = %1
%6 = add i8 %0, 15
%7 = icmp ult i8 %6, 4
br i1 %7, label %8, label %13
8: ; preds = %5
%9 = zext i8 %6 to i32
%10 = shl nuw nsw i32 %9, 3
%11 = lshr i32 1684037990, %10
%12 = trunc i32 %11 to i8
br label %13
13: ; preds = %5, %8, %3
%14 = phi i8 [ %4, %3 ], [ %12, %8 ], [ -1, %5 ]
ret i8 %14
}