// File: /workspace/github_c_makefile_star2_O0/mjosaarinen[P]brutus/crypto_aead/lunarkeyakv2/compact/KeccakP-1600-compact64.c
// Function: KeccakP1600_Permute_Nrounds
void KeccakP1600_Permute_Nrounds(void *argState, UINT8 rounds, UINT8 LFSRinitialState)
{
    tSmallUInt x, y, round;
    tKeccakLane        temp;
    tKeccakLane        BC[5];
    tKeccakLane     *state;
    UINT8           LFSRstate;

    state = (tKeccakLane*)argState;
    LFSRstate = LFSRinitialState;
    round = rounds;
    do
    {
        /* Theta */
        for ( x = 0; x < 5; ++x )
        {
            BC[x] = state[x] ^ state[5 + x] ^ state[10 + x] ^ state[15 + x] ^ state[20 + x];
        }
        for ( x = 0; x < 5; ++x )
        {
            temp = BC[MOD5(x+4)] ^ ROL64(BC[MOD5(x+1)], 1);
            for ( y = 0; y < 25; y += 5 )
            {
                state[y + x] ^= temp;
            }
        }

        /* Rho Pi */
        temp = state[1];
        for ( x = 0; x < 24; ++x )
        {
            BC[0] = state[KeccakP1600_PiLane[x]];
            state[KeccakP1600_PiLane[x]] = ROL64( temp, KeccakP1600_RotationConstants[x] );
            temp = BC[0];
        }

        /*    Chi */
        for ( y = 0; y < 25; y += 5 )
        {
#if defined(UNROLL_CHILOOP)
            BC[0] = state[y + 0];
            BC[1] = state[y + 1];
            BC[2] = state[y + 2];
            BC[3] = state[y + 3];
            BC[4] = state[y + 4];
#else
            for ( x = 0; x < 5; ++x )
            {
                BC[x] = state[y + x];
            }
#endif
            for ( x = 0; x < 5; ++x )
            {
                state[y + x] = BC[x] ^((~BC[MOD5(x+1)]) & BC[MOD5(x+2)]);
            }
        }

        /*    Iota */
        state[0] ^= KeccakF1600_GetNextRoundConstant(&LFSRstate);
    }
    while( --round != 0 );
}

// Assembly:
subq $0x58, %rsp
movb %dl, %al
movb %sil, %cl
movq %rdi, 0x50(%rsp)
movb %cl, 0x4f(%rsp)
movb %al, 0x4e(%rsp)
movq 0x50(%rsp), %rax
movq %rax, 0x8(%rsp)
movb 0x4e(%rsp), %al
movb %al, 0x7(%rsp)
movzbl 0x4f(%rsp), %eax
movl %eax, 0x40(%rsp)
movl $0x0, 0x48(%rsp)
cmpl $0x5, 0x48(%rsp)
jae 0x5cdb
movq 0x8(%rsp), %rax
movl 0x48(%rsp), %ecx
movq (%rax,%rcx,8), %rcx
movq 0x8(%rsp), %rax
movl 0x48(%rsp), %edx
addl $0x5, %edx
movl %edx, %edx
xorq (%rax,%rdx,8), %rcx
movq 0x8(%rsp), %rax
movl 0x48(%rsp), %edx
addl $0xa, %edx
movl %edx, %edx
xorq (%rax,%rdx,8), %rcx
movq 0x8(%rsp), %rax
movl 0x48(%rsp), %edx
addl $0xf, %edx
movl %edx, %edx
xorq (%rax,%rdx,8), %rcx
movq 0x8(%rsp), %rax
movl 0x48(%rsp), %edx
addl $0x14, %edx
movl %edx, %edx
xorq (%rax,%rdx,8), %rcx
movl 0x48(%rsp), %eax
movq %rcx, 0x10(%rsp,%rax,8)
movl 0x48(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
jmp 0x5c69
movl $0x0, 0x48(%rsp)
cmpl $0x5, 0x48(%rsp)
jae 0x5d9b
movl 0x48(%rsp), %eax
addl $0x4, %eax
movl %eax, %eax
movl %eax, %ecx
movq 0x132d8(%rip), %rax     # 0x18fd8
movzbl (%rax,%rcx), %eax
movq 0x10(%rsp,%rax,8), %rax
movl 0x48(%rsp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movl %ecx, %edx
movq 0x132bd(%rip), %rcx     # 0x18fd8
movzbl (%rcx,%rdx), %ecx
movq 0x10(%rsp,%rcx,8), %rcx
shlq %rcx
movl 0x48(%rsp), %edx
addl $0x1, %edx
movl %edx, %edx
movl %edx, %esi
movq 0x1329f(%rip), %rdx     # 0x18fd8
movzbl (%rdx,%rsi), %edx
movq 0x10(%rsp,%rdx,8), %rdx
shrq $0x3f, %rdx
xorq %rdx, %rcx
xorq %rcx, %rax
movq %rax, 0x38(%rsp)
movl $0x0, 0x44(%rsp)
cmpl $0x19, 0x44(%rsp)
jae 0x5d89
movq 0x38(%rsp), %rdx
movq 0x8(%rsp), %rax
movl 0x44(%rsp), %ecx
addl 0x48(%rsp), %ecx
movl %ecx, %ecx
xorq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movl 0x44(%rsp), %eax
addl $0x5, %eax
movl %eax, 0x44(%rsp)
jmp 0x5d59
jmp 0x5d8b
movl 0x48(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
jmp 0x5ce3
movq 0x8(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x38(%rsp)
movl $0x0, 0x48(%rsp)
cmpl $0x18, 0x48(%rsp)
jae 0x5e51
movq 0x8(%rsp), %rax
movl 0x48(%rsp), %ecx
movl %ecx, %edx
movq 0x131da(%rip), %rcx     # 0x18fa8
movzbl (%rcx,%rdx), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, 0x10(%rsp)
movq 0x38(%rsp), %rdx
movl 0x48(%rsp), %eax
movl %eax, %ecx
movq 0x131cb(%rip), %rax     # 0x18fb8
movzbl (%rax,%rcx), %eax
movl %eax, %eax
movl %eax, %ecx
shlq %cl, %rdx
movq 0x38(%rsp), %rax
movl 0x48(%rsp), %ecx
movl %ecx, %esi
movq 0x131ae(%rip), %rcx     # 0x18fb8
movzbl (%rcx,%rsi), %esi
movl $0x40, %ecx
subl %esi, %ecx
movl %ecx, %ecx
shrq %cl, %rax
xorq %rax, %rdx
movq 0x8(%rsp), %rax
movl 0x48(%rsp), %ecx
movl %ecx, %esi
movq 0x13179(%rip), %rcx     # 0x18fa8
movzbl (%rcx,%rsi), %ecx
movq %rdx, (%rax,%rcx,8)
movq 0x10(%rsp), %rax
movq %rax, 0x38(%rsp)
movl 0x48(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
jmp 0x5db1
movl $0x0, 0x44(%rsp)
cmpl $0x19, 0x44(%rsp)
jae 0x5f5e
movq 0x8(%rsp), %rax
movl 0x44(%rsp), %ecx
addl $0x0, %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
movq %rax, 0x10(%rsp)
movq 0x8(%rsp), %rax
movl 0x44(%rsp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
movq %rax, 0x18(%rsp)
movq 0x8(%rsp), %rax
movl 0x44(%rsp), %ecx
addl $0x2, %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
movq %rax, 0x20(%rsp)
movq 0x8(%rsp), %rax
movl 0x44(%rsp), %ecx
addl $0x3, %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
movq %rax, 0x28(%rsp)
movq 0x8(%rsp), %rax
movl 0x44(%rsp), %ecx
addl $0x4, %ecx
movl %ecx, %ecx
movq (%rax,%rcx,8), %rax
movq %rax, 0x30(%rsp)
movl $0x0, 0x48(%rsp)
cmpl $0x5, 0x48(%rsp)
jae 0x5f4c
movl 0x48(%rsp), %eax
movq 0x10(%rsp,%rax,8), %rdx
movl 0x48(%rsp), %eax
addl $0x1, %eax
movl %eax, %eax
movl %eax, %ecx
movq 0x130d7(%rip), %rax     # 0x18fd8
movzbl (%rax,%rcx), %eax
movq 0x10(%rsp,%rax,8), %rax
xorq $-0x1, %rax
movl 0x48(%rsp), %ecx
addl $0x2, %ecx
movl %ecx, %ecx
movl %ecx, %esi
movq 0x130b8(%rip), %rcx     # 0x18fd8
movzbl (%rcx,%rsi), %ecx
andq 0x10(%rsp,%rcx,8), %rax
xorq %rax, %rdx
movq 0x8(%rsp), %rax
movl 0x44(%rsp), %ecx
addl 0x48(%rsp), %ecx
movl %ecx, %ecx
movq %rdx, (%rax,%rcx,8)
movl 0x48(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
jmp 0x5edf
jmp 0x5f4e
movl 0x44(%rsp), %eax
addl $0x5, %eax
movl %eax, 0x44(%rsp)
jmp 0x5e59
leaq 0x7(%rsp), %rdi
callq 0x5f90
movq %rax, %rcx
movq 0x8(%rsp), %rax
xorq (%rax), %rcx
movq %rcx, (%rax)
movl 0x40(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x40(%rsp)
cmpl $0x0, %eax
jne 0x5c61
addq $0x58, %rsp
retq
nop