// File: /workspace/github_c_makefile_star2_O0/mjosaarinen[P]brutus/crypto_aead/lakekeyakv2/SandyBridge/KeccakP-1600-times2-SIMD128.c
// Function: KeccakP1600times2_AddBytes
void KeccakP1600times2_AddBytes(void *states, unsigned int instanceIndex, const unsigned char *data, unsigned int offset, unsigned int length)
{
    unsigned int sizeLeft = length;
    unsigned int lanePosition = offset/SnP_laneLengthInBytes;
    unsigned int offsetInLane = offset%SnP_laneLengthInBytes;
    const unsigned char *curData = data;
    UINT64 *statesAsLanes = states;

    if ((sizeLeft > 0) && (offsetInLane != 0)) {
        unsigned int bytesInLane = SnP_laneLengthInBytes - offsetInLane;
        UINT64 lane = 0;
        if (bytesInLane > sizeLeft)
            bytesInLane = sizeLeft;
        memcpy((unsigned char*)&lane + offsetInLane, curData, bytesInLane);
        statesAsLanes[laneIndex(instanceIndex, lanePosition)] ^= lane;
        sizeLeft -= bytesInLane;
        lanePosition++;
        curData += bytesInLane;
    }

    while(sizeLeft >= SnP_laneLengthInBytes) {
        UINT64 lane = *((const UINT64*)curData);
        statesAsLanes[laneIndex(instanceIndex, lanePosition)] ^= lane;
        sizeLeft -= SnP_laneLengthInBytes;
        lanePosition++;
        curData += SnP_laneLengthInBytes;
    }

    if (sizeLeft > 0) {
        UINT64 lane = 0;
        memcpy(&lane, curData, sizeLeft);
        statesAsLanes[laneIndex(instanceIndex, lanePosition)] ^= lane;
    }
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x60(%rsp)
movl %esi, 0x5c(%rsp)
movq %rdx, 0x50(%rsp)
movl %ecx, 0x4c(%rsp)
movl %r8d, 0x48(%rsp)
movl 0x48(%rsp), %eax
movl %eax, 0x44(%rsp)
movl 0x4c(%rsp), %eax
shrl $0x3, %eax
movl %eax, 0x40(%rsp)
movl 0x4c(%rsp), %eax
andl $0x7, %eax
movl %eax, 0x3c(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x60(%rsp), %rax
movq %rax, 0x28(%rsp)
cmpl $0x0, 0x44(%rsp)
jbe 0x12b01
cmpl $0x0, 0x3c(%rsp)
je 0x12b01
movl $0x8, %eax
subl 0x3c(%rsp), %eax
movl %eax, 0x24(%rsp)
movq $0x0, 0x18(%rsp)
movl 0x24(%rsp), %eax
cmpl 0x44(%rsp), %eax
jbe 0x12a9b
movl 0x44(%rsp), %eax
movl %eax, 0x24(%rsp)
movl 0x3c(%rsp), %eax
leaq 0x18(%rsp), %rdi
addq %rax, %rdi
movq 0x30(%rsp), %rsi
movl 0x24(%rsp), %eax
movl %eax, %edx
callq 0x55a0
movq 0x18(%rsp), %rdx
movq 0x28(%rsp), %rax
movl 0x40(%rsp), %ecx
shll %ecx
addl 0x5c(%rsp), %ecx
movl %ecx, %ecx
xorq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movl 0x24(%rsp), %ecx
movl 0x44(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x44(%rsp)
movl 0x40(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x40(%rsp)
movl 0x24(%rsp), %ecx
movq 0x30(%rsp), %rax
movl %ecx, %ecx
addq %rcx, %rax
movq %rax, 0x30(%rsp)
jmp 0x12b03
cmpl $0x8, 0x44(%rsp)
jb 0x12b5b
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rdx
movq 0x28(%rsp), %rax
movl 0x40(%rsp), %ecx
shll %ecx
addl 0x5c(%rsp), %ecx
movl %ecx, %ecx
xorq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movl 0x44(%rsp), %eax
subl $0x8, %eax
movl %eax, 0x44(%rsp)
movl 0x40(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x40(%rsp)
movq 0x30(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x30(%rsp)
jmp 0x12b03
cmpl $0x0, 0x44(%rsp)
jbe 0x12b9e
movq $0x0, 0x8(%rsp)
movq 0x30(%rsp), %rsi
movl 0x44(%rsp), %eax
movl %eax, %edx
leaq 0x8(%rsp), %rdi
callq 0x55a0
movq 0x8(%rsp), %rdx
movq 0x28(%rsp), %rax
movl 0x40(%rsp), %ecx
shll %ecx
addl 0x5c(%rsp), %ecx
movl %ecx, %ecx
xorq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
addq $0x68, %rsp
retq
nopw %cs:(%rax,%rax)