// File: ralgond[P]SortedListIntersection/./bloom_filter.hpp
// Function: bloom_filter::hash_ap(unsigned char const*, unsigned long, unsigned int) const
inline bloom_type hash_ap(const unsigned char* begin, std::size_t remaining_length, bloom_type hash) const
   {
      const unsigned char* itr = begin;
      unsigned int loop        = 0;

      while (remaining_length >= 8)
      {
         const unsigned int& i1 = *(reinterpret_cast<const unsigned int*>(itr)); itr += sizeof(unsigned int);
         const unsigned int& i2 = *(reinterpret_cast<const unsigned int*>(itr)); itr += sizeof(unsigned int);

         hash ^= (hash <<  7) ^  i1 * (hash >> 3) ^
              (~((hash << 11) + (i2 ^ (hash >> 5))));

         remaining_length -= 8;
      }

      if (remaining_length)
      {
         if (remaining_length >= 4)
         {
            const unsigned int& i = *(reinterpret_cast<const unsigned int*>(itr));

            if (loop & 0x01)
               hash ^=    (hash <<  7) ^  i * (hash >> 3);
            else
               hash ^= (~((hash << 11) + (i ^ (hash >> 5))));

            ++loop;

            remaining_length -= 4;

            itr += sizeof(unsigned int);
         }

         if (remaining_length >= 2)
         {
            const unsigned short& i = *(reinterpret_cast<const unsigned short*>(itr));

            if (loop & 0x01)
               hash ^=    (hash <<  7) ^  i * (hash >> 3);
            else
               hash ^= (~((hash << 11) + (i ^ (hash >> 5))));

            ++loop;

            remaining_length -= 2;

            itr += sizeof(unsigned short);
         }

         if (remaining_length)
         {
            hash += ((*itr) ^ (hash * 0xA5A5A5A5)) + loop;
         }
      }

      return hash;
   }

// Assembly:
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movq %rdx, -0x18(%rsp)
movl %ecx, -0x1c(%rsp)
movq -0x10(%rsp), %rax
movq %rax, -0x28(%rsp)
movl $0x0, -0x2c(%rsp)
cmpq $0x8, -0x18(%rsp)
jb 0x87c4
movq -0x28(%rsp), %rax
movq %rax, -0x38(%rsp)
movq -0x28(%rsp), %rax
addq $0x4, %rax
movq %rax, -0x28(%rsp)
movq -0x28(%rsp), %rax
movq %rax, -0x40(%rsp)
movq -0x28(%rsp), %rax
addq $0x4, %rax
movq %rax, -0x28(%rsp)
movl -0x1c(%rsp), %eax
shll $0x7, %eax
movq -0x38(%rsp), %rcx
movl (%rcx), %ecx
movl -0x1c(%rsp), %edx
shrl $0x3, %edx
imull %edx, %ecx
xorl %ecx, %eax
movl -0x1c(%rsp), %ecx
shll $0xb, %ecx
movq -0x40(%rsp), %rdx
movl (%rdx), %edx
movl -0x1c(%rsp), %esi
shrl $0x5, %esi
xorl %esi, %edx
addl %edx, %ecx
xorl $-0x1, %ecx
xorl %ecx, %eax
xorl -0x1c(%rsp), %eax
movl %eax, -0x1c(%rsp)
movq -0x18(%rsp), %rax
subq $0x8, %rax
movq %rax, -0x18(%rsp)
jmp 0x8735
cmpq $0x0, -0x18(%rsp)
je 0x891c
cmpq $0x4, -0x18(%rsp)
jb 0x8861
movq -0x28(%rsp), %rax
movq %rax, -0x48(%rsp)
movl -0x2c(%rsp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x8816
movl -0x1c(%rsp), %eax
shll $0x7, %eax
movq -0x48(%rsp), %rcx
movl (%rcx), %ecx
movl -0x1c(%rsp), %edx
shrl $0x3, %edx
imull %edx, %ecx
xorl %ecx, %eax
xorl -0x1c(%rsp), %eax
movl %eax, -0x1c(%rsp)
jmp 0x883a
movl -0x1c(%rsp), %eax
shll $0xb, %eax
movq -0x48(%rsp), %rcx
movl (%rcx), %ecx
movl -0x1c(%rsp), %edx
shrl $0x5, %edx
xorl %edx, %ecx
addl %ecx, %eax
xorl $-0x1, %eax
xorl -0x1c(%rsp), %eax
movl %eax, -0x1c(%rsp)
movl -0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rsp)
movq -0x18(%rsp), %rax
subq $0x4, %rax
movq %rax, -0x18(%rsp)
movq -0x28(%rsp), %rax
addq $0x4, %rax
movq %rax, -0x28(%rsp)
cmpq $0x2, -0x18(%rsp)
jb 0x88f4
movq -0x28(%rsp), %rax
movq %rax, -0x50(%rsp)
movl -0x2c(%rsp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x88a8
movl -0x1c(%rsp), %eax
shll $0x7, %eax
movq -0x50(%rsp), %rcx
movzwl (%rcx), %ecx
movl -0x1c(%rsp), %edx
shrl $0x3, %edx
imull %edx, %ecx
xorl %ecx, %eax
xorl -0x1c(%rsp), %eax
movl %eax, -0x1c(%rsp)
jmp 0x88cd
movl -0x1c(%rsp), %eax
shll $0xb, %eax
movq -0x50(%rsp), %rcx
movzwl (%rcx), %ecx
movl -0x1c(%rsp), %edx
shrl $0x5, %edx
xorl %edx, %ecx
addl %ecx, %eax
xorl $-0x1, %eax
xorl -0x1c(%rsp), %eax
movl %eax, -0x1c(%rsp)
movl -0x2c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rsp)
movq -0x18(%rsp), %rax
subq $0x2, %rax
movq %rax, -0x18(%rsp)
movq -0x28(%rsp), %rax
addq $0x2, %rax
movq %rax, -0x28(%rsp)
cmpq $0x0, -0x18(%rsp)
je 0x891a
movq -0x28(%rsp), %rax
movzbl (%rax), %eax
imull $0xa5a5a5a5, -0x1c(%rsp), %ecx # imm = 0xA5A5A5A5
xorl %ecx, %eax
addl -0x2c(%rsp), %eax
addl -0x1c(%rsp), %eax
movl %eax, -0x1c(%rsp)
jmp 0x891c
movl -0x1c(%rsp), %eax
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)