#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 /*<<< orphan*/ uint8_t;
typedef int uint64_t;
typedef int uint32_t;
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int _mm_extract_epi32(int /*<<< orphan*/, int);
int /*<<< orphan*/ _mm_loadu_si128(int /*<<< orphan*/ *);
int _mm_movemask_epi8(int /*<<< orphan*/);
int /*<<< orphan*/ _mm_set1_epi32(int);
int masked_vbyte_search_group_delta(int /*<<< orphan*/ const *, int *, int,
                                    int *, int /*<<< orphan*/ *, int, int,
                                    int *);
scalar_t__ read_int_delta(int /*<<< orphan*/ const *, int *, int *);
int masked_vbyte_search_delta(const uint8_t *in, uint64_t length, uint32_t prev,
                              uint32_t key, uint32_t *presult) {
  size_t consumed = 0;
  __m128i mprev = _mm_set1_epi32(prev);
  uint64_t count = 0;
  uint64_t sig = 0;
  int availablebytes = 0;
  if (96 < length) {
    size_t scanned = 0;
    __m128i low1 = _mm_loadu_si128((__m128i *)(in + scanned));
    uint32_t lowSig1 = _mm_movemask_epi8(low1);
    __m128i low2 = _mm_loadu_si128((__m128i *)(in + scanned + 16));
    uint32_t lowSig2 = _mm_movemask_epi8(low2);
    uint32_t lowSig = lowSig2 << 16;
    lowSig |= lowSig1;
    __m128i high = _mm_loadu_si128((__m128i *)(in + scanned + 32));
    uint32_t highSig = _mm_movemask_epi8(high);
    uint64_t nextSig = highSig;
    nextSig <<= 32;
    nextSig |= lowSig;
    scanned += 48;
    while (count + 96 < length) {
      uint64_t thisSig = nextSig;
      low1 = _mm_loadu_si128((__m128i *)(in + scanned));
      lowSig1 = _mm_movemask_epi8(low1);
      low2 = _mm_loadu_si128((__m128i *)(in + scanned + 16));
      lowSig2 = _mm_movemask_epi8(low2);
      lowSig = lowSig2 << 16;
      lowSig |= lowSig1;
      high = _mm_loadu_si128((__m128i *)(in + scanned + 32));
      highSig = _mm_movemask_epi8(high);
      nextSig = highSig;
      nextSig <<= 32;
      nextSig |= lowSig;
      uint64_t remaining = scanned - (consumed + 48);
      sig = (thisSig << remaining) | sig;
      uint64_t reload = scanned - 16;
      scanned += 48;
      while (consumed < reload) {
        uint64_t ints_read = 0, bytes = 0;
        int ret = masked_vbyte_search_group_delta(in + consumed, &bytes, sig,
                                                  &ints_read, &mprev, count,
                                                  key, presult);
        if (ret >= 0)
          return (ret);
        sig >>= bytes;
        if (sig == 0xFFFFFFFFFFFFFFFF)
          return 0;
        consumed += bytes;
        count += ints_read;
      }
    }
    sig = (nextSig << (scanned - consumed - 48)) | sig;
    availablebytes = scanned - consumed;
  }
  while (availablebytes + count < length) {
    if (availablebytes < 16)
      break;
    uint64_t ints_read = 0, bytes = 0;
    int ret = masked_vbyte_search_group_delta(
        in + consumed, &bytes, sig, &ints_read, &mprev, count, key, presult);
    if (ret >= 0)
      return (ret);
    consumed += bytes;
    availablebytes -= bytes;
    sig >>= bytes;
    count += ints_read;
  }
  prev = _mm_extract_epi32(mprev, 3);
  for (; count < length; count++) {
    uint32_t out;
    consumed += read_int_delta(in + consumed, &out, &prev);
    if (key <= prev) {
      *presult = prev;
      return (count);
    }
  }
  *presult = key + 1;
  return length;
}


