// File: /workspace/github_c_makefile_star2_O2/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 $0x98, %rsp
movq %rsi, %rbx
movq %rdi, 0x10(%rsp)
leaq 0x38(%rsp), %r12
pushq $0x5
popq %rsi
leaq 0x70(%rsp), %rdx
movq %r12, %rdi
callq 0x60c0
movq %rbx, 0x20(%rsp)
movq (%rbx), %r14
xorl %r15d, %r15d
movq (%r12), %r12
pushq $0x1
popq %r13
cmpq $0x5, %r15
je 0x84ca
movq (%r14,%r15,8), %rbx
movq %rbx, (%r12,%r15,8)
movl %r13d, %ebp
cmpl $0x5, %ebp
je 0x84c5
movl %r15d, %edi
movl %ebp, %esi
callq 0x6aa0
movl %eax, %eax
xorq (%r14,%rax,8), %rbx
movq %rbx, (%r12,%r15,8)
incl %ebp
jmp 0x84a8
incq %r15
jmp 0x8497
vmovaps 0x2b2e(%rip), %ymm0     # 0xb000
vmovups %ymm0, 0x70(%rsp)
movabsq $-0x3287650eca1d943c, %rax # imm = 0xCD789AF135E26BC4
movq %rax, 0x90(%rsp)
leaq 0x68(%rsp), %rdx
andq $0x0, (%rdx)
leaq 0x50(%rsp), %rdi
pushq $0x5
popq %rsi
leaq 0xf(%rsp), %rcx
vzeroupper
callq 0x6050
movq 0x50(%rsp), %r8
movq 0x10(%rsp), %rax
movl 0xc(%rax), %eax
xorl %ecx, %ecx
cmpl $0x40, %ecx
jae 0x853a
movl %ecx, %edx
xorl %esi, %esi
cmpq $0x5, %rsi
je 0x8536
shrxq %rdx, 0x70(%rsp,%rsi,8), %rdi
xorq %rdi, (%r8,%rsi,8)
incq %rsi
jmp 0x8520
addl %eax, %ecx
jmp 0x8517
xorl %ecx, %ecx
cmpl %eax, %ecx
jae 0x8609
movq %rcx, 0x18(%rsp)
xorl %r14d, %r14d
cmpq $0x5, %r14
je 0x85ca
xorl %r13d, %r13d
cmpl $0x5, %r13d
je 0x85c5
movl %r13d, %eax
subl %r14d, %eax
cltd
pushq $0x5
popq %rcx
idivl %ecx
leal 0x5(%rdx), %ebp
testl %edx, %edx
cmovnsl %edx, %ebp
movq 0x38(%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x28(%rsp)
xorl %r12d, %r12d
cmpl $0x5, %r12d
je 0x85c0
testb $0x1, (%r8,%r14,8)
je 0x85bb
movq 0x30(%rsp), %rax
movq (%rax,%rbp,8), %r15
movl %r13d, %edi
movl %r12d, %esi
movq %r8, %rbx
callq 0x6aa0
movq %rbx, %r8
movl %eax, %eax
movq 0x28(%rsp), %rcx
xorq %r15, (%rcx,%rax,8)
incl %r12d
jmp 0x8589
incl %r13d
jmp 0x8555
incq %r14
jmp 0x854c
xorl %ebx, %ebx
movq 0x10(%rsp), %r14
cmpq $0x28, %rbx
je 0x85f9
movq 0x38(%rsp), %rsi
addq %rbx, %rsi
movq %r14, %rdi
pushq $0x1
popq %rdx
callq 0x6730
movq 0x50(%rsp), %r8
shrq (%r8,%rbx)
addq $0x8, %rbx
jmp 0x85d1
movq 0x18(%rsp), %rcx
incl %ecx
movl 0xc(%r14), %eax
jmp 0x853c
leaq 0x50(%rsp), %rdi
callq 0x6780
leaq 0x38(%rsp), %rdi
callq 0x6780
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x6780
movq %rbx, %rdi
callq 0x6980