int inverse_mod26(int d) {
  d = (d + 26) % 26;
  switch (d) {
  case 1:
    return 1;
  case 3:
    return 9;
  case 5:
    return 21;
  case 7:
    return 15;
  case 9:
    return 3;
  case 11:
    return 19;
  case 15:
    return 7;
  case 17:
    return 23;
  case 19:
    return 11;
  case 21:
    return 5;
  case 23:
    return 17;
  case 25:
    return 25;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<inverse_mod26>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    %edx,%eax
add    $0x1a,%eax
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
sar    $0x23,%rcx
add    %eax,%ecx
mov    %ecx,%eax
lea    (%rax,%rax,4),%esi
mov    %esi,%eax
lea    (%rax,%rax,4),%eax
add    %ecx,%eax
neg    %eax
mov    %eax,%ecx
mov    %edx,%eax
lea    0x1a(%rax,%rcx,1),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x18,%eax
ja     11f7 <inverse_mod26+0xf7>
mov    -0x10(%rbp),%rax
lea    0xea2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x4(%rbp)
jmp    11fe <inverse_mod26+0xfe>
movl   $0x9,-0x4(%rbp)
jmp    11fe <inverse_mod26+0xfe>
movl   $0x15,-0x4(%rbp)
jmp    11fe <inverse_mod26+0xfe>
movl   $0xf,-0x4(%rbp)
jmp    11fe <inverse_mod26+0xfe>
movl   $0x3,-0x4(%rbp)
jmp    11fe <inverse_mod26+0xfe>
movl   $0x13,-0x4(%rbp)
jmp    11fe <inverse_mod26+0xfe>
movl   $0x7,-0x4(%rbp)
jmp    11fe <inverse_mod26+0xfe>
movl   $0x17,-0x4(%rbp)
jmp    11fe <inverse_mod26+0xfe>
movl   $0xb,-0x4(%rbp)
jmp    11fe <inverse_mod26+0xfe>
movl   $0x5,-0x4(%rbp)
jmp    11fe <inverse_mod26+0xfe>
movl   $0x11,-0x4(%rbp)
jmp    11fe <inverse_mod26+0xfe>
movl   $0x19,-0x4(%rbp)
jmp    11fe <inverse_mod26+0xfe>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inverse_mod26>:
lea    0x1a(%rdi),%eax
cltq
imul   $0x4ec4ec4f,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x23,%rax
add    %ecx,%eax
lea    (%rax,%rax,4),%ecx
lea    (%rcx,%rcx,4),%ecx
add    %eax,%ecx
not    %ecx
add    %edi,%ecx
add    $0x1a,%ecx
xor    %eax,%eax
cmp    $0x18,%ecx
ja     113c <inverse_mod26+0x3c>
movslq %ecx,%rax
lea    0xec7(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @inverse_mod26(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = add nsw i32 %4, 26
%6 = srem i32 %5, 26
store i32 %6, i32* %3
%7 = load i32, i32* %3
switch i32 %7, label %20 [
i32 1, label %8
i32 3, label %9
i32 5, label %10
i32 7, label %11
i32 9, label %12
i32 11, label %13
i32 15, label %14
i32 17, label %15
i32 19, label %16
i32 21, label %17
i32 23, label %18
i32 25, label %19
]
8: ; preds = %1
store i32 1, i32* %2
br label %21
9: ; preds = %1
store i32 9, i32* %2
br label %21
10: ; preds = %1
store i32 21, i32* %2
br label %21
11: ; preds = %1
store i32 15, i32* %2
br label %21
12: ; preds = %1
store i32 3, i32* %2
br label %21
13: ; preds = %1
store i32 19, i32* %2
br label %21
14: ; preds = %1
store i32 7, i32* %2
br label %21
15: ; preds = %1
store i32 23, i32* %2
br label %21
16: ; preds = %1
store i32 11, i32* %2
br label %21
17: ; preds = %1
store i32 5, i32* %2
br label %21
18: ; preds = %1
store i32 17, i32* %2
br label %21
19: ; preds = %1
store i32 25, i32* %2
br label %21
20: ; preds = %1
store i32 0, i32* %2
br label %21
21: ; preds = %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
@switch.table.inverse_mod26 = [25 x i32] [i32 1, i32 0, i32 9, i32 0, i32 21, i32 0, i32 15, i32 0, i32 3, i32 0, i32 19, i32 0, i32 0, i32 0, i32 7, i32 0, i32 23, i32 0, i32 11, i32 0, i32 5, i32 0, i32 17, i32 0, i32 25]
define i32 @inverse_mod26(i32 %0) {
%2 = add nsw i32 %0, 26
%3 = srem i32 %2, 26
%4 = add nsw i32 %3, -1
%5 = icmp ult i32 %4, 25
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = sext i32 %4 to i64
%8 = getelementptr inbounds [25 x i32], [25 x i32]* @switch.table.inverse_mod26, i64 0, i64 %7
%9 = load i32, i32* %8
br label %10
10: ; preds = %1, %6
%11 = phi i32 [ %9, %6 ], [ 0, %1 ]
ret i32 %11
}