// File: /workspace/github_c_makefile_star2_O1/mjosaarinen[P]brutus/crypto_aead/lakekeyakv2/SandyBridge/KeccakP-1600-times2-SIMD128.c
// Function: KeccakF1600times2_FastLoop_Absorb
size_t KeccakF1600times2_FastLoop_Absorb(void *states, unsigned int laneCount, unsigned int laneOffsetParallel, unsigned int laneOffsetSerial, const unsigned char *data, size_t dataByteLen)
{
    if (laneCount == 21) {
#if 1
        unsigned int i;
        const unsigned char *dataStart = data;

        while(dataByteLen >= (laneOffsetParallel + laneCount)*8) {
            V128 *stateAsLanes = states;
            unsigned int i;
            const UINT64 *curData0 = (const UINT64 *)data;
            const UINT64 *curData1 = (const UINT64 *)(data+laneOffsetParallel*SnP_laneLengthInBytes);
            #define XOR_In( argIndex )  XOReq128( stateAsLanes[argIndex], LOAD6464(curData1[argIndex], curData0[argIndex]))
            XOR_In( 0 );
            XOR_In( 1 );
            XOR_In( 2 );
            XOR_In( 3 );
            XOR_In( 4 );
            XOR_In( 5 );
            XOR_In( 6 );
            XOR_In( 7 );
            XOR_In( 8 );
            XOR_In( 9 );
            XOR_In( 10 );
            XOR_In( 11 );
            XOR_In( 12 );
            XOR_In( 13 );
            XOR_In( 14 );
            XOR_In( 15 );
            XOR_In( 16 );
            XOR_In( 17 );
            XOR_In( 18 );
            XOR_In( 19 );
            XOR_In( 20 );
            #undef  XOR_In
            KeccakP1600times2_PermuteAll_24rounds(states);
            data += laneOffsetSerial*8;
            dataByteLen -= laneOffsetSerial*8;
        }
        return data - dataStart;
#else
        unsigned int i;
        const unsigned char *dataStart = data;
        const UINT64 *curData0 = (const UINT64 *)data;
        const UINT64 *curData1 = (const UINT64 *)(data+laneOffsetParallel*SnP_laneLengthInBytes);
        V128 *statesAsLanes = states;
        declareABCDE

        copyFromState(A, statesAsLanes)
        while(dataByteLen >= (laneOffsetParallel + laneCount)*8) {
            #define XOR_In( Xxx, argIndex )  XOReq128( Xxx, LOAD6464(curData1[argIndex], curData0[argIndex]))
            XOR_In( Aba, 0 );
            XOR_In( Abe, 1 );
            XOR_In( Abi, 2 );
            XOR_In( Abo, 3 );
            XOR_In( Abu, 4 );
            XOR_In( Aga, 5 );
            XOR_In( Age, 6 );
            XOR_In( Agi, 7 );
            XOR_In( Ago, 8 );
            XOR_In( Agu, 9 );
            XOR_In( Aka, 10 );
            XOR_In( Ake, 11 );
            XOR_In( Aki, 12 );
            XOR_In( Ako, 13 );
            XOR_In( Aku, 14 );
            XOR_In( Ama, 15 );
            XOR_In( Ame, 16 );
            XOR_In( Ami, 17 );
            XOR_In( Amo, 18 );
            XOR_In( Amu, 19 );
            XOR_In( Asa, 20 );
            #undef XOR_In
            rounds24
            curData0 += laneOffsetSerial;
            curData1 += laneOffsetSerial;
            dataByteLen -= laneOffsetSerial*8;
        }
        copyToState(statesAsLanes, A)
        return (const unsigned char *)curData0 - dataStart;
#endif
    }
    else {
        unsigned int i;
        const unsigned char *dataStart = data;

        while(dataByteLen >= (laneOffsetParallel + laneCount)*8) {
            KeccakP1600times2_AddLanesAll(states, data, laneCount, laneOffsetParallel);
            KeccakP1600times2_PermuteAll_24rounds(states);
            data += laneOffsetSerial*8;
            dataByteLen -= laneOffsetSerial*8;
        }
        return data - dataStart;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %r14
movq %r8, %r13
movl %ecx, %r15d
movl %edx, %eax
movq %rdi, %r12
cmpl $0x15, %esi
movq %r8, 0x8(%rsp)
jne 0x1a5c5
leal 0xa8(,%rax,8), %ebx
cmpq %r14, %rbx
ja 0x1a613
shll $0x3, %eax
movl %eax, %ebp
shll $0x3, %r15d
movq 0x8(%rsp), %r13
vmovsd (%r13,%rbp), %xmm0
vmovsd (%r13), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vxorps (%r12), %xmm0, %xmm0
vmovaps %xmm0, (%r12)
vmovsd 0x8(%r13,%rbp), %xmm0
vmovsd 0x8(%r13), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vxorps 0x10(%r12), %xmm0, %xmm0
vmovaps %xmm0, 0x10(%r12)
vmovsd 0x10(%r13,%rbp), %xmm0
vmovsd 0x10(%r13), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vxorps 0x20(%r12), %xmm0, %xmm0
vmovaps %xmm0, 0x20(%r12)
vmovsd 0x18(%r13,%rbp), %xmm0
vmovsd 0x18(%r13), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vxorps 0x30(%r12), %xmm0, %xmm0
vmovaps %xmm0, 0x30(%r12)
vmovsd 0x20(%r13,%rbp), %xmm0
vmovsd 0x20(%r13), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vxorps 0x40(%r12), %xmm0, %xmm0
vmovaps %xmm0, 0x40(%r12)
vmovsd 0x28(%r13,%rbp), %xmm0
vmovsd 0x28(%r13), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vxorps 0x50(%r12), %xmm0, %xmm0
vmovaps %xmm0, 0x50(%r12)
vmovsd 0x30(%r13,%rbp), %xmm0
vmovsd 0x30(%r13), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vxorps 0x60(%r12), %xmm0, %xmm0
vmovaps %xmm0, 0x60(%r12)
vmovsd 0x38(%r13,%rbp), %xmm0
vmovsd 0x38(%r13), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vxorps 0x70(%r12), %xmm0, %xmm0
vmovaps %xmm0, 0x70(%r12)
vmovsd 0x40(%r13,%rbp), %xmm0
vmovsd 0x40(%r13), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vxorps 0x80(%r12), %xmm0, %xmm0
vmovaps %xmm0, 0x80(%r12)
vmovsd 0x48(%r13,%rbp), %xmm0
vmovsd 0x48(%r13), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vxorps 0x90(%r12), %xmm0, %xmm0
vmovaps %xmm0, 0x90(%r12)
vmovsd 0x50(%r13,%rbp), %xmm0
vmovsd 0x50(%r13), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vxorps 0xa0(%r12), %xmm0, %xmm0
vmovaps %xmm0, 0xa0(%r12)
vmovsd 0x58(%r13,%rbp), %xmm0
vmovsd 0x58(%r13), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vxorps 0xb0(%r12), %xmm0, %xmm0
vmovaps %xmm0, 0xb0(%r12)
vmovsd 0x60(%r13,%rbp), %xmm0
vmovsd 0x60(%r13), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vxorps 0xc0(%r12), %xmm0, %xmm0
vmovaps %xmm0, 0xc0(%r12)
vmovsd 0x68(%r13,%rbp), %xmm0
vmovsd 0x68(%r13), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vxorps 0xd0(%r12), %xmm0, %xmm0
vmovaps %xmm0, 0xd0(%r12)
vmovsd 0x70(%r13,%rbp), %xmm0
vmovsd 0x70(%r13), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vxorps 0xe0(%r12), %xmm0, %xmm0
vmovaps %xmm0, 0xe0(%r12)
vmovsd 0x78(%r13,%rbp), %xmm0
vmovsd 0x78(%r13), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vxorps 0xf0(%r12), %xmm0, %xmm0
vmovaps %xmm0, 0xf0(%r12)
vmovsd 0x80(%r13,%rbp), %xmm0
vmovsd 0x80(%r13), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vxorps 0x100(%r12), %xmm0, %xmm0
vmovaps %xmm0, 0x100(%r12)
vmovsd 0x88(%r13,%rbp), %xmm0
vmovsd 0x88(%r13), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vxorps 0x110(%r12), %xmm0, %xmm0
vmovaps %xmm0, 0x110(%r12)
vmovsd 0x90(%r13,%rbp), %xmm0
vmovsd 0x90(%r13), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vxorps 0x120(%r12), %xmm0, %xmm0
vmovaps %xmm0, 0x120(%r12)
vmovsd 0x98(%r13,%rbp), %xmm0
vmovsd 0x98(%r13), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vxorps 0x130(%r12), %xmm0, %xmm0
vmovaps %xmm0, 0x130(%r12)
vmovsd 0xa0(%r13,%rbp), %xmm0
vmovsd 0xa0(%r13), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vxorps 0x140(%r12), %xmm0, %xmm0
vmovaps %xmm0, 0x140(%r12)
movq %r12, %rdi
callq 0x5570
addq %r15, %r13
subq %r15, %r14
cmpq %rbx, %r14
jae 0x1a2b7
jmp 0x1a613
movl %esi, %ebp
leal (%rax,%rbp), %edx
shll $0x3, %edx
cmpq %r14, %rdx
ja 0x1a613
shll $0x3, %r15d
movq 0x8(%rsp), %r13
movq %r15, 0x10(%rsp)
movq %r12, %rdi
movq %r13, %rsi
movq %rdx, %r15
movl %ebp, %edx
movq %rax, %rbx
movl %ebx, %ecx
callq 0x52c0
movq %r12, %rdi
callq 0x5570
movq %r15, %rdx
movq 0x10(%rsp), %r15
movq %rbx, %rax
addq %r15, %r13
subq %r15, %r14
cmpq %rdx, %r14
jae 0x1a5e0
subq 0x8(%rsp), %r13
movq %r13, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop