#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*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ sorter_binary_insertion_sort(int /*<<< orphan*/ *,
                                                size_t const);
int /*<<< orphan*/ sorter_bitonic_sort_10(int /*<<< orphan*/ *);
int /*<<< orphan*/ sorter_bitonic_sort_11(int /*<<< orphan*/ *);
int /*<<< orphan*/ sorter_bitonic_sort_12(int /*<<< orphan*/ *);
int /*<<< orphan*/ sorter_bitonic_sort_13(int /*<<< orphan*/ *);
int /*<<< orphan*/ sorter_bitonic_sort_14(int /*<<< orphan*/ *);
int /*<<< orphan*/ sorter_bitonic_sort_15(int /*<<< orphan*/ *);
int /*<<< orphan*/ sorter_bitonic_sort_16(int /*<<< orphan*/ *);
int /*<<< orphan*/ sorter_bitonic_sort_2(int /*<<< orphan*/ *);
int /*<<< orphan*/ sorter_bitonic_sort_3(int /*<<< orphan*/ *);
int /*<<< orphan*/ sorter_bitonic_sort_4(int /*<<< orphan*/ *);
int /*<<< orphan*/ sorter_bitonic_sort_5(int /*<<< orphan*/ *);
int /*<<< orphan*/ sorter_bitonic_sort_6(int /*<<< orphan*/ *);
int /*<<< orphan*/ sorter_bitonic_sort_7(int /*<<< orphan*/ *);
int /*<<< orphan*/ sorter_bitonic_sort_8(int /*<<< orphan*/ *);
int /*<<< orphan*/ sorter_bitonic_sort_9(int /*<<< orphan*/ *);
void sorter_bitonic_sort(int64_t *dst, const size_t size) {
  switch (size) {
  case 0:
  case 1:
    break;
  case 2:
    sorter_bitonic_sort_2(dst);
    break;
  case 3:
    sorter_bitonic_sort_3(dst);
    break;
  case 4:
    sorter_bitonic_sort_4(dst);
    break;
  case 5:
    sorter_bitonic_sort_5(dst);
    break;
  case 6:
    sorter_bitonic_sort_6(dst);
    break;
  case 7:
    sorter_bitonic_sort_7(dst);
    break;
  case 8:
    sorter_bitonic_sort_8(dst);
    break;
  case 9:
    sorter_bitonic_sort_9(dst);
    break;
  case 10:
    sorter_bitonic_sort_10(dst);
    break;
  case 11:
    sorter_bitonic_sort_11(dst);
    break;
  case 12:
    sorter_bitonic_sort_12(dst);
    break;
  case 13:
    sorter_bitonic_sort_13(dst);
    break;
  case 14:
    sorter_bitonic_sort_14(dst);
    break;
  case 15:
    sorter_bitonic_sort_15(dst);
    break;
  case 16:
    sorter_bitonic_sort_16(dst);
    break;
  default:
    sorter_binary_insertion_sort(dst, size);
  }
}


