#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_1__;

/* Type definitions */
struct TYPE_6__ {
  int /*<<< orphan*/ sh_type;
};
typedef TYPE_1__ Elf64_Shdr;

/* Variables and functions */
scalar_t__ SHT_REL;
scalar_t__ SHT_RELA;
char const *__has64_rel_mcount(TYPE_1__ const *const, TYPE_1__ const *const,
                               char const *const, char const *const);
scalar_t__ w(int /*<<< orphan*/);
char const *has64_rel_mcount(Elf64_Shdr const *const relhdr,
                             Elf64_Shdr const *const shdr0,
                             char const *const shstrtab,
                             char const *const fname) {
  if (w(relhdr->sh_type) != SHT_REL && w(relhdr->sh_type) != SHT_RELA) {
    return NULL;
  }
  return __has64_rel_mcount(relhdr, shdr0, shstrtab, fname);
}


x86 assembly (clang, -O0):
<has64_rel_mcount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1040 <w@plt>
mov    0x2e96(%rip),%rcx
cmp    (%rcx),%rax
je     117b <has64_rel_mcount+0x5b>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1040 <w@plt>
mov    0x2e83(%rip),%rcx
cmp    (%rcx),%rax
je     117b <has64_rel_mcount+0x5b>
movq   $0x0,-0x8(%rbp)
jmp    1194 <has64_rel_mcount+0x74>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1030 <__has64_rel_mcount@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<has64_rel_mcount>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
mov    (%rdi),%edi
call   1040 <w@plt>
mov    0x2e9e(%rip),%rcx
cmp    (%rcx),%rax
je     115a <has64_rel_mcount+0x3a>
mov    (%rbx),%edi
call   1040 <w@plt>
mov    0x2e93(%rip),%rcx
cmp    (%rcx),%rax
jne    1176 <has64_rel_mcount+0x56>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <__has64_rel_mcount@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.TYPE_6__ = type { i32 }
@SHT_REL = global i64 0
@SHT_RELA = global i64 0
define i8* @has64_rel_mcount(%struct.TYPE_6__* %0, %struct.TYPE_6__* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca %struct.TYPE_6__*
%7 = alloca %struct.TYPE_6__*
%8 = alloca i8*
%9 = alloca i8*
store %struct.TYPE_6__* %0, %struct.TYPE_6__** %6
store %struct.TYPE_6__* %1, %struct.TYPE_6__** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
%10 = load %struct.TYPE_6__*, %struct.TYPE_6__** %6
%11 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %10, i32 0, i32 0
%12 = load i32, i32* %11
%13 = call i64 @w(i32 %12)
%14 = load i64, i64* @SHT_REL
%15 = icmp ne i64 %13, %14
br i1 %15, label %16, label %24
16: ; preds = %4
%17 = load %struct.TYPE_6__*, %struct.TYPE_6__** %6
%18 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %17, i32 0, i32 0
%19 = load i32, i32* %18
%20 = call i64 @w(i32 %19)
%21 = load i64, i64* @SHT_RELA
%22 = icmp ne i64 %20, %21
br i1 %22, label %23, label %24
23: ; preds = %16
store i8* null, i8** %5
br label %30
24: ; preds = %16, %4
%25 = load %struct.TYPE_6__*, %struct.TYPE_6__** %6
%26 = load %struct.TYPE_6__*, %struct.TYPE_6__** %7
%27 = load i8*, i8** %8
%28 = load i8*, i8** %9
%29 = call i8* @__has64_rel_mcount(%struct.TYPE_6__* %25, %struct.TYPE_6__* %26, i8* %27, i8* %28)
store i8* %29, i8** %5
br label %30
30: ; preds = %24, %23
%31 = load i8*, i8** %5
ret i8* %31
}

LLVM IR (-O2):
%struct.TYPE_6__ = type { i32 }
@SHT_REL = global i64 0
@SHT_RELA = global i64 0
define i8* @has64_rel_mcount(%struct.TYPE_6__* %0, %struct.TYPE_6__* %1, i8* %2, i8* %3) {
%5 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %0, i64 0, i32 0
%6 = load i32, i32* %5
%7 = tail call i64 @w(i32 %6)
%8 = load i64, i64* @SHT_REL
%9 = icmp eq i64 %7, %8
br i1 %9, label %15, label %10
10: ; preds = %4
%11 = load i32, i32* %5
%12 = tail call i64 @w(i32 %11)
%13 = load i64, i64* @SHT_RELA
%14 = icmp eq i64 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %10, %4
%16 = tail call i8* @__has64_rel_mcount(%struct.TYPE_6__* %0, %struct.TYPE_6__* %1, i8* %2, i8* %3)
br label %17
17: ; preds = %10, %15
%18 = phi i8* [ %16, %15 ], [ null, %10 ]
ret i8* %18
}