// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/lakekeyakv2/generic32/KeccakP-1600-inplace32BI.c
// Function: KeccakP1600_ExtractAndAddLanes
void KeccakP1600_ExtractAndAddLanes(const void *state, const unsigned char *input, unsigned char *output, unsigned int laneCount)
{
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
    const UINT32 * pI = (const UINT32 *)input;
    UINT32 * pO = (UINT32 *)output;
    const UINT32 * pS = (const UINT32 *)state;
    UINT32 t, x0, x1;
    int i;
    for (i = laneCount-1; i >= 0; --i) {
#ifdef NO_MISALIGNED_ACCESSES
        UINT32 low;
        UINT32 high;
        fromBitInterleaving(*(pS++), *(pS++), low, high, t, x0, x1);
        *(pO++) = *(pI++) ^ low;
        *(pO++) = *(pI++) ^ high;
#else
        fromBitInterleavingAndXOR(*(pS++), *(pS++), *(pI++), *(pI++), *(pO++), *(pO++), t, x0, x1)
#endif
    }
#else
    unsigned int lanePosition;
    for(lanePosition=0; lanePosition<laneCount; lanePosition++) {
        UINT32 *stateAsHalfLanes = (UINT32*)state;
        UINT32 low, high, temp, temp0, temp1;
        fromBitInterleaving(stateAsHalfLanes[lanePosition*2], stateAsHalfLanes[lanePosition*2+1], low, high, temp, temp0, temp1);
        UINT8 laneAsBytes[8];
        laneAsBytes[0] = low & 0xFF;
        laneAsBytes[1] = (low >> 8) & 0xFF;
        laneAsBytes[2] = (low >> 16) & 0xFF;
        laneAsBytes[3] = (low >> 24) & 0xFF;
        laneAsBytes[4] = high & 0xFF;
        laneAsBytes[5] = (high >> 8) & 0xFF;
        laneAsBytes[6] = (high >> 16) & 0xFF;
        laneAsBytes[7] = (high >> 24) & 0xFF;
        ((UINT32*)(output+lanePosition*8))[0] = ((UINT32*)(input+lanePosition*8))[0] ^ (*(const UINT32*)(laneAsBytes+0));
        ((UINT32*)(output+lanePosition*8))[1] = ((UINT32*)(input+lanePosition*8))[0] ^ (*(const UINT32*)(laneAsBytes+4));
    }
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
decl %ecx
xorl %eax, %eax
movl $0xff00, %r8d           # imm = 0xFF00
movl $0xf000f0, %r9d         # imm = 0xF000F0
movl $0xc0c0c0c, %r10d       # imm = 0xC0C0C0C
movl $0x22222222, %r11d      # imm = 0x22222222
testl %ecx, %ecx
js 0x635e
movl (%rdi,%rax), %r12d
movl 0x4(%rdi,%rax), %ebx
movzwl %r12w, %ebp
movl %ebx, %r15d
shll $0x10, %r15d
orl %ebp, %r15d
movl %ebx, %ebp
shll $0x8, %ebp
xorl %r12d, %ebp
shrl $0x10, %r12d
movl %ebx, %r14d
andl $0xffff0000, %r14d      # imm = 0xFFFF0000
orl %r12d, %r14d
andl %r8d, %ebp
movl %ebp, %r13d
shll $0x8, %r13d
xorl %r15d, %r13d
xorl %r13d, %ebp
movl %ebp, %r15d
shrl $0x4, %r15d
xorl %r13d, %r15d
andl %r9d, %r15d
imull $0x11, %r15d, %r15d
xorl %ebp, %r15d
movl %r15d, %r13d
shrl $0x2, %r13d
xorl %r15d, %r13d
andl %r10d, %r13d
leal (%r13,%r13,4), %ebp
xorl %r15d, %ebp
movl %ebp, %r15d
shrl %r15d
xorl %ebp, %r15d
andl %r11d, %r15d
leal (%r15,%r15,2), %r15d
shrl $0x8, %ebx
xorl %r12d, %ebx
andl %r8d, %ebx
movl %ebx, %r12d
shll $0x8, %r12d
xorl %r14d, %r12d
xorl %r12d, %ebx
movl %ebx, %r14d
shrl $0x4, %r14d
xorl %r12d, %r14d
andl %r9d, %r14d
imull $0x11, %r14d, %r14d
xorl %ebx, %r14d
movl %r14d, %ebx
shrl $0x2, %ebx
xorl %r14d, %ebx
andl %r10d, %ebx
leal (%rbx,%rbx,4), %ebx
xorl %r14d, %ebx
movl %ebx, %r14d
shrl %r14d
xorl %ebx, %r14d
andl %r11d, %r14d
leal (%r14,%r14,2), %r14d
xorl (%rsi,%rax), %r15d
xorl %ebp, %r15d
movl %r15d, (%rdx,%rax)
xorl 0x4(%rsi,%rax), %r14d
xorl %ebx, %r14d
movl %r14d, 0x4(%rdx,%rax)
addq $0x8, %rax
decl %ecx
jmp 0x626f
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq