// File: /workspace/github_c_makefile_star2_O1/mjosaarinen[P]brutus/crypto_aead/lunarkeyakv2/compact/KeccakP-200-compact.c
// Function: KeccakP200_Permute_Nrounds
void KeccakP200_Permute_Nrounds(void *argState, unsigned int nr)
{
    tSmallUInt x, y;
    tKeccakLane temp;
    tKeccakLane BC[5];
    tKeccakLane *state;
    const tKeccakLane *rc;

    state = (tKeccakLane*)argState;
    rc = KeccakF200_RoundConstants + 18 - nr;
    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)] ^ ROL8(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[KeccakP200_PiLane[x]];
            state[KeccakP200_PiLane[x]] = ROL8( temp, KeccakP200_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 */
        temp = *(rc++);
        state[0] ^= temp;
    }
    while( temp != 0x80 );
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %esi, %ecx
movq 0xcbf7(%rip), %rax      # 0x12ff8
subq %rcx, %rax
addq $0x12, %rax
leaq 0x1(%rdi), %rcx
movq %rcx, -0x8(%rsp)
leaq 0x5(%rdi), %rcx
movq %rcx, -0x10(%rsp)
leaq 0xa(%rdi), %rsi
leaq 0xf(%rdi), %r8
leaq 0x14(%rdi), %r9
movw $0x1f, %r10w
kmovd %r10d, %k1
movq 0xcb91(%rip), %r10      # 0x12fc8
movq 0xcbaa(%rip), %r11      # 0x12fe8
movq 0xcb4b(%rip), %rbx      # 0x12f90
leaq -0x18(%rsp), %r14
vmovdqu8 (%rdi), %xmm0 {%k1} {z}
movq -0x10(%rsp), %rcx
vmovdqu8 (%rcx), %xmm1 {%k1} {z}
vmovdqu8 (%rsi), %xmm2 {%k1} {z}
vpternlogq $0x96, %xmm0, %xmm1, %xmm2
vmovdqu8 (%r8), %xmm0 {%k1} {z}
vmovdqu8 (%r9), %xmm1 {%k1} {z}
vpternlogq $0x96, %xmm0, %xmm2, %xmm1
vmovdqu8 %xmm1, -0x18(%rsp) {%k1}
movq %rdi, %r15
xorl %r12d, %r12d
movzbl 0x4(%r12,%r10), %r13d
movzbl 0x1(%r10,%r12), %ebp
incq %r12
movb -0x18(%rsp,%rbp), %bpl
rolb %bpl
xorb -0x18(%rsp,%r13), %bpl
movq $-0x5, %r13
xorb %bpl, 0x5(%r15,%r13)
addq $0x5, %r13
cmpq $0x14, %r13
jb 0x64af
incq %r15
cmpq $0x5, %r12
jne 0x648c
xorl %r15d, %r15d
movq -0x8(%rsp), %r12
movzbl (%r12), %ebp
movzbl (%r11,%r15), %r12d
movb (%rdi,%r12), %r13b
movb %r13b, -0x18(%rsp)
movb (%rbx,%r15), %r13b
andb $0x7, %r13b
shlxl %r13d, %ebp, %edx
movb $0x8, %cl
subb %r13b, %cl
shrxl %ecx, %ebp, %ecx
xorl %edx, %ecx
movb %cl, (%rdi,%r12)
incq %r15
movq %r14, %r12
cmpq $0x18, %r15
jne 0x64cf
movq %rdi, %r15
xorl %r12d, %r12d
movl (%rdi,%r12), %ecx
movl %ecx, -0x18(%rsp)
movb 0x4(%rdi,%r12), %cl
movb %cl, -0x14(%rsp)
xorl %r13d, %r13d
movzbl 0x1(%r10,%r13), %ecx
movb -0x18(%rsp,%rcx), %cl
notb %cl
movzbl 0x2(%r10,%r13), %edx
andb -0x18(%rsp,%rdx), %cl
xorb -0x18(%rsp,%r13), %cl
movb %cl, (%r15,%r13)
leaq 0x1(%r13), %rcx
movq %rcx, %r13
cmpq $0x5, %rcx
jne 0x6525
leaq 0x5(%r12), %rcx
addq $0x5, %r15
cmpq $0x14, %r12
movq %rcx, %r12
jb 0x6511
movb (%rax), %cl
incq %rax
xorb %cl, (%rdi)
cmpb $-0x80, %cl
jne 0x644a
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq