#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_16 142
#define R_386_32 141
#define R_386_8 140
#define R_386_COPY 139
#define R_386_GLOB_DAT 138
#define R_386_GOT32 137
#define R_386_GOTOFF 136
#define R_386_GOTPC 135
#define R_386_JMP_SLOT 134
#define R_386_NONE 133
#define R_386_PC16 132
#define R_386_PC32 131
#define R_386_PC8 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",       [R_386_8] = "R_386_8",
      [R_386_PC8] = "R_386_PC8",           [R_386_16] = "R_386_16",
      [R_386_PC16] = "R_386_PC16",
  };
  const char *name = "unknown type rel type name";
  if (type < (sizeof(type_name) / sizeof((type_name)[0])) && type_name[type]) {
    name = type_name[type];
  }
  return name;
}


x86 assembly (clang, -O0):
<rel_type>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
lea    0xfa0(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cmp    $0x8f,%rax
jae    114c <rel_type+0x4c>
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
lea    0x2f03(%rip),%rax
cmpq   $0x0,(%rax,%rcx,8)
je     114c <rel_type+0x4c>
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
lea    0x2eec(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rel_type>:
lea    -0x8f(%rdi),%eax
cmp    $0xfffffff1,%eax
jae    1113 <rel_type+0x13>
lea    0xf9c(%rip),%rax
ret
mov    %edi,%eax
lea    0x28b4(%rip),%rcx
mov    (%rcx,%rax,8),%rax
ret

LLVM IR (-O0):
@rel_type.type_name = internal global [143 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 ([10 x i8], [10 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 ([11 x i8], [11 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 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 ([13 x i8], [13 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.14, 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 = [10 x i8] c"R_386_PC8\00"
@.str.3 = [11 x i8] c"R_386_PC32\00"
@.str.4 = [11 x i8] c"R_386_PC16\00"
@.str.5 = [11 x i8] c"R_386_NONE\00"
@.str.6 = [15 x i8] c"R_386_JMP_SLOT\00"
@.str.7 = [12 x i8] c"R_386_GOTPC\00"
@.str.8 = [13 x i8] c"R_386_GOTOFF\00"
@.str.9 = [12 x i8] c"R_386_GOT32\00"
@.str.10 = [15 x i8] c"R_386_GLOB_DAT\00"
@.str.11 = [11 x i8] c"R_386_COPY\00"
@.str.12 = [8 x i8] c"R_386_8\00"
@.str.13 = [9 x i8] c"R_386_32\00"
@.str.14 = [9 x i8] c"R_386_16\00"
@.str.15 = [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.15, i64 0, i64 0), i8** %3
%4 = load i32, i32* %2
%5 = zext i32 %4 to i64
%6 = icmp ult i64 %5, 143
br i1 %6, label %7, label %18
7: ; preds = %1
%8 = load i32, i32* %2
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds [143 x i8*], [143 x i8*]* @rel_type.type_name, i64 0, i64 %9
%11 = load i8*, i8** %10
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %18
13: ; preds = %7
%14 = load i32, i32* %2
%15 = zext i32 %14 to i64
%16 = getelementptr inbounds [143 x i8*], [143 x i8*]* @rel_type.type_name, i64 0, i64 %15
%17 = load i8*, i8** %16
store i8* %17, i8** %3
br label %18
18: ; preds = %13, %7, %1
%19 = load i8*, i8** %3
ret i8* %19
}

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