// File: /workspace/github_c_makefile_star2_O1/mjosaarinen[P]brutus/crypto_aead/lakekeyakv2/SandyBridge/KeccakP-1600-times2-SIMD128.c
// Function: KeccakP1600times2_OverwriteLanesAll
void KeccakP1600times2_OverwriteLanesAll(void *states, const unsigned char *data, unsigned int laneCount, unsigned int laneOffset)
{
    V128 *stateAsLanes = states;
    unsigned int i;
    const UINT64 *curData0 = (const UINT64 *)data;
    const UINT64 *curData1 = (const UINT64 *)(data+laneOffset*SnP_laneLengthInBytes);
    #define OverWr( argIndex )  STORE128(stateAsLanes[argIndex], LOAD6464(curData1[argIndex], curData0[argIndex]))
    if ( laneCount >= 17 )  {
        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 );
        OverWr( 16 );
        if ( laneCount >= 21 )  {
            OverWr( 17 );
            OverWr( 18 );
            OverWr( 19 );
            OverWr( 20 );
            for(i=21; i<laneCount; i++)
                OverWr( i );
        }
        else {
            for(i=17; i<laneCount; i++)
                OverWr( i );
        }
    }
    else {
        for(i=0; i<laneCount; i++)
            OverWr( i );
    }
    #undef  OverWr
}

// Assembly:
shll $0x3, %ecx
addq %rsi, %rcx
cmpl $0x10, %edx
jbe 0x130b6
vmovsd (%rcx), %xmm0
vmovsd (%rsi), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vmovaps %xmm0, (%rdi)
vmovsd 0x8(%rcx), %xmm0
vmovsd 0x8(%rsi), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vmovaps %xmm0, 0x10(%rdi)
vmovsd 0x10(%rcx), %xmm0
vmovsd 0x10(%rsi), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vmovaps %xmm0, 0x20(%rdi)
vmovsd 0x18(%rcx), %xmm0
vmovsd 0x18(%rsi), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vmovaps %xmm0, 0x30(%rdi)
vmovsd 0x20(%rcx), %xmm0
vmovsd 0x20(%rsi), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vmovaps %xmm0, 0x40(%rdi)
vmovsd 0x28(%rcx), %xmm0
vmovsd 0x28(%rsi), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vmovaps %xmm0, 0x50(%rdi)
vmovsd 0x30(%rcx), %xmm0
vmovsd 0x30(%rsi), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vmovaps %xmm0, 0x60(%rdi)
vmovsd 0x38(%rcx), %xmm0
vmovsd 0x38(%rsi), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vmovaps %xmm0, 0x70(%rdi)
vmovsd 0x40(%rcx), %xmm0
vmovsd 0x40(%rsi), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vmovaps %xmm0, 0x80(%rdi)
vmovsd 0x48(%rcx), %xmm0
vmovsd 0x48(%rsi), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vmovaps %xmm0, 0x90(%rdi)
vmovsd 0x50(%rcx), %xmm0
vmovsd 0x50(%rsi), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vmovaps %xmm0, 0xa0(%rdi)
vmovsd 0x58(%rcx), %xmm0
vmovsd 0x58(%rsi), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vmovaps %xmm0, 0xb0(%rdi)
vmovsd 0x60(%rcx), %xmm0
vmovsd 0x60(%rsi), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vmovaps %xmm0, 0xc0(%rdi)
vmovsd 0x68(%rcx), %xmm0
vmovsd 0x68(%rsi), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vmovaps %xmm0, 0xd0(%rdi)
vmovsd 0x70(%rcx), %xmm0
vmovsd 0x70(%rsi), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vmovaps %xmm0, 0xe0(%rdi)
vmovsd 0x78(%rcx), %xmm0
vmovsd 0x78(%rsi), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vmovaps %xmm0, 0xf0(%rdi)
vmovsd 0x80(%rcx), %xmm0
vmovsd 0x80(%rsi), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vmovaps %xmm0, 0x100(%rdi)
cmpl $0x14, %edx
jbe 0x130e0
vmovsd 0x88(%rcx), %xmm0
vmovsd 0x88(%rsi), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vmovaps %xmm0, 0x110(%rdi)
vmovsd 0x90(%rcx), %xmm0
vmovsd 0x90(%rsi), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vmovaps %xmm0, 0x120(%rdi)
vmovsd 0x98(%rcx), %xmm0
vmovsd 0x98(%rsi), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vmovaps %xmm0, 0x130(%rdi)
vmovsd 0xa0(%rcx), %xmm0
vmovsd 0xa0(%rsi), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vmovaps %xmm0, 0x140(%rdi)
cmpl $0x15, %edx
je 0x13111
movl %edx, %eax
addq $0x150, %rdi            # imm = 0x150
movl $0x15, %edx
vmovsd (%rcx,%rdx,8), %xmm0
vmovsd (%rsi,%rdx,8), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vmovaps %xmm0, (%rdi)
incq %rdx
addq $0x10, %rdi
cmpq %rdx, %rax
jne 0x13096
jmp 0x13111
testl %edx, %edx
je 0x13111
movl %edx, %eax
shlq $0x3, %rax
xorl %edx, %edx
vmovsd (%rcx,%rdx), %xmm0
vmovsd (%rsi,%rdx), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vmovaps %xmm0, (%rdi,%rdx,2)
addq $0x8, %rdx
cmpq %rdx, %rax
jne 0x130c2
jmp 0x13111
cmpl $0x11, %edx
je 0x13111
movl %edx, %eax
addq $0x110, %rdi            # imm = 0x110
movl $0x11, %edx
vmovsd (%rcx,%rdx,8), %xmm0
vmovsd (%rsi,%rdx,8), %xmm1
vmovlhps %xmm0, %xmm1, %xmm0     # xmm0 = xmm1[0],xmm0[0]
vmovaps %xmm0, (%rdi)
incq %rdx
addq $0x10, %rdi
cmpq %rdx, %rax
jne 0x130f3
retq