#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__ Elf32_Shdr;

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


x86 assembly (clang, -O0):
<has32_rel_mcount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    0x2ea1(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1040 <w@plt>
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
je     1197 <has32_rel_mcount+0x77>
mov    0x2e80(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1040 <w@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
cmp    %rcx,%rax
je     1197 <has32_rel_mcount+0x77>
movq   $0x0,-0x8(%rbp)
jmp    11b0 <has32_rel_mcount+0x90>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1030 <__has32_rel_mcount@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<has32_rel_mcount>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
mov    0x2ea4(%rip),%rax
mov    (%rax),%r13
mov    (%rdi),%edi
call   1040 <w@plt>
cmp    %rax,%r13
je     1161 <has32_rel_mcount+0x41>
mov    0x2e96(%rip),%rax
mov    (%rax),%r13
mov    (%rbx),%edi
call   1040 <w@plt>
cmp    %rax,%r13
jne    117b <has32_rel_mcount+0x5b>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <__has32_rel_mcount@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
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* @has32_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 i64, i64* @SHT_REL
%11 = load %struct.TYPE_6__*, %struct.TYPE_6__** %6
%12 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %11, i32 0, i32 0
%13 = load i32, i32* %12
%14 = call i64 @w(i32 %13)
%15 = icmp ne i64 %10, %14
br i1 %15, label %16, label %24
16: ; preds = %4
%17 = load i64, i64* @SHT_RELA
%18 = load %struct.TYPE_6__*, %struct.TYPE_6__** %6
%19 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %18, i32 0, i32 0
%20 = load i32, i32* %19
%21 = call i64 @w(i32 %20)
%22 = icmp ne i64 %17, %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* @__has32_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* @has32_rel_mcount(%struct.TYPE_6__* %0, %struct.TYPE_6__* %1, i8* %2, i8* %3) {
%5 = load i64, i64* @SHT_REL
%6 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %0, i64 0, i32 0
%7 = load i32, i32* %6
%8 = tail call i64 @w(i32 %7)
%9 = icmp eq i64 %5, %8
br i1 %9, label %15, label %10
10: ; preds = %4
%11 = load i64, i64* @SHT_RELA
%12 = load i32, i32* %6
%13 = tail call i64 @w(i32 %12)
%14 = icmp eq i64 %11, %13
br i1 %14, label %15, label %17
15: ; preds = %10, %4
%16 = tail call i8* @__has32_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
}