// File: /workspace/github_c_makefile_star2_O3/mjosaarinen[P]brutus/crypto_aead/riverkeyakv2/ref/Keccak-f.h
// Function: void KeccakF::inverseTheta<unsigned long long>(std::vector<unsigned long long, std::allocator<unsigned long long>>&) const
void KeccakF::inverseTheta(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)];
        }
    }
    const LaneValue inversePositions64[5] = {
        0xDE26BC4D789AF134ULL,
        0x09AF135E26BC4D78ULL,
        0xEBC4D789AF135E26ULL,
        0x7135E26BC4D789AFULL,
        0xCD789AF135E26BC4ULL };
    vector<LaneValue> inversePositions(5, 0);
    for(unsigned int z=0; z<64; z+=laneSize)
        for(unsigned int x=0; x<5; x++)
            inversePositions[x] ^= inversePositions64[x] >> z;
    for(unsigned int z=0; z<laneSize; z++) {
        for(unsigned int xOff=0; xOff<5; xOff++)
           for(int x=0; x<5; x++)
               for(unsigned int y=0; y<5; y++)
                   if ((inversePositions[xOff] & 1) != 0) 
                      A[index(x, y)] ^= C[index(x-xOff)];
        for(unsigned int xOff=0; xOff<5; xOff++) {
            ROL(C[xOff], 1);
            inversePositions[xOff] >>= 1;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %r15
movl $0x28, %edi
callq 0x5210
movq %rax, %rbx
vxorps %xmm0, %xmm0, %xmm0
vmovups %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 0x76de
incq %rcx
addq $0x8, %rdx
cmpq $0x5, %rcx
jne 0x76d1
vmovaps 0x3938(%rip), %ymm0     # 0xb040
vmovups %ymm0, (%rsp)
movabsq $-0x3287650eca1d943c, %rax # imm = 0xCD789AF135E26BC4
movq %rax, 0x20(%rsp)
movl $0x28, %edi
vzeroupper
callq 0x5210
movq %rax, %rdi
vxorps %xmm0, %xmm0, %xmm0
vmovups %ymm0, (%rax)
movq $0x0, 0x20(%rax)
movl 0xc(%r15), %ecx
xorl %eax, %eax
vpmovsxbq 0x3925(%rip), %ymm0 # 0xb070
vpbroadcastq 0x390c(%rip), %ymm1 # 0xb060
movl %eax, %edx
vpbroadcastq %rdx, %ymm2
xorl %edx, %edx
vpbroadcastq %rdx, %ymm3
vpor %ymm0, %ymm3, %ymm3
vpcmpltuq %ymm1, %ymm3, %k1
vmovdqu64 (%rsp,%rdx,8), %ymm3 {%k1} {z}
vmovdqu64 (%rdi,%rdx,8), %ymm4 {%k1} {z}
vpsrlvq %ymm2, %ymm3, %ymm3
vpxor %ymm3, %ymm4, %ymm3
vmovdqu64 %ymm3, (%rdi,%rdx,8) {%k1}
addq $0x4, %rdx
cmpq $0x8, %rdx
jne 0x775e
addl %ecx, %eax
cmpl $0x40, %eax
jb 0x7754
testl %ecx, %ecx
je 0x78cb
movl $0x1, %eax
xorl %edx, %edx
idivl %ecx
xorl %eax, %eax
movl %ecx, %esi
subl %edx, %esi
cmpl $0x1, %edx
movl $0x0, %r8d
sbbl %r8d, %r8d
kmovd %r8d, %k0
vpbroadcastq %rdx, %ymm2
vpbroadcastq %rsi, %ymm3
knotw %k0, %k1
xorl %edx, %edx
movq (%rdi,%rdx,8), %rsi
xorl %r8d, %r8d
xorl %r9d, %r9d
movl %r9d, %r10d
subl %edx, %r10d
movslq %r10d, %r10
imulq $0x66666667, %r10, %r11 # imm = 0x66666667
movq %r11, %r12
shrq $0x3f, %r12
sarq $0x21, %r11
addl %r12d, %r11d
leal (%r11,%r11,4), %r11d
movl %r10d, %ebp
subl %r11d, %ebp
negl %r11d
testl %ebp, %ebp
leal 0x5(%r10,%r11), %r10d
cmovnsl %ebp, %r10d
movq (%r14), %r11
addq %r8, %r11
xorl %r12d, %r12d
testb $0x1, %sil
je 0x782f
movq (%rbx,%r10,8), %r13
xorq %r13, (%r11,%r12)
addq $0x28, %r12
cmpq $0xc8, %r12
jne 0x7821
incq %r9
addq $0x8, %r8
cmpq $0x5, %r9
jne 0x77e2
incq %rdx
cmpq $0x5, %rdx
jne 0x77d8
vpbroadcastq 0x50(%r15), %ymm4
xorl %edx, %edx
vpbroadcastq %rdx, %ymm5
vpor %ymm0, %ymm5, %ymm5
vpcmpltuq %ymm1, %ymm5, %k2
vmovdqu64 (%rbx,%rdx,8), %ymm5 {%k2} {z}
kandw %k1, %k2, %k3
vpand %ymm5, %ymm4, %ymm6
vpsllvq %ymm2, %ymm6, %ymm7
vpsrlvq %ymm3, %ymm6, %ymm6
vpxor %ymm6, %ymm7, %ymm6
vmovdqu64 %ymm6, (%rbx,%rdx,8) {%k3}
kandw %k0, %k2, %k3
vmovdqa64 %ymm5, %ymm6 {%k3}
vpand %ymm6, %ymm4, %ymm5
vmovdqu64 %ymm5, (%rbx,%rdx,8) {%k2}
vmovdqu64 (%rdi,%rdx,8), %ymm5 {%k2} {z}
vpsrlq $0x1, %ymm5, %ymm5
vmovdqu64 %ymm5, (%rdi,%rdx,8) {%k2}
addq $0x4, %rdx
cmpq $0x8, %rdx
jne 0x785a
incl %eax
cmpl %ecx, %eax
jne 0x77d6
movl $0x28, %esi
vzeroupper
callq 0x5060
movl $0x28, %esi
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5060
movq %rax, %r14
movl $0x28, %esi
movq %rbx, %rdi
callq 0x5060
movq %r14, %rdi
callq 0x5670
nop