x86 assembly (clang, -O0):
<sorter_bitonic_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
sub    $0x10,%rax
ja     130d <sorter_bitonic_sort+0x10d>
mov    -0x18(%rbp),%rax
lea    0xdd3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    131a <sorter_bitonic_sort+0x11a>
mov    -0x8(%rbp),%rdi
call   10c0 <sorter_bitonic_sort_2@plt>
jmp    131a <sorter_bitonic_sort+0x11a>
mov    -0x8(%rbp),%rdi
call   1090 <sorter_bitonic_sort_3@plt>
jmp    131a <sorter_bitonic_sort+0x11a>
mov    -0x8(%rbp),%rdi
call   10b0 <sorter_bitonic_sort_4@plt>
jmp    131a <sorter_bitonic_sort+0x11a>
mov    -0x8(%rbp),%rdi
call   1030 <sorter_bitonic_sort_5@plt>
jmp    131a <sorter_bitonic_sort+0x11a>
mov    -0x8(%rbp),%rdi
call   10d0 <sorter_bitonic_sort_6@plt>
jmp    131a <sorter_bitonic_sort+0x11a>
mov    -0x8(%rbp),%rdi
call   1040 <sorter_bitonic_sort_7@plt>
jmp    131a <sorter_bitonic_sort+0x11a>
mov    -0x8(%rbp),%rdi
call   10a0 <sorter_bitonic_sort_8@plt>
jmp    131a <sorter_bitonic_sort+0x11a>
mov    -0x8(%rbp),%rdi
call   1050 <sorter_bitonic_sort_9@plt>
jmp    131a <sorter_bitonic_sort+0x11a>
mov    -0x8(%rbp),%rdi
call   1100 <sorter_bitonic_sort_10@plt>
jmp    131a <sorter_bitonic_sort+0x11a>
mov    -0x8(%rbp),%rdi
call   1060 <sorter_bitonic_sort_11@plt>
jmp    131a <sorter_bitonic_sort+0x11a>
mov    -0x8(%rbp),%rdi
call   10e0 <sorter_bitonic_sort_12@plt>
jmp    131a <sorter_bitonic_sort+0x11a>
mov    -0x8(%rbp),%rdi
call   1070 <sorter_bitonic_sort_13@plt>
jmp    131a <sorter_bitonic_sort+0x11a>
mov    -0x8(%rbp),%rdi
call   10f0 <sorter_bitonic_sort_14@plt>
jmp    131a <sorter_bitonic_sort+0x11a>
mov    -0x8(%rbp),%rdi
call   1080 <sorter_bitonic_sort_15@plt>
jmp    131a <sorter_bitonic_sort+0x11a>
mov    -0x8(%rbp),%rdi
call   1110 <sorter_bitonic_sort_16@plt>
jmp    131a <sorter_bitonic_sort+0x11a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1120 <sorter_binary_insertion_sort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sorter_bitonic_sort>:
cmp    $0x10,%rsi
ja     1217 <sorter_bitonic_sort+0x17>
lea    0xdf3(%rip),%rax
movslq (%rax,%rsi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
ret
jmp    1120 <sorter_binary_insertion_sort@plt>
jmp    10c0 <sorter_bitonic_sort_2@plt>
jmp    1090 <sorter_bitonic_sort_3@plt>
jmp    10b0 <sorter_bitonic_sort_4@plt>
jmp    1030 <sorter_bitonic_sort_5@plt>
jmp    10d0 <sorter_bitonic_sort_6@plt>
jmp    1040 <sorter_bitonic_sort_7@plt>
jmp    10a0 <sorter_bitonic_sort_8@plt>
jmp    1050 <sorter_bitonic_sort_9@plt>
jmp    1100 <sorter_bitonic_sort_10@plt>
jmp    1060 <sorter_bitonic_sort_11@plt>
jmp    10e0 <sorter_bitonic_sort_12@plt>
jmp    1070 <sorter_bitonic_sort_13@plt>
jmp    10f0 <sorter_bitonic_sort_14@plt>
jmp    1080 <sorter_bitonic_sort_15@plt>
jmp    1110 <sorter_bitonic_sort_16@plt>

LLVM IR (-O0):
define void @sorter_bitonic_sort(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
store i32* %0, i32** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
switch i64 %5, label %52 [
i64 0, label %6
i64 1, label %6
i64 2, label %7
i64 3, label %10
i64 4, label %13
i64 5, label %16
i64 6, label %19
i64 7, label %22
i64 8, label %25
i64 9, label %28
i64 10, label %31
i64 11, label %34
i64 12, label %37
i64 13, label %40
i64 14, label %43
i64 15, label %46
i64 16, label %49
]
6: ; preds = %2, %2
br label %56
7: ; preds = %2
%8 = load i32*, i32** %3
%9 = call i32 @sorter_bitonic_sort_2(i32* %8)
br label %56
10: ; preds = %2
%11 = load i32*, i32** %3
%12 = call i32 @sorter_bitonic_sort_3(i32* %11)
br label %56
13: ; preds = %2
%14 = load i32*, i32** %3
%15 = call i32 @sorter_bitonic_sort_4(i32* %14)
br label %56
16: ; preds = %2
%17 = load i32*, i32** %3
%18 = call i32 @sorter_bitonic_sort_5(i32* %17)
br label %56
19: ; preds = %2
%20 = load i32*, i32** %3
%21 = call i32 @sorter_bitonic_sort_6(i32* %20)
br label %56
22: ; preds = %2
%23 = load i32*, i32** %3
%24 = call i32 @sorter_bitonic_sort_7(i32* %23)
br label %56
25: ; preds = %2
%26 = load i32*, i32** %3
%27 = call i32 @sorter_bitonic_sort_8(i32* %26)
br label %56
28: ; preds = %2
%29 = load i32*, i32** %3
%30 = call i32 @sorter_bitonic_sort_9(i32* %29)
br label %56
31: ; preds = %2
%32 = load i32*, i32** %3
%33 = call i32 @sorter_bitonic_sort_10(i32* %32)
br label %56
34: ; preds = %2
%35 = load i32*, i32** %3
%36 = call i32 @sorter_bitonic_sort_11(i32* %35)
br label %56
37: ; preds = %2
%38 = load i32*, i32** %3
%39 = call i32 @sorter_bitonic_sort_12(i32* %38)
br label %56
40: ; preds = %2
%41 = load i32*, i32** %3
%42 = call i32 @sorter_bitonic_sort_13(i32* %41)
br label %56
43: ; preds = %2
%44 = load i32*, i32** %3
%45 = call i32 @sorter_bitonic_sort_14(i32* %44)
br label %56
46: ; preds = %2
%47 = load i32*, i32** %3
%48 = call i32 @sorter_bitonic_sort_15(i32* %47)
br label %56
49: ; preds = %2
%50 = load i32*, i32** %3
%51 = call i32 @sorter_bitonic_sort_16(i32* %50)
br label %56
52: ; preds = %2
%53 = load i32*, i32** %3
%54 = load i64, i64* %4
%55 = call i32 @sorter_binary_insertion_sort(i32* %53, i64 %54)
br label %56
56: ; preds = %52, %49, %46, %43, %40, %37, %34, %31, %28, %25, %22, %19, %16, %13, %10, %7, %6
ret void
}

LLVM IR (-O2):
define void @sorter_bitonic_sort(i32* %0, i64 %1) {
switch i64 %1, label %33 [
i64 0, label %35
i64 1, label %35
i64 2, label %3
i64 3, label %5
i64 4, label %7
i64 5, label %9
i64 6, label %11
i64 7, label %13
i64 8, label %15
i64 9, label %17
i64 10, label %19
i64 11, label %21
i64 12, label %23
i64 13, label %25
i64 14, label %27
i64 15, label %29
i64 16, label %31
]
3: ; preds = %2
%4 = tail call i32 @sorter_bitonic_sort_2(i32* %0)
br label %35
5: ; preds = %2
%6 = tail call i32 @sorter_bitonic_sort_3(i32* %0)
br label %35
7: ; preds = %2
%8 = tail call i32 @sorter_bitonic_sort_4(i32* %0)
br label %35
9: ; preds = %2
%10 = tail call i32 @sorter_bitonic_sort_5(i32* %0)
br label %35
11: ; preds = %2
%12 = tail call i32 @sorter_bitonic_sort_6(i32* %0)
br label %35
13: ; preds = %2
%14 = tail call i32 @sorter_bitonic_sort_7(i32* %0)
br label %35
15: ; preds = %2
%16 = tail call i32 @sorter_bitonic_sort_8(i32* %0)
br label %35
17: ; preds = %2
%18 = tail call i32 @sorter_bitonic_sort_9(i32* %0)
br label %35
19: ; preds = %2
%20 = tail call i32 @sorter_bitonic_sort_10(i32* %0)
br label %35
21: ; preds = %2
%22 = tail call i32 @sorter_bitonic_sort_11(i32* %0)
br label %35
23: ; preds = %2
%24 = tail call i32 @sorter_bitonic_sort_12(i32* %0)
br label %35
25: ; preds = %2
%26 = tail call i32 @sorter_bitonic_sort_13(i32* %0)
br label %35
27: ; preds = %2
%28 = tail call i32 @sorter_bitonic_sort_14(i32* %0)
br label %35
29: ; preds = %2
%30 = tail call i32 @sorter_bitonic_sort_15(i32* %0)
br label %35
31: ; preds = %2
%32 = tail call i32 @sorter_bitonic_sort_16(i32* %0)
br label %35
33: ; preds = %2
%34 = tail call i32 @sorter_binary_insertion_sort(i32* %0, i64 %1)
br label %35
35: ; preds = %2, %2, %33, %31, %29, %27, %25, %23, %21, %19, %17, %15, %13, %11, %9, %7, %5, %3
ret void
}