#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ p;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
int get_hashtable_size(int n) {
  static const int p[] = {
      1103,   1217,   1361,   1499,   1657,   1823,   2011,   2213,   2437,
      2683,   2953,   3251,   3581,   3943,   4339,   4783,   5273,   5801,
      6389,   7039,   7753,   8537,   9391,   10331,  11369,  12511,  13763,
      15149,  16673,  18341,  20177,  22229,  24469,  26921,  29629,  32603,
      35869,  39461,  43411,  47777,  52561,  57829,  63617,  69991,  76991,
      84691,  93169,  102497, 112757, 124067, 136481, 150131, 165161, 181693,
      199873, 219871, 241861, 266051, 292661, 321947, 354143, 389561, 428531};
  const int lp = sizeof(p) / sizeof(p[0]);
  int a = -1;
  int b = lp;
  n += n >> 1;
  while (b - a > 1) {
    int c = ((a + b) >> 1);
    if (p[c] <= n) {
      a = c;
    } else {
      b = c;
    }
  }
  if (a < 0) {
    a++;
  }
  assert(a < lp - 1);
  return p[a];
}


x86 assembly (clang, -O0):
<get_hashtable_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x3f,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
movl   $0x3f,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%eax
sub    -0xc(%rbp),%eax
cmp    $0x1,%eax
jle    1184 <get_hashtable_size+0x74>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x14(%rbp)
movslq -0x14(%rbp),%rcx
lea    0xe9e(%rip),%rax
mov    (%rax,%rcx,4),%eax
cmp    -0x4(%rbp),%eax
jg     1179 <get_hashtable_size+0x69>
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    117f <get_hashtable_size+0x6f>
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    113c <get_hashtable_size+0x2c>
cmpl   $0x0,-0xc(%rbp)
jge    1197 <get_hashtable_size+0x87>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x3e,-0xc(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movslq -0xc(%rbp),%rcx
lea    0xe4d(%rip),%rax
mov    (%rax,%rcx,4),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_hashtable_size>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%eax
sar    %eax
add    %edi,%eax
mov    $0xffffffff,%ecx
mov    $0x3f,%edx
lea    0xed6(%rip),%rbx
jmp    113b <get_hashtable_size+0x2b>
nopl   0x0(%rax)
mov    %esi,%ecx
mov    %edx,%esi
sub    %ecx,%esi
cmp    $0x1,%esi
jle    114c <get_hashtable_size+0x3c>
lea    (%rdx,%rcx,1),%esi
sar    %esi
movslq %esi,%rdi
cmp    %eax,(%rbx,%rdi,4)
jle    1130 <get_hashtable_size+0x20>
mov    %esi,%edx
jmp    1132 <get_hashtable_size+0x22>
mov    %ecx,%ebp
shr    $0x1f,%ebp
add    %ecx,%ebp
xor    %edi,%edi
cmp    $0x3e,%ebp
setl   %dil
call   1030 <assert@plt>
movslq %ebp,%rax
mov    (%rbx,%rax,4),%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@get_hashtable_size.p = internal constant [63 x i32] [i32 1103, i32 1217, i32 1361, i32 1499, i32 1657, i32 1823, i32 2011, i32 2213, i32 2437, i32 2683, i32 2953, i32 3251, i32 3581, i32 3943, i32 4339, i32 4783, i32 5273, i32 5801, i32 6389, i32 7039, i32 7753, i32 8537, i32 9391, i32 10331, i32 11369, i32 12511, i32 13763, i32 15149, i32 16673, i32 18341, i32 20177, i32 22229, i32 24469, i32 26921, i32 29629, i32 32603, i32 35869, i32 39461, i32 43411, i32 47777, i32 52561, i32 57829, i32 63617, i32 69991, i32 76991, i32 84691, i32 93169, i32 102497, i32 112757, i32 124067, i32 136481, i32 150131, i32 165161, i32 181693, i32 199873, i32 219871, i32 241861, i32 266051, i32 292661, i32 321947, i32 354143, i32 389561, i32 428531]
define i32 @get_hashtable_size(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
store i32 63, i32* %3
store i32 -1, i32* %4
store i32 63, i32* %5
%7 = load i32, i32* %2
%8 = ashr i32 %7, 1
%9 = load i32, i32* %2
%10 = add nsw i32 %9, %8
store i32 %10, i32* %2
br label %11
11: ; preds = %31, %1
%12 = load i32, i32* %5
%13 = load i32, i32* %4
%14 = sub nsw i32 %12, %13
%15 = icmp sgt i32 %14, 1
br i1 %15, label %16, label %32
16: ; preds = %11
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = add nsw i32 %17, %18
%20 = ashr i32 %19, 1
store i32 %20, i32* %6
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [63 x i32], [63 x i32]* @get_hashtable_size.p, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = load i32, i32* %2
%26 = icmp sle i32 %24, %25
br i1 %26, label %27, label %29
27: ; preds = %16
%28 = load i32, i32* %6
store i32 %28, i32* %4
br label %31
29: ; preds = %16
%30 = load i32, i32* %6
store i32 %30, i32* %5
br label %31
31: ; preds = %29, %27
br label %11
32: ; preds = %11
%33 = load i32, i32* %4
%34 = icmp slt i32 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 1
store i32 %37, i32* %4
br label %38
38: ; preds = %35, %32
%39 = load i32, i32* %4
%40 = icmp slt i32 %39, 62
%41 = zext i1 %40 to i32
%42 = call i32 @assert(i32 %41)
%43 = load i32, i32* %4
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [63 x i32], [63 x i32]* @get_hashtable_size.p, i64 0, i64 %44
%46 = load i32, i32* %45
ret i32 %46
}

LLVM IR (-O2):
@get_hashtable_size.p = internal unnamed_addr constant [63 x i32] [i32 1103, i32 1217, i32 1361, i32 1499, i32 1657, i32 1823, i32 2011, i32 2213, i32 2437, i32 2683, i32 2953, i32 3251, i32 3581, i32 3943, i32 4339, i32 4783, i32 5273, i32 5801, i32 6389, i32 7039, i32 7753, i32 8537, i32 9391, i32 10331, i32 11369, i32 12511, i32 13763, i32 15149, i32 16673, i32 18341, i32 20177, i32 22229, i32 24469, i32 26921, i32 29629, i32 32603, i32 35869, i32 39461, i32 43411, i32 47777, i32 52561, i32 57829, i32 63617, i32 69991, i32 76991, i32 84691, i32 93169, i32 102497, i32 112757, i32 124067, i32 136481, i32 150131, i32 165161, i32 181693, i32 199873, i32 219871, i32 241861, i32 266051, i32 292661, i32 321947, i32 354143, i32 389561, i32 428531]
define i32 @get_hashtable_size(i32 %0) {
%2 = ashr i32 %0, 1
%3 = add nsw i32 %2, %0
br label %4
4: ; preds = %1, %4
%5 = phi i32 [ 63, %1 ], [ %14, %4 ]
%6 = phi i32 [ -1, %1 ], [ %13, %4 ]
%7 = add nsw i32 %5, %6
%8 = ashr i32 %7, 1
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [63 x i32], [63 x i32]* @get_hashtable_size.p, i64 0, i64 %9
%11 = load i32, i32* %10
%12 = icmp sgt i32 %11, %3
%13 = select i1 %12, i32 %6, i32 %8
%14 = select i1 %12, i32 %8, i32 %5
%15 = sub nsw i32 %14, %13
%16 = icmp sgt i32 %15, 1
br i1 %16, label %4, label %17
17: ; preds = %4
%18 = lshr i32 %13, 31
%19 = add nsw i32 %18, %13
%20 = icmp slt i32 %19, 62
%21 = zext i1 %20 to i32
%22 = tail call i32 @assert(i32 %21)
%23 = sext i32 %19 to i64
%24 = getelementptr inbounds [63 x i32], [63 x i32]* @get_hashtable_size.p, i64 0, i64 %23
%25 = load i32, i32* %24
ret i32 %25
}