#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 */
typedef struct TYPE_6__ TYPE_2__;
typedef struct TYPE_5__ TYPE_1__;

/* Type definitions */
struct TYPE_6__ {
  int /*<<< orphan*/ e_shoff;
};
struct TYPE_5__ {
  int /*<<< orphan*/ sh_offset;
  int /*<<< orphan*/ sh_link;
};
typedef int /*<<< orphan*/ Elf32_Sym;
typedef TYPE_1__ Elf32_Shdr;
typedef int /*<<< orphan*/ Elf32_Rel;
typedef TYPE_2__ Elf32_Ehdr;

/* Variables and functions */
int w(int /*<<< orphan*/);
void get_sym_str_and_relp_32(Elf32_Shdr const *const relhdr,
                             Elf32_Ehdr const *const ehdr,
                             Elf32_Sym const **sym0, char const **str0,
                             Elf32_Rel const **relp) {
  Elf32_Shdr *const shdr0 = (Elf32_Shdr *)(w(ehdr->e_shoff) + (void *)ehdr);
  unsigned const symsec_sh_link = w(relhdr->sh_link);
  Elf32_Shdr const *const symsec = &shdr0[symsec_sh_link];
  Elf32_Shdr const *const strsec = &shdr0[w(symsec->sh_link)];
  Elf32_Rel const *const rel0 =
      (Elf32_Rel const *)(w(relhdr->sh_offset) + (void *)ehdr);
  *sym0 = (Elf32_Sym const *)(w(symsec->sh_offset) + (void *)ehdr);
  *str0 = (char const *)(w(strsec->sh_offset) + (void *)ehdr);
  *relp = rel0;
}


