int hash_size(int n) {
  if (n < 5)
    return 5;
  if (n < 11)
    return 11;
  if (n < 23)
    return 23;
  if (n < 47)
    return 47;
  if (n < 97)
    return 97;
  if (n < 199)
    return 199;
  if (n < 499)
    return 499;
  if (n < 997)
    return 997;
  if (n < 9973)
    return 9973;
  return 19997;
}


x86 assembly (clang, -O0):
<hash_size>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    111d <hash_size+0x1d>
movl   $0x5,-0x4(%rbp)
jmp    11e0 <hash_size+0xe0>
cmpl   $0xb,-0x8(%rbp)
jge    1133 <hash_size+0x33>
movl   $0xb,-0x4(%rbp)
jmp    11e0 <hash_size+0xe0>
cmpl   $0x17,-0x8(%rbp)
jge    1149 <hash_size+0x49>
movl   $0x17,-0x4(%rbp)
jmp    11e0 <hash_size+0xe0>
cmpl   $0x2f,-0x8(%rbp)
jge    115f <hash_size+0x5f>
movl   $0x2f,-0x4(%rbp)
jmp    11e0 <hash_size+0xe0>
cmpl   $0x61,-0x8(%rbp)
jge    1175 <hash_size+0x75>
movl   $0x61,-0x4(%rbp)
jmp    11e0 <hash_size+0xe0>
cmpl   $0xc7,-0x8(%rbp)
jge    118e <hash_size+0x8e>
movl   $0xc7,-0x4(%rbp)
jmp    11e0 <hash_size+0xe0>
cmpl   $0x1f3,-0x8(%rbp)
jge    11a7 <hash_size+0xa7>
movl   $0x1f3,-0x4(%rbp)
jmp    11e0 <hash_size+0xe0>
cmpl   $0x3e5,-0x8(%rbp)
jge    11c0 <hash_size+0xc0>
movl   $0x3e5,-0x4(%rbp)
jmp    11e0 <hash_size+0xe0>
cmpl   $0x26f5,-0x8(%rbp)
jge    11d9 <hash_size+0xd9>
movl   $0x26f5,-0x4(%rbp)
jmp    11e0 <hash_size+0xe0>
movl   $0x4e1d,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_size>:
mov    $0x5,%eax
cmp    $0x5,%edi
jl     116c <hash_size+0x6c>
mov    $0xb,%eax
cmp    $0xb,%edi
jb     116c <hash_size+0x6c>
mov    $0x17,%eax
cmp    $0x17,%edi
jb     116c <hash_size+0x6c>
mov    $0x2f,%eax
cmp    $0x2f,%edi
jb     116c <hash_size+0x6c>
mov    $0x61,%eax
cmp    $0x61,%edi
jb     116c <hash_size+0x6c>
mov    $0xc7,%eax
cmp    $0xc7,%edi
jb     116c <hash_size+0x6c>
mov    $0x1f3,%eax
cmp    $0x1f3,%edi
jb     116c <hash_size+0x6c>
mov    $0x3e5,%eax
cmp    $0x3e5,%edi
jb     116c <hash_size+0x6c>
cmp    $0x26f5,%edi
mov    $0x26f5,%ecx
mov    $0x4e1d,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @hash_size(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp slt i32 %4, 5
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 5, i32* %2
br label %40
7: ; preds = %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 11
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 11, i32* %2
br label %40
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp slt i32 %12, 23
br i1 %13, label %14, label %15
14: ; preds = %11
store i32 23, i32* %2
br label %40
15: ; preds = %11
%16 = load i32, i32* %3
%17 = icmp slt i32 %16, 47
br i1 %17, label %18, label %19
18: ; preds = %15
store i32 47, i32* %2
br label %40
19: ; preds = %15
%20 = load i32, i32* %3
%21 = icmp slt i32 %20, 97
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 97, i32* %2
br label %40
23: ; preds = %19
%24 = load i32, i32* %3
%25 = icmp slt i32 %24, 199
br i1 %25, label %26, label %27
26: ; preds = %23
store i32 199, i32* %2
br label %40
27: ; preds = %23
%28 = load i32, i32* %3
%29 = icmp slt i32 %28, 499
br i1 %29, label %30, label %31
30: ; preds = %27
store i32 499, i32* %2
br label %40
31: ; preds = %27
%32 = load i32, i32* %3
%33 = icmp slt i32 %32, 997
br i1 %33, label %34, label %35
34: ; preds = %31
store i32 997, i32* %2
br label %40
35: ; preds = %31
%36 = load i32, i32* %3
%37 = icmp slt i32 %36, 9973
br i1 %37, label %38, label %39
38: ; preds = %35
store i32 9973, i32* %2
br label %40
39: ; preds = %35
store i32 19997, i32* %2
br label %40
40: ; preds = %39, %38, %34, %30, %26, %22, %18, %14, %10, %6
%41 = load i32, i32* %2
ret i32 %41
}

LLVM IR (-O2):
define i32 @hash_size(i32 %0) {
%2 = icmp slt i32 %0, 5
br i1 %2, label %20, label %3
3: ; preds = %1
%4 = icmp ult i32 %0, 11
br i1 %4, label %20, label %5
5: ; preds = %3
%6 = icmp ult i32 %0, 23
br i1 %6, label %20, label %7
7: ; preds = %5
%8 = icmp ult i32 %0, 47
br i1 %8, label %20, label %9
9: ; preds = %7
%10 = icmp ult i32 %0, 97
br i1 %10, label %20, label %11
11: ; preds = %9
%12 = icmp ult i32 %0, 199
br i1 %12, label %20, label %13
13: ; preds = %11
%14 = icmp ult i32 %0, 499
br i1 %14, label %20, label %15
15: ; preds = %13
%16 = icmp ult i32 %0, 997
br i1 %16, label %20, label %17
17: ; preds = %15
%18 = icmp ult i32 %0, 9973
%19 = select i1 %18, i32 9973, i32 19997
br label %20
20: ; preds = %17, %15, %13, %11, %9, %7, %5, %3, %1
%21 = phi i32 [ 5, %1 ], [ 11, %3 ], [ 23, %5 ], [ 47, %7 ], [ 97, %9 ], [ 199, %11 ], [ 499, %13 ], [ 997, %15 ], [ %19, %17 ]
ret i32 %21
}