#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*/ assert(int /*<<< orphan*/);
const char *get_paxos_name(int p) {
  switch (p) {
  case 1:
    return "mdsmap";
  case 4:
    return "monmap";
  case 2:
    return "osdmap";
  case 0:
    return "pgmap";
  case 3:
    return "logm";
  case 5:
    return "auth";
  default:
    assert(0);
    return 0;
  }
}


x86 assembly (clang, -O0):
<get_paxos_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x5,%rax
ja     11a0 <get_paxos_name+0x90>
mov    -0x18(%rbp),%rax
lea    0xec9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11af <get_paxos_name+0x9f>
lea    0xec8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11af <get_paxos_name+0x9f>
lea    0xebf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11af <get_paxos_name+0x9f>
lea    0xeb6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11af <get_paxos_name+0x9f>
lea    0xeac(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11af <get_paxos_name+0x9f>
lea    0xea1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11af <get_paxos_name+0x9f>
xor    %edi,%edi
call   1030 <assert@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_paxos_name>:
push   %rbx
cmp    $0x6,%edi
jae    1129 <get_paxos_name+0x19>
movslq %edi,%rax
lea    0xf08(%rip),%rcx
movslq (%rcx,%rax,4),%rbx
add    %rcx,%rbx
jmp    1132 <get_paxos_name+0x22>
xor    %ebx,%ebx
xor    %edi,%edi
call   1030 <assert@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"mdsmap\00"
@.str.1 = [7 x i8] c"monmap\00"
@.str.2 = [7 x i8] c"osdmap\00"
@.str.3 = [6 x i8] c"pgmap\00"
@.str.4 = [5 x i8] c"logm\00"
@.str.5 = [5 x i8] c"auth\00"
define i8* @get_paxos_name(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %11 [
i32 1, label %5
i32 4, label %6
i32 2, label %7
i32 0, label %8
i32 3, label %9
i32 5, label %10
]
5: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %2
br label %13
6: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %13
7: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %13
8: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %13
9: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %13
10: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %13
11: ; preds = %1
%12 = call i32 @assert(i32 0)
store i8* null, i8** %2
br label %13
13: ; preds = %11, %10, %9, %8, %7, %6, %5
%14 = load i8*, i8** %2
ret i8* %14
}

LLVM IR (-O2):
@.str = [7 x i8] c"mdsmap\00"
@.str.1 = [7 x i8] c"monmap\00"
@.str.2 = [7 x i8] c"osdmap\00"
@.str.3 = [6 x i8] c"pgmap\00"
@.str.4 = [5 x i8] c"logm\00"
@.str.5 = [5 x i8] c"auth\00"
@reltable.get_paxos_name = [6 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.3 to i64), i64 ptrtoint ([6 x i32]* @reltable.get_paxos_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str to i64), i64 ptrtoint ([6 x i32]* @reltable.get_paxos_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.2 to i64), i64 ptrtoint ([6 x i32]* @reltable.get_paxos_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.4 to i64), i64 ptrtoint ([6 x i32]* @reltable.get_paxos_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.1 to i64), i64 ptrtoint ([6 x i32]* @reltable.get_paxos_name to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.5 to i64), i64 ptrtoint ([6 x i32]* @reltable.get_paxos_name to i64)) to i32)]
define i8* @get_paxos_name(i32 %0) {
%2 = icmp ult i32 %0, 6
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @assert(i32 0)
br label %9
5: ; preds = %1
%6 = sext i32 %0 to i64
%7 = shl i64 %6, 2
%8 = call i8* @llvm.load.relative.i64(i8* bitcast ([6 x i32]* @reltable.get_paxos_name to i8*), i64 %7)
br label %9
9: ; preds = %5, %3
%10 = phi i8* [ null, %3 ], [ %8, %5 ]
ret i8* %10
}