// File: /workspace/github_c_makefile_star2_O3/mjosaarinen[P]brutus/crypto_aead/lakekeyakv2/generic32/KeccakP-400-reference.c
// Function: KeccakP400Round
void KeccakP400Round(tKeccakLane *state, unsigned int indexRound)
{
#ifdef KeccakReference
    displayRoundNumber(3, indexRound);
#endif

    theta(state);
#ifdef KeccakReference
    displayStateAsLanes(3, "After theta", state, 400);
#endif

    rho(state);
#ifdef KeccakReference
    displayStateAsLanes(3, "After rho", state, 400);
#endif

    pi(state);
#ifdef KeccakReference
    displayStateAsLanes(3, "After pi", state, 400);
#endif

    chi(state);
#ifdef KeccakReference
    displayStateAsLanes(3, "After chi", state, 400);
#endif

    iota(state, indexRound);
#ifdef KeccakReference
    displayStateAsLanes(3, "After iota", state, 400);
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movb $0x1f, %al
kmovd %eax, %k1
vmovdqu16 (%rdi), %xmm0 {%k1} {z}
vmovdqu16 0xa(%rdi), %xmm1 {%k1} {z}
vmovdqu16 0x14(%rdi), %xmm2 {%k1} {z}
vpternlogq $0x96, %xmm0, %xmm1, %xmm2
vmovdqu16 0x1e(%rdi), %xmm0 {%k1} {z}
vmovdqu16 0x28(%rdi), %xmm1 {%k1} {z}
movl $0xfffffffd, %eax       # imm = 0xFFFFFFFD
vpternlogq $0x96, %xmm2, %xmm0, %xmm1
vmovdqu16 %xmm1, -0x40(%rsp) {%k1}
xorl %ecx, %ecx
movl $0x4, %edx
leaq 0x1(%rcx), %r8
cmpq $0x4, %rcx
movl $0x0, %r9d
cmovneq %r8, %r9
movzwl -0x40(%rsp,%r9,2), %r9d
rolw %r9w
testq %rcx, %rcx
leal 0x2(%rax,%rcx), %r10d
cmoveq %rdx, %r10
xorw -0x40(%rsp,%r10,2), %r9w
movw %r9w, -0x4a(%rsp,%rcx,2)
movq %r8, %rcx
cmpq $0x5, %r8
jne 0x902a
xorl %ecx, %ecx
movq %rdi, %rdx
movzwl -0x4a(%rsp,%rcx,2), %r8d
xorl %r9d, %r9d
xorw %r8w, (%rdx,%r9)
addq $0xa, %r9
cmpq $0x32, %r9
jne 0x9075
incq %rcx
addq $0x2, %rdx
cmpq $0x5, %rcx
jne 0x906c
leaq 0x97c8(%rip), %rcx      # 0x12860
xorl %edx, %edx
xorl %r8d, %r8d
leaq (%rdi,%rdx), %r9
xorl %r10d, %r10d
xorl %r11d, %r11d
movl %r10d, %ebx
orl %r8d, %ebx
je 0x90d4
leaq (%r11,%r11,4), %rbx
addq %r8, %rbx
movzwl (%r9,%r10,2), %ebp
movb (%rcx,%r10,4), %r14b
shlxl %r14d, %ebp, %r15d
movb $0x10, %r12b
subb %r14b, %r12b
shrxl %r12d, %ebp, %ebp
xorl %r15d, %ebp
jmp 0x90dd
movzwl (%rdi,%r10,2), %ebp
leaq (%r8,%r10), %rbx
movw %bp, (%rdi,%rbx,2)
incq %r11
addq $0x5, %r10
cmpq $0x19, %r10
jne 0x90a7
incq %r8
addq $0x4, %rcx
addq $0x2, %rdx
cmpq $0x5, %r8
jne 0x909d
leaq -0x40(%rsp), %rcx
xorl %edx, %edx
movq %rdi, %r8
xorl %r9d, %r9d
movzwl (%r8,%r9), %r10d
movw %r10w, (%rcx,%r9)
addq $0xa, %r9
cmpq $0x32, %r9
jne 0x910c
incq %rdx
addq $0x2, %rcx
addq $0x2, %r8
cmpq $0x5, %rdx
jne 0x9109
xorl %ecx, %ecx
leaq -0x40(%rsp), %rdx
movl $0xcccccccd, %r8d       # imm = 0xCCCCCCCD
xorl %r9d, %r9d
xorl %r10d, %r10d
movl %ecx, %r11d
movl %r9d, %ebx
movq %rdi, %r14
xorl %r15d, %r15d
movl %r11d, %r12d
imulq %r8, %r12
shrq $0x22, %r12
leal (%r12,%r12,4), %r12d
leal (%r12,%r12,4), %ebp
movl %ebx, %r12d
subl %ebp, %r12d
movzwl (%rdx,%r15,2), %ebp
movw %bp, (%r14,%r12,2)
addq $0x5, %r15
addq $0x2, %r14
addl $0xf, %ebx
addl $0x3, %r11d
cmpq $0x19, %r15
jne 0x9150
incq %r10
addl $0xa, %r9d
addl $0x2, %ecx
addq $0x2, %rdx
cmpq $0x5, %r10
jne 0x9144
xorl %ecx, %ecx
movl $0xcccccccd, %edx       # imm = 0xCCCCCCCD
movq %rdi, %r8
xorl %r9d, %r9d
leaq (%r9,%r9,4), %r11
movl %r9d, %r10d
imulq %rdx, %r10
shrq $0x22, %r10
imull $-0x19, %r10d, %r10d
addl %r11d, %r10d
addq %r10, %r10
leaq (%rdi,%r11,2), %r11
xorl %ebx, %ebx
leaq 0x1(%rbx), %r14
cmpq $0x4, %rbx
movl $0x0, %r15d
cmovneq %r14, %r15
movzwl (%r11,%r15,2), %ebp
notl %ebp
cmpq $0x3, %rbx
movl $0x2, %r15d
cmovael %eax, %r15d
addl %ecx, %r15d
addl %ebx, %r15d
andw (%rdi,%r15,2), %bp
xorw (%r8,%rbx,2), %bp
movw %bp, -0x40(%rsp,%rbx,2)
movq %r14, %rbx
cmpq $0x5, %r14
jne 0x91c8
movzwl -0x38(%rsp), %r11d
movw %r11w, 0x8(%rdi,%r10)
movq -0x40(%rsp), %r11
movq %r11, (%rdi,%r10)
incq %r9
addq $0x5, %rcx
addq $0xa, %r8
cmpq $0x5, %r9
jne 0x91a9
movl %esi, %eax
leaq 0x95f0(%rip), %rcx      # 0x12830
movzwl (%rcx,%rax,2), %eax
xorw %ax, (%rdi)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq