#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 */
#define SHT_HIPROC 131
#define SHT_HIUSER 130
#define SHT_LOPROC 129
#define SHT_LOUSER 128
char *GetSectionTypeName(int type) {
  char *names[] = {"SHT_NULL",   "SHT_PROGBITS", "SHT_SYMTAB",  "SHT_STRTAB",
                   "SHT_RELA",   "SHT_HASH",     "SHT_DYNAMIC", "SHT_NOTE",
                   "SHT_NOBITS", "SHT_REL",      "SHT_SHLIB",   "SHT_DYNSIM"};
  if (type < 12)
    return names[type];
  switch (type) {
  case SHT_LOPROC:
    return "SHT_LOPROC";
    break;
  case SHT_HIPROC:
    return "SHT_HIPROC";
    break;
  case SHT_LOUSER:
    return "SHT_LOUSER";
    break;
  case SHT_HIUSER:
    return "SHT_HIUSER";
    break;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<GetSectionTypeName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %edi,-0xc(%rbp)
lea    -0x70(%rbp),%rdi
lea    0x2c97(%rip),%rsi
mov    $0x60,%edx
call   1030 <memcpy@plt>
cmpl   $0xc,-0xc(%rbp)
jge    114f <GetSectionTypeName+0x3f>
movslq -0xc(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rax
mov    %rax,-0x8(%rbp)
jmp    11c0 <GetSectionTypeName+0xb0>
mov    -0xc(%rbp),%eax
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x78(%rbp)
sub    $0x3,%eax
ja     11b8 <GetSectionTypeName+0xa8>
mov    -0x78(%rbp),%rax
lea    0xe91(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf0c(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11c0 <GetSectionTypeName+0xb0>
lea    0xf07(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11c0 <GetSectionTypeName+0xb0>
lea    0xf02(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11c0 <GetSectionTypeName+0xb0>
lea    0xefd(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11c0 <GetSectionTypeName+0xb0>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetSectionTypeName>:
cmp    $0xb,%edi
jg     1111 <GetSectionTypeName+0x11>
movslq %edi,%rax
lea    0x2cc1(%rip),%rcx
jmp    1123 <GetSectionTypeName+0x23>
add    $0xffffff80,%edi
cmp    $0x3,%edi
ja     112b <GetSectionTypeName+0x2b>
movslq %edi,%rax
lea    0x2d0d(%rip),%rcx
lea    (%rcx,%rax,8),%rax
mov    (%rax),%rax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
@.str = [9 x i8] c"SHT_NULL\00"
@.str.1 = [13 x i8] c"SHT_PROGBITS\00"
@.str.2 = [11 x i8] c"SHT_SYMTAB\00"
@.str.3 = [11 x i8] c"SHT_STRTAB\00"
@.str.4 = [9 x i8] c"SHT_RELA\00"
@.str.5 = [9 x i8] c"SHT_HASH\00"
@.str.6 = [12 x i8] c"SHT_DYNAMIC\00"
@.str.7 = [9 x i8] c"SHT_NOTE\00"
@.str.8 = [11 x i8] c"SHT_NOBITS\00"
@.str.9 = [8 x i8] c"SHT_REL\00"
@.str.10 = [10 x i8] c"SHT_SHLIB\00"
@.str.11 = [11 x i8] c"SHT_DYNSIM\00"
@__const.GetSectionTypeName.names = [12 x i8*] [i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i32 0, i32 0)]
@.str.12 = [11 x i8] c"SHT_LOPROC\00"
@.str.13 = [11 x i8] c"SHT_HIPROC\00"
@.str.14 = [11 x i8] c"SHT_LOUSER\00"
@.str.15 = [11 x i8] c"SHT_HIUSER\00"
define i8* @GetSectionTypeName(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [12 x i8*]
store i32 %0, i32* %3
%5 = bitcast [12 x i8*]* %4 to i8*
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 12
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [12 x i8*], [12 x i8*]* %4, i64 0, i64 %10
%12 = load i8*, i8** %11
store i8* %12, i8** %2
br label %20
13: ; preds = %1
%14 = load i32, i32* %3
switch i32 %14, label %19 [
i32 129, label %15
i32 131, label %16
i32 128, label %17
i32 130, label %18
]
15: ; preds = %13
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8** %2
br label %20
16: ; preds = %13
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0), i8** %2
br label %20
17: ; preds = %13
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0), i8** %2
br label %20
18: ; preds = %13
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i8** %2
br label %20
19: ; preds = %13
store i8* null, i8** %2
br label %20
20: ; preds = %19, %18, %17, %16, %15, %8
%21 = load i8*, i8** %2
ret i8* %21
}

LLVM IR (-O2):
@.str = [9 x i8] c"SHT_NULL\00"
@.str.1 = [13 x i8] c"SHT_PROGBITS\00"
@.str.2 = [11 x i8] c"SHT_SYMTAB\00"
@.str.3 = [11 x i8] c"SHT_STRTAB\00"
@.str.4 = [9 x i8] c"SHT_RELA\00"
@.str.5 = [9 x i8] c"SHT_HASH\00"
@.str.6 = [12 x i8] c"SHT_DYNAMIC\00"
@.str.7 = [9 x i8] c"SHT_NOTE\00"
@.str.8 = [11 x i8] c"SHT_NOBITS\00"
@.str.9 = [8 x i8] c"SHT_REL\00"
@.str.10 = [10 x i8] c"SHT_SHLIB\00"
@.str.11 = [11 x i8] c"SHT_DYNSIM\00"
@__const.GetSectionTypeName.names = [12 x i8*] [i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i32 0, i32 0)]
@.str.12 = [11 x i8] c"SHT_LOPROC\00"
@.str.13 = [11 x i8] c"SHT_HIPROC\00"
@.str.14 = [11 x i8] c"SHT_LOUSER\00"
@.str.15 = [11 x i8] c"SHT_HIUSER\00"
@switch.table.GetSectionTypeName = [4 x i8*] [i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.13, i64 0, i64 0)]
define i8* @GetSectionTypeName(i32 %0) {
%2 = icmp slt i32 %0, 12
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = sext i32 %0 to i64
%5 = getelementptr inbounds [12 x i8*], [12 x i8*]* @__const.GetSectionTypeName.names, i64 0, i64 %4
br label %12
6: ; preds = %1
%7 = add i32 %0, -128
%8 = icmp ult i32 %7, 4
br i1 %8, label %9, label %15
9: ; preds = %6
%10 = sext i32 %7 to i64
%11 = getelementptr inbounds [4 x i8*], [4 x i8*]* @switch.table.GetSectionTypeName, i64 0, i64 %10
br label %12
12: ; preds = %3, %9
%13 = phi i8** [ %11, %9 ], [ %5, %3 ]
%14 = load i8*, i8** %13
br label %15
15: ; preds = %12, %6
%16 = phi i8* [ null, %6 ], [ %14, %12 ]
ret i8* %16
}