// File: /workspace/github_c_makefile_star2_O1/mjosaarinen[P]brutus/crypto_aead/riverkeyakv2/ref/Keccak-f.h
// Function: void KeccakF::theta<unsigned long long>(std::vector<unsigned long long, std::allocator<unsigned long long>>&) const
void KeccakF::theta(vector<Lane>& A) const
{
    vector<Lane> C(5);
    for(unsigned int x=0; x<5; x++) {
        C[x] = A[index(x,0)]; 
        for(unsigned int y=1; y<5; y++) 
            C[x] ^= A[index(x,y)];
    }
    vector<Lane> D(5);
    for(unsigned int x=0; x<5; x++) {
        Lane temp = C[index(x+1)];
        ROL(temp, 1);
        D[x] = temp ^ C[index(x-1)];
    }
    for(int x=0; x<5; x++)
        for(unsigned int y=0; y<5; y++)
            A[index(x,y)] ^= D[x];
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
movl $0x28, %edi
callq 0x5210
movq %rax, %rbx
vpxor %xmm0, %xmm0, %xmm0
vmovdqu %ymm0, (%rax)
movq $0x0, 0x20(%rax)
movq (%r14), %rax
xorl %ecx, %ecx
movq %rax, %rdx
movq (%rax,%rcx,8), %rsi
movq %rsi, (%rbx,%rcx,8)
movl $0x28, %edi
xorq (%rdx,%rdi), %rsi
movq %rsi, (%rbx,%rcx,8)
addq $0x28, %rdi
cmpq $0xc8, %rdi
jne 0x7077
incq %rcx
addq $0x8, %rdx
cmpq $0x5, %rcx
jne 0x706a
movl $0x28, %edi
vzeroupper
callq 0x5210
movq %rax, %rdi
vpxor %xmm0, %xmm0, %xmm0
vmovdqu %ymm0, (%rax)
movq $0x0, 0x20(%rax)
movl 0xc(%r15), %ecx
movl $0x1, %eax
xorl %edx, %edx
idivl %ecx
xorl %eax, %eax
subl %edx, %ecx
vpbroadcastq 0x50(%r15), %ymm1
vpbroadcastq %rdx, %ymm2
vpbroadcastq %rcx, %ymm3
vpmovsxbd 0x3fb7(%rip), %xmm4 # 0xb09c
vpmovsxbq 0x3fae(%rip), %ymm5 # 0xb09c
vpbroadcastq 0x3f89(%rip), %ymm6 # 0xb080
vpcmpeqd %ymm7, %ymm7, %ymm7
vpcmpeqd %xmm8, %xmm8, %xmm8
vpbroadcastd 0x3f87(%rip), %xmm9 # 0xb090
vpmovsxbd 0x3f8e(%rip), %xmm10 # 0xb0a0
vpbroadcastd 0x3f79(%rip), %xmm11 # 0xb094
vpbroadcastq 0x3f64(%rip), %ymm12 # 0xb088
vpbroadcastd 0x3f6b(%rip), %xmm13 # 0xb098
vpcmpltuq %ymm6, %ymm5, %k1
vpsubq %ymm7, %ymm5, %ymm14
vpcmpneqq %ymm6, %ymm14, %k2
vpblendd $0xaa, %ymm0, %ymm14, %ymm14 # ymm14 = ymm14[0],ymm0[1],ymm14[2],ymm0[3],ymm14[4],ymm0[5],ymm14[6],ymm0[7]
vmovdqa64 %ymm14, %ymm15 {%k2} {z}
kmovq %k1, %k2
vpxor %xmm14, %xmm14, %xmm14
vpgatherqq (%rbx,%ymm15,8), %ymm14 {%k2}
testl %edx, %edx
je 0x7173
vpand %ymm1, %ymm14, %ymm14
vpsllvq %ymm2, %ymm14, %ymm15
vpsrlvq %ymm3, %ymm14, %ymm14
vpxor %ymm14, %ymm15, %ymm14
vpaddd %xmm4, %xmm8, %xmm15
vpmuldq %xmm9, %xmm15, %xmm16
vpsrlq $0x20, %xmm15, %xmm17
vpmuldq %xmm9, %xmm17, %xmm17
vpermt2d %xmm17, %xmm10, %xmm16
vpsrld $0x1f, %xmm16, %xmm17
vpsrad $0x1, %xmm16, %xmm16
vpaddd %xmm17, %xmm16, %xmm16
vpslld $0x2, %xmm16, %xmm17
vpaddd %xmm17, %xmm16, %xmm16
vpsubd %xmm16, %xmm15, %xmm15
vpmovd2m %xmm15, %k2
vpaddd %xmm11, %xmm15, %xmm15 {%k2}
vpmovzxdq %xmm15, %ymm15  # ymm15 = xmm15[0],zero,xmm15[1],zero,xmm15[2],zero,xmm15[3],zero
kmovq %k1, %k2
vpxord %xmm16, %xmm16, %xmm16
vpgatherqq (%rbx,%ymm15,8), %ymm16 {%k2}
vpternlogq $0x78, %ymm14, %ymm1, %ymm16
vmovdqu64 %ymm16, (%rdi,%rax,8) {%k1}
addq $0x4, %rax
vpaddq %ymm5, %ymm12, %ymm5
vpaddd %xmm4, %xmm13, %xmm4
cmpq $0x8, %rax
jne 0x712d
movq (%r14), %rax
xorl %ecx, %ecx
xorl %edx, %edx
movq (%rdi,%rcx,8), %rsi
xorq %rsi, (%rax,%rdx)
addq $0x28, %rdx
cmpq $0xc8, %rdx
jne 0x7205
incq %rcx
addq $0x8, %rax
cmpq $0x5, %rcx
jne 0x7203
movl $0x28, %esi
vzeroupper
callq 0x5060
movl $0x28, %esi
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x5060
movq %rax, %r14
movl $0x28, %esi
movq %rbx, %rdi
callq 0x5060
movq %r14, %rdi
callq 0x5680