#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 get_value();
int /*<<< orphan*/ parse_value(char *);
int /*<<< orphan*/ printf(char *);
void parse_collection(void) {
  switch (get_value()) {
  case 0x00:
    parse_value("COLLECTION");
    (printf(" "), printf("Physical"));
    break;
  case 0x01:
    parse_value("COLLECTION");
    (printf(" "), printf("Application"));
    break;
  case 0x02:
    parse_value("COLLECTION");
    (printf(" "), printf("Logical"));
    break;
  case 0x03:
    parse_value("COLLECTION");
    (printf(" "), printf("Report"));
    break;
  case 0x04:
    parse_value("COLLECTION");
    (printf(" "), printf("Named Array"));
    break;
  case 0x05:
    parse_value("COLLECTION");
    (printf(" "), printf("Usage Switch"));
    break;
  case 0x06:
    parse_value("COLLECTION");
    (printf(" "), printf("Usage Modifier"));
    break;
  default:
    parse_value("COLLECTION");
    (printf(" "), printf("RESERVED"));
    break;
  }
}


x86 assembly (clang, -O0):
<parse_collection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
call   1050 <get_value@plt>
mov    %eax,%ecx
mov    %rcx,-0x8(%rbp)
sub    $0x6,%eax
ja     1281 <parse_collection+0x151>
mov    -0x8(%rbp),%rax
lea    0xea7(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeb3(%rip),%rdi
call   1030 <parse_value@plt>
lea    0xeb2(%rip),%rdi
call   1040 <printf@plt>
lea    0xea8(%rip),%rdi
call   1040 <printf@plt>
jmp    12a5 <parse_collection+0x175>
lea    0xe8a(%rip),%rdi
call   1030 <parse_value@plt>
lea    0xe89(%rip),%rdi
call   1040 <printf@plt>
lea    0xe88(%rip),%rdi
call   1040 <printf@plt>
jmp    12a5 <parse_collection+0x175>
lea    0xe61(%rip),%rdi
call   1030 <parse_value@plt>
lea    0xe60(%rip),%rdi
call   1040 <printf@plt>
lea    0xe6b(%rip),%rdi
call   1040 <printf@plt>
jmp    12a5 <parse_collection+0x175>
lea    0xe38(%rip),%rdi
call   1030 <parse_value@plt>
lea    0xe37(%rip),%rdi
call   1040 <printf@plt>
lea    0xe4a(%rip),%rdi
call   1040 <printf@plt>
jmp    12a5 <parse_collection+0x175>
lea    0xe0f(%rip),%rdi
call   1030 <parse_value@plt>
lea    0xe0e(%rip),%rdi
call   1040 <printf@plt>
lea    0xe28(%rip),%rdi
call   1040 <printf@plt>
jmp    12a5 <parse_collection+0x175>
lea    0xde6(%rip),%rdi
call   1030 <parse_value@plt>
lea    0xde5(%rip),%rdi
call   1040 <printf@plt>
lea    0xe0b(%rip),%rdi
call   1040 <printf@plt>
jmp    12a5 <parse_collection+0x175>
lea    0xdbd(%rip),%rdi
call   1030 <parse_value@plt>
lea    0xdbc(%rip),%rdi
call   1040 <printf@plt>
lea    0xdef(%rip),%rdi
call   1040 <printf@plt>
jmp    12a5 <parse_collection+0x175>
lea    0xd94(%rip),%rdi
call   1030 <parse_value@plt>
lea    0xd93(%rip),%rdi
call   1040 <printf@plt>
lea    0xdd5(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_collection>:
push   %rbx
xor    %eax,%eax
call   1060 <get_value@plt>
cmp    $0x6,%eax
ja     115f <parse_collection+0x1f>
cltq
lea    0xf0a(%rip),%rcx
movslq (%rcx,%rax,4),%rbx
add    %rcx,%rbx
jmp    1166 <parse_collection+0x26>
lea    0xef1(%rip),%rbx
lea    0xe93(%rip),%rdi
call   1040 <parse_value@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"COLLECTION\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [9 x i8] c"Physical\00"
@.str.3 = [12 x i8] c"Application\00"
@.str.4 = [8 x i8] c"Logical\00"
@.str.5 = [7 x i8] c"Report\00"
@.str.6 = [12 x i8] c"Named Array\00"
@.str.7 = [13 x i8] c"Usage Switch\00"
@.str.8 = [15 x i8] c"Usage Modifier\00"
@.str.9 = [9 x i8] c"RESERVED\00"
define void @parse_collection() {
%1 = call i32 (...) @get_value()
switch i32 %1, label %30 [
i32 0, label %2
i32 1, label %6
i32 2, label %10
i32 3, label %14
i32 4, label %18
i32 5, label %22
i32 6, label %26
]
2: ; preds = %0
%3 = call i32 @parse_value(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %34
6: ; preds = %0
%7 = call i32 @parse_value(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %34
10: ; preds = %0
%11 = call i32 @parse_value(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
br label %34
14: ; preds = %0
%15 = call i32 @parse_value(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%17 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
br label %34
18: ; preds = %0
%19 = call i32 @parse_value(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%20 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%21 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
br label %34
22: ; preds = %0
%23 = call i32 @parse_value(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%24 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%25 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
br label %34
26: ; preds = %0
%27 = call i32 @parse_value(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%28 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%29 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
br label %34
30: ; preds = %0
%31 = call i32 @parse_value(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%32 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%33 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0))
br label %34
34: ; preds = %30, %26, %22, %18, %14, %10, %6, %2
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"COLLECTION\00"
@.str.2 = [9 x i8] c"Physical\00"
@.str.3 = [12 x i8] c"Application\00"
@.str.4 = [8 x i8] c"Logical\00"
@.str.5 = [7 x i8] c"Report\00"
@.str.6 = [12 x i8] c"Named Array\00"
@.str.7 = [13 x i8] c"Usage Switch\00"
@.str.8 = [15 x i8] c"Usage Modifier\00"
@.str.9 = [9 x i8] c"RESERVED\00"
@reltable.parse_collection = [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.2 to i64), i64 ptrtoint ([7 x i32]* @reltable.parse_collection to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.3 to i64), i64 ptrtoint ([7 x i32]* @reltable.parse_collection to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.parse_collection to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.5 to i64), i64 ptrtoint ([7 x i32]* @reltable.parse_collection to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.6 to i64), i64 ptrtoint ([7 x i32]* @reltable.parse_collection to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.7 to i64), i64 ptrtoint ([7 x i32]* @reltable.parse_collection to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([15 x i8]* @.str.8 to i64), i64 ptrtoint ([7 x i32]* @reltable.parse_collection to i64)) to i32)]
define void @parse_collection() {
%1 = tail call i32 (...) @get_value()
%2 = icmp ult i32 %1, 7
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = sext i32 %1 to i64
%5 = shl i64 %4, 2
%6 = call i8* @llvm.load.relative.i64(i8* bitcast ([7 x i32]* @reltable.parse_collection to i8*), i64 %5)
br label %7
7: ; preds = %0, %3
%8 = phi i8* [ %6, %3 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.9, i64 0, i64 0), %0 ]
%9 = tail call i32 @parse_value(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 @putchar(i32 32)
%11 = tail call i32 @printf(i8* dereferenceable(1) %8)
ret void
}