x86 assembly (clang, -O0):
<get_sym_str_and_relp_32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1030 <w@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edi
call   1030 <w@plt>
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x34(%rbp),%ecx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x40(%rbp),%rax
mov    0x4(%rax),%edi
call   1030 <w@plt>
mov    %eax,%ecx
mov    -0x58(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x48(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <w@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x50(%rbp)
mov    -0x40(%rbp),%rax
mov    (%rax),%edi
call   1030 <w@plt>
mov    -0x10(%rbp),%rcx
cltq
add    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x48(%rbp),%rax
mov    (%rax),%edi
call   1030 <w@plt>
mov    -0x10(%rbp),%rcx
cltq
add    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x50(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_sym_str_and_relp_32>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,0x10(%rsp)
mov    %rcx,0x8(%rsp)
mov    %rdx,(%rsp)
mov    %rsi,%r12
mov    %rdi,%r13
mov    (%rsi),%edi
call   1030 <w@plt>
movslq %eax,%rbp
add    %r12,%rbp
mov    0x4(%r13),%edi
call   1030 <w@plt>
mov    %eax,%r14d
mov    0x4(%rbp,%r14,8),%edi
call   1030 <w@plt>
movslq %eax,%r15
mov    0x0(%r13),%edi
call   1030 <w@plt>
movslq %eax,%rbx
add    %r12,%rbx
mov    0x0(%rbp,%r14,8),%edi
call   1030 <w@plt>
cltq
add    %r12,%rax
mov    (%rsp),%rcx
mov    %rax,(%rcx)
mov    0x0(%rbp,%r15,8),%edi
call   1030 <w@plt>
cltq
add    %r12,%rax
mov    0x8(%rsp),%rcx
mov    %rax,(%rcx)
mov    0x10(%rsp),%rax
mov    %rbx,(%rax)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { i32, i32 }
%struct.TYPE_6__ = type { i32 }
define void @get_sym_str_and_relp_32(%struct.TYPE_5__* %0, %struct.TYPE_6__* %1, i32** %2, i8** %3, i32** %4) {
%6 = alloca %struct.TYPE_5__*
%7 = alloca %struct.TYPE_6__*
%8 = alloca i32**
%9 = alloca i8**
%10 = alloca i32**
%11 = alloca %struct.TYPE_5__*
%12 = alloca i32
%13 = alloca %struct.TYPE_5__*
%14 = alloca %struct.TYPE_5__*
%15 = alloca i32*
store %struct.TYPE_5__* %0, %struct.TYPE_5__** %6
store %struct.TYPE_6__* %1, %struct.TYPE_6__** %7
store i32** %2, i32*** %8
store i8** %3, i8*** %9
store i32** %4, i32*** %10
%16 = load %struct.TYPE_6__*, %struct.TYPE_6__** %7
%17 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %16, i32 0, i32 0
%18 = load i32, i32* %17
%19 = call i32 @w(i32 %18)
%20 = load %struct.TYPE_6__*, %struct.TYPE_6__** %7
%21 = bitcast %struct.TYPE_6__* %20 to i8*
%22 = sext i32 %19 to i64
%23 = getelementptr i8, i8* %21, i64 %22
%24 = bitcast i8* %23 to %struct.TYPE_5__*
store %struct.TYPE_5__* %24, %struct.TYPE_5__** %11
%25 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%26 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %25, i32 0, i32 1
%27 = load i32, i32* %26
%28 = call i32 @w(i32 %27)
store i32 %28, i32* %12
%29 = load %struct.TYPE_5__*, %struct.TYPE_5__** %11
%30 = load i32, i32* %12
%31 = zext i32 %30 to i64
%32 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %29, i64 %31
store %struct.TYPE_5__* %32, %struct.TYPE_5__** %13
%33 = load %struct.TYPE_5__*, %struct.TYPE_5__** %11
%34 = load %struct.TYPE_5__*, %struct.TYPE_5__** %13
%35 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %34, i32 0, i32 1
%36 = load i32, i32* %35
%37 = call i32 @w(i32 %36)
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %33, i64 %38
store %struct.TYPE_5__* %39, %struct.TYPE_5__** %14
%40 = load %struct.TYPE_5__*, %struct.TYPE_5__** %6
%41 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %40, i32 0, i32 0
%42 = load i32, i32* %41
%43 = call i32 @w(i32 %42)
%44 = load %struct.TYPE_6__*, %struct.TYPE_6__** %7
%45 = bitcast %struct.TYPE_6__* %44 to i8*
%46 = sext i32 %43 to i64
%47 = getelementptr i8, i8* %45, i64 %46
%48 = bitcast i8* %47 to i32*
store i32* %48, i32** %15
%49 = load %struct.TYPE_5__*, %struct.TYPE_5__** %13
%50 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %49, i32 0, i32 0
%51 = load i32, i32* %50
%52 = call i32 @w(i32 %51)
%53 = load %struct.TYPE_6__*, %struct.TYPE_6__** %7
%54 = bitcast %struct.TYPE_6__* %53 to i8*
%55 = sext i32 %52 to i64
%56 = getelementptr i8, i8* %54, i64 %55
%57 = bitcast i8* %56 to i32*
%58 = load i32**, i32*** %8
store i32* %57, i32** %58
%59 = load %struct.TYPE_5__*, %struct.TYPE_5__** %14
%60 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %59, i32 0, i32 0
%61 = load i32, i32* %60
%62 = call i32 @w(i32 %61)
%63 = load %struct.TYPE_6__*, %struct.TYPE_6__** %7
%64 = bitcast %struct.TYPE_6__* %63 to i8*
%65 = sext i32 %62 to i64
%66 = getelementptr i8, i8* %64, i64 %65
%67 = load i8**, i8*** %9
store i8* %66, i8** %67
%68 = load i32*, i32** %15
%69 = load i32**, i32*** %10
store i32* %68, i32** %69
ret void
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i32, i32 }
%struct.TYPE_6__ = type { i32 }
define void @get_sym_str_and_relp_32(%struct.TYPE_5__* nocapture %0, %struct.TYPE_6__* %1, i32** nocapture writeonly %2, i8** nocapture writeonly %3, i32** nocapture writeonly %4) {
%6 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %1, i64 0, i32 0
%7 = load i32, i32* %6
%8 = tail call i32 @w(i32 %7)
%9 = bitcast %struct.TYPE_6__* %1 to i8*
%10 = sext i32 %8 to i64
%11 = getelementptr i8, i8* %9, i64 %10
%12 = bitcast i8* %11 to %struct.TYPE_5__*
%13 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %0, i64 0, i32 1
%14 = load i32, i32* %13
%15 = tail call i32 @w(i32 %14)
%16 = zext i32 %15 to i64
%17 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %12, i64 %16, i32 1
%18 = load i32, i32* %17
%19 = tail call i32 @w(i32 %18)
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %0, i64 0, i32 0
%22 = load i32, i32* %21
%23 = tail call i32 @w(i32 %22)
%24 = sext i32 %23 to i64
%25 = getelementptr i8, i8* %9, i64 %24
%26 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %12, i64 %16, i32 0
%27 = load i32, i32* %26
%28 = tail call i32 @w(i32 %27)
%29 = sext i32 %28 to i64
%30 = getelementptr i8, i8* %9, i64 %29
%31 = bitcast i32** %2 to i8**
store i8* %30, i8** %31
%32 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %12, i64 %20, i32 0
%33 = load i32, i32* %32
%34 = tail call i32 @w(i32 %33)
%35 = sext i32 %34 to i64
%36 = getelementptr i8, i8* %9, i64 %35
store i8* %36, i8** %3
%37 = bitcast i32** %4 to i8**
store i8* %25, i8** %37
ret void
}