// File: /workspace/github_c_makefile_star2_O2/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 %rbx
movl %esi, %ecx
movq 0xcbb7(%rip), %rax      # 0x12ff8
subq %rcx, %rax
addq $0x12, %rax
leaq 0x1(%rdi), %rcx
movq 0xcb75(%rip), %rdx      # 0x12fc8
movq 0xcb8e(%rip), %rsi      # 0x12fe8
movq 0xcb2f(%rip), %r8       # 0x12f90
leaq -0x8(%rsp), %r9
xorl %r10d, %r10d
cmpq $0x5, %r10
je 0x6491
movb 0x5(%rdi,%r10), %r11b
xorb (%rdi,%r10), %r11b
xorb 0xa(%rdi,%r10), %r11b
xorb 0xf(%rdi,%r10), %r11b
xorb 0x14(%rdi,%r10), %r11b
movb %r11b, -0x8(%rsp,%r10)
incq %r10
jmp 0x6469
movq %rdi, %r10
xorl %r11d, %r11d
cmpq $0x5, %r11
je 0x64cf
movzbl 0x4(%r11,%rdx), %r14d
movzbl 0x1(%rdx,%r11), %ebx
incq %r11
movb -0x8(%rsp,%rbx), %bl
rolb %bl
xorb -0x8(%rsp,%r14), %bl
xorl %r14d, %r14d
cmpq $0x18, %r14
ja 0x64ca
xorb %bl, (%r10,%r14)
addq $0x5, %r14
jmp 0x64ba
incq %r10
jmp 0x6497
xorl %r10d, %r10d
movq %rcx, %r11
cmpq $0x18, %r10
je 0x6514
movzbl (%r11), %r11d
movzbl (%rsi,%r10), %ebx
movb (%rdi,%rbx), %bpl
movb %bpl, -0x8(%rsp)
movb (%r8,%r10), %bpl
andb $0x7, %bpl
shlxl %ebp, %r11d, %r14d
movb $0x8, %r15b
subb %bpl, %r15b
shrxl %r15d, %r11d, %r11d
xorl %r14d, %r11d
movb %r11b, (%rdi,%rbx)
incq %r10
movq %r9, %r11
jmp 0x64d5
movq %rdi, %r10
xorl %r11d, %r11d
cmpq $0x18, %r11
ja 0x656a
movl (%rdi,%r11), %ebx
movl %ebx, -0x8(%rsp)
movb 0x4(%rdi,%r11), %bl
movb %bl, -0x4(%rsp)
xorl %ebx, %ebx
cmpq $0x5, %rbx
je 0x6560
movzbl 0x1(%rdx,%rbx), %r14d
movb -0x8(%rsp,%r14), %bpl
notb %bpl
movzbl 0x2(%rdx,%rbx), %r14d
andb -0x8(%rsp,%r14), %bpl
xorb -0x8(%rsp,%rbx), %bpl
movb %bpl, (%r10,%rbx)
incq %rbx
jmp 0x6533
addq $0x5, %r11
addq $0x5, %r10
jmp 0x651a
movb (%rax), %r10b
incq %rax
xorb %r10b, (%rdi)
cmpb $-0x80, %r10b
jne 0x6466
popq %rbx
popq %r14
popq %r15
popq %rbp
retq