#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_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int e_machine;
  scalar_t__ *e_ident;
};
typedef TYPE_1__ Elf64_Ehdr;

/* Variables and functions */
size_t EI_CLASS;
scalar_t__ ELFCLASS64;
int EM_S390;
int elf_machine_matches_host(const Elf64_Ehdr *ehdr) {
  return (ehdr->e_machine == EM_S390 || ehdr->e_machine == 0xA390) &&
         ehdr->e_ident[EI_CLASS] == ELFCLASS64;
}


x86 assembly (clang, -O0):
<elf_machine_matches_host>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    0x2ed3(%rip),%rcx
cmp    (%rcx),%eax
je     1132 <elf_machine_matches_host+0x32>
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmpl   $0xa390,(%rcx)
mov    %al,-0x9(%rbp)
jne    1158 <elf_machine_matches_host+0x58>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    0x2e8f(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    0x2e91(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<elf_machine_matches_host>:
mov    (%rdi),%ecx
cmp    $0xa390,%ecx
je     1118 <elf_machine_matches_host+0x18>
mov    0x2ed7(%rip),%rdx
xor    %eax,%eax
cmp    (%rdx),%ecx
je     1118 <elf_machine_matches_host+0x18>
ret
mov    0x8(%rdi),%rax
mov    0x2ead(%rip),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rcx
mov    0x2eaf(%rip),%rdx
xor    %eax,%eax
cmp    (%rdx),%rcx
sete   %al
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i64* }
@EM_S390 = global i32 0
@EI_CLASS = global i64 0
@ELFCLASS64 = global i64 0
define i32 @elf_machine_matches_host(%struct.TYPE_3__* %0) {
%2 = alloca %struct.TYPE_3__*
store %struct.TYPE_3__* %0, %struct.TYPE_3__** %2
%3 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%4 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %3, i32 0, i32 0
%5 = load i32, i32* %4
%6 = load i32, i32* @EM_S390
%7 = icmp eq i32 %5, %6
br i1 %7, label %13, label %8
8: ; preds = %1
%9 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%10 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %9, i32 0, i32 0
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 41872
br i1 %12, label %13, label %22
13: ; preds = %8, %1
%14 = load %struct.TYPE_3__*, %struct.TYPE_3__** %2
%15 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %14, i32 0, i32 1
%16 = load i64*, i64** %15
%17 = load i64, i64* @EI_CLASS
%18 = getelementptr inbounds i64, i64* %16, i64 %17
%19 = load i64, i64* %18
%20 = load i64, i64* @ELFCLASS64
%21 = icmp eq i64 %19, %20
br label %22
22: ; preds = %13, %8
%23 = phi i1 [ false, %8 ], [ %21, %13 ]
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
%struct.TYPE_3__ = type { i32, i64* }
@EM_S390 = global i32 0
@EI_CLASS = global i64 0
@ELFCLASS64 = global i64 0
define i32 @elf_machine_matches_host(%struct.TYPE_3__* nocapture %0) {
%2 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = load i32, i32* @EM_S390
%5 = icmp eq i32 %3, %4
%6 = icmp eq i32 %3, 41872
%7 = or i1 %6, %5
br i1 %7, label %8, label %17
8: ; preds = %1
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %0, i64 0, i32 1
%10 = load i64*, i64** %9
%11 = load i64, i64* @EI_CLASS
%12 = getelementptr inbounds i64, i64* %10, i64 %11
%13 = load i64, i64* %12
%14 = load i64, i64* @ELFCLASS64
%15 = icmp eq i64 %13, %14
%16 = zext i1 %15 to i32
br label %17
17: ; preds = %1, %8
%18 = phi i32 [ %16, %8 ], [ 0, %1 ]
ret i32 %18
}