// File: /workspace/github_c_makefile_star2_O3/mjosaarinen[P]brutus/crypto_aead/primatesv1ape120/ref/primate.cpp
// Function: MixColumnsInv(unsigned char*)
void MixColumnsInv(unsigned char *state) //Inverse MixColumns operation on the state
{
	unsigned char tmp[StateSize];
	for(int p=0; p<NumberRows; p++){
		for(int i=0; i<NumberColumns; i++){
			tmp[i]=T2(state[i])^T15(state[NumberColumns*1+i])^T9(state[NumberColumns*2+i])^T9(state[NumberColumns*3+i])^T15(state[NumberColumns*4+i])^T2(state[NumberColumns*5+i])^state[NumberColumns*6+i];
 			for(int j=1; j<NumberRows; j++)
				tmp[NumberColumns*j+i]=state[NumberColumns*(j-1)+i];
		}
		for(int j=0; j<StateSize; j++)
			state[j]=tmp[j];
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
xorl %eax, %eax
leaq -0x30(%rsp), %rcx
vpbroadcastw 0x892(%rip), %xmm0 # 0x41fc
vpbroadcastw 0x88b(%rip), %xmm1 # 0x41fe
vpbroadcastb 0x87c(%rip), %xmm2 # 0x41f8
vpbroadcastb 0x874(%rip), %xmm3 # 0x41f9
vpbroadcastb 0x86c(%rip), %xmm4 # 0x41fa
vpbroadcastb 0x864(%rip), %xmm5 # 0x41fb
vmovd 0x841(%rip), %xmm6      # 0x41e0
movq %rcx, %rdx
movq %rdi, %rsi
xorl %r8d, %r8d
movb 0x8(%rdi,%r8), %r9b
movb 0x10(%rdi,%r8), %bl
leal (,%rbx,8), %r10d
andb $0x18, %r10b
vmovd %ebx, %xmm7
movzbl (%rdi,%r8), %r11d
vmovd %r11d, %xmm8
vpinsrb $0x1, %r9d, %xmm8, %xmm8
vmovd %r9d, %xmm9
xorb %bl, %r9b
movl %ebx, %ebp
shlb $0x4, %bpl
sarb $0x7, %bpl
andb $0xa, %bpl
movb 0x18(%rdi,%r8), %r15b
leal (,%r15,8), %r14d
vpinsrb $0x1, %r15d, %xmm7, %xmm7
movb 0x20(%rdi,%r8), %bl
vpinsrb $0x1, %ebx, %xmm9, %xmm9
andb $0x18, %r14b
vpinsrb $0x2, %ebx, %xmm8, %xmm8
xorb %r15b, %bl
shlb $0x4, %r15b
sarb $0x7, %r15b
andb $0xa, %r15b
vpunpcklbw %xmm7, %xmm7, %xmm7 # xmm7 = xmm7[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
vptestnmb %xmm0, %xmm7, %k1
vmovd %ebp, %xmm7
vpinsrb $0x1, %r10d, %xmm7, %xmm7
vpinsrb $0x2, %r15d, %xmm7, %xmm7
vpinsrb $0x3, %r14d, %xmm7, %xmm7
vpor %xmm1, %xmm7, %xmm10
vmovdqu8 %xmm7, %xmm10 {%k1}
vpaddb %xmm9, %xmm9, %xmm7
vpand %xmm2, %xmm7, %xmm7
vptestnmb %xmm3, %xmm9, %k1
vpxor %xmm4, %xmm7, %xmm11
vmovdqu8 %xmm7, %xmm11 {%k1}
vpaddb %xmm11, %xmm11, %xmm7
vpand %xmm2, %xmm7, %xmm7
vptestnmb %xmm5, %xmm9, %k1
vpxor %xmm4, %xmm7, %xmm9
vmovdqu8 %xmm7, %xmm9 {%k1}
vpaddb %xmm9, %xmm9, %xmm7
vpand %xmm2, %xmm7, %xmm7
movzbl 0x28(%rdi,%r8), %r10d
vpinsrb $0x3, %r10d, %xmm8, %xmm8
vptestmb %xmm6, %xmm8, %k1
vmovdqu8 %xmm4, %xmm8 {%k1} {z}
vpsrld $0x10, %xmm8, %xmm12
vpxor %xmm12, %xmm8, %xmm8
vpsrlw $0x8, %xmm8, %xmm12
vpxor %xmm12, %xmm8, %xmm8
vmovd %xmm8, %ebp
vpsrld $0x10, %xmm10, %xmm8
vpxor %xmm8, %xmm10, %xmm8
vpsrlw $0x8, %xmm8, %xmm10
vpxor %xmm10, %xmm8, %xmm8
vmovd %xmm8, %r14d
xorl %ebp, %r14d
xorb 0x30(%rdi,%r8), %r14b
vpxor %xmm9, %xmm11, %xmm8
vmovd %xmm8, %ebp
vpextrb $0x1, %xmm8, %r15d
xorl %r10d, %r11d
addb %r11b, %r11b
andb $0x1e, %r11b
vpsrlw $0x8, %xmm7, %xmm8
vpxor %xmm7, %xmm8, %xmm7
vmovd %xmm7, %r10d
xorb %bpl, %bl
xorb %r9b, %bl
xorb %r15b, %r11b
xorb %r10b, %r11b
xorb %bl, %r11b
xorb %r14b, %r11b
movb %r11b, -0x38(%rsp,%r8)
xorl %r9d, %r9d
movb (%rsi,%r9,8), %r10b
movb %r10b, (%rdx,%r9,8)
incq %r9
cmpq $0x6, %r9
jne 0x3b1a
incq %r8
incq %rsi
incq %rdx
cmpq $0x8, %r8
jne 0x39a8
vmovdqu -0x38(%rsp), %ymm7
vmovdqu -0x20(%rsp), %ymm8
vmovdqu %ymm8, 0x18(%rdi)
vmovdqu %ymm7, (%rdi)
incl %eax
cmpl $0x7, %eax
jne 0x399f
popq %rbx
popq %r14
popq %r15
popq %rbp
vzeroupper
retq