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

/* Variables and functions */
int host_is_big_endian();
int /*<<< orphan*/ memcpy(int *, char *, int);
int ntohl(int);
int ecryptfs_contains_ecryptfs_marker(char *data) {
  uint32_t m_1, m_2;
  int big_endian;
  big_endian = host_is_big_endian();
  memcpy(&m_1, data, 4);
  if (!big_endian)
    m_1 = ntohl(m_1);
  memcpy(&m_2, (data + 4), 4);
  if (!big_endian)
    m_2 = ntohl(m_2);
  if ((m_1 ^ 0x3c81b7f5) == m_2)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<ecryptfs_contains_ecryptfs_marker>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <host_is_big_endian@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
cmpl   $0x0,-0x1c(%rbp)
jne    116d <ecryptfs_contains_ecryptfs_marker+0x3d>
mov    -0x14(%rbp),%edi
call   1050 <ntohl@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
add    $0x4,%rsi
lea    -0x18(%rbp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
cmpl   $0x0,-0x1c(%rbp)
jne    1198 <ecryptfs_contains_ecryptfs_marker+0x68>
mov    -0x18(%rbp),%edi
call   1050 <ntohl@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
xor    $0x3c81b7f5,%eax
cmp    -0x18(%rbp),%eax
jne    11b5 <ecryptfs_contains_ecryptfs_marker+0x85>
movl   $0x1,-0x4(%rbp)
jmp    11bc <ecryptfs_contains_ecryptfs_marker+0x8c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ecryptfs_contains_ecryptfs_marker>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <host_is_big_endian@plt>
mov    %eax,%ebp
lea    0x4(%rsp),%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
test   %ebp,%ebp
je     116e <ecryptfs_contains_ecryptfs_marker+0x3e>
add    $0x4,%rbx
mov    %rsp,%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    (%rsp),%eax
jmp    1197 <ecryptfs_contains_ecryptfs_marker+0x67>
mov    0x4(%rsp),%edi
call   1050 <ntohl@plt>
mov    %eax,0x4(%rsp)
add    $0x4,%rbx
mov    %rsp,%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    (%rsp),%edi
call   1050 <ntohl@plt>
mov    $0x3c81b7f5,%edx
xor    0x4(%rsp),%edx
xor    %ecx,%ecx
cmp    %eax,%edx
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ecryptfs_contains_ecryptfs_marker(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
%7 = call i32 (...) @host_is_big_endian()
store i32 %7, i32* %6
%8 = load i8*, i8** %3
%9 = call i32 @memcpy(i32* %4, i8* %8, i32 4)
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %1
%13 = load i32, i32* %4
%14 = call i32 @ntohl(i32 %13)
store i32 %14, i32* %4
br label %15
15: ; preds = %12, %1
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 4
%18 = call i32 @memcpy(i32* %5, i8* %17, i32 4)
%19 = load i32, i32* %6
%20 = icmp ne i32 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %15
%22 = load i32, i32* %5
%23 = call i32 @ntohl(i32 %22)
store i32 %23, i32* %5
br label %24
24: ; preds = %21, %15
%25 = load i32, i32* %4
%26 = xor i32 %25, 1015134197
%27 = load i32, i32* %5
%28 = icmp eq i32 %26, %27
br i1 %28, label %29, label %30
29: ; preds = %24
store i32 1, i32* %2
br label %31
30: ; preds = %24
store i32 0, i32* %2
br label %31
31: ; preds = %30, %29
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
define i32 @ecryptfs_contains_ecryptfs_marker(i8* %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
%6 = tail call i32 (...) @host_is_big_endian()
%7 = call i32 @memcpy(i32* %2, i8* %0, i32 4)
%8 = icmp eq i32 %6, 0
br i1 %8, label %9, label %16
9: ; preds = %1
%10 = load i32, i32* %2
%11 = call i32 @ntohl(i32 %10)
store i32 %11, i32* %2
%12 = getelementptr inbounds i8, i8* %0, i64 4
%13 = call i32 @memcpy(i32* %3, i8* %12, i32 4)
%14 = load i32, i32* %3
%15 = call i32 @ntohl(i32 %14)
br label %20
16: ; preds = %1
%17 = getelementptr inbounds i8, i8* %0, i64 4
%18 = call i32 @memcpy(i32* %3, i8* %17, i32 4)
%19 = load i32, i32* %3
br label %20
20: ; preds = %16, %9
%21 = phi i32 [ %19, %16 ], [ %15, %9 ]
%22 = load i32, i32* %2
%23 = xor i32 %22, 1015134197
%24 = icmp eq i32 %23, %21
%25 = zext i1 %24 to i32
ret i32 %25
}