// File: /workspace/github_c_makefile_star2_O1/mjosaarinen[P]brutus/crypto_aead/primatesv1ape80/ref/encrypt.cpp
// Function: crypto_aead_decrypt
int crypto_aead_decrypt(
    unsigned char *m,unsigned long long *mlen,
    unsigned char *nsec,
    const unsigned char *c,unsigned long long clen,
    const unsigned char *ad,unsigned long long adlen,
    const unsigned char *npub,
    const unsigned char *k
)
{
	/*
    ... generating a plaintext m[0],m[1],...,m[*mlen-1]
    ... and secret message number nsec[0],nsec[1],...
    ... from a ciphertext c[0],c[1],...,c[clen-1]
    ... and associated data ad[0],ad[1],...,ad[adlen-1]
    ... and public message number npub[0],npub[1],...
    ... and secret key k[0],k[1],...
    ...
	*/
	unsigned char V[StateSize]; //the state represented in Elements
	//Temp variables represented as elements
	unsigned char key[KeySizeElements];
	unsigned char nonce[NonceSizeElements];
	unsigned char tag[TagSizeElements];
	unsigned char data[RateSizeElements];
	unsigned char cipher[RateSizeElements];
	unsigned char IV[StateSize]; //temp state represented in Elements
	
	if((clen<(TagSizeBytes+RateSizeBytes))&&(clen!=TagSizeBytes)) return -1; //invalid ciphertext
   
	//a temporary array for message
	unsigned char *mT = (unsigned char*) malloc(clen-TagSizeBytes);
    if (mT == NULL) return -2; // memory allocation failure
	
	Bytes2Element(key,k,0,KeySizeElements); //representing k as elements
	Bytes2Element(nonce,npub,0,NonceSizeElements); //representing npub as elements

	// IV <-- O||K
	InitializeState(IV,key);
	// Treating the nonce as the first part of the associated data
	for(int i=0; i<(NonceSizeElements/RateSizeElements); i++)
	{
		// IV <-- p_1 (N[i]^IV_r || IV_c)
		for(int j=0; j<RateSizeElements; j++)
			IV[j]^=nonce[RateSizeElements*i+j];
		p_1(IV);
	}
	if(adlen!=0)
	{ 
		// for i=1 to u-1 (except the last block which needs padding)
		if(adlen>RateSizeBytes)
		{ 
			for(unsigned long long i=0; i<adlen-RateSizeBytes; i=i+RateSizeBytes)
			{
				Bytes2Element(data,ad,i,RateSizeElements); // representing a block of ad as elements
				// IV <-- p_1 (A[i]^IV_r || IV_c)
				for(int j=0; j<RateSizeElements; j++)
					IV[j]^=data[j];
				p_1(IV);
			}
		}
		// IV <-- A[u]^IV_r || IV_c
		int l = adlen%RateSizeBytes;
		if(l==0){ //do padding with spill over			
			Bytes2Element(data,ad,adlen-RateSizeBytes,RateSizeElements); // representing last block of ad as elements
			for(int i=0; i<RateSizeElements; i++)
				IV[i]^=data[i];
			IV[RateSizeElements]^=16; //padding spills over to capacity
		}
		else{ //do standard padding
			unsigned char dataP[RateSizeBytes];
			for(int i=0; i< l; i++)
				dataP[i]=ad[adlen-l+i];
			dataP[l]=128; //padding over bytes
			for(int i=l+1; i<RateSizeBytes; i++)
				dataP[i]=0;
			Bytes2Element(data,dataP,0,RateSizeElements); // representing last padded block of ad as elements
			for(int i=0; i<RateSizeElements; i++)
				IV[i]^=data[i];
		}
		// IV <-- p_1(IV)
		p_1(IV);	
	}
	// IV <-- IV ^ (0..01)
	IV[StateSize-1]^=1;
	unsigned char tagT[TagSizeBytes];
	if(clen==TagSizeBytes){ //ciphertext length and hence the message length is 0
		*mlen=0;
		//do standard padding
		unsigned char dataP[RateSizeBytes];
		dataP[0]=128; //padding over bytes
		for(int i=1; i<RateSizeBytes; i++)
			dataP[i]=0;
		Bytes2Element(data,dataP,0,RateSizeElements);  // representing last block of m as elements
		// V <-- p_1 (M[1]^V_r || V_c)
		for(int i=0; i<RateSizeElements; i++)
			IV[i]^=data[i];
		p_1(IV);
		// T <-- (V_c)_c/2 ^ K 
		for(int i=0; i<TagSizeElements; i++)
			tag[i]=IV[RateSizeElements+i]^key[i]; 
		Element2Bytes(tagT,tag,0,TagSizeBytes) ;

		unsigned char cor=0;
		for(int i=0; i<TagSizeBytes; i++) //check if tags match
			cor = cor || (tagT[i]^c[i]);
		free(mT);
		if(cor==0) return 0;
		else return -1;
	}
	else{
		// V <-- p_1_inv(C[w] || K^T)
		Bytes2Element(cipher,c,clen-(TagSizeBytes+RateSizeBytes),RateSizeElements);
		Bytes2Element(tag,c,clen-(TagSizeBytes),TagSizeElements);
		for(int i=0; i<RateSizeElements; i++)
			V[i]=cipher[i];
		for(int i=0; i<CapacitySize; i++)
			V[RateSizeElements+i]=key[i]^tag[i];
		p_1_inv(V);
		
		if(clen==(TagSizeBytes+RateSizeBytes)){ //ciphertext is one block only hence plaintext length is less then or equal to RateSize
			// V <-- V ^ IV
			for(int i=0; i<StateSize; i++)
				V[i] ^= IV[i]; 
			unsigned char cor=0;
			for(int i=RateSizeElements+1; i<StateSize; i++) //check if IV_c matches with V_c
				cor = cor || V[i];
			cor = cor || (!((V[RateSizeElements]==0) || (V[RateSizeElements]==16)));
			if (cor==0)
			{
				for(int i=0; i<RateSizeElements; i++)
					data[i]=V[i];
				Element2Bytes(mT,data,0,RateSizeBytes); //representing m as bytes
				if(V[RateSizeElements]==16) *mlen=(unsigned long long) RateSizeBytes;
				else{ 
					unsigned char match=0;
					for(int i=0; i<RateSizeBytes; i++) {
						match |= (mT[i]==128);
					}
					if(match==0) { free(mT); return -1; }
					for(int i=RateSizeBytes-1; i>=0; i--)
						if(mT[i]==128) { *mlen=(unsigned long long) i; break;}
				}
				for(unsigned long long i=0; i<*mlen; i++)
					m[i]=mT[i];
				free(mT);
				return 0;
			}
			else { free(mT); return -1; }
		}
		else{
			*mlen=clen-TagSizeBytes;
			//for i=w (tha last block)
			int l = clen%RateSizeBytes;
			if (l==0){
				//M[w] <-- |V_r|_l^C[w-1]
				Bytes2Element(cipher,c,clen-(TagSizeBytes+2*RateSizeBytes),RateSizeElements);
				for(int i=0; i<RateSizeElements; i++)
					data[i]=V[i]^cipher[i];
				Element2Bytes(mT,data,clen-(TagSizeBytes+RateSizeBytes),RateSizeBytes); //representing last block m as bytes
				//V <-- V^M[w]10*
				for(int i=0; i<(RateSizeElements); i++)
					V[i]^=data[i];
				V[RateSizeElements]^=16;
			}
			else{
				//M[w] <-- |V_r|_l^C[w-1]
				unsigned char cipherP[RateSizeBytes];
				unsigned char mtmp[RateSizeBytes];
				Element2Bytes(cipherP,V,0,RateSizeBytes); //representing last block m as bytes
				for(int i=0; i<l; i++){
					mT[(clen-TagSizeBytes)-l+i]=cipherP[i]^c[clen-(TagSizeBytes+RateSizeBytes+l)+i];
					mtmp[i]=mT[(clen-TagSizeBytes)-l+i];
				}
				mtmp[l]=128;
				for(int i=l+1; i<RateSizeBytes; i++)
					mtmp[i]=0;
				Bytes2Element(data,mtmp,0,RateSizeElements);
				//V <-- V^M[w]10*
				for(int i=0; i<RateSizeElements; i++)
					V[i]^=data[i];	
			}
			l = (l==0) ? RateSizeBytes : l;
			//for i=w-1 to 2
			for(unsigned long long i=((clen-TagSizeBytes)-l); i>RateSizeBytes; i=i-5){
				// V <-- p_1_inv(V)
				p_1_inv(V);
				// M[i] <-- C[i-1]^V_r
				unsigned char mtmp[RateSizeElements];
				Bytes2Element(data,c,i-2*RateSizeBytes,RateSizeElements);
				for(int j=0; j<RateSizeElements; j++)
					mtmp[j]=data[j]^V[j];
				Element2Bytes(mT,mtmp,i-RateSizeBytes,RateSizeBytes); //representing last block m as bytes
				
				// V <-- C[i-1] || V_c
				for(int j=0; j<RateSizeElements; j++)
					V[j]=data[j];
			}
			//for i=1
			// V <-- p_1_inv(V)
			p_1_inv(V);
			// M[i] <-- C[i-1]^V_r
			for(int i=0; i<RateSizeElements; i++)
				data[i]=IV[i]^V[i];
			Element2Bytes(mT,data,0,RateSizeBytes); //representing last block m as bytes
			 //check if IV_c matches with V_c
			for(int j=0; j<RateSizeElements; j++)
				V[j]^=data[j];
			unsigned char cor=0;
			for(int i=RateSizeElements; i<StateSize; i++) 
				cor = cor || (V[i]^IV[i]);
			if(cor==0) {
				for(unsigned long long i=0; i<*mlen; i++)
					m[i]=mT[i];
			}
			free(mT);
			if (cor == 0) return 0;
			else return -1;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rcx, %r14
cmpq $0x19, %r8
setb %cl
cmpq $0x14, %r8
setne %dl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testb %dl, %cl
jne 0x2eca
movq %r9, %r15
movq %r8, %r13
movq %rsi, %rbx
movq %rdi, 0x28(%rsp)
leaq -0x14(%r8), %r12
movq %r12, %rdi
callq 0x20a0
testq %rax, %rax
je 0x27cb
movq %r12, 0x98(%rsp)
movq %r14, 0x20(%rsp)
movq %rbx, 0x60(%rsp)
movq %rax, 0x10(%rsp)
movq 0x140(%rsp), %rsi
movq 0x138(%rsp), %rbx
xorl %ebp, %ebp
leaq 0xb0(%rsp), %r12
movq %r12, %rdi
xorl %edx, %edx
movl $0x20, %ecx
callq 0x2160
leaq 0xa0(%rsp), %rdi
movq %rbx, %rsi
xorl %edx, %edx
movl $0x10, %ecx
callq 0x2160
leaq 0x70(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x20b0
movq 0xa0(%rsp,%rbp,8), %rax
xorq %rax, 0x70(%rsp)
movq %rbx, %rdi
callq 0x2070
incq %rbp
cmpq $0x1, %rbp
je 0x26b5
movq 0x130(%rsp), %rax
testq %rax, %rax
movq 0x10(%rsp), %r12
je 0x280d
cmpq $0x6, %rax
jb 0x2737
movq 0x130(%rsp), %r14
addq $-0x5, %r14
je 0x2737
xorl %ebp, %ebp
leaq 0x8(%rsp), %rbx
leaq 0x70(%rsp), %r12
movq %rbx, %rdi
movq %r15, %rsi
movq %rbp, %rdx
movl $0x8, %ecx
callq 0x2160
movq 0x8(%rsp), %rax
xorq %rax, 0x70(%rsp)
movq %r12, %rdi
callq 0x2070
addq $0x5, %rbp
cmpq %r14, %rbp
jb 0x2709
movabsq $-0x3333333333333333, %rax # imm = 0xCCCCCCCCCCCCCCCD
movq 0x130(%rsp), %r12
movq %r12, %rdx
mulxq %rax, %r14, %r14
shrq $0x2, %r14
leaq (%r14,%r14,4), %rax
movq %r12, %rbx
subq %rax, %rbx
je 0x27d5
movq %r12, %rax
subq %rbx, %rax
addq %rax, %r15
leaq 0x30(%rsp), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x2170
movb $-0x80, 0x30(%rsp,%rbx)
cmpq $0x3, %rbx
ja 0x27a8
leal (%r14,%r14,4), %edx
movl %r12d, %eax
subl %edx, %eax
incl %eax
leaq (%rsp,%rax), %rdi
addq $0x30, %rdi
subl %r12d, %edx
addl $0x3, %edx
incq %rdx
xorl %esi, %esi
callq 0x2040
leaq 0x8(%rsp), %rbx
leaq 0x30(%rsp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
movl $0x8, %ecx
callq 0x2160
movq (%rbx), %rax
xorq %rax, 0x70(%rsp)
jmp 0x27fe
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x2eca
addq $-0x5, %r12
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movl $0x8, %ecx
callq 0x2160
movq (%rbx), %rax
xorq %rax, 0x70(%rsp)
xorb $0x10, 0x78(%rsp)
movq 0x10(%rsp), %r12
leaq 0x70(%rsp), %rdi
callq 0x2070
xorb $0x1, 0x97(%rsp)
cmpq $0x14, %r13
movq 0x60(%rsp), %rbp
jne 0x28c7
movq $0x0, (%rbp)
leaq 0x68(%rsp), %rsi
movb $-0x80, (%rsi)
movl $0x0, 0x1(%rsi)
xorl %r14d, %r14d
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
xorl %edx, %edx
movl $0x8, %ecx
callq 0x2160
movq (%rbx), %rax
leaq 0x70(%rsp), %rbx
xorq %rax, (%rbx)
movq %rbx, %rdi
callq 0x2070
vmovdqu 0xb0(%rsp), %ymm0
vpxor 0x8(%rbx), %ymm0, %ymm0
leaq 0xd0(%rsp), %rsi
vmovdqu %ymm0, (%rsi)
leaq 0x30(%rsp), %rdi
xorl %edx, %edx
movl $0x14, %ecx
vzeroupper
callq 0x2090
xorl %ebx, %ebx
movq 0x20(%rsp), %rcx
testb %bl, %bl
movb $0x1, %bl
jne 0x28ac
movb 0x30(%rsp,%r14), %al
cmpb (%rcx,%r14), %al
setne %bl
incq %r14
cmpq $0x14, %r14
jne 0x289a
movq %r12, %rdi
callq 0x20e0
negb %bl
movsbl %bl, %eax
jmp 0x2eca
leaq -0x19(%r13), %r14
leaq 0x68(%rsp), %rbx
movq %rbx, %rdi
movq 0x20(%rsp), %r12
movq %r12, %rsi
movq %r14, %rdx
movl $0x8, %ecx
callq 0x2160
leaq 0xd0(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
movq 0x98(%rsp), %r12
movq %r12, %rdx
movl $0x20, %ecx
callq 0x2160
movq (%rbx), %rax
leaq 0x30(%rsp), %rdi
movq %rax, (%rdi)
vmovdqu (%r15), %ymm0
vpxor 0xb0(%rsp), %ymm0, %ymm0
vmovdqu %ymm0, 0x8(%rdi)
vzeroupper
callq 0x2100
cmpq $0x19, %r13
jne 0x2ac4
xorl %eax, %eax
vpmovsxbq 0x17da(%rip), %ymm0 # 0x4120
vpmovsxbq 0x17d5(%rip), %ymm1 # 0x4124
vpmovsxbq 0x17d0(%rip), %ymm2 # 0x4128
vpmovsxbq 0x17cb(%rip), %ymm3 # 0x412c
vpmovsxbq 0x17c6(%rip), %ymm4 # 0x4130
vpmovsxbq 0x17c1(%rip), %ymm5 # 0x4134
vpmovsxbq 0x17bc(%rip), %ymm6 # 0x4138
vpmovsxbq 0x17b7(%rip), %ymm7 # 0x413c
vpbroadcastq 0x1772(%rip), %ymm8 # 0x4100
movq 0x10(%rsp), %r14
vpbroadcastq %rax, %ymm9
vpor %ymm0, %ymm9, %ymm10
vpor %ymm1, %ymm9, %ymm11
vpor %ymm2, %ymm9, %ymm12
vpor %ymm3, %ymm9, %ymm13
vpor %ymm4, %ymm9, %ymm14
vpor %ymm5, %ymm9, %ymm15
vporq %ymm6, %ymm9, %ymm16
vpor %ymm7, %ymm9, %ymm9
vpcmpltuq %ymm8, %ymm9, %k0
vpcmpltuq %ymm8, %ymm16, %k1
kshiftlb $0x4, %k1, %k1
korb %k1, %k0, %k0
vpcmpltuq %ymm8, %ymm15, %k1
vpcmpltuq %ymm8, %ymm14, %k2
kshiftlb $0x4, %k2, %k2
korb %k2, %k1, %k1
kunpckbw %k0, %k1, %k0
vpcmpltuq %ymm8, %ymm13, %k1
vpcmpltuq %ymm8, %ymm12, %k2
kshiftlb $0x4, %k2, %k2
korb %k2, %k1, %k1
vpcmpltuq %ymm8, %ymm11, %k2
vpcmpltuq %ymm8, %ymm10, %k3
kshiftlb $0x4, %k3, %k3
korb %k3, %k2, %k2
kunpckbw %k1, %k2, %k1
kunpckwd %k0, %k1, %k1
vmovdqu8 0x70(%rsp,%rax), %ymm9 {%k1} {z}
vmovdqu8 0x30(%rsp,%rax), %ymm10 {%k1} {z}
vpxor %ymm9, %ymm10, %ymm9
vmovdqu8 %ymm9, 0x30(%rsp,%rax) {%k1}
addq $0x20, %rax
cmpq $0x40, %rax
jne 0x2993
movl $0x9, %ecx
xorl %eax, %eax
testb %al, %al
movb $0x1, %al
jne 0x2a70
cmpb $0x0, 0x30(%rsp,%rcx)
setne %al
incq %rcx
cmpq $0x28, %rcx
jne 0x2a62
movb 0x38(%rsp), %cl
andb $-0x11, %cl
orb %cl, %al
jne 0x2caf
movq 0x30(%rsp), %rax
leaq 0x8(%rsp), %rsi
movq %rax, (%rsi)
movq %r14, %rdi
xorl %edx, %edx
movl $0x5, %ecx
vzeroupper
callq 0x2090
cmpb $0x10, 0x38(%rsp)
jne 0x2e1f
movq $0x5, (%rbp)
movq 0x28(%rsp), %rdx
jmp 0x2ea7
movq %r12, (%rbp)
movabsq $-0x3333333333333333, %rax # imm = 0xCCCCCCCCCCCCCCCD
movq %r13, %rdx
mulxq %rax, %rbx, %rbx
shrq $0x2, %rbx
leaq (%rbx,%rbx,4), %rax
movq %r13, %r15
subq %rax, %r15
movq 0x10(%rsp), %rbp
je 0x2cc4
xorl %r14d, %r14d
leaq 0x58(%rsp), %rdi
leaq 0x30(%rsp), %rsi
xorl %edx, %edx
movl $0x5, %ecx
callq 0x2090
movq %r13, %rax
subq %r15, %rax
movq 0x20(%rsp), %rcx
addq %rcx, %rax
addq $-0x19, %rax
movq %r12, %rdx
subq %r15, %rdx
addq %rdx, %rbp
cmpl $0x2, %r15d
movl $0x1, %edx
cmovael %r15d, %edx
leaq -0x1(%rdx), %rsi
addl $0x1f, %edx
andl $0x20, %edx
vpbroadcastq %rsi, %ymm0
vpmovsxbq 0x15d3(%rip), %ymm1 # 0x4120
vpmovsxbq 0x15ce(%rip), %ymm2 # 0x4124
vpmovsxbq 0x15c9(%rip), %ymm3 # 0x4128
vpmovsxbq 0x15c4(%rip), %ymm4 # 0x412c
vpmovsxbq 0x15bf(%rip), %ymm5 # 0x4130
vpmovsxbq 0x15ba(%rip), %ymm6 # 0x4134
vpmovsxbq 0x15b5(%rip), %ymm7 # 0x4138
vpmovsxbq 0x15b0(%rip), %ymm8 # 0x413c
vpbroadcastq %r14, %ymm9
vpor %ymm1, %ymm9, %ymm10
vpor %ymm2, %ymm9, %ymm11
vpor %ymm3, %ymm9, %ymm12
vpor %ymm4, %ymm9, %ymm13
vpor %ymm5, %ymm9, %ymm14
vpor %ymm6, %ymm9, %ymm15
vporq %ymm7, %ymm9, %ymm16
vpor %ymm8, %ymm9, %ymm9
vpcmpleuq %ymm0, %ymm9, %k0
vpcmpleuq %ymm0, %ymm16, %k1
kshiftlb $0x4, %k1, %k1
korb %k1, %k0, %k0
vpcmpleuq %ymm0, %ymm15, %k1
vpcmpleuq %ymm0, %ymm14, %k2
kshiftlb $0x4, %k2, %k2
korb %k2, %k1, %k1
kunpckbw %k0, %k1, %k0
vpcmpleuq %ymm0, %ymm13, %k1
vpcmpleuq %ymm0, %ymm12, %k2
kshiftlb $0x4, %k2, %k2
korb %k2, %k1, %k1
vpcmpleuq %ymm0, %ymm11, %k2
vpcmpleuq %ymm0, %ymm10, %k3
kshiftlb $0x4, %k3, %k3
korb %k3, %k2, %k2
kunpckbw %k1, %k2, %k1
kunpckwd %k0, %k1, %k1
vmovdqu8 0x58(%rsp,%r14), %ymm9 {%k1} {z}
vmovdqu8 (%rax,%r14), %ymm10 {%k1} {z}
vpxor %ymm9, %ymm10, %ymm9
vmovdqu8 %ymm9, (%rbp,%r14) {%k1}
vmovdqu8 %ymm9, 0x1b(%rsp,%r14) {%k1}
addq $0x20, %r14
cmpq %r14, %rdx
jne 0x2b8c
movb $-0x80, 0x1b(%rsp,%r15)
cmpq $0x3, %r15
ja 0x2c89
leal (%rbx,%rbx,4), %edx
movl %r13d, %eax
subl %edx, %eax
incl %eax
leaq (%rsp,%rax), %rdi
addq $0x1b, %rdi
subl %r13d, %edx
addl $0x3, %edx
incq %rdx
xorl %esi, %esi
vzeroupper
callq 0x2040
leaq 0x8(%rsp), %rbx
leaq 0x1b(%rsp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
movl $0x8, %ecx
vzeroupper
callq 0x2160
movq (%rbx), %rax
xorq %rax, 0x30(%rsp)
jmp 0x2d15
movq %r14, %rdi
vzeroupper
callq 0x20e0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x2eca
leaq -0x1e(%r13), %rdx
leaq 0x68(%rsp), %rbx
movq %rbx, %rdi
movq 0x20(%rsp), %rsi
movl $0x8, %ecx
callq 0x2160
movq (%rbx), %rax
xorq 0x30(%rsp), %rax
leaq 0x8(%rsp), %rbx
movq %rax, (%rbx)
movq %rbp, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movl $0x5, %ecx
callq 0x2090
movq (%rbx), %rax
xorq %rax, 0x30(%rsp)
xorb $0x10, 0x38(%rsp)
movl $0x5, %r15d
subq %r15, %r12
cmpq $0x6, %r12
movq 0x20(%rsp), %r12
movq 0x10(%rsp), %r14
jb 0x2d90
subq %r15, %r13
addq $-0x1e, %r13
leaq 0x8(%rsp), %r15
leaq 0x58(%rsp), %rbp
leaq 0x30(%rsp), %rdi
callq 0x2100
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
movl $0x8, %ecx
callq 0x2160
movq 0x30(%rsp), %rax
xorq 0x8(%rsp), %rax
movq %rax, 0x58(%rsp)
leaq 0x5(%r13), %rbx
movq %r14, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
movl $0x5, %ecx
callq 0x2090
movq 0x8(%rsp), %rax
movq %rax, 0x30(%rsp)
addq $-0x5, %r13
cmpq $0x5, %rbx
ja 0x2d39
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
callq 0x2100
movq (%rbx), %rax
xorq 0x70(%rsp), %rax
leaq 0x8(%rsp), %r12
movq %rax, (%r12)
xorl %r15d, %r15d
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
movl $0x5, %ecx
callq 0x2090
movq (%r12), %rax
xorq %rax, (%rbx)
xorl %ebx, %ebx
movq 0x60(%rsp), %rdx
movq 0x28(%rsp), %rsi
testb %bl, %bl
movb $0x1, %bl
jne 0x2de9
movb 0x38(%rsp,%r15), %al
cmpb 0x78(%rsp,%r15), %al
setne %bl
incq %r15
cmpq $0x20, %r15
jne 0x2dd6
testb %bl, %bl
jne 0x2e0d
cmpq $0x0, (%rdx)
je 0x2e0d
xorl %eax, %eax
movb (%r14,%rax), %cl
movb %cl, (%rsi,%rax)
incq %rax
cmpq (%rdx), %rax
jb 0x2dfe
movq %r14, %rdi
callq 0x20e0
movzbl %bl, %eax
negl %eax
jmp 0x2eca
movw $0x1f, %ax
kmovd %eax, %k1
vmovdqu8 (%r14), %xmm0 {%k1} {z}
vpbroadcastb 0x12d2(%rip), %xmm1 # 0x4108
vpcmpeqb %xmm1, %xmm0, %xmm0
vpbroadcastb 0x12c6(%rip), %xmm1 # 0x4109
vpternlogq $0x80, 0x12c2(%rip), %xmm0, %xmm1 # 0x4110
vpsrlq $0x20, %xmm1, %xmm0
vpor %xmm0, %xmm1, %xmm0
vpsrld $0x10, %xmm0, %xmm1
vpor %xmm1, %xmm0, %xmm0
vpsrlw $0x8, %xmm0, %xmm1
vpor %xmm1, %xmm0, %xmm0
vmovd %xmm0, %ebx
testb %bl, %bl
je 0x2e8c
movl $0x4, %eax
xorl %ecx, %ecx
movq 0x28(%rsp), %rdx
movl %eax, %eax
cmpb (%r14,%rax), %cl
jo 0x2e9b
addl $-0x1, %eax
jb 0x2e7d
jmp 0x2e9f
movq %r14, %rdi
callq 0x20e0
movq 0x28(%rsp), %rdx
jmp 0x2e9f
movq %rax, (%rbp)
testb %bl, %bl
je 0x2cba
cmpq $0x0, (%rbp)
je 0x2ec0
xorl %eax, %eax
movb (%r14,%rax), %cl
movb %cl, (%rdx,%rax)
incq %rax
cmpq (%rbp), %rax
jb 0x2eb0
movq %r14, %rdi
callq 0x20e0
xorl %eax, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq