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

/* Variables and functions */
int /*<<< orphan*/ sort3_sorting_network_simple_swap(char *);
int /*<<< orphan*/ sort4_sorting_network_simple_swap(char *);
int /*<<< orphan*/ sort5_sorting_network_simple_swap(char *);
int /*<<< orphan*/ sort6_sorting_network_simple_swap(char *);
void word_sort(char *word, int len) {
  switch (len) {
  case 3:
    sort3_sorting_network_simple_swap(word);
    break;
  case 4:
    sort4_sorting_network_simple_swap(word);
    break;
  case 5:
    sort5_sorting_network_simple_swap(word);
    break;
  case 6:
    sort6_sorting_network_simple_swap(word);
    break;
  }
}


x86 assembly (clang, -O0):
<word_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xfffffffd,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x3,%eax
ja     11ab <word_sort+0x6b>
mov    -0x18(%rbp),%rax
lea    0xe91(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
call   1050 <sort3_sorting_network_simple_swap@plt>
jmp    11ab <word_sort+0x6b>
mov    -0x8(%rbp),%rdi
call   1030 <sort4_sorting_network_simple_swap@plt>
jmp    11ab <word_sort+0x6b>
mov    -0x8(%rbp),%rdi
call   1060 <sort5_sorting_network_simple_swap@plt>
jmp    11ab <word_sort+0x6b>
mov    -0x8(%rbp),%rdi
call   1040 <sort6_sorting_network_simple_swap@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<word_sort>:
add    $0xfffffffd,%esi
cmp    $0x3,%esi
ja     115d <word_sort+0x1d>
lea    0xeb1(%rip),%rax
movslq (%rax,%rsi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
jmp    1050 <sort3_sorting_network_simple_swap@plt>
ret
jmp    1030 <sort4_sorting_network_simple_swap@plt>
jmp    1060 <sort5_sorting_network_simple_swap@plt>
jmp    1040 <sort6_sorting_network_simple_swap@plt>

LLVM IR (-O0):
define void @word_sort(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
switch i32 %5, label %18 [
i32 3, label %6
i32 4, label %9
i32 5, label %12
i32 6, label %15
]
6: ; preds = %2
%7 = load i8*, i8** %3
%8 = call i32 @sort3_sorting_network_simple_swap(i8* %7)
br label %18
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = call i32 @sort4_sorting_network_simple_swap(i8* %10)
br label %18
12: ; preds = %2
%13 = load i8*, i8** %3
%14 = call i32 @sort5_sorting_network_simple_swap(i8* %13)
br label %18
15: ; preds = %2
%16 = load i8*, i8** %3
%17 = call i32 @sort6_sorting_network_simple_swap(i8* %16)
br label %18
18: ; preds = %2, %15, %12, %9, %6
ret void
}

LLVM IR (-O2):
define void @word_sort(i8* %0, i32 %1) {
switch i32 %1, label %11 [
i32 3, label %3
i32 4, label %5
i32 5, label %7
i32 6, label %9
]
3: ; preds = %2
%4 = tail call i32 @sort3_sorting_network_simple_swap(i8* %0)
br label %11
5: ; preds = %2
%6 = tail call i32 @sort4_sorting_network_simple_swap(i8* %0)
br label %11
7: ; preds = %2
%8 = tail call i32 @sort5_sorting_network_simple_swap(i8* %0)
br label %11
9: ; preds = %2
%10 = tail call i32 @sort6_sorting_network_simple_swap(i8* %0)
br label %11
11: ; preds = %2, %9, %7, %5, %3
ret void
}