// File: /workspace/github_c_makefile_star2_O3/mjosaarinen[P]brutus/crypto_aead/oceankeyakv2/KnightsLanding/KeccakP-1600-times8-SIMD512.c
// Function: KeccakP1600times8_ExtractAndAddLanesAll
void KeccakP1600times8_ExtractAndAddLanesAll(const void *states, const unsigned char *input, unsigned char *output, unsigned int laneCount, unsigned int laneOffset)
{
    const V512 *stateAsLanes = states;
    const UINT64 *inAsLanes = (const UINT64 *)input;
    UINT64 *outAsLanes = (UINT64 *)output;
    unsigned int i;
	V256 index;

    #define ExtrAdd( argIndex )  STORE_SCATTER8_64(outAsLanes+argIndex, index, XOR(stateAsLanes[argIndex], LOAD_GATHER8_64(index, inAsLanes+argIndex)))
    index = LOAD8_32(7*laneOffset, 6*laneOffset, 5*laneOffset, 4*laneOffset, 3*laneOffset, 2*laneOffset, 1*laneOffset, 0*laneOffset);
    if ( laneCount >= 16 )  {
        ExtrAdd( 0 );
        ExtrAdd( 1 );
        ExtrAdd( 2 );
        ExtrAdd( 3 );
        ExtrAdd( 4 );
        ExtrAdd( 5 );
        ExtrAdd( 6 );
        ExtrAdd( 7 );
        ExtrAdd( 8 );
        ExtrAdd( 9 );
        ExtrAdd( 10 );
        ExtrAdd( 11 );
        ExtrAdd( 12 );
        ExtrAdd( 13 );
        ExtrAdd( 14 );
        ExtrAdd( 15 );
        if ( laneCount >= 20 )  {
	        ExtrAdd( 16 );
    	    ExtrAdd( 17 );
	        ExtrAdd( 18 );
    	    ExtrAdd( 19 );
            for(i=20; i<laneCount; i++)
                ExtrAdd( i );
        }
        else {
            for(i=16; i<laneCount; i++)
                ExtrAdd( i );
        }
    }
    else {
        for(i=0; i<laneCount; i++)
            ExtrAdd( i );
    }
    #undef  ExtrAdd

}

// Assembly:
vpbroadcastd %r8d, %xmm0
vpmulld 0x19458(%rip), %xmm0, %xmm1 # 0x304c0
vpmulld 0x1945f(%rip), %xmm0, %xmm2 # 0x304d0
movb $0x2, %al
kmovd %eax, %k1
vpexpandd %ymm0, %ymm0 {%k1} {z}
vpmovsxbq 0x1949a(%rip), %ymm3 # 0x30520
vpermi2q %ymm0, %ymm2, %ymm3
vpmovsxbq 0x1948f(%rip), %ymm0 # 0x30524
vpermi2q %ymm1, %ymm3, %ymm0
cmpl $0xf, %ecx
jbe 0x173bd
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq (%rsi,%ymm0,8), %zmm1 {%k1}
vpxorq (%rdi), %zmm1, %zmm1
kxnorw %k0, %k0, %k1
vpscatterdq %zmm1, (%rdx,%ymm0,8) {%k1}
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x8(%rsi,%ymm0,8), %zmm1 {%k1}
vpxorq 0x40(%rdi), %zmm1, %zmm1
kxnorw %k0, %k0, %k1
vpscatterdq %zmm1, 0x8(%rdx,%ymm0,8) {%k1}
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x10(%rsi,%ymm0,8), %zmm1 {%k1}
vpxorq 0x80(%rdi), %zmm1, %zmm1
kxnorw %k0, %k0, %k1
vpscatterdq %zmm1, 0x10(%rdx,%ymm0,8) {%k1}
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x18(%rsi,%ymm0,8), %zmm1 {%k1}
vpxorq 0xc0(%rdi), %zmm1, %zmm1
kxnorw %k0, %k0, %k1
vpscatterdq %zmm1, 0x18(%rdx,%ymm0,8) {%k1}
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x20(%rsi,%ymm0,8), %zmm1 {%k1}
vpxorq 0x100(%rdi), %zmm1, %zmm1
kxnorw %k0, %k0, %k1
vpscatterdq %zmm1, 0x20(%rdx,%ymm0,8) {%k1}
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x28(%rsi,%ymm0,8), %zmm1 {%k1}
vpxorq 0x140(%rdi), %zmm1, %zmm1
kxnorw %k0, %k0, %k1
vpscatterdq %zmm1, 0x28(%rdx,%ymm0,8) {%k1}
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x30(%rsi,%ymm0,8), %zmm1 {%k1}
vpxorq 0x180(%rdi), %zmm1, %zmm1
kxnorw %k0, %k0, %k1
vpscatterdq %zmm1, 0x30(%rdx,%ymm0,8) {%k1}
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x38(%rsi,%ymm0,8), %zmm1 {%k1}
vpxorq 0x1c0(%rdi), %zmm1, %zmm1
kxnorw %k0, %k0, %k1
vpscatterdq %zmm1, 0x38(%rdx,%ymm0,8) {%k1}
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x40(%rsi,%ymm0,8), %zmm1 {%k1}
vpxorq 0x200(%rdi), %zmm1, %zmm1
kxnorw %k0, %k0, %k1
vpscatterdq %zmm1, 0x40(%rdx,%ymm0,8) {%k1}
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x48(%rsi,%ymm0,8), %zmm1 {%k1}
vpxorq 0x240(%rdi), %zmm1, %zmm1
kxnorw %k0, %k0, %k1
vpscatterdq %zmm1, 0x48(%rdx,%ymm0,8) {%k1}
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x50(%rsi,%ymm0,8), %zmm1 {%k1}
vpxorq 0x280(%rdi), %zmm1, %zmm1
kxnorw %k0, %k0, %k1
vpscatterdq %zmm1, 0x50(%rdx,%ymm0,8) {%k1}
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x58(%rsi,%ymm0,8), %zmm1 {%k1}
vpxorq 0x2c0(%rdi), %zmm1, %zmm1
kxnorw %k0, %k0, %k1
vpscatterdq %zmm1, 0x58(%rdx,%ymm0,8) {%k1}
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x60(%rsi,%ymm0,8), %zmm1 {%k1}
vpxorq 0x300(%rdi), %zmm1, %zmm1
kxnorw %k0, %k0, %k1
vpscatterdq %zmm1, 0x60(%rdx,%ymm0,8) {%k1}
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x68(%rsi,%ymm0,8), %zmm1 {%k1}
vpxorq 0x340(%rdi), %zmm1, %zmm1
kxnorw %k0, %k0, %k1
vpscatterdq %zmm1, 0x68(%rdx,%ymm0,8) {%k1}
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x70(%rsi,%ymm0,8), %zmm1 {%k1}
vpxorq 0x380(%rdi), %zmm1, %zmm1
kxnorw %k0, %k0, %k1
vpscatterdq %zmm1, 0x70(%rdx,%ymm0,8) {%k1}
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x78(%rsi,%ymm0,8), %zmm1 {%k1}
kxnorw %k0, %k0, %k1
vpxorq 0x3c0(%rdi), %zmm1, %zmm1
vpscatterdq %zmm1, 0x78(%rdx,%ymm0,8) {%k1}
vpxor %xmm1, %xmm1, %xmm1
cmpl $0x13, %ecx
jbe 0x17401
kxnorw %k0, %k0, %k1
vpxor %xmm2, %xmm2, %xmm2
vpgatherdq 0x80(%rsi,%ymm0,8), %zmm2 {%k1}
vpxorq 0x400(%rdi), %zmm2, %zmm2
kxnorw %k0, %k0, %k1
vpscatterdq %zmm2, 0x80(%rdx,%ymm0,8) {%k1}
kxnorw %k0, %k0, %k1
vpxor %xmm2, %xmm2, %xmm2
vpgatherdq 0x88(%rsi,%ymm0,8), %zmm2 {%k1}
vpxorq 0x440(%rdi), %zmm2, %zmm2
kxnorw %k0, %k0, %k1
vpscatterdq %zmm2, 0x88(%rdx,%ymm0,8) {%k1}
kxnorw %k0, %k0, %k1
vpxor %xmm2, %xmm2, %xmm2
vpgatherdq 0x90(%rsi,%ymm0,8), %zmm2 {%k1}
vpxorq 0x480(%rdi), %zmm2, %zmm2
kxnorw %k0, %k0, %k1
vpscatterdq %zmm2, 0x90(%rdx,%ymm0,8) {%k1}
kxnorw %k0, %k0, %k1
vpgatherdq 0x98(%rsi,%ymm0,8), %zmm1 {%k1}
kxnorw %k0, %k0, %k1
vpxorq 0x4c0(%rdi), %zmm1, %zmm1
vpscatterdq %zmm1, 0x98(%rdx,%ymm0,8) {%k1}
cmpl $0x14, %ecx
je 0x1744f
movl %ecx, %eax
movl $0xa0, %ecx
addq %rcx, %rdx
addq $0x500, %rdi            # imm = 0x500
addq %rcx, %rsi
addq $-0x14, %rax
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq (%rsi,%ymm0,8), %zmm1 {%k1}
vpxorq (%rdi), %zmm1, %zmm1
kxnorw %k0, %k0, %k1
vpscatterdq %zmm1, (%rdx,%ymm0,8) {%k1}
addq $0x8, %rdx
addq $0x40, %rdi
addq $0x8, %rsi
decq %rax
jne 0x17387
jmp 0x1744f
testl %ecx, %ecx
je 0x1744f
movl %ecx, %eax
shlq $0x3, %rax
xorl %ecx, %ecx
leaq (%rsi,%rcx), %r8
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq (%r8,%ymm0,8), %zmm1 {%k1}
leaq (%rdx,%rcx), %r8
vpxorq (%rdi,%rcx,8), %zmm1, %zmm1
kxnorw %k0, %k0, %k1
vpscatterdq %zmm1, (%r8,%ymm0,8) {%k1}
addq $0x8, %rcx
cmpq %rcx, %rax
jne 0x173cd
jmp 0x1744f
cmpl $0x10, %ecx
je 0x1744f
movl %ecx, %eax
movl $0x80, %ecx
addq %rcx, %rdx
addq $0x400, %rdi            # imm = 0x400
addq %rcx, %rsi
addq $-0x10, %rax
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq (%rsi,%ymm0,8), %zmm1 {%k1}
vpxorq (%rdi), %zmm1, %zmm1
kxnorw %k0, %k0, %k1
vpscatterdq %zmm1, (%rdx,%ymm0,8) {%k1}
addq $0x8, %rdx
addq $0x40, %rdi
addq $0x8, %rsi
decq %rax
jne 0x1741e
vzeroupper
retq