#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*/ printf(char *);
void decode_tpgs_state(const int st) {
  switch (st) {
  case 0x0:
    printf(" (active/optimized)");
    break;
  case 0x1:
    printf(" (active/non optimized)");
    break;
  case 0x2:
    printf(" (standby)");
    break;
  case 0x3:
    printf(" (unavailable)");
    break;
  case 0xe:
    printf(" (offline)");
    break;
  case 0xf:
    printf(" (transitioning between states)");
    break;
  default:
    printf(" (unknown)");
    break;
  }
}


x86 assembly (clang, -O0):
<decode_tpgs_state>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0xf,%rax
ja     11a6 <decode_tpgs_state+0x96>
mov    -0x10(%rbp),%rax
lea    0xec9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xef9(%rip),%rdi
call   1030 <printf@plt>
jmp    11b2 <decode_tpgs_state+0xa2>
lea    0xefc(%rip),%rdi
call   1030 <printf@plt>
jmp    11b2 <decode_tpgs_state+0xa2>
lea    0xf03(%rip),%rdi
call   1030 <printf@plt>
jmp    11b2 <decode_tpgs_state+0xa2>
lea    0xefd(%rip),%rdi
call   1030 <printf@plt>
jmp    11b2 <decode_tpgs_state+0xa2>
lea    0xefb(%rip),%rdi
call   1030 <printf@plt>
jmp    11b2 <decode_tpgs_state+0xa2>
lea    0xef5(%rip),%rdi
call   1030 <printf@plt>
jmp    11b2 <decode_tpgs_state+0xa2>
lea    0xf04(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_tpgs_state>:
cmp    $0xf,%edi
ja     1154 <decode_tpgs_state+0x44>
mov    %edi,%eax
lea    0xf22(%rip),%rdi
mov    %eax,%eax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf1d(%rip),%rdi
jmp    1030 <printf@plt>
lea    0xf29(%rip),%rdi
jmp    1030 <printf@plt>
lea    0xf28(%rip),%rdi
jmp    1030 <printf@plt>
lea    0xf56(%rip),%rdi
jmp    1030 <printf@plt>
lea    0xf1f(%rip),%rdi
jmp    1030 <printf@plt>
lea    0xf1e(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [20 x i8] c" (active/optimized)\00"
@.str.1 = [24 x i8] c" (active/non optimized)\00"
@.str.2 = [11 x i8] c" (standby)\00"
@.str.3 = [15 x i8] c" (unavailable)\00"
@.str.4 = [11 x i8] c" (offline)\00"
@.str.5 = [32 x i8] c" (transitioning between states)\00"
@.str.6 = [11 x i8] c" (unknown)\00"
define void @decode_tpgs_state(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %16 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 14, label %12
i32 15, label %14
]
4: ; preds = %1
%5 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %18
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
br label %18
8: ; preds = %1
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %18
10: ; preds = %1
%11 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
br label %18
12: ; preds = %1
%13 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %18
14: ; preds = %1
%15 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
br label %18
16: ; preds = %1
%17 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
br label %18
18: ; preds = %16, %14, %12, %10, %8, %6, %4
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c" (active/optimized)\00"
@.str.1 = [24 x i8] c" (active/non optimized)\00"
@.str.2 = [11 x i8] c" (standby)\00"
@.str.3 = [15 x i8] c" (unavailable)\00"
@.str.4 = [11 x i8] c" (offline)\00"
@.str.5 = [32 x i8] c" (transitioning between states)\00"
@.str.6 = [11 x i8] c" (unknown)\00"
define void @decode_tpgs_state(i32 %0) {
switch i32 %0, label %7 [
i32 0, label %8
i32 1, label %2
i32 2, label %3
i32 3, label %4
i32 14, label %5
i32 15, label %6
]
2: ; preds = %1
br label %8
3: ; preds = %1
br label %8
4: ; preds = %1
br label %8
5: ; preds = %1
br label %8
6: ; preds = %1
br label %8
7: ; preds = %1
br label %8
8: ; preds = %1, %7, %6, %5, %4, %3, %2
%9 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0), %6 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), %5 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), %4 ], [ getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), %3 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), %2 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), %1 ]
%10 = tail call i32 @printf(i8* dereferenceable(1) %9)
ret void
}