x86 assembly (clang, -O0):
<masked_vbyte_search_delta>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
mov    -0x18(%rbp),%edi
call   1060 <_mm_set1_epi32@plt>
mov    %eax,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
mov    $0x60,%eax
cmp    -0x14(%rbp),%eax
jge    1425 <masked_vbyte_search_delta+0x2c5>
movq   $0x0,-0x48(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x48(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1070 <_mm_loadu_si128@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%edi
call   1080 <_mm_movemask_epi8@plt>
mov    %eax,-0x50(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x48(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
add    $0x40,%rdi
call   1070 <_mm_loadu_si128@plt>
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%edi
call   1080 <_mm_movemask_epi8@plt>
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
shl    $0x10,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x50(%rbp),%eax
or     -0x5c(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x48(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
add    $0x80,%rdi
call   1070 <_mm_loadu_si128@plt>
mov    %eax,-0x60(%rbp)
mov    -0x60(%rbp),%edi
call   1080 <_mm_movemask_epi8@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x68(%rbp),%eax
mov    $0x20,%ecx
shl    %cl,%eax
mov    %eax,-0x68(%rbp)
mov    -0x5c(%rbp),%eax
or     -0x68(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x48(%rbp),%rax
add    $0x30,%rax
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%eax
add    $0x60,%eax
cmp    -0x14(%rbp),%eax
jge    1403 <masked_vbyte_search_delta+0x2a3>
mov    -0x68(%rbp),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x48(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
call   1070 <_mm_loadu_si128@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%edi
call   1080 <_mm_movemask_epi8@plt>
mov    %eax,-0x50(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x48(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
add    $0x40,%rdi
call   1070 <_mm_loadu_si128@plt>
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%edi
call   1080 <_mm_movemask_epi8@plt>
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
shl    $0x10,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x50(%rbp),%eax
or     -0x5c(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x48(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
add    $0x80,%rdi
call   1070 <_mm_loadu_si128@plt>
mov    %eax,-0x60(%rbp)
mov    -0x60(%rbp),%edi
call   1080 <_mm_movemask_epi8@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x68(%rbp),%eax
mov    $0x20,%ecx
shl    %cl,%eax
mov    %eax,-0x68(%rbp)
mov    -0x5c(%rbp),%eax
or     -0x68(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x48(%rbp),%rax
mov    -0x30(%rbp),%rcx
add    $0x30,%rcx
sub    %rcx,%rax
mov    %eax,-0x70(%rbp)
mov    -0x6c(%rbp),%eax
mov    -0x70(%rbp),%ecx
shl    %cl,%eax
or     -0x3c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x48(%rbp),%rax
sub    $0x10,%rax
mov    %eax,-0x74(%rbp)
mov    -0x48(%rbp),%rax
add    $0x30,%rax
mov    %rax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x74(%rbp),%rcx
cmp    %rcx,%rax
jae    13fe <masked_vbyte_search_delta+0x29e>
movl   $0x0,-0x78(%rbp)
movl   $0x0,-0x7c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x3c(%rbp),%edx
mov    -0x38(%rbp),%r9d
mov    -0x1c(%rbp),%r10d
mov    -0x28(%rbp),%rax
lea    -0x7c(%rbp),%rsi
lea    -0x78(%rbp),%rcx
lea    -0x34(%rbp),%r8
mov    %r10d,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <masked_vbyte_search_group_delta@plt>
mov    %eax,-0x80(%rbp)
cmpl   $0x0,-0x80(%rbp)
jl     13bf <masked_vbyte_search_delta+0x25f>
mov    -0x80(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    157f <masked_vbyte_search_delta+0x41f>
mov    -0x7c(%rbp),%ecx
mov    -0x3c(%rbp),%eax
sar    %cl,%eax
mov    %eax,-0x3c(%rbp)
movslq -0x3c(%rbp),%rax
cmp    $0xffffffffffffffff,%rax
jne    13e4 <masked_vbyte_search_delta+0x284>
movl   $0x0,-0x4(%rbp)
jmp    157f <masked_vbyte_search_delta+0x41f>
movslq -0x7c(%rbp),%rax
add    -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x78(%rbp),%eax
add    -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
jmp    1350 <masked_vbyte_search_delta+0x1f0>
jmp    1265 <masked_vbyte_search_delta+0x105>
mov    -0x68(%rbp),%eax
mov    -0x48(%rbp),%rcx
sub    -0x30(%rbp),%rcx
sub    $0x30,%rcx
shl    %cl,%eax
or     -0x3c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x48(%rbp),%rax
sub    -0x30(%rbp),%rax
mov    %eax,-0x40(%rbp)
jmp    142a <masked_vbyte_search_delta+0x2ca>
mov    -0x40(%rbp),%eax
add    -0x38(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    14f7 <masked_vbyte_search_delta+0x397>
cmpl   $0x10,-0x40(%rbp)
jge    1448 <masked_vbyte_search_delta+0x2e8>
jmp    14f7 <masked_vbyte_search_delta+0x397>
movl   $0x0,-0x84(%rbp)
movl   $0x0,-0x88(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0x3c(%rbp),%edx
mov    -0x38(%rbp),%r9d
mov    -0x1c(%rbp),%r10d
mov    -0x28(%rbp),%rax
lea    -0x88(%rbp),%rsi
lea    -0x84(%rbp),%rcx
lea    -0x34(%rbp),%r8
mov    %r10d,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <masked_vbyte_search_group_delta@plt>
mov    %eax,-0x8c(%rbp)
cmpl   $0x0,-0x8c(%rbp)
jl     14bb <masked_vbyte_search_delta+0x35b>
mov    -0x8c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    157f <masked_vbyte_search_delta+0x41f>
movslq -0x88(%rbp),%rax
add    -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x88(%rbp),%ecx
mov    -0x40(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x40(%rbp)
mov    -0x88(%rbp),%ecx
mov    -0x3c(%rbp),%eax
sar    %cl,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x84(%rbp),%eax
add    -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
jmp    142a <masked_vbyte_search_delta+0x2ca>
mov    -0x34(%rbp),%edi
mov    $0x3,%esi
call   1030 <_mm_extract_epi32@plt>
mov    %eax,-0x18(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    156d <masked_vbyte_search_delta+0x40d>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdi
lea    -0x90(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1050 <read_int_delta@plt>
add    -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     155a <masked_vbyte_search_delta+0x3fa>
mov    -0x18(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x38(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    157f <masked_vbyte_search_delta+0x41f>
jmp    155f <masked_vbyte_search_delta+0x3ff>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1507 <masked_vbyte_search_delta+0x3a7>
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<masked_vbyte_search_delta>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,0x20(%rsp)
mov    %ecx,%r12d
mov    %esi,%ebp
mov    %esi,0x10(%rsp)
mov    %rdi,%rbx
mov    %edx,%edi
call   1060 <_mm_set1_epi32@plt>
mov    %eax,0x18(%rsp)
cmp    $0x61,%ebp
jl     128e <masked_vbyte_search_delta+0x12e>
mov    %rbx,%rdi
call   1070 <_mm_loadu_si128@plt>
mov    %eax,%edi
call   1080 <_mm_movemask_epi8@plt>
lea    0x40(%rbx),%rdi
call   1070 <_mm_loadu_si128@plt>
mov    %eax,%edi
call   1080 <_mm_movemask_epi8@plt>
lea    0x80(%rbx),%rdi
call   1070 <_mm_loadu_si128@plt>
mov    %eax,%edi
call   1080 <_mm_movemask_epi8@plt>
mov    $0x30,%r14d
xor    %r13d,%r13d
xor    %ebp,%ebp
jmp    11f3 <masked_vbyte_search_delta+0x93>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x30,%r14
lea    0x60(%rbp),%eax
mov    0x10(%rsp),%ecx
cmp    %ecx,%eax
jge    130e <masked_vbyte_search_delta+0x1ae>
lea    (%rbx,%r14,4),%rdi
call   1070 <_mm_loadu_si128@plt>
mov    %eax,%edi
call   1080 <_mm_movemask_epi8@plt>
lea    (%rbx,%r14,4),%rdi
add    $0x40,%rdi
call   1070 <_mm_loadu_si128@plt>
mov    %eax,%edi
call   1080 <_mm_movemask_epi8@plt>
lea    (%rbx,%r14,4),%rdi
add    $0x80,%rdi
call   1070 <_mm_loadu_si128@plt>
mov    %eax,%edi
call   1080 <_mm_movemask_epi8@plt>
lea    -0x10(%r14),%eax
movslq %eax,%r15
cs nopw 0x0(%rax,%rax,1)
nop
cmp    %r15,%r13
jae    11e0 <masked_vbyte_search_delta+0x80>
movl   $0x0,0xc(%rsp)
movl   $0x0,0x14(%rsp)
lea    (%rbx,%r13,4),%rdi
lea    0x14(%rsp),%rsi
xor    %edx,%edx
lea    0xc(%rsp),%rcx
lea    0x18(%rsp),%r8
mov    %ebp,%r9d
push   0x20(%rsp)
push   %r12
call   1040 <masked_vbyte_search_group_delta@plt>
add    $0x10,%rsp
test   %eax,%eax
jns    12ff <masked_vbyte_search_delta+0x19f>
movslq 0x14(%rsp),%rax
add    %rax,%r13
add    0xc(%rsp),%ebp
jmp    1240 <masked_vbyte_search_delta+0xe0>
xor    %ebp,%ebp
xor    %r13d,%r13d
mov    0x18(%rsp),%edi
mov    $0x3,%esi
call   1030 <_mm_extract_epi32@plt>
mov    %eax,0x1c(%rsp)
cmp    0x10(%rsp),%ebp
jge    12e4 <masked_vbyte_search_delta+0x184>
lea    0xc(%rsp),%r14
lea    0x1c(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nop
lea    (%rbx,%r13,4),%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <read_int_delta@plt>
mov    0x1c(%rsp),%ecx
cmp    %r12d,%ecx
jge    12f6 <masked_vbyte_search_delta+0x196>
add    %rax,%r13
add    $0x1,%ebp
cmp    %ebp,0x10(%rsp)
jne    12c0 <masked_vbyte_search_delta+0x160>
add    $0x1,%r12d
mov    0x20(%rsp),%rax
mov    %r12d,(%rax)
mov    0x10(%rsp),%eax
jmp    12ff <masked_vbyte_search_delta+0x19f>
mov    0x20(%rsp),%rax
mov    %ecx,(%rax)
mov    %ebp,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
sub    %r13d,%r14d
cmp    $0x10,%r14d
jl     1293 <masked_vbyte_search_delta+0x133>
lea    (%r14,%rbp,1),%eax
cmp    %ecx,%eax
jge    1293 <masked_vbyte_search_delta+0x133>
lea    0x18(%rsp),%r15
nopl   0x0(%rax)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x14(%rsp)
lea    (%rbx,%r13,4),%rdi
lea    0x14(%rsp),%rsi
xor    %edx,%edx
lea    0xc(%rsp),%rcx
mov    %r15,%r8
mov    %ebp,%r9d
push   0x20(%rsp)
push   %r12
call   1040 <masked_vbyte_search_group_delta@plt>
add    $0x10,%rsp
test   %eax,%eax
jns    12ff <masked_vbyte_search_delta+0x19f>
movslq 0x14(%rsp),%rax
add    %rax,%r13
sub    %eax,%r14d
add    0xc(%rsp),%ebp
cmp    $0x10,%r14d
jl     1293 <masked_vbyte_search_delta+0x133>
lea    (%r14,%rbp,1),%eax
cmp    0x10(%rsp),%eax
jl     1330 <masked_vbyte_search_delta+0x1d0>
jmp    1293 <masked_vbyte_search_delta+0x133>

LLVM IR (-O0):
define i32 @masked_vbyte_search_delta(i32* %0, i32 %1, i32 %2, i32 %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32*
%12 = alloca i64
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i64
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca i32
%35 = alloca i32
store i32* %0, i32** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32* %4, i32** %11
store i64 0, i64* %12
%36 = load i32, i32* %9
%37 = call i32 @_mm_set1_epi32(i32 %36)
store i32 %37, i32* %13
store i32 0, i32* %14
store i32 0, i32* %15
store i32 0, i32* %16
%38 = load i32, i32* %8
%39 = icmp slt i32 96, %38
br i1 %39, label %40, label %176
40: ; preds = %5
store i64 0, i64* %17
%41 = load i32*, i32** %7
%42 = load i64, i64* %17
%43 = getelementptr inbounds i32, i32* %41, i64 %42
%44 = call i32 @_mm_loadu_si128(i32* %43)
store i32 %44, i32* %18
%45 = load i32, i32* %18
%46 = call i32 @_mm_movemask_epi8(i32 %45)
store i32 %46, i32* %19
%47 = load i32*, i32** %7
%48 = load i64, i64* %17
%49 = getelementptr inbounds i32, i32* %47, i64 %48
%50 = getelementptr inbounds i32, i32* %49, i64 16
%51 = call i32 @_mm_loadu_si128(i32* %50)
store i32 %51, i32* %20
%52 = load i32, i32* %20
%53 = call i32 @_mm_movemask_epi8(i32 %52)
store i32 %53, i32* %21
%54 = load i32, i32* %21
%55 = shl i32 %54, 16
store i32 %55, i32* %22
%56 = load i32, i32* %19
%57 = load i32, i32* %22
%58 = or i32 %57, %56
store i32 %58, i32* %22
%59 = load i32*, i32** %7
%60 = load i64, i64* %17
%61 = getelementptr inbounds i32, i32* %59, i64 %60
%62 = getelementptr inbounds i32, i32* %61, i64 32
%63 = call i32 @_mm_loadu_si128(i32* %62)
store i32 %63, i32* %23
%64 = load i32, i32* %23
%65 = call i32 @_mm_movemask_epi8(i32 %64)
store i32 %65, i32* %24
%66 = load i32, i32* %24
store i32 %66, i32* %25
%67 = load i32, i32* %25
%68 = shl i32 %67, 32
store i32 %68, i32* %25
%69 = load i32, i32* %22
%70 = load i32, i32* %25
%71 = or i32 %70, %69
store i32 %71, i32* %25
%72 = load i64, i64* %17
%73 = add i64 %72, 48
store i64 %73, i64* %17
br label %74
74: ; preds = %161, %40
%75 = load i32, i32* %14
%76 = add nsw i32 %75, 96
%77 = load i32, i32* %8
%78 = icmp slt i32 %76, %77
br i1 %78, label %79, label %162
79: ; preds = %74
%80 = load i32, i32* %25
store i32 %80, i32* %26
%81 = load i32*, i32** %7
%82 = load i64, i64* %17
%83 = getelementptr inbounds i32, i32* %81, i64 %82
%84 = call i32 @_mm_loadu_si128(i32* %83)
store i32 %84, i32* %18
%85 = load i32, i32* %18
%86 = call i32 @_mm_movemask_epi8(i32 %85)
store i32 %86, i32* %19
%87 = load i32*, i32** %7
%88 = load i64, i64* %17
%89 = getelementptr inbounds i32, i32* %87, i64 %88
%90 = getelementptr inbounds i32, i32* %89, i64 16
%91 = call i32 @_mm_loadu_si128(i32* %90)
store i32 %91, i32* %20
%92 = load i32, i32* %20
%93 = call i32 @_mm_movemask_epi8(i32 %92)
store i32 %93, i32* %21
%94 = load i32, i32* %21
%95 = shl i32 %94, 16
store i32 %95, i32* %22
%96 = load i32, i32* %19
%97 = load i32, i32* %22
%98 = or i32 %97, %96
store i32 %98, i32* %22
%99 = load i32*, i32** %7
%100 = load i64, i64* %17
%101 = getelementptr inbounds i32, i32* %99, i64 %100
%102 = getelementptr inbounds i32, i32* %101, i64 32
%103 = call i32 @_mm_loadu_si128(i32* %102)
store i32 %103, i32* %23
%104 = load i32, i32* %23
%105 = call i32 @_mm_movemask_epi8(i32 %104)
store i32 %105, i32* %24
%106 = load i32, i32* %24
store i32 %106, i32* %25
%107 = load i32, i32* %25
%108 = shl i32 %107, 32
store i32 %108, i32* %25
%109 = load i32, i32* %22
%110 = load i32, i32* %25
%111 = or i32 %110, %109
store i32 %111, i32* %25
%112 = load i64, i64* %17
%113 = load i64, i64* %12
%114 = add i64 %113, 48
%115 = sub i64 %112, %114
%116 = trunc i64 %115 to i32
store i32 %116, i32* %27
%117 = load i32, i32* %26
%118 = load i32, i32* %27
%119 = shl i32 %117, %118
%120 = load i32, i32* %15
%121 = or i32 %119, %120
store i32 %121, i32* %15
%122 = load i64, i64* %17
%123 = sub i64 %122, 16
%124 = trunc i64 %123 to i32
store i32 %124, i32* %28
%125 = load i64, i64* %17
%126 = add i64 %125, 48
store i64 %126, i64* %17
br label %127
127: ; preds = %153, %79
%128 = load i64, i64* %12
%129 = load i32, i32* %28
%130 = sext i32 %129 to i64
%131 = icmp ult i64 %128, %130
br i1 %131, label %132, label %161
132: ; preds = %127
store i32 0, i32* %29
store i32 0, i32* %30
%133 = load i32*, i32** %7
%134 = load i64, i64* %12
%135 = getelementptr inbounds i32, i32* %133, i64 %134
%136 = load i32, i32* %15
%137 = load i32, i32* %14
%138 = load i32, i32* %10
%139 = load i32*, i32** %11
%140 = call i32 @masked_vbyte_search_group_delta(i32* %135, i32* %30, i32 %136, i32* %29, i32* %13, i32 %137, i32 %138, i32* %139)
store i32 %140, i32* %31
%141 = load i32, i32* %31
%142 = icmp sge i32 %141, 0
br i1 %142, label %143, label %145
143: ; preds = %132
%144 = load i32, i32* %31
store i32 %144, i32* %6
br label %244
145: ; preds = %132
%146 = load i32, i32* %30
%147 = load i32, i32* %15
%148 = ashr i32 %147, %146
store i32 %148, i32* %15
%149 = load i32, i32* %15
%150 = sext i32 %149 to i64
%151 = icmp eq i64 %150, -1
br i1 %151, label %152, label %153
152: ; preds = %145
store i32 0, i32* %6
br label %244
153: ; preds = %145
%154 = load i32, i32* %30
%155 = sext i32 %154 to i64
%156 = load i64, i64* %12
%157 = add i64 %156, %155
store i64 %157, i64* %12
%158 = load i32, i32* %29
%159 = load i32, i32* %14
%160 = add nsw i32 %159, %158
store i32 %160, i32* %14
br label %127
161: ; preds = %127
br label %74
162: ; preds = %74
%163 = load i32, i32* %25
%164 = load i64, i64* %17
%165 = load i64, i64* %12
%166 = sub i64 %164, %165
%167 = sub i64 %166, 48
%168 = trunc i64 %167 to i32
%169 = shl i32 %163, %168
%170 = load i32, i32* %15
%171 = or i32 %169, %170
store i32 %171, i32* %15
%172 = load i64, i64* %17
%173 = load i64, i64* %12
%174 = sub i64 %172, %173
%175 = trunc i64 %174 to i32
store i32 %175, i32* %16
br label %176
176: ; preds = %162, %5
br label %177
177: ; preds = %200, %176
%178 = load i32, i32* %16
%179 = load i32, i32* %14
%180 = add nsw i32 %178, %179
%181 = load i32, i32* %8
%182 = icmp slt i32 %180, %181
br i1 %182, label %183, label %214
183: ; preds = %177
%184 = load i32, i32* %16
%185 = icmp slt i32 %184, 16
br i1 %185, label %186, label %187
186: ; preds = %183
br label %214
187: ; preds = %183
store i32 0, i32* %32
store i32 0, i32* %33
%188 = load i32*, i32** %7
%189 = load i64, i64* %12
%190 = getelementptr inbounds i32, i32* %188, i64 %189
%191 = load i32, i32* %15
%192 = load i32, i32* %14
%193 = load i32, i32* %10
%194 = load i32*, i32** %11
%195 = call i32 @masked_vbyte_search_group_delta(i32* %190, i32* %33, i32 %191, i32* %32, i32* %13, i32 %192, i32 %193, i32* %194)
store i32 %195, i32* %34
%196 = load i32, i32* %34
%197 = icmp sge i32 %196, 0
br i1 %197, label %198, label %200
198: ; preds = %187
%199 = load i32, i32* %34
store i32 %199, i32* %6
br label %244
200: ; preds = %187
%201 = load i32, i32* %33
%202 = sext i32 %201 to i64
%203 = load i64, i64* %12
%204 = add i64 %203, %202
store i64 %204, i64* %12
%205 = load i32, i32* %33
%206 = load i32, i32* %16
%207 = sub nsw i32 %206, %205
store i32 %207, i32* %16
%208 = load i32, i32* %33
%209 = load i32, i32* %15
%210 = ashr i32 %209, %208
store i32 %210, i32* %15
%211 = load i32, i32* %32
%212 = load i32, i32* %14
%213 = add nsw i32 %212, %211
store i32 %213, i32* %14
br label %177
214: ; preds = %186, %177
%215 = load i32, i32* %13
%216 = call i32 @_mm_extract_epi32(i32 %215, i32 3)
store i32 %216, i32* %9
br label %217
217: ; preds = %236, %214
%218 = load i32, i32* %14
%219 = load i32, i32* %8
%220 = icmp slt i32 %218, %219
br i1 %220, label %221, label %239
221: ; preds = %217
%222 = load i32*, i32** %7
%223 = load i64, i64* %12
%224 = getelementptr inbounds i32, i32* %222, i64 %223
%225 = call i64 @read_int_delta(i32* %224, i32* %35, i32* %9)
%226 = load i64, i64* %12
%227 = add i64 %226, %225
store i64 %227, i64* %12
%228 = load i32, i32* %10
%229 = load i32, i32* %9
%230 = icmp sle i32 %228, %229
br i1 %230, label %231, label %235
231: ; preds = %221
%232 = load i32, i32* %9
%233 = load i32*, i32** %11
store i32 %232, i32* %233
%234 = load i32, i32* %14
store i32 %234, i32* %6
br label %244
235: ; preds = %221
br label %236
236: ; preds = %235
%237 = load i32, i32* %14
%238 = add nsw i32 %237, 1
store i32 %238, i32* %14
br label %217
239: ; preds = %217
%240 = load i32, i32* %10
%241 = add nsw i32 %240, 1
%242 = load i32*, i32** %11
store i32 %241, i32* %242
%243 = load i32, i32* %8
store i32 %243, i32* %6
br label %244
244: ; preds = %239, %231, %198, %152, %143
%245 = load i32, i32* %6
ret i32 %245
}

LLVM IR (-O2):
define i32 @masked_vbyte_search_delta(i32* %0, i32 %1, i32 %2, i32 %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = bitcast i32* %7 to i8*
%14 = tail call i32 @_mm_set1_epi32(i32 %2)
store i32 %14, i32* %7
%15 = icmp sgt i32 %1, 96
br i1 %15, label %16, label %93
16: ; preds = %5
%17 = tail call i32 @_mm_loadu_si128(i32* %0)
%18 = tail call i32 @_mm_movemask_epi8(i32 %17)
%19 = getelementptr inbounds i32, i32* %0, i64 16
%20 = tail call i32 @_mm_loadu_si128(i32* %19)
%21 = tail call i32 @_mm_movemask_epi8(i32 %20)
%22 = getelementptr inbounds i32, i32* %0, i64 32
%23 = tail call i32 @_mm_loadu_si128(i32* %22)
%24 = tail call i32 @_mm_movemask_epi8(i32 %23)
%25 = bitcast i32* %8 to i8*
%26 = bitcast i32* %9 to i8*
br label %32
27: ; preds = %56, %32
%28 = phi i32 [ %34, %32 ], [ %61, %56 ]
%29 = phi i64 [ %33, %32 ], [ %59, %56 ]
%30 = add nsw i32 %28, 96
%31 = icmp slt i32 %30, %1
br i1 %31, label %32, label %64
32: ; preds = %16, %27
%33 = phi i64 [ 0, %16 ], [ %29, %27 ]
%34 = phi i32 [ 0, %16 ], [ %28, %27 ]
%35 = phi i64 [ 48, %16 ], [ %45, %27 ]
%36 = getelementptr inbounds i32, i32* %0, i64 %35
%37 = call i32 @_mm_loadu_si128(i32* %36)
%38 = call i32 @_mm_movemask_epi8(i32 %37)
%39 = getelementptr inbounds i32, i32* %36, i64 16
%40 = call i32 @_mm_loadu_si128(i32* %39)
%41 = call i32 @_mm_movemask_epi8(i32 %40)
%42 = getelementptr inbounds i32, i32* %36, i64 32
%43 = call i32 @_mm_loadu_si128(i32* %42)
%44 = call i32 @_mm_movemask_epi8(i32 %43)
%45 = add i64 %35, 48
%46 = shl i64 %35, 32
%47 = add i64 %46, -68719476736
%48 = ashr exact i64 %47, 32
%49 = icmp ult i64 %33, %48
br i1 %49, label %50, label %27
50: ; preds = %32, %56
%51 = phi i64 [ %59, %56 ], [ %33, %32 ]
%52 = phi i32 [ %61, %56 ], [ %34, %32 ]
store i32 0, i32* %8
store i32 0, i32* %9
%53 = getelementptr inbounds i32, i32* %0, i64 %51
%54 = call i32 @masked_vbyte_search_group_delta(i32* %53, i32* %9, i32 0, i32* %8, i32* %7, i32 %52, i32 %3, i32* %4)
%55 = icmp sgt i32 %54, -1
br i1 %55, label %63, label %56
56: ; preds = %50
%57 = load i32, i32* %9
%58 = sext i32 %57 to i64
%59 = add i64 %51, %58
%60 = load i32, i32* %8
%61 = add nsw i32 %60, %52
%62 = icmp ult i64 %59, %48
br i1 %62, label %50, label %27
63: ; preds = %50
br label %115
64: ; preds = %27
%65 = sub i64 %45, %29
%66 = trunc i64 %65 to i32
%67 = add nsw i32 %28, %66
%68 = icmp sge i32 %67, %1
%69 = icmp slt i32 %66, 16
%70 = or i1 %69, %68
br i1 %70, label %93, label %71
71: ; preds = %64
%72 = bitcast i32* %10 to i8*
%73 = bitcast i32* %11 to i8*
br label %74
74: ; preds = %71, %82
%75 = phi i64 [ %29, %71 ], [ %85, %82 ]
%76 = phi i32 [ %28, %71 ], [ %88, %82 ]
%77 = phi i32 [ %66, %71 ], [ %86, %82 ]
store i32 0, i32* %10
store i32 0, i32* %11
%78 = getelementptr inbounds i32, i32* %0, i64 %75
%79 = call i32 @masked_vbyte_search_group_delta(i32* %78, i32* %11, i32 0, i32* %10, i32* %7, i32 %76, i32 %3, i32* %4)
%80 = icmp sgt i32 %79, -1
br i1 %80, label %81, label %82
81: ; preds = %74
br label %115
82: ; preds = %74
%83 = load i32, i32* %11
%84 = sext i32 %83 to i64
%85 = add i64 %75, %84
%86 = sub nsw i32 %77, %83
%87 = load i32, i32* %10
%88 = add nsw i32 %87, %76
%89 = add nsw i32 %88, %86
%90 = icmp sge i32 %89, %1
%91 = icmp slt i32 %86, 16
%92 = or i1 %91, %90
br i1 %92, label %93, label %74
93: ; preds = %82, %5, %64
%94 = phi i32 [ %28, %64 ], [ 0, %5 ], [ %88, %82 ]
%95 = phi i64 [ %29, %64 ], [ 0, %5 ], [ %85, %82 ]
%96 = load i32, i32* %7
%97 = call i32 @_mm_extract_epi32(i32 %96, i32 3)
store i32 %97, i32* %6
%98 = icmp slt i32 %94, %1
br i1 %98, label %99, label %113
99: ; preds = %93
%100 = bitcast i32* %12 to i8*
br label %101
101: ; preds = %99, %109
%102 = phi i64 [ %95, %99 ], [ %110, %109 ]
%103 = phi i32 [ %94, %99 ], [ %111, %109 ]
%104 = getelementptr inbounds i32, i32* %0, i64 %102
%105 = call i64 @read_int_delta(i32* %104, i32* %12, i32* %6)
%106 = load i32, i32* %6
%107 = icmp slt i32 %106, %3
br i1 %107, label %109, label %108
108: ; preds = %101
store i32 %106, i32* %4
br label %115
109: ; preds = %101
%110 = add i64 %105, %102
%111 = add i32 %103, 1
%112 = icmp eq i32 %111, %1
br i1 %112, label %113, label %101
113: ; preds = %109, %93
%114 = add nsw i32 %3, 1
store i32 %114, i32* %4
br label %115
115: ; preds = %63, %108, %81, %113
%116 = phi i32 [ %103, %108 ], [ %1, %113 ], [ %54, %63 ], [ %79, %81 ]
ret i32 %116
}