#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 uint64_t;
typedef size_t ssize_t;

/* Variables and functions */
int const checksum_marker(int const *);
ssize_t find_marker_v1(const void *src, size_t len) {
  size_t i = len & ~(size_t)(((8) * (int)sizeof(uint64_t)) - 1);
  const uint64_t *p = src;
  p += i / sizeof(uint64_t);
  while (i > 0) {
    i -= ((8) * (int)sizeof(uint64_t));
    p -= (8);
    if (((p[0] == 0xc56a5d888149eee7ULL && p[1] == 0x4139ef05dda34f80ULL) ||
         (p[0] == 0xe7ee4981885d6ac5ULL && p[1] == 0x804fa3dd05ef3941ULL)) &&
        p[7] == checksum_marker(p))
      return i;
  }
  return -1;
}


x86 assembly (clang, -O0):
<find_marker_v1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
and    $0xffffffffffffffe0,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
shr    $0x2,%rax
shl    $0x2,%rax
add    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x20(%rbp)
jbe    1207 <find_marker_v1+0xf7>
mov    -0x20(%rbp),%rax
sub    $0x20,%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
add    $0xffffffffffffffe0,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movslq (%rax),%rax
movabs $0xc56a5d888149eee7,%rcx
5d 6a c5
cmp    %rcx,%rax
jne    11a0 <find_marker_v1+0x90>
mov    -0x28(%rbp),%rax
movslq 0x4(%rax),%rax
movabs $0x4139ef05dda34f80,%rcx
ef 39 41
cmp    %rcx,%rax
je     11d5 <find_marker_v1+0xc5>
mov    -0x28(%rbp),%rax
movslq (%rax),%rax
movabs $0xe7ee4981885d6ac5,%rcx
49 ee e7
cmp    %rcx,%rax
jne    1202 <find_marker_v1+0xf2>
mov    -0x28(%rbp),%rax
movslq 0x4(%rax),%rax
movabs $0x804fa3dd05ef3941,%rcx
a3 4f 80
cmp    %rcx,%rax
jne    1202 <find_marker_v1+0xf2>
mov    -0x28(%rbp),%rax
mov    0x1c(%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <checksum_marker@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
cmp    %ecx,%eax
jne    1202 <find_marker_v1+0xf2>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    120f <find_marker_v1+0xff>
jmp    1148 <find_marker_v1+0x38>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_marker_v1>:
mov    $0xffffffffffffffff,%rax
ret

LLVM IR (-O0):
define i64 @find_marker_v1(i8* %0, i64 %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32*
store i8* %0, i8** %4
store i64 %1, i64* %5
%8 = load i64, i64* %5
%9 = and i64 %8, -32
store i64 %9, i64* %6
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i32*
store i32* %11, i32** %7
%12 = load i64, i64* %6
%13 = udiv i64 %12, 4
%14 = load i32*, i32** %7
%15 = getelementptr inbounds i32, i32* %14, i64 %13
store i32* %15, i32** %7
br label %16
16: ; preds = %56, %2
%17 = load i64, i64* %6
%18 = icmp ugt i64 %17, 0
br i1 %18, label %19, label %57
19: ; preds = %16
%20 = load i64, i64* %6
%21 = sub i64 %20, 32
store i64 %21, i64* %6
%22 = load i32*, i32** %7
%23 = getelementptr inbounds i32, i32* %22, i64 -8
store i32* %23, i32** %7
%24 = load i32*, i32** %7
%25 = getelementptr inbounds i32, i32* %24, i64 0
%26 = load i32, i32* %25
%27 = sext i32 %26 to i64
%28 = icmp eq i64 %27, -4221458859840377113
br i1 %28, label %29, label %35
29: ; preds = %19
%30 = load i32*, i32** %7
%31 = getelementptr inbounds i32, i32* %30, i64 1
%32 = load i32, i32* %31
%33 = sext i32 %32 to i64
%34 = icmp eq i64 %33, 4700050494610165632
br i1 %34, label %47, label %35
35: ; preds = %29, %19
%36 = load i32*, i32** %7
%37 = getelementptr inbounds i32, i32* %36, i64 0
%38 = load i32, i32* %37
%39 = sext i32 %38 to i64
%40 = icmp eq i64 %39, -1734367985803629883
br i1 %40, label %41, label %56
41: ; preds = %35
%42 = load i32*, i32** %7
%43 = getelementptr inbounds i32, i32* %42, i64 1
%44 = load i32, i32* %43
%45 = sext i32 %44 to i64
%46 = icmp eq i64 %45, -9200955344011970239
br i1 %46, label %47, label %56
47: ; preds = %41, %29
%48 = load i32*, i32** %7
%49 = getelementptr inbounds i32, i32* %48, i64 7
%50 = load i32, i32* %49
%51 = load i32*, i32** %7
%52 = call i32 @checksum_marker(i32* %51)
%53 = icmp eq i32 %50, %52
br i1 %53, label %54, label %56
54: ; preds = %47
%55 = load i64, i64* %6
store i64 %55, i64* %3
br label %58
56: ; preds = %47, %41, %35
br label %16
57: ; preds = %16
store i64 -1, i64* %3
br label %58
58: ; preds = %57, %54
%59 = load i64, i64* %3
ret i64 %59
}

LLVM IR (-O2):
define i64 @find_marker_v1(i8* nocapture readnone %0, i64 %1) {
ret i64 -1
}