// File: /workspace/github_c_makefile_star2_O0/mjosaarinen[P]brutus/crypto_aead/lakekeyakv2/generic32lc/KeccakP-800-opt32.c
// Function: KeccakP800_ExtractBytes
void KeccakP800_ExtractBytes(const void *argState, unsigned char *data, unsigned int offset, unsigned int length)
{
#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN)
#ifdef KeccakP800_useLaneComplementing
    unsigned int sizeLeft = length;
    unsigned int lanePosition = offset/4;
    unsigned int offsetInLane = offset%4;
    unsigned char *curData = data;
    const UINT32 *state = (const UINT32*)argState;
    const UINT32 *pLaneComplement;

    state += lanePosition;
    pLaneComplement = KeccakP800LaneComplement + lanePosition;
    if ((sizeLeft > 0) && (offsetInLane != 0)) {
        unsigned int bytesInLane = 4 - offsetInLane;
        UINT32  lane = (*state++ ^ *pLaneComplement++) >> (offsetInLane * 8);
        if (bytesInLane > sizeLeft)
            bytesInLane = sizeLeft;
        sizeLeft -= bytesInLane;
        do {
            *curData++ = (unsigned char)lane;
            lane >>= 8;
        }
        while ( --bytesInLane != 0);
        lanePosition++;
    }

    while(sizeLeft >= 4) {
        WRITE32_UNALIGNED( curData, *state++ ^ *pLaneComplement++ );
        sizeLeft -= 4;
        curData += 4;
    }

    if (sizeLeft > 0) {
        UINT32  lane = *state ^ *pLaneComplement;
        unsigned int i;
        for ( i = 0; i < sizeLeft; ++i ) {
            *curData++ = (unsigned char)lane;
            lane >>= 8;
        }
    }
#else
    memcpy(data, (unsigned char*)argState+offset, length);
#endif
#else
#error "Not yet implemented"
#endif
}

// Assembly:
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movl %edx, -0x14(%rsp)
movl %ecx, -0x18(%rsp)
movl -0x18(%rsp), %eax
movl %eax, -0x1c(%rsp)
movl -0x14(%rsp), %eax
shrl $0x2, %eax
movl %eax, -0x20(%rsp)
movl -0x14(%rsp), %eax
andl $0x3, %eax
movl %eax, -0x24(%rsp)
movq -0x10(%rsp), %rax
movq %rax, -0x30(%rsp)
movq -0x8(%rsp), %rax
movq %rax, -0x38(%rsp)
movl -0x20(%rsp), %ecx
movq -0x38(%rsp), %rax
movl %ecx, %ecx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rsp)
movl -0x20(%rsp), %eax
movl %eax, %ecx
movq 0x102d8(%rip), %rax     # 0x1fff0
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rsp)
cmpl $0x0, -0x1c(%rsp)
jbe 0xfdd9
cmpl $0x0, -0x24(%rsp)
je 0xfdd9
movl $0x4, %eax
subl -0x24(%rsp), %eax
movl %eax, -0x44(%rsp)
movq -0x38(%rsp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x38(%rsp)
movl (%rax), %eax
movq -0x40(%rsp), %rcx
movq %rcx, %rdx
addq $0x4, %rdx
movq %rdx, -0x40(%rsp)
xorl (%rcx), %eax
movl -0x24(%rsp), %ecx
shll $0x3, %ecx
shrl %cl, %eax
movl %eax, -0x48(%rsp)
movl -0x44(%rsp), %eax
cmpl -0x1c(%rsp), %eax
jbe 0xfd8c
movl -0x1c(%rsp), %eax
movl %eax, -0x44(%rsp)
movl -0x44(%rsp), %ecx
movl -0x1c(%rsp), %eax
subl %ecx, %eax
movl %eax, -0x1c(%rsp)
movl -0x48(%rsp), %eax
movb %al, %cl
movq -0x30(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rsp)
movb %cl, (%rax)
movl -0x48(%rsp), %eax
shrl $0x8, %eax
movl %eax, -0x48(%rsp)
movl -0x44(%rsp), %eax
addl $-0x1, %eax
movl %eax, -0x44(%rsp)
cmpl $0x0, %eax
jne 0xfd9a
movl -0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rsp)
jmp 0xfddb
cmpl $0x4, -0x1c(%rsp)
jb 0xfe2a
movq -0x38(%rsp), %rax
movq %rax, %rcx
addq $0x4, %rcx
movq %rcx, -0x38(%rsp)
movl (%rax), %ecx
movq -0x40(%rsp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, -0x40(%rsp)
xorl (%rax), %ecx
movq -0x30(%rsp), %rax
movl %ecx, (%rax)
movl -0x1c(%rsp), %eax
subl $0x4, %eax
movl %eax, -0x1c(%rsp)
movq -0x30(%rsp), %rax
addq $0x4, %rax
movq %rax, -0x30(%rsp)
jmp 0xfddb
cmpl $0x0, -0x1c(%rsp)
jbe 0xfe88
movq -0x38(%rsp), %rax
movl (%rax), %eax
movq -0x40(%rsp), %rcx
xorl (%rcx), %eax
movl %eax, -0x4c(%rsp)
movl $0x0, -0x50(%rsp)
movl -0x50(%rsp), %eax
cmpl -0x1c(%rsp), %eax
jae 0xfe86
movl -0x4c(%rsp), %eax
movb %al, %cl
movq -0x30(%rsp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rsp)
movb %cl, (%rax)
movl -0x4c(%rsp), %eax
shrl $0x8, %eax
movl %eax, -0x4c(%rsp)
movl -0x50(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rsp)
jmp 0xfe4b
jmp 0xfe88
retq
nopl (%rax)