#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*/ _sys_printf(char *);
int /*<<< orphan*/ _sys_putchar(char);
void print_mem_type(int type) {
  _sys_putchar('(');
  switch (type) {
  case 1:
    _sys_printf("usable");
    break;
  case 2:
    _sys_printf("unusable");
    break;
  case 3:
    _sys_printf("ACPI");
    break;
  case 4:
    _sys_printf("ACPI NVS");
    break;
  }
  _sys_putchar(')');
}


x86 assembly (clang, -O0):
<print_mem_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x28,%edi
call   1040 <_sys_putchar@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     119d <print_mem_type+0x7d>
mov    -0x10(%rbp),%rax
lea    0xeab(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xead(%rip),%rdi
call   1030 <_sys_printf@plt>
jmp    119d <print_mem_type+0x7d>
lea    0xe9a(%rip),%rdi
call   1030 <_sys_printf@plt>
jmp    119d <print_mem_type+0x7d>
lea    0xe92(%rip),%rdi
call   1030 <_sys_printf@plt>
jmp    119d <print_mem_type+0x7d>
lea    0xe86(%rip),%rdi
call   1030 <_sys_printf@plt>
mov    $0x29,%edi
call   1040 <_sys_putchar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_mem_type>:
push   %rbx
mov    %edi,%ebx
mov    $0x28,%edi
call   1040 <_sys_putchar@plt>
add    $0xffffffff,%ebx
cmp    $0x3,%ebx
ja     114b <print_mem_type+0x2b>
movslq %ebx,%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
call   1030 <_sys_printf@plt>
mov    $0x29,%edi
pop    %rbx
jmp    1040 <_sys_putchar@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"usable\00"
@.str.1 = [9 x i8] c"unusable\00"
@.str.2 = [5 x i8] c"ACPI\00"
@.str.3 = [9 x i8] c"ACPI NVS\00"
define void @print_mem_type(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @_sys_putchar(i8 signext 40)
%4 = load i32, i32* %2
switch i32 %4, label %13 [
i32 1, label %5
i32 2, label %7
i32 3, label %9
i32 4, label %11
]
5: ; preds = %1
%6 = call i32 @_sys_printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %13
7: ; preds = %1
%8 = call i32 @_sys_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %13
9: ; preds = %1
%10 = call i32 @_sys_printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %13
11: ; preds = %1
%12 = call i32 @_sys_printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
br label %13
13: ; preds = %1, %11, %9, %7, %5
%14 = call i32 @_sys_putchar(i8 signext 41)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"usable\00"
@.str.1 = [9 x i8] c"unusable\00"
@.str.2 = [5 x i8] c"ACPI\00"
@.str.3 = [9 x i8] c"ACPI NVS\00"
@reltable.print_mem_type = [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str to i64), i64 ptrtoint ([4 x i32]* @reltable.print_mem_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.1 to i64), i64 ptrtoint ([4 x i32]* @reltable.print_mem_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.2 to i64), i64 ptrtoint ([4 x i32]* @reltable.print_mem_type to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([9 x i8]* @.str.3 to i64), i64 ptrtoint ([4 x i32]* @reltable.print_mem_type to i64)) to i32)]
define void @print_mem_type(i32 %0) {
%2 = tail call i32 @_sys_putchar(i8 signext 40)
%3 = add i32 %0, -1
%4 = icmp ult i32 %3, 4
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = sext i32 %3 to i64
%7 = shl i64 %6, 2
%8 = call i8* @llvm.load.relative.i64(i8* bitcast ([4 x i32]* @reltable.print_mem_type to i8*), i64 %7)
%9 = tail call i32 @_sys_printf(i8* %8)
br label %10
10: ; preds = %1, %5
%11 = tail call i32 @_sys_putchar(i8 signext 41)
ret void
}