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

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

// Assembly:
vpbroadcastd %ecx, %xmm0
vpmulld 0x18d70(%rip), %xmm0, %xmm1 # 0x2f4c0
vpmulld 0x18d77(%rip), %xmm0, %xmm2 # 0x2f4d0
movb $0x2, %al
kmovd %eax, %k1
vpexpandd %ymm0, %ymm0 {%k1} {z}
vpmovsxbq 0x18db2(%rip), %ymm3 # 0x2f520
vpermi2q %ymm0, %ymm2, %ymm3
vpmovsxbq 0x18da7(%rip), %ymm0 # 0x2f524
vpermi2q %ymm1, %ymm3, %ymm0
cmpl $0xf, %edx
jbe 0x1698f
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq (%rsi,%ymm0,8), %zmm1 {%k1}
vmovdqa64 %zmm1, (%rdi)
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x8(%rsi,%ymm0,8), %zmm1 {%k1}
vmovdqa64 %zmm1, 0x40(%rdi)
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x10(%rsi,%ymm0,8), %zmm1 {%k1}
vmovdqa64 %zmm1, 0x80(%rdi)
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x18(%rsi,%ymm0,8), %zmm1 {%k1}
vmovdqa64 %zmm1, 0xc0(%rdi)
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x20(%rsi,%ymm0,8), %zmm1 {%k1}
vmovdqa64 %zmm1, 0x100(%rdi)
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x28(%rsi,%ymm0,8), %zmm1 {%k1}
vmovdqa64 %zmm1, 0x140(%rdi)
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x30(%rsi,%ymm0,8), %zmm1 {%k1}
vmovdqa64 %zmm1, 0x180(%rdi)
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x38(%rsi,%ymm0,8), %zmm1 {%k1}
vmovdqa64 %zmm1, 0x1c0(%rdi)
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x40(%rsi,%ymm0,8), %zmm1 {%k1}
vmovdqa64 %zmm1, 0x200(%rdi)
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x48(%rsi,%ymm0,8), %zmm1 {%k1}
vmovdqa64 %zmm1, 0x240(%rdi)
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x50(%rsi,%ymm0,8), %zmm1 {%k1}
vmovdqa64 %zmm1, 0x280(%rdi)
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x58(%rsi,%ymm0,8), %zmm1 {%k1}
vmovdqa64 %zmm1, 0x2c0(%rdi)
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x60(%rsi,%ymm0,8), %zmm1 {%k1}
vmovdqa64 %zmm1, 0x300(%rdi)
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x68(%rsi,%ymm0,8), %zmm1 {%k1}
vmovdqa64 %zmm1, 0x340(%rdi)
kxnorw %k0, %k0, %k1
vpxor %xmm1, %xmm1, %xmm1
vpgatherdq 0x70(%rsi,%ymm0,8), %zmm1 {%k1}
kxnorw %k0, %k0, %k1
vmovdqa64 %zmm1, 0x380(%rdi)
vpxor %xmm2, %xmm2, %xmm2
vpgatherdq 0x78(%rsi,%ymm0,8), %zmm2 {%k1}
vpxor %xmm1, %xmm1, %xmm1
vmovdqa64 %zmm2, 0x3c0(%rdi)
cmpl $0x13, %edx
jbe 0x169bc
vpxor %xmm2, %xmm2, %xmm2
kxnorw %k0, %k0, %k1
vpgatherdq 0x80(%rsi,%ymm0,8), %zmm2 {%k1}
vmovdqa64 %zmm2, 0x400(%rdi)
vpxor %xmm2, %xmm2, %xmm2
kxnorw %k0, %k0, %k1
vpgatherdq 0x88(%rsi,%ymm0,8), %zmm2 {%k1}
vmovdqa64 %zmm2, 0x440(%rdi)
vpxor %xmm2, %xmm2, %xmm2
kxnorw %k0, %k0, %k1
vpgatherdq 0x90(%rsi,%ymm0,8), %zmm2 {%k1}
vmovdqa64 %zmm2, 0x480(%rdi)
kxnorw %k0, %k0, %k1
vpgatherdq 0x98(%rsi,%ymm0,8), %zmm1 {%k1}
vmovdqa64 %zmm1, 0x4c0(%rdi)
movl %edx, %eax
shlq $0x3, %rax
movl $0xa0, %ecx
cmpq %rcx, %rax
je 0x169ec
leaq (%rsi,%rcx), %rdx
vpxor %xmm1, %xmm1, %xmm1
kxnorw %k0, %k0, %k1
vpgatherdq (%rdx,%ymm0,8), %zmm1 {%k1}
vmovdqa64 %zmm1, (%rdi,%rcx,8)
addq $0x8, %rcx
jmp 0x1696a
movl %edx, %eax
shlq $0x3, %rax
xorl %ecx, %ecx
cmpq %rcx, %rax
je 0x169ec
leaq (%rsi,%rcx), %rdx
vpxor %xmm1, %xmm1, %xmm1
kxnorw %k0, %k0, %k1
vpgatherdq (%rdx,%ymm0,8), %zmm1 {%k1}
vmovdqa64 %zmm1, (%rdi,%rcx,8)
addq $0x8, %rcx
jmp 0x16997
movl %edx, %eax
shlq $0x3, %rax
movl $0x80, %ecx
cmpq %rcx, %rax
je 0x169ec
leaq (%rsi,%rcx), %rdx
vpxor %xmm1, %xmm1, %xmm1
kxnorw %k0, %k0, %k1
vpgatherdq (%rdx,%ymm0,8), %zmm1 {%k1}
vmovdqa64 %zmm1, (%rdi,%rcx,8)
addq $0x8, %rcx
jmp 0x169c7
vzeroupper
retq