// File: /workspace/github_cpp_makefile_star2_O3/adamjanovsky[P]PA193_test_parser_monero/src/keccak/Keccak-readable-and-compact.c
// Function: KeccakF1600_StatePermute
void KeccakF1600_StatePermute(void *state)
{
    unsigned int round, x, y, j, t;
    UINT8 LFSRstate = 0x01;
    
    for(round=0; round<24; round++) {
        {   /* === θ step (see [Keccak Reference, Section 2.3.2]) === */
            tKeccakLane C[5], D;
            
            /* Compute the parity of the columns */
            for(x=0; x<5; x++)
                C[x] = readLane(x, 0) ^ readLane(x, 1) ^ readLane(x, 2) ^ readLane(x, 3) ^ readLane(x, 4);
            for(x=0; x<5; x++) {
                /* Compute the θ effect for a given column */
                D = C[(x+4)%5] ^ ROL64(C[(x+1)%5], 1);
                /* Add the θ effect to the whole column */
                for (y=0; y<5; y++)
                    XORLane(x, y, D);
            }
        }
        
        {   /* === ρ and π steps (see [Keccak Reference, Sections 2.3.3 and 2.3.4]) === */
            tKeccakLane current, temp;
            /* Start at coordinates (1 0) */
            x = 1; y = 0;
            current = readLane(x, y);
            /* Iterate over ((0 1)(2 3))^t * (1 0) for 0 ≤ t ≤ 23 */
            for(t=0; t<24; t++) {
                /* Compute the rotation constant r = (t+1)(t+2)/2 */
                unsigned int r = ((t+1)*(t+2)/2)%64;
                /* Compute ((0 1)(2 3)) * (x y) */
                unsigned int Y = (2*x+3*y)%5; x = y; y = Y;
                /* Swap current and state(x,y), and rotate */
                temp = readLane(x, y);
                writeLane(x, y, ROL64(current, r));
                current = temp;
            }
        }
        
        {   /* === χ step (see [Keccak Reference, Section 2.3.1]) === */
            tKeccakLane temp[5];
            for(y=0; y<5; y++) {
                /* Take a copy of the plane */
                for(x=0; x<5; x++)
                    temp[x] = readLane(x, y);
                /* Compute χ on the plane */
                for(x=0; x<5; x++)
                    writeLane(x, y, temp[x] ^((~temp[(x+1)%5]) & temp[(x+2)%5]));
            }
        }
        
        {   /* === ι step (see [Keccak Reference, Section 2.3.5]) === */
            for(j=0; j<7; j++) {
                unsigned int bitPosition = (1<<j)-1; /* 2^j-1 */
                if (LFSR86540(&LFSRstate))
                    XORLane(0, 0, (tKeccakLane)1<<bitPosition);
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl $0xfffffffd, %esi       # imm = 0xFFFFFFFD
movb $0x1, %bl
xorl %r8d, %r8d
movl $0x4, %r9d
movl $0xcccccccd, %r10d      # imm = 0xCCCCCCCD
xorl %eax, %eax
movl %eax, -0x2c(%rbp)
movq %rdi, %rax
xorl %ecx, %ecx
movl $0x8, %edx
xorl %r14d, %r14d
movq %r14, %r11
shlq $0x8, %r11
movzbl -0x1(%rax,%rdx), %r14d
orq %r11, %r14
decq %rdx
jne 0x4b86
movl $0x2f, %r15d
xorl %edx, %edx
movq %rdx, %r11
shlq $0x8, %r11
movzbl (%rax,%r15), %edx
orq %r11, %rdx
decq %r15
cmpq $0x27, %r15
jne 0x4ba3
movl $0x57, %r12d
xorl %r15d, %r15d
movq %r15, %r11
shlq $0x8, %r11
movzbl (%rax,%r12), %r15d
orq %r11, %r15
decq %r12
cmpq $0x4f, %r12
jne 0x4bc4
xorq %r14, %rdx
movl $0x7f, %r12d
xorl %r14d, %r14d
movq %r14, %r11
shlq $0x8, %r11
movzbl (%rax,%r12), %r14d
orq %r11, %r14
decq %r12
cmpq $0x77, %r12
jne 0x4be8
xorq %r15, %rdx
movl $0xa7, %r15d
xorl %r12d, %r12d
movq %r12, %r11
shlq $0x8, %r11
movzbl (%rax,%r15), %r12d
orq %r11, %r12
decq %r15
cmpq $0x9f, %r15
jne 0x4c0c
xorq %r14, %rdx
xorq %r12, %rdx
movq %rdx, -0x60(%rbp,%rcx,8)
incq %rcx
addq $0x8, %rax
cmpq $0x5, %rcx
jne 0x4b7e
movq %rdi, %rax
xorl %ecx, %ecx
testq %rcx, %rcx
leal 0x2(%rsi,%rcx), %r11d
cmoveq %r9, %r11
incq %rcx
cmpq $0x5, %rcx
movl %ecx, %edx
cmoveq %r8, %rdx
movq -0x60(%rbp,%rdx,8), %rdx
rolq %rdx
xorq -0x60(%rbp,%r11,8), %rdx
movq %rax, %r14
xorl %r15d, %r15d
xorl %r11d, %r11d
movq %rdx, %r12
xorb %r12b, (%r14,%r11)
shrq $0x8, %r12
incq %r11
cmpq $0x8, %r11
jne 0x4c7a
incq %r15
addq $0x28, %r14
cmpq $0x5, %r15
jne 0x4c74
addq $0x8, %rax
cmpq $0x5, %rcx
jne 0x4c48
movl $0xf, %ecx
xorl %eax, %eax
movq %rax, %rdx
shlq $0x8, %rdx
movzbl (%rdi,%rcx), %eax
orq %rdx, %rax
decq %rcx
cmpq $0x7, %rcx
jne 0x4ca9
xorl %edx, %edx
movl $0x1, %r12d
xorl %r14d, %r14d
movl %r14d, %ecx
leal 0x1(%rcx), %r14d
addl $0x2, %ecx
imull %r14d, %ecx
shrl %ecx
leal (%rdx,%rdx,2), %r11d
leal (%r11,%r12,2), %r15d
movq %r15, %r11
imulq %r10, %r11
shrq $0x22, %r11
leal (%r11,%r11,4), %r11d
subl %r11d, %r15d
leal (%r15,%r15,4), %r11d
addl %edx, %r11d
leaq (%rdi,%r11,8), %r12
movl $0x8, %r11d
xorl %r13d, %r13d
movq %r13, %r9
shlq $0x8, %r9
movzbl -0x1(%r12,%r11), %r13d
orq %r9, %r13
decq %r11
jne 0x4d09
movq %rax, %r9
shlq %cl, %r9
andb $0x3f, %cl
negb %cl
shrq %cl, %rax
xorq %r9, %rax
xorl %ecx, %ecx
movb %al, (%r12,%rcx)
shrq $0x8, %rax
incq %rcx
cmpq $0x8, %rcx
jne 0x4d31
movl %edx, %r12d
movl %r15d, %edx
movq %r13, %rax
cmpl $0x18, %r14d
jne 0x4ccb
movq %rdi, %rax
xorl %ecx, %ecx
movq %rax, %rdx
xorl %r14d, %r14d
movl $0x8, %r11d
xorl %r15d, %r15d
movq %r15, %r9
shlq $0x8, %r9
movzbl -0x1(%rdx,%r11), %r15d
orq %r9, %r15
decq %r11
jne 0x4d69
movq %r15, -0x60(%rbp,%r14,8)
incq %r14
addq $0x8, %rdx
cmpq $0x5, %r14
jne 0x4d60
movq %rax, %rdx
xorl %r14d, %r14d
movq %r14, %r9
incq %r14
cmpq $0x5, %r14
movl %r14d, %r11d
cmoveq %r8, %r11
movq -0x60(%rbp,%r11,8), %r15
cmpq $0x3, %r9
movl $0x2, %r11d
cmovael %esi, %r11d
notq %r15
addl %r9d, %r11d
andq -0x60(%rbp,%r11,8), %r15
xorq -0x60(%rbp,%r9,8), %r15
xorl %r11d, %r11d
movb %r15b, (%rdx,%r11)
shrq $0x8, %r15
incq %r11
cmpq $0x8, %r11
jne 0x4dcd
addq $0x8, %rdx
cmpq $0x5, %r14
jne 0x4d96
incq %rcx
addq $0x28, %rax
cmpq $0x5, %rcx
jne 0x4d5a
xorl %eax, %eax
movl %ebx, %ecx
leal (%rcx,%rcx), %edx
movzbl %dl, %r9d
xorb $0x71, %dl
testb %bl, %bl
movzbl %dl, %ebx
cmovnsl %r9d, %ebx
testb $0x1, %cl
je 0x4e3e
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl %eax, %ecx
shll %cl, %edx
notb %dl
movl $0x1, %r14d
movl %edx, %ecx
shlq %cl, %r14
xorl %ecx, %ecx
xorb %r14b, (%rdi,%rcx)
shrq $0x8, %r14
incq %rcx
cmpq $0x8, %rcx
jne 0x4e2d
incl %eax
cmpl $0x7, %eax
jne 0x4dfb
movl -0x2c(%rbp), %eax
incl %eax
cmpl $0x18, %eax
movl $0x4, %r9d
jne 0x4b76
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq