int nextSquare(int square) {
  switch (square) {
  case 4:
    return 14;
  case 9:
    return 31;
  case 17:
    return 7;
  case 20:
    return 38;
  case 28:
    return 84;
  case 40:
    return 59;
  case 51:
    return 67;
  case 54:
    return 34;
  case 62:
    return 19;
  case 63:
    return 81;
  case 64:
    return 60;
  case 71:
    return 91;
  case 87:
    return 24;
  case 93:
    return 73;
  case 95:
    return 75;
  case 99:
    return 78;
  default:
    return square;
  }
}


x86 assembly (clang, -O0):
<nextSquare>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xfffffffc,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x5f,%eax
ja     11f0 <nextSquare+0xf0>
mov    -0x10(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0xe,-0x4(%rbp)
jmp    11f6 <nextSquare+0xf6>
movl   $0x1f,-0x4(%rbp)
jmp    11f6 <nextSquare+0xf6>
movl   $0x7,-0x4(%rbp)
jmp    11f6 <nextSquare+0xf6>
movl   $0x26,-0x4(%rbp)
jmp    11f6 <nextSquare+0xf6>
movl   $0x54,-0x4(%rbp)
jmp    11f6 <nextSquare+0xf6>
movl   $0x3b,-0x4(%rbp)
jmp    11f6 <nextSquare+0xf6>
movl   $0x43,-0x4(%rbp)
jmp    11f6 <nextSquare+0xf6>
movl   $0x22,-0x4(%rbp)
jmp    11f6 <nextSquare+0xf6>
movl   $0x13,-0x4(%rbp)
jmp    11f6 <nextSquare+0xf6>
movl   $0x51,-0x4(%rbp)
jmp    11f6 <nextSquare+0xf6>
movl   $0x3c,-0x4(%rbp)
jmp    11f6 <nextSquare+0xf6>
movl   $0x5b,-0x4(%rbp)
jmp    11f6 <nextSquare+0xf6>
movl   $0x18,-0x4(%rbp)
jmp    11f6 <nextSquare+0xf6>
movl   $0x49,-0x4(%rbp)
jmp    11f6 <nextSquare+0xf6>
movl   $0x4b,-0x4(%rbp)
jmp    11f6 <nextSquare+0xf6>
movl   $0x4e,-0x4(%rbp)
jmp    11f6 <nextSquare+0xf6>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nextSquare>:
lea    -0x4(%rdi),%ecx
cmp    $0x5f,%ecx
ja     1177 <nextSquare+0x77>
mov    $0xe,%eax
lea    0xeec(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x1f,%eax
ret
mov    $0x7,%eax
ret
mov    $0x26,%eax
ret
mov    $0x54,%eax
ret
mov    $0x3b,%eax
ret
mov    $0x43,%eax
ret
mov    $0x22,%eax
ret
mov    $0x13,%eax
ret
mov    $0x51,%eax
ret
mov    $0x3c,%eax
ret
mov    $0x5b,%eax
ret
mov    $0x18,%eax
ret
mov    $0x49,%eax
ret
mov    $0x4b,%eax
ret
mov    $0x4e,%eax
ret
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @nextSquare(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %21 [
i32 4, label %5
i32 9, label %6
i32 17, label %7
i32 20, label %8
i32 28, label %9
i32 40, label %10
i32 51, label %11
i32 54, label %12
i32 62, label %13
i32 63, label %14
i32 64, label %15
i32 71, label %16
i32 87, label %17
i32 93, label %18
i32 95, label %19
i32 99, label %20
]
5: ; preds = %1
store i32 14, i32* %2
br label %23
6: ; preds = %1
store i32 31, i32* %2
br label %23
7: ; preds = %1
store i32 7, i32* %2
br label %23
8: ; preds = %1
store i32 38, i32* %2
br label %23
9: ; preds = %1
store i32 84, i32* %2
br label %23
10: ; preds = %1
store i32 59, i32* %2
br label %23
11: ; preds = %1
store i32 67, i32* %2
br label %23
12: ; preds = %1
store i32 34, i32* %2
br label %23
13: ; preds = %1
store i32 19, i32* %2
br label %23
14: ; preds = %1
store i32 81, i32* %2
br label %23
15: ; preds = %1
store i32 60, i32* %2
br label %23
16: ; preds = %1
store i32 91, i32* %2
br label %23
17: ; preds = %1
store i32 24, i32* %2
br label %23
18: ; preds = %1
store i32 73, i32* %2
br label %23
19: ; preds = %1
store i32 75, i32* %2
br label %23
20: ; preds = %1
store i32 78, i32* %2
br label %23
21: ; preds = %1
%22 = load i32, i32* %3
store i32 %22, i32* %2
br label %23
23: ; preds = %21, %20, %19, %18, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @nextSquare(i32 %0) {
switch i32 %0, label %17 [
i32 4, label %18
i32 9, label %2
i32 17, label %3
i32 20, label %4
i32 28, label %5
i32 40, label %6
i32 51, label %7
i32 54, label %8
i32 62, label %9
i32 63, label %10
i32 64, label %11
i32 71, label %12
i32 87, label %13
i32 93, label %14
i32 95, label %15
i32 99, label %16
]
2: ; preds = %1
br label %18
3: ; preds = %1
br label %18
4: ; preds = %1
br label %18
5: ; preds = %1
br label %18
6: ; preds = %1
br label %18
7: ; preds = %1
br label %18
8: ; preds = %1
br label %18
9: ; preds = %1
br label %18
10: ; preds = %1
br label %18
11: ; preds = %1
br label %18
12: ; preds = %1
br label %18
13: ; preds = %1
br label %18
14: ; preds = %1
br label %18
15: ; preds = %1
br label %18
16: ; preds = %1
br label %18
17: ; preds = %1
br label %18
18: ; preds = %1, %17, %16, %15, %14, %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%19 = phi i32 [ %0, %17 ], [ 78, %16 ], [ 75, %15 ], [ 73, %14 ], [ 24, %13 ], [ 91, %12 ], [ 60, %11 ], [ 81, %10 ], [ 19, %9 ], [ 34, %8 ], [ 67, %7 ], [ 59, %6 ], [ 84, %5 ], [ 38, %4 ], [ 7, %3 ], [ 31, %2 ], [ 14, %1 ]
ret i32 %19
}