int hash_table_kPrime(int n) {
  static const unsigned long _prime_list[] = {
      53ul,         97ul,         193ul,       389ul,       769ul,
      1543ul,       3079ul,       6151ul,      12289ul,     24593ul,
      49157ul,      98317ul,      196613ul,    393241ul,    786433ul,
      1572869ul,    3145739ul,    6291469ul,   12582917ul,  25165843ul,
      50331653ul,   100663319ul,  201326611ul, 402653189ul, 805306457ul,
      1610612741ul, 3221225473ul, 4294967291ul};
  const int _prime_size = 28;
  for (int i = 0; i < _prime_size; i++)
    if (_prime_list[i] > n)
      return _prime_list[i];
  return _prime_list[_prime_size - 1];
}


x86 assembly (clang, -O0):
<hash_table_kPrime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x1c,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x1c,-0x10(%rbp)
jge    1165 <hash_table_kPrime+0x65>
movslq -0x10(%rbp),%rcx
lea    0xed6(%rip),%rax
mov    (%rax,%rcx,8),%rax
movslq -0x8(%rbp),%rcx
cmp    %rcx,%rax
jbe    1152 <hash_table_kPrime+0x52>
movslq -0x10(%rbp),%rcx
lea    0xeba(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %eax,-0x4(%rbp)
jmp    116f <hash_table_kPrime+0x6f>
jmp    1157 <hash_table_kPrime+0x57>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1115 <hash_table_kPrime+0x15>
mov    0xf6c(%rip),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_table_kPrime>:
mov    $0x35,%eax
cmp    $0x35,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0x61,%eax
cmp    $0x61,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0xc1,%eax
cmp    $0xc1,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0x185,%eax
cmp    $0x185,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0x301,%eax
cmp    $0x301,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0x607,%eax
cmp    $0x607,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0xc07,%eax
cmp    $0xc07,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0x1807,%eax
cmp    $0x1807,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0x3001,%eax
cmp    $0x3001,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0x6011,%eax
cmp    $0x6011,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0xc005,%eax
cmp    $0xc005,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0x1800d,%eax
cmp    $0x1800d,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0x30005,%eax
cmp    $0x30005,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0x60019,%eax
cmp    $0x60019,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0xc0001,%eax
cmp    $0xc0001,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0x180005,%eax
cmp    $0x180005,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0x30000b,%eax
cmp    $0x30000b,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0x60000d,%eax
cmp    $0x60000d,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0xc00005,%eax
cmp    $0xc00005,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0x1800013,%eax
cmp    $0x1800013,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0x3000005,%eax
cmp    $0x3000005,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0x6000017,%eax
cmp    $0x6000017,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0xc000013,%eax
cmp    $0xc000013,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0x18000005,%eax
cmp    $0x18000005,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0x30000059,%eax
cmp    $0x30000059,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0x60000005,%eax
cmp    $0x60000005,%edi
jb     129e <hash_table_kPrime+0x19e>
mov    $0xc0000001,%eax
test   %edi,%edi
jns    129e <hash_table_kPrime+0x19e>
mov    $0xfffffffb,%eax
ret

LLVM IR (-O0):
@hash_table_kPrime._prime_list = internal constant [28 x i64] [i64 53, i64 97, i64 193, i64 389, i64 769, i64 1543, i64 3079, i64 6151, i64 12289, i64 24593, i64 49157, i64 98317, i64 196613, i64 393241, i64 786433, i64 1572869, i64 3145739, i64 6291469, i64 12582917, i64 25165843, i64 50331653, i64 100663319, i64 201326611, i64 402653189, i64 805306457, i64 1610612741, i64 3221225473, i64 4294967291]
define i32 @hash_table_kPrime(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 28, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %24, %1
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 28
br i1 %8, label %9, label %27
9: ; preds = %6
%10 = load i32, i32* %5
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [28 x i64], [28 x i64]* @hash_table_kPrime._prime_list, i64 0, i64 %11
%13 = load i64, i64* %12
%14 = load i32, i32* %3
%15 = sext i32 %14 to i64
%16 = icmp ugt i64 %13, %15
br i1 %16, label %17, label %23
17: ; preds = %9
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [28 x i64], [28 x i64]* @hash_table_kPrime._prime_list, i64 0, i64 %19
%21 = load i64, i64* %20
%22 = trunc i64 %21 to i32
store i32 %22, i32* %2
br label %30
23: ; preds = %9
br label %24
24: ; preds = %23
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %6
27: ; preds = %6
%28 = load i64, i64* getelementptr inbounds ([28 x i64], [28 x i64]* @hash_table_kPrime._prime_list, i64 0, i64 27)
%29 = trunc i64 %28 to i32
store i32 %29, i32* %2
br label %30
30: ; preds = %27, %17
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
define i32 @hash_table_kPrime(i32 %0) {
%2 = icmp ult i32 %0, 53
br i1 %2, label %55, label %3
3: ; preds = %1
%4 = icmp ult i32 %0, 97
br i1 %4, label %55, label %5
5: ; preds = %3
%6 = icmp ult i32 %0, 193
br i1 %6, label %55, label %7
7: ; preds = %5
%8 = icmp ult i32 %0, 389
br i1 %8, label %55, label %9
9: ; preds = %7
%10 = icmp ult i32 %0, 769
br i1 %10, label %55, label %11
11: ; preds = %9
%12 = icmp ult i32 %0, 1543
br i1 %12, label %55, label %13
13: ; preds = %11
%14 = icmp ult i32 %0, 3079
br i1 %14, label %55, label %15
15: ; preds = %13
%16 = icmp ult i32 %0, 6151
br i1 %16, label %55, label %17
17: ; preds = %15
%18 = icmp ult i32 %0, 12289
br i1 %18, label %55, label %19
19: ; preds = %17
%20 = icmp ult i32 %0, 24593
br i1 %20, label %55, label %21
21: ; preds = %19
%22 = icmp ult i32 %0, 49157
br i1 %22, label %55, label %23
23: ; preds = %21
%24 = icmp ult i32 %0, 98317
br i1 %24, label %55, label %25
25: ; preds = %23
%26 = icmp ult i32 %0, 196613
br i1 %26, label %55, label %27
27: ; preds = %25
%28 = icmp ult i32 %0, 393241
br i1 %28, label %55, label %29
29: ; preds = %27
%30 = icmp ult i32 %0, 786433
br i1 %30, label %55, label %31
31: ; preds = %29
%32 = icmp ult i32 %0, 1572869
br i1 %32, label %55, label %33
33: ; preds = %31
%34 = icmp ult i32 %0, 3145739
br i1 %34, label %55, label %35
35: ; preds = %33
%36 = icmp ult i32 %0, 6291469
br i1 %36, label %55, label %37
37: ; preds = %35
%38 = icmp ult i32 %0, 12582917
br i1 %38, label %55, label %39
39: ; preds = %37
%40 = icmp ult i32 %0, 25165843
br i1 %40, label %55, label %41
41: ; preds = %39
%42 = icmp ult i32 %0, 50331653
br i1 %42, label %55, label %43
43: ; preds = %41
%44 = icmp ult i32 %0, 100663319
br i1 %44, label %55, label %45
45: ; preds = %43
%46 = icmp ult i32 %0, 201326611
br i1 %46, label %55, label %47
47: ; preds = %45
%48 = icmp ult i32 %0, 402653189
br i1 %48, label %55, label %49
49: ; preds = %47
%50 = icmp ult i32 %0, 805306457
br i1 %50, label %55, label %51
51: ; preds = %49
%52 = icmp ult i32 %0, 1610612741
br i1 %52, label %55, label %53
53: ; preds = %51
%54 = icmp sgt i32 %0, -1
br i1 %54, label %55, label %57
55: ; preds = %53, %51, %49, %47, %45, %43, %41, %39, %37, %35, %33, %31, %29, %27, %25, %23, %21, %19, %17, %15, %13, %11, %9, %7, %5, %3, %1
%56 = phi i32 [ 53, %1 ], [ 97, %3 ], [ 193, %5 ], [ 389, %7 ], [ 769, %9 ], [ 1543, %11 ], [ 3079, %13 ], [ 6151, %15 ], [ 12289, %17 ], [ 24593, %19 ], [ 49157, %21 ], [ 98317, %23 ], [ 196613, %25 ], [ 393241, %27 ], [ 786433, %29 ], [ 1572869, %31 ], [ 3145739, %33 ], [ 6291469, %35 ], [ 12582917, %37 ], [ 25165843, %39 ], [ 50331653, %41 ], [ 100663319, %43 ], [ 201326611, %45 ], [ 402653189, %47 ], [ 805306457, %49 ], [ 1610612741, %51 ], [ -1073741823, %53 ]
br label %57
57: ; preds = %53, %55
%58 = phi i32 [ %56, %55 ], [ -5, %53 ]
ret i32 %58
}