#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 /*<<< orphan*/ type_name;

/* Variables and functions */
#define R_386_32 138
#define R_386_COPY 137
#define R_386_GLOB_DAT 136
#define R_386_GOT32 135
#define R_386_GOTOFF 134
#define R_386_GOTPC 133
#define R_386_JMP_SLOT 132
#define R_386_NONE 131
#define R_386_PC32 130
#define R_386_PLT32 129
#define R_386_RELATIVE 128
const char *rel_type(unsigned type) {
  static const char *type_name[] = {
      [R_386_NONE] = "R_386_NONE",         [R_386_32] = "R_386_32",
      [R_386_PC32] = "R_386_PC32",         [R_386_GOT32] = "R_386_GOT32",
      [R_386_PLT32] = "R_386_PLT32",       [R_386_COPY] = "R_386_COPY",
      [R_386_GLOB_DAT] = "R_386_GLOB_DAT", [R_386_JMP_SLOT] = "R_386_JMP_SLOT",
      [R_386_RELATIVE] = "R_386_RELATIVE", [R_386_GOTOFF] = "R_386_GOTOFF",
      [R_386_GOTPC] = "R_386_GOTPC",
  };
  const char *name = "unknown type rel type name";
  if (type < sizeof(type_name) / sizeof(type_name[0])) {
    name = type_name[type];
  }
  return name;
}


x86 assembly (clang, -O0):
<rel_type>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
lea    0xf7a(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cmp    $0x8b,%rax
jae    1135 <rel_type+0x35>
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
lea    0x2f03(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rel_type>:
cmp    $0x8a,%edi
ja     1116 <rel_type+0x16>
mov    %edi,%eax
lea    0x28df(%rip),%rcx
mov    (%rcx,%rax,8),%rax
ret
lea    0xf6b(%rip),%rax
ret

LLVM IR (-O0):
@rel_type.type_name = internal global [139 x i8*] [i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 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 ([15 x i8], [15 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i32 0, i32 0)]
@.str = [15 x i8] c"R_386_RELATIVE\00"
@.str.1 = [12 x i8] c"R_386_PLT32\00"
@.str.2 = [11 x i8] c"R_386_PC32\00"
@.str.3 = [11 x i8] c"R_386_NONE\00"
@.str.4 = [15 x i8] c"R_386_JMP_SLOT\00"
@.str.5 = [12 x i8] c"R_386_GOTPC\00"
@.str.6 = [13 x i8] c"R_386_GOTOFF\00"
@.str.7 = [12 x i8] c"R_386_GOT32\00"
@.str.8 = [15 x i8] c"R_386_GLOB_DAT\00"
@.str.9 = [11 x i8] c"R_386_COPY\00"
@.str.10 = [9 x i8] c"R_386_32\00"
@.str.11 = [27 x i8] c"unknown type rel type name\00"
define i8* @rel_type(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0), i8** %3
%4 = load i32, i32* %2
%5 = zext i32 %4 to i64
%6 = icmp ult i64 %5, 139
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i32, i32* %2
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds [139 x i8*], [139 x i8*]* @rel_type.type_name, i64 0, i64 %9
%11 = load i8*, i8** %10
store i8* %11, i8** %3
br label %12
12: ; preds = %7, %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@rel_type.type_name = internal unnamed_addr constant [139 x i8*] [i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* null, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 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 ([15 x i8], [15 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i32 0, i32 0)]
@.str = [15 x i8] c"R_386_RELATIVE\00"
@.str.1 = [12 x i8] c"R_386_PLT32\00"
@.str.2 = [11 x i8] c"R_386_PC32\00"
@.str.3 = [11 x i8] c"R_386_NONE\00"
@.str.4 = [15 x i8] c"R_386_JMP_SLOT\00"
@.str.5 = [12 x i8] c"R_386_GOTPC\00"
@.str.6 = [13 x i8] c"R_386_GOTOFF\00"
@.str.7 = [12 x i8] c"R_386_GOT32\00"
@.str.8 = [15 x i8] c"R_386_GLOB_DAT\00"
@.str.9 = [11 x i8] c"R_386_COPY\00"
@.str.10 = [9 x i8] c"R_386_32\00"
@.str.11 = [27 x i8] c"unknown type rel type name\00"
define i8* @rel_type(i32 %0) {
%2 = icmp ult i32 %0, 139
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = zext i32 %0 to i64
%5 = getelementptr inbounds [139 x i8*], [139 x i8*]* @rel_type.type_name, i64 0, i64 %4
%6 = load i8*, i8** %5
br label %7
7: ; preds = %3, %1
%8 = phi i8* [ %6, %3 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0), %1 ]
ret i8* %8
}