// File: /workspace/github_c_makefile_star2_O1/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 $0x38, %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 0x77ca
incq %rcx
addq $0x8, %rdx
cmpq $0x5, %rcx
jne 0x77bd
vmovaps 0x386c(%rip), %ymm0     # 0xb060
vmovups %ymm0, 0x10(%rsp)
movabsq $-0x3287650eca1d943c, %rax # imm = 0xCD789AF135E26BC4
movq %rax, 0x30(%rsp)
movl $0x28, %edi
vzeroupper
callq 0x5210
movq %rax, %r12
vxorps %xmm0, %xmm0, %xmm0
vmovups %ymm0, (%rax)
movq $0x0, 0x20(%rax)
movl 0xc(%r15), %eax
xorl %ecx, %ecx
vpmovsxbq 0x3864(%rip), %ymm0 # 0xb09c
vpbroadcastq 0x383f(%rip), %ymm1 # 0xb080
movl %ecx, %edx
vpbroadcastq %rdx, %ymm2
xorl %edx, %edx
vpbroadcastq %rdx, %ymm3
vpor %ymm0, %ymm3, %ymm3
vpcmpltuq %ymm1, %ymm3, %k1
vmovdqu64 0x10(%rsp,%rdx,8), %ymm3 {%k1} {z}
vmovdqu64 (%r12,%rdx,8), %ymm4 {%k1} {z}
vpsrlvq %ymm2, %ymm3, %ymm3
vpxor %ymm3, %ymm4, %ymm3
vmovdqu64 %ymm3, (%r12,%rdx,8) {%k1}
addq $0x4, %rdx
cmpq $0x8, %rdx
jne 0x784b
addl %eax, %ecx
cmpl $0x40, %ecx
jb 0x7841
movl 0xc(%r15), %eax
movl %eax, 0xc(%rsp)
testl %eax, %eax
je 0x7947
xorl %r13d, %r13d
xorl %eax, %eax
xorl %ecx, %ecx
xorl %edx, %edx
movl %edx, %esi
subl %eax, %esi
movslq %esi, %rsi
imulq $0x66666667, %rsi, %rdi # imm = 0x66666667
movq %rdi, %r8
shrq $0x3f, %r8
sarq $0x21, %rdi
addl %r8d, %edi
leal (%rdi,%rdi,4), %edi
movl %esi, %r8d
subl %edi, %r8d
negl %edi
testl %r8d, %r8d
leal 0x5(%rsi,%rdi), %esi
cmovnsl %r8d, %esi
movq (%r14), %rdi
addq %rcx, %rdi
xorl %r8d, %r8d
testb $0x1, (%r12,%rax,8)
je 0x78f2
movq (%rbx,%rsi,8), %r9
xorq %r9, (%rdi,%r8)
addq $0x28, %r8
cmpq $0xc8, %r8
jne 0x78e3
incq %rdx
addq $0x8, %rcx
cmpq $0x5, %rdx
jne 0x78a8
incq %rax
cmpq $0x5, %rax
jne 0x78a4
xorl %ebp, %ebp
leaq (%rbx,%rbp), %rsi
movq %r15, %rdi
movl $0x1, %edx
vzeroupper
callq 0x54f0
shrq (%r12,%rbp)
addq $0x8, %rbp
cmpq $0x28, %rbp
jne 0x7917
incl %r13d
cmpl 0xc(%rsp), %r13d
jne 0x78a2
movl $0x28, %esi
movq %r12, %rdi
vzeroupper
callq 0x5060
movl $0x28, %esi
movq %rbx, %rdi
addq $0x38, %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 0x5680