// File: /workspace/github_c_makefile_star2_O1/mjosaarinen[P]brutus/crypto_aead/oceankeyakv2/generic64lc/KeccakP-1600-opt64.c
// Function: KeccakP1600_AddLanes
void KeccakP1600_AddLanes(void *state, const unsigned char *data, unsigned int laneCount)
{
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
    unsigned int i = 0;
#ifdef NO_MISALIGNED_ACCESSES
    /* If either pointer is misaligned, fall back to byte-wise xor. */
    if (((((uintptr_t)state) & 7) != 0) || ((((uintptr_t)data) & 7) != 0)) {
      for (i = 0; i < laneCount * 8; i++) {
        ((unsigned char*)state)[i] ^= data[i];
      }
    }
    else
#endif
    {
      /* Otherwise... */
      for( ; (i+8)<=laneCount; i+=8) {
          ((UINT64*)state)[i+0] ^= ((UINT64*)data)[i+0];
          ((UINT64*)state)[i+1] ^= ((UINT64*)data)[i+1];
          ((UINT64*)state)[i+2] ^= ((UINT64*)data)[i+2];
          ((UINT64*)state)[i+3] ^= ((UINT64*)data)[i+3];
          ((UINT64*)state)[i+4] ^= ((UINT64*)data)[i+4];
          ((UINT64*)state)[i+5] ^= ((UINT64*)data)[i+5];
          ((UINT64*)state)[i+6] ^= ((UINT64*)data)[i+6];
          ((UINT64*)state)[i+7] ^= ((UINT64*)data)[i+7];
      }
      for( ; (i+4)<=laneCount; i+=4) {
          ((UINT64*)state)[i+0] ^= ((UINT64*)data)[i+0];
          ((UINT64*)state)[i+1] ^= ((UINT64*)data)[i+1];
          ((UINT64*)state)[i+2] ^= ((UINT64*)data)[i+2];
          ((UINT64*)state)[i+3] ^= ((UINT64*)data)[i+3];
      }
      for( ; (i+2)<=laneCount; i+=2) {
          ((UINT64*)state)[i+0] ^= ((UINT64*)data)[i+0];
          ((UINT64*)state)[i+1] ^= ((UINT64*)data)[i+1];
      }
      if (i<laneCount) {
          ((UINT64*)state)[i+0] ^= ((UINT64*)data)[i+0];
      }
    }
#else
    unsigned int i;
    UINT8 *curData = data;
    for(i=0; i<laneCount; i++, curData+=8) {
        UINT64 lane = (UINT64)curData[0]
            | ((UINT64)curData[1] << 8)
            | ((UINT64)curData[2] << 16)
            | ((UINT64)curData[3] << 24)
            | ((UINT64)curData[4] <<32)
            | ((UINT64)curData[5] << 40)
            | ((UINT64)curData[6] << 48)
            | ((UINT64)curData[7] << 56);
        ((UINT64*)state)[i] ^= lane;
    }
#endif
}

// Assembly:
xorl %eax, %eax
cmpl $0x8, %edx
jb 0x58af
movl %edx, %ecx
xorl %eax, %eax
movq %rax, %r8
movq (%rsi,%rax,8), %rax
xorq %rax, (%rdi,%r8,8)
movq 0x8(%rsi,%r8,8), %rax
xorq %rax, 0x8(%rdi,%r8,8)
movq 0x10(%rsi,%r8,8), %rax
xorq %rax, 0x10(%rdi,%r8,8)
movq 0x18(%rsi,%r8,8), %rax
xorq %rax, 0x18(%rdi,%r8,8)
movq 0x20(%rsi,%r8,8), %rax
xorq %rax, 0x20(%rdi,%r8,8)
movq 0x28(%rsi,%r8,8), %rax
xorq %rax, 0x28(%rdi,%r8,8)
movq 0x30(%rsi,%r8,8), %rax
xorq %rax, 0x30(%rdi,%r8,8)
movq 0x38(%rsi,%r8,8), %rax
xorq %rax, 0x38(%rdi,%r8,8)
leaq 0x8(%r8), %rax
addq $0x10, %r8
cmpq %rcx, %r8
jbe 0x5851
movl %eax, %ecx
orl $0x4, %ecx
cmpl %edx, %ecx
jbe 0x58bc
movl %eax, %ecx
jmp 0x58f3
movl %eax, %ecx
movq (%rsi,%rcx,8), %r8
xorq %r8, (%rdi,%rcx,8)
leal 0x1(%rax), %ecx
movq (%rsi,%rcx,8), %r8
xorq %r8, (%rdi,%rcx,8)
leal 0x2(%rax), %ecx
movq (%rsi,%rcx,8), %r8
xorq %r8, (%rdi,%rcx,8)
leal 0x3(%rax), %ecx
movq (%rsi,%rcx,8), %r8
xorq %r8, (%rdi,%rcx,8)
leal 0x4(%rax), %ecx
addl $0x8, %eax
cmpl %edx, %eax
movl %ecx, %eax
jbe 0x58bc
leal 0x2(%rcx), %eax
cmpl %edx, %eax
jbe 0x58fe
movl %ecx, %eax
jmp 0x591f
movl %ecx, %eax
movq (%rsi,%rax,8), %r8
xorq %r8, (%rdi,%rax,8)
leal 0x1(%rcx), %eax
movq (%rsi,%rax,8), %r8
xorq %r8, (%rdi,%rax,8)
leal 0x2(%rcx), %eax
addl $0x4, %ecx
cmpl %edx, %ecx
movl %eax, %ecx
jbe 0x58fe
cmpl %edx, %eax
jae 0x592d
movl %eax, %eax
movq (%rsi,%rax,8), %rcx
xorq %rcx, (%rdi,%rax,8)
retq