#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 uint8_t;

/* Variables and functions */
const char *power_mode_init_to_text(uint8_t val) {
  val &= (0xC0);
  switch (val) {
  case (0x00):
    return "INIT_UNAVAILABLE";
  case (0x40):
    return "INIT_HOST";
  case (0x80):
    return "INIT_IO_UNIT";
  case (0xC0):
    return "INIT_PCIE_DPA";
  }
  return "INIT_UNKNOWN";
}


x86 assembly (clang, -O0):
<power_mode_init_to_text>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xc0,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     115c <power_mode_init_to_text+0x5c>
jmp    1125 <power_mode_init_to_text+0x25>
mov    -0x10(%rbp),%eax
sub    $0x40,%eax
je     116c <power_mode_init_to_text+0x6c>
jmp    1136 <power_mode_init_to_text+0x36>
mov    -0x10(%rbp),%eax
sub    $0x80,%eax
je     117c <power_mode_init_to_text+0x7c>
jmp    1149 <power_mode_init_to_text+0x49>
mov    -0x10(%rbp),%eax
sub    $0xc0,%eax
je     118c <power_mode_init_to_text+0x8c>
jmp    119c <power_mode_init_to_text+0x9c>
lea    0xe9d(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a7 <power_mode_init_to_text+0xa7>
lea    0xe9e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a7 <power_mode_init_to_text+0xa7>
lea    0xe98(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a7 <power_mode_init_to_text+0xa7>
lea    0xe95(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11a7 <power_mode_init_to_text+0xa7>
lea    0xe93(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<power_mode_init_to_text>:
shr    $0x6,%edi
and    $0x3,%edi
lea    0xf2b(%rip),%rcx
movslq (%rcx,%rdi,4),%rax
add    %rcx,%rax
ret

LLVM IR (-O0):
@.str = [17 x i8] c"INIT_UNAVAILABLE\00"
@.str.1 = [10 x i8] c"INIT_HOST\00"
@.str.2 = [13 x i8] c"INIT_IO_UNIT\00"
@.str.3 = [14 x i8] c"INIT_PCIE_DPA\00"
@.str.4 = [13 x i8] c"INIT_UNKNOWN\00"
define i8* @power_mode_init_to_text(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = and i32 %4, 192
store i32 %5, i32* %3
%6 = load i32, i32* %3
switch i32 %6, label %11 [
i32 0, label %7
i32 64, label %8
i32 128, label %9
i32 192, label %10
]
7: ; preds = %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8** %2
br label %12
8: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %12
9: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %12
10: ; preds = %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %12
11: ; preds = %1
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %12
12: ; preds = %11, %10, %9, %8, %7
%13 = load i8*, i8** %2
ret i8* %13
}

LLVM IR (-O2):
@.str = [17 x i8] c"INIT_UNAVAILABLE\00"
@.str.1 = [10 x i8] c"INIT_HOST\00"
@.str.2 = [13 x i8] c"INIT_IO_UNIT\00"
@.str.3 = [14 x i8] c"INIT_PCIE_DPA\00"
@reltable.power_mode_init_to_text = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([17 x i8]* @.str to i64), i64 ptrtoint ([4 x i32]* @reltable.power_mode_init_to_text to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.1 to i64), i64 ptrtoint ([4 x i32]* @reltable.power_mode_init_to_text to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.2 to i64), i64 ptrtoint ([4 x i32]* @reltable.power_mode_init_to_text to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.power_mode_init_to_text to i64)) to i32)]
define i8* @power_mode_init_to_text(i32 %0) {
%2 = lshr i32 %0, 6
%3 = and i32 %2, 3
%4 = zext i32 %3 to i64
%5 = shl i64 %4, 2
%6 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.power_mode_init_to_text to i8*), i64 %5)
ret i8* %6
}