int trans_letter_2_index(char letter) {
  int index = -1;
  if (letter >= 97 && letter <= 122) {
    index = letter - 97 + 26;
  } else if (letter >= 65 && letter <= 90) {
    index = letter - 65;
  } else {
    do {
      printf("[%s/%d]:", __func__, 52);
      printf("error letter input:%c", letter);
      printf("\n");
    } while (0);
    exit(0);
  }
  return index;
}


x86 assembly (clang, -O0):
<trans_letter_2_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0xffffffff,-0x8(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jl     1161 <trans_letter_2_index+0x41>
movsbl -0x1(%rbp),%eax
cmp    $0x7a,%eax
jg     1161 <trans_letter_2_index+0x41>
movsbl -0x1(%rbp),%eax
sub    $0x61,%eax
add    $0x1a,%eax
mov    %eax,-0x8(%rbp)
jmp    11d5 <trans_letter_2_index+0xb5>
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     118a <trans_letter_2_index+0x6a>
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
jg     118a <trans_letter_2_index+0x6a>
movsbl -0x1(%rbp),%eax
sub    $0x41,%eax
mov    %eax,-0x8(%rbp)
jmp    11d0 <trans_letter_2_index+0xb0>
jmp    118f <trans_letter_2_index+0x6f>
lea    0xe6a(%rip),%rdi
lea    0xe6c(%rip),%rsi
mov    $0x34,%edx
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x1(%rbp),%esi
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>
jmp    11d5 <trans_letter_2_index+0xb5>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trans_letter_2_index>:
push   %rbx
mov    %edi,%ebx
lea    -0x61(%rbx),%ecx
mov    $0xffffffb9,%eax
cmp    $0x1a,%cl
jb     114d <trans_letter_2_index+0x1d>
lea    -0x41(%rbx),%ecx
mov    $0xffffffbf,%eax
cmp    $0x1a,%cl
jae    1151 <trans_letter_2_index+0x21>
add    %ebx,%eax
pop    %rbx
ret
lea    0xea8(%rip),%rdi
lea    0xeaa(%rip),%rsi
mov    $0x34,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeac(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"[%s/%d]:\00"
@__func__.trans_letter_2_index = [21 x i8] c"trans_letter_2_index\00"
@.str.1 = [22 x i8] c"error letter input:%c\00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @trans_letter_2_index(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
store i32 -1, i32* %3
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 97
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 122
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = load i8, i8* %2
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 97
%15 = add nsw i32 %14, 26
store i32 %15, i32* %3
br label %37
16: ; preds = %7, %1
%17 = load i8, i8* %2
%18 = sext i8 %17 to i32
%19 = icmp sge i32 %18, 65
br i1 %19, label %20, label %28
20: ; preds = %16
%21 = load i8, i8* %2
%22 = sext i8 %21 to i32
%23 = icmp sle i32 %22, 90
br i1 %23, label %24, label %28
24: ; preds = %20
%25 = load i8, i8* %2
%26 = sext i8 %25 to i32
%27 = sub nsw i32 %26, 65
store i32 %27, i32* %3
br label %36
28: ; preds = %20, %16
br label %29
29: ; preds = %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.trans_letter_2_index, i64 0, i64 0), i32 52)
%31 = load i8, i8* %2
%32 = sext i8 %31 to i32
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %35
35: ; preds = %29
unreachable
36: ; preds = %24
br label %37
37: ; preds = %36, %11
%38 = load i32, i32* %3
ret i32 %38
}

LLVM IR (-O2):
@.str = [9 x i8] c"[%s/%d]:\00"
@__func__.trans_letter_2_index = [21 x i8] c"trans_letter_2_index\00"
@.str.1 = [22 x i8] c"error letter input:%c\00"
define i32 @trans_letter_2_index(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add i8 %0, -97
%4 = icmp ult i8 %3, 26
br i1 %4, label %12, label %5
5: ; preds = %1
%6 = add i8 %0, -65
%7 = icmp ult i8 %6, 26
br i1 %7, label %12, label %8
8: ; preds = %5
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__func__.trans_letter_2_index, i64 0, i64 0), i32 52)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%11 = tail call i32 @putchar(i32 10)
tail call void @exit(i32 0)
unreachable
12: ; preds = %5, %1
%13 = phi i32 [ -71, %1 ], [ -65, %5 ]
%14 = add nsw i32 %13, %2
ret i32 %14
}