// File: /workspace/github_c_makefile_star2_O1/mjosaarinen[P]brutus/crypto_aead/aegis128l/aesnic/encrypt.c
// Function: crypto_aead_encrypt
int crypto_aead_encrypt(
	unsigned char *c,unsigned long long *clen,
	const unsigned char *m,unsigned long long mlen,
	const unsigned char *ad,unsigned long long adlen,
	const unsigned char *nsec,
	const unsigned char *npub,
	const unsigned char *k
	)
        //void aegis128L_enc_aut(unsigned char *key, unsigned char *iv, unsigned char *ad, unsigned char *plaintext,
        //unsigned char *ciphertext, unsigned char *mac, unsigned char maclen, unsigned long msglen, unsigned long adlen)
{
    unsigned long long i;  
    unsigned char plaintextblock[32], ciphertextblock[32], mac[16];
    __m128i state[8], tmp, ct0, ct1, msg0, msg1,msg2,msg3;

    //initialization stage
    aegis128L_initialization(k, npub, state); 

    //process the associated data 
    for (i = 0; (i+128) <= adlen; i = i+128)   
    {   
        //The first 32-byte    
        msg0 = _mm_load_si128((__m128i*)(ad+i));
        msg1 = _mm_load_si128((__m128i*)(ad+i+16));

        //state update function
        tmp = state[7];
        state[7] = _mm_aesenc_si128(state[6],state[7]);
        state[6] = _mm_aesenc_si128(state[5],state[6]);
        state[5] = _mm_aesenc_si128(state[4],state[5]);
        state[4] = _mm_aesenc_si128(state[3],state[4]);
        state[3] = _mm_aesenc_si128(state[2],state[3]);
        state[2] = _mm_aesenc_si128(state[1],state[2]);
        state[1] = _mm_aesenc_si128(state[0],state[1]);
        state[0] = _mm_aesenc_si128(tmp,state[0]);

        //message is used to update the state.
        state[0] = _mm_xor_si128(state[0],msg0);
        state[4] = _mm_xor_si128(state[4],msg1);  

        
        //The second 32-byte 
        msg2 = _mm_load_si128((__m128i*)(ad+i+32));
        msg3 = _mm_load_si128((__m128i*)(ad+i+48));

        //state update function
        tmp = state[7];
        state[7] = _mm_aesenc_si128(state[6],state[7]);
        state[6] = _mm_aesenc_si128(state[5],state[6]);
        state[5] = _mm_aesenc_si128(state[4],state[5]);
        state[4] = _mm_aesenc_si128(state[3],state[4]);
        state[3] = _mm_aesenc_si128(state[2],state[3]);
        state[2] = _mm_aesenc_si128(state[1],state[2]);
        state[1] = _mm_aesenc_si128(state[0],state[1]);
        state[0] = _mm_aesenc_si128(tmp,state[0]);

        //message is used to update the state.
        state[0] = _mm_xor_si128(state[0],msg2);
        state[4] = _mm_xor_si128(state[4],msg3);    


        //The third 32-byte    
        msg0 = _mm_load_si128((__m128i*)(ad+i+64));
        msg1 = _mm_load_si128((__m128i*)(ad+i+80));

        //state update function
        tmp = state[7];
        state[7] = _mm_aesenc_si128(state[6],state[7]);
        state[6] = _mm_aesenc_si128(state[5],state[6]);
        state[5] = _mm_aesenc_si128(state[4],state[5]);
        state[4] = _mm_aesenc_si128(state[3],state[4]);
        state[3] = _mm_aesenc_si128(state[2],state[3]);
        state[2] = _mm_aesenc_si128(state[1],state[2]);
        state[1] = _mm_aesenc_si128(state[0],state[1]);
        state[0] = _mm_aesenc_si128(tmp,state[0]);

        //message is used to update the state.
        state[0] = _mm_xor_si128(state[0],msg0);
        state[4] = _mm_xor_si128(state[4],msg1);  

        
        //The fourth 32-byte 
        msg2 = _mm_load_si128((__m128i*)(ad+i+96));
        msg3 = _mm_load_si128((__m128i*)(ad+i+112));

        //state update function
        tmp = state[7];
        state[7] = _mm_aesenc_si128(state[6],state[7]);
        state[6] = _mm_aesenc_si128(state[5],state[6]);
        state[5] = _mm_aesenc_si128(state[4],state[5]);
        state[4] = _mm_aesenc_si128(state[3],state[4]);
        state[3] = _mm_aesenc_si128(state[2],state[3]);
        state[2] = _mm_aesenc_si128(state[1],state[2]);
        state[1] = _mm_aesenc_si128(state[0],state[1]);
        state[0] = _mm_aesenc_si128(tmp,state[0]);

        //message is used to update the state.
        state[0] = _mm_xor_si128(state[0],msg2);
        state[4] = _mm_xor_si128(state[4],msg3);    
     }  

    // Deal with the partial block    
    // In this program, we assume that the message length is multiple of bytes.
    if (  (adlen & 0x7f) != 0 ) aegis128L_ad_partial(state, ad + i, adlen & 0x7f);     

    // encrypt the message  
    for (i = 0; (i+128) <= mlen; i = i+128) 
    {   
        //encrypt 32 bytes: the first  
        msg0 = _mm_load_si128((__m128i*)(m+i)); 
        msg1 = _mm_load_si128((__m128i*)(m+i+16)); 

        ct0 = _mm_xor_si128(msg0, state[6]);
        ct0 = _mm_xor_si128(ct0,  state[1]);
        ct1 = _mm_xor_si128(msg1, state[2]);
        ct1 = _mm_xor_si128(ct1,  state[5]);
        ct0 = _mm_xor_si128(ct0,  _mm_and_si128(state[2], state[3]));
        ct1 = _mm_xor_si128(ct1,  _mm_and_si128(state[6], state[7]));
    	_mm_store_si128((__m128i*)(c+i), ct0);
    	_mm_store_si128((__m128i*)(c+i+16), ct1);

        //state update function
        tmp = state[7];
        state[7] = _mm_aesenc_si128(state[6],state[7]);
        state[6] = _mm_aesenc_si128(state[5],state[6]);
        state[5] = _mm_aesenc_si128(state[4],state[5]);
        state[4] = _mm_aesenc_si128(state[3],state[4]);
        state[3] = _mm_aesenc_si128(state[2],state[3]);
        state[2] = _mm_aesenc_si128(state[1],state[2]);
        state[1] = _mm_aesenc_si128(state[0],state[1]);
        state[0] = _mm_aesenc_si128(tmp,state[0]);

        //message is used to update the state.
        state[0] = _mm_xor_si128(state[0],msg0);
        state[4] = _mm_xor_si128(state[4],msg1);  


        //encrypt 32 bytes: the second  
        msg2 = _mm_load_si128((__m128i*)(m+i+32)); 
        msg3 = _mm_load_si128((__m128i*)(m+i+48)); 

        ct0 = _mm_xor_si128(msg2, state[6]);
        ct0 = _mm_xor_si128(ct0,  state[1]);
        ct1 = _mm_xor_si128(msg3, state[2]);
        ct1 = _mm_xor_si128(ct1,  state[5]);
        ct0 = _mm_xor_si128(ct0,  _mm_and_si128(state[2], state[3]));
        ct1 = _mm_xor_si128(ct1,  _mm_and_si128(state[6], state[7]));
    	_mm_store_si128((__m128i*)(c+i+32), ct0);
    	_mm_store_si128((__m128i*)(c+i+48), ct1);

        //state update function
        tmp = state[7];
        state[7] = _mm_aesenc_si128(state[6],state[7]);
        state[6] = _mm_aesenc_si128(state[5],state[6]);
        state[5] = _mm_aesenc_si128(state[4],state[5]);
        state[4] = _mm_aesenc_si128(state[3],state[4]);
        state[3] = _mm_aesenc_si128(state[2],state[3]);
        state[2] = _mm_aesenc_si128(state[1],state[2]);
        state[1] = _mm_aesenc_si128(state[0],state[1]);
        state[0] = _mm_aesenc_si128(tmp,state[0]);

        //message is used to update the state.
        state[0] = _mm_xor_si128(state[0],msg2);
        state[4] = _mm_xor_si128(state[4],msg3);  

        //encrypt 32 bytes: the third  
        msg0 = _mm_load_si128((__m128i*)(m+i+64)); 
        msg1 = _mm_load_si128((__m128i*)(m+i+80)); 

        ct0 = _mm_xor_si128(msg0, state[6]);
        ct0 = _mm_xor_si128(ct0,  state[1]);
        ct1 = _mm_xor_si128(msg1, state[2]);
        ct1 = _mm_xor_si128(ct1,  state[5]);
        ct0 = _mm_xor_si128(ct0,  _mm_and_si128(state[2], state[3]));
        ct1 = _mm_xor_si128(ct1,  _mm_and_si128(state[6], state[7]));
    	_mm_store_si128((__m128i*)(c+i+64), ct0);
    	_mm_store_si128((__m128i*)(c+i+80), ct1);

        //state update function
        tmp = state[7];
        state[7] = _mm_aesenc_si128(state[6],state[7]);
        state[6] = _mm_aesenc_si128(state[5],state[6]);
        state[5] = _mm_aesenc_si128(state[4],state[5]);
        state[4] = _mm_aesenc_si128(state[3],state[4]);
        state[3] = _mm_aesenc_si128(state[2],state[3]);
        state[2] = _mm_aesenc_si128(state[1],state[2]);
        state[1] = _mm_aesenc_si128(state[0],state[1]);
        state[0] = _mm_aesenc_si128(tmp,state[0]);

        //message is used to update the state.
        state[0] = _mm_xor_si128(state[0],msg0);
        state[4] = _mm_xor_si128(state[4],msg1);  


        //encrypt 32 bytes: the fourth 
        msg2 = _mm_load_si128((__m128i*)(m+i+96)); 
        msg3 = _mm_load_si128((__m128i*)(m+i+112)); 

        ct0 = _mm_xor_si128(msg2, state[6]);
        ct0 = _mm_xor_si128(ct0,  state[1]);
        ct1 = _mm_xor_si128(msg3, state[2]);
        ct1 = _mm_xor_si128(ct1,  state[5]);
        ct0 = _mm_xor_si128(ct0,  _mm_and_si128(state[2], state[3]));
        ct1 = _mm_xor_si128(ct1,  _mm_and_si128(state[6], state[7]));
    	_mm_store_si128((__m128i*)(c+i+96), ct0);
    	_mm_store_si128((__m128i*)(c+i+112), ct1);

        //state update function
        tmp = state[7];
        state[7] = _mm_aesenc_si128(state[6],state[7]);
        state[6] = _mm_aesenc_si128(state[5],state[6]);
        state[5] = _mm_aesenc_si128(state[4],state[5]);
        state[4] = _mm_aesenc_si128(state[3],state[4]);
        state[3] = _mm_aesenc_si128(state[2],state[3]);
        state[2] = _mm_aesenc_si128(state[1],state[2]);
        state[1] = _mm_aesenc_si128(state[0],state[1]);
        state[0] = _mm_aesenc_si128(tmp,state[0]);

        //message is used to update the state.
        state[0] = _mm_xor_si128(state[0],msg2);
        state[4] = _mm_xor_si128(state[4],msg3);    
    }  

    // Deal with the partial block    
    // In this program, we assume that the message length is multiple of bytes.   
    if (  (mlen & 0x7f) != 0 ) aegis128L_enc_partial(state, m+i, mlen & 0x7f, c+i);      

    // finalization stage, we assume that the tag length is multiple of bytes
    aegis128L_tag_generation(mlen,adlen, 16, mac, state);
    *clen = mlen + 16;
    memcpy(c+mlen, mac, 16); 
          
    return 0; 
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x80, %rsp
movq 0xb8(%rsp), %rax
movq 0xc0(%rsp), %r10
vmovdqa (%r10), %xmm2
vmovdqa (%rax), %xmm3
vpxor %xmm2, %xmm3, %xmm4
vmovdqa %xmm4, (%rsp)
vmovdqa 0x18f6(%rip), %xmm0     # 0x3000
vmovdqa %xmm0, 0x10(%rsp)
vmovdqa 0x18f8(%rip), %xmm1     # 0x3010
vmovdqa %xmm1, 0x20(%rsp)
vmovdqa %xmm0, 0x30(%rsp)
movq %r9, %r12
movq %rcx, %rbx
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %r14
vmovdqa %xmm4, 0x40(%rsp)
vpxor %xmm1, %xmm2, %xmm9
vmovdqa %xmm9, 0x50(%rsp)
vpxor %xmm0, %xmm2, %xmm5
vmovdqa %xmm5, 0x60(%rsp)
vmovdqa %xmm9, 0x70(%rsp)
movl $0xa, %eax
vmovdqa %xmm9, %xmm6
vmovdqa %xmm0, %xmm7
vmovdqa %xmm4, %xmm8
vaesenc %xmm8, %xmm9, %xmm10
vaesenc %xmm9, %xmm5, %xmm9
vaesenc %xmm5, %xmm6, %xmm5
vaesenc %xmm6, %xmm4, %xmm6
vaesenc %xmm4, %xmm0, %xmm4
vaesenc %xmm0, %xmm1, %xmm0
vaesenc %xmm1, %xmm7, %xmm1
vaesenc %xmm7, %xmm8, %xmm7
vpxor %xmm3, %xmm10, %xmm8
vpxor %xmm2, %xmm4, %xmm4
decl %eax
jne 0x1764
vmovdqa %xmm9, 0x70(%rsp)
vmovdqa %xmm5, 0x60(%rsp)
vmovdqa %xmm6, 0x50(%rsp)
vmovdqa %xmm4, 0x40(%rsp)
vmovdqa %xmm0, 0x30(%rsp)
vmovdqa %xmm1, 0x20(%rsp)
vmovdqa %xmm7, 0x10(%rsp)
vmovdqa %xmm8, (%rsp)
cmpq $0x80, %r12
jae 0x17d7
xorl %eax, %eax
jmp 0x1927
vmovdqa (%rsp), %xmm0
vmovdqa 0x10(%rsp), %xmm3
vmovdqa 0x20(%rsp), %xmm2
vmovdqa 0x30(%rsp), %xmm4
vmovdqa 0x40(%rsp), %xmm7
vmovdqa 0x50(%rsp), %xmm5
vmovdqa 0x60(%rsp), %xmm6
vmovdqa 0x70(%rsp), %xmm1
xorl %eax, %eax
movq %rax, %rcx
vaesenc %xmm1, %xmm6, %xmm8
vaesenc %xmm6, %xmm5, %xmm6
vaesenc %xmm5, %xmm7, %xmm5
vaesenc %xmm7, %xmm4, %xmm7
vaesenc %xmm4, %xmm2, %xmm4
vaesenc %xmm2, %xmm3, %xmm2
vaesenc %xmm0, %xmm1, %xmm1
vpxor (%r8,%rax), %xmm1, %xmm1
vaesenc %xmm3, %xmm0, %xmm0
vpxor 0x10(%r8,%rax), %xmm7, %xmm3
vaesenc %xmm8, %xmm6, %xmm7
vaesenc %xmm6, %xmm5, %xmm6
vaesenc %xmm5, %xmm3, %xmm5
vaesenc %xmm3, %xmm4, %xmm3
vaesenc %xmm4, %xmm2, %xmm4
vaesenc %xmm2, %xmm0, %xmm2
vaesenc %xmm1, %xmm8, %xmm8
vpxor 0x20(%r8,%rax), %xmm8, %xmm8
vaesenc %xmm0, %xmm1, %xmm0
vpxor 0x30(%r8,%rax), %xmm3, %xmm1
vaesenc %xmm7, %xmm6, %xmm3
vaesenc %xmm6, %xmm5, %xmm6
vaesenc %xmm5, %xmm1, %xmm5
vaesenc %xmm1, %xmm4, %xmm1
vaesenc %xmm4, %xmm2, %xmm4
vaesenc %xmm2, %xmm0, %xmm2
vaesenc %xmm8, %xmm7, %xmm7
vpxor 0x40(%r8,%rax), %xmm7, %xmm7
vaesenc %xmm0, %xmm8, %xmm8
vpxor 0x50(%r8,%rax), %xmm1, %xmm0
vaesenc %xmm3, %xmm6, %xmm1
vaesenc %xmm6, %xmm5, %xmm6
vaesenc %xmm5, %xmm0, %xmm5
vaesenc %xmm0, %xmm4, %xmm9
vaesenc %xmm4, %xmm2, %xmm4
vaesenc %xmm2, %xmm8, %xmm2
vaesenc %xmm7, %xmm3, %xmm0
vpxor 0x60(%r8,%rax), %xmm0, %xmm0
vaesenc %xmm8, %xmm7, %xmm3
vpxor 0x70(%r8,%rax), %xmm9, %xmm7
addq $0x80, %rax
addq $0x100, %rcx            # imm = 0x100
cmpq %r12, %rcx
jbe 0x1808
vmovdqa %xmm1, 0x70(%rsp)
vmovdqa %xmm6, 0x60(%rsp)
vmovdqa %xmm5, 0x50(%rsp)
vmovdqa %xmm7, 0x40(%rsp)
vmovdqa %xmm4, 0x30(%rsp)
vmovdqa %xmm2, 0x20(%rsp)
vmovdqa %xmm3, 0x10(%rsp)
vmovdqa %xmm0, (%rsp)
movq %r12, %rdx
andq $0x7f, %rdx
je 0x193e
addq %rax, %r8
movq %rsp, %rdi
movq %r8, %rsi
callq 0x1090
cmpq $0x80, %rbx
jae 0x194e
xorl %ecx, %ecx
jmp 0x1b7b
vmovdqa (%rsp), %xmm4
vmovdqa 0x10(%rsp), %xmm3
vmovdqa 0x20(%rsp), %xmm5
vmovdqa 0x30(%rsp), %xmm6
vmovdqa 0x40(%rsp), %xmm7
vmovdqa 0x70(%rsp), %xmm2
vmovdqa 0x50(%rsp), %xmm0
vmovdqa 0x60(%rsp), %xmm1
xorl %ecx, %ecx
movq %rcx, %rax
vmovdqa (%r13,%rcx), %xmm9
vmovdqa 0x10(%r13,%rcx), %xmm10
vaesenc %xmm4, %xmm2, %xmm8
vpxor %xmm9, %xmm8, %xmm8
vmovdqa %xmm9, %xmm11
vpternlogq $0x78, %xmm5, %xmm6, %xmm11
vpternlogq $0x96, %xmm1, %xmm3, %xmm11
vaesenc %xmm7, %xmm6, %xmm9
vpxor %xmm10, %xmm9, %xmm9
vpternlogq $0x78, %xmm1, %xmm2, %xmm10
vmovdqa %xmm11, (%r14,%rcx)
vpternlogq $0x96, %xmm5, %xmm0, %xmm10
vmovdqa %xmm10, 0x10(%r14,%rcx)
vaesenc %xmm2, %xmm1, %xmm2
vaesenc %xmm1, %xmm0, %xmm10
vaesenc %xmm0, %xmm7, %xmm0
vaesenc %xmm6, %xmm5, %xmm6
vaesenc %xmm5, %xmm3, %xmm5
vmovdqa 0x20(%r13,%rcx), %xmm7
vmovdqa 0x30(%r13,%rcx), %xmm11
vaesenc %xmm3, %xmm4, %xmm3
vaesenc %xmm10, %xmm0, %xmm1
vaesenc %xmm0, %xmm9, %xmm4
vmovdqa %xmm0, %xmm12
vpternlogq $0x78, %xmm2, %xmm10, %xmm12
vaesenc %xmm2, %xmm10, %xmm0
vpternlogq $0x78, %xmm6, %xmm5, %xmm10
vpternlogq $0x96, %xmm3, %xmm7, %xmm10
vpternlogq $0x96, %xmm5, %xmm11, %xmm12
vmovdqa %xmm10, 0x20(%r14,%rcx)
vmovdqa %xmm12, 0x30(%r14,%rcx)
vaesenc %xmm9, %xmm6, %xmm9
vaesenc %xmm6, %xmm5, %xmm6
vaesenc %xmm5, %xmm3, %xmm5
vaesenc %xmm3, %xmm8, %xmm3
vaesenc %xmm8, %xmm2, %xmm2
vpxor %xmm7, %xmm2, %xmm2
vpxor %xmm11, %xmm9, %xmm8
vmovdqa 0x40(%r13,%rcx), %xmm9
vmovdqa 0x50(%r13,%rcx), %xmm10
vaesenc %xmm1, %xmm4, %xmm7
vaesenc %xmm4, %xmm8, %xmm11
vmovdqa %xmm4, %xmm12
vpternlogq $0x78, %xmm0, %xmm1, %xmm12
vaesenc %xmm0, %xmm1, %xmm4
vmovdqa %xmm1, %xmm13
vpternlogq $0x78, %xmm6, %xmm5, %xmm13
vpternlogq $0x96, %xmm3, %xmm9, %xmm13
vpternlogq $0x96, %xmm5, %xmm10, %xmm12
vaesenc %xmm8, %xmm6, %xmm1
vaesenc %xmm6, %xmm5, %xmm6
vaesenc %xmm5, %xmm3, %xmm5
vaesenc %xmm3, %xmm2, %xmm3
vaesenc %xmm2, %xmm0, %xmm14
vpxor %xmm1, %xmm10, %xmm8
vaesenc %xmm7, %xmm11, %xmm1
vaesenc %xmm11, %xmm8, %xmm0
vpternlogq $0x78, %xmm4, %xmm7, %xmm11
vaesenc %xmm4, %xmm7, %xmm2
vmovdqa %xmm13, 0x40(%r14,%rcx)
vmovdqa %xmm12, 0x50(%r14,%rcx)
vmovdqa 0x60(%r13,%rcx), %xmm10
vmovdqa 0x70(%r13,%rcx), %xmm12
vpxor %xmm9, %xmm14, %xmm9
vpternlogq $0x78, %xmm6, %xmm5, %xmm7
vpternlogq $0x96, %xmm3, %xmm10, %xmm7
vmovdqa %xmm7, 0x60(%r14,%rcx)
vpternlogq $0x96, %xmm5, %xmm12, %xmm11
vmovdqa %xmm11, 0x70(%r14,%rcx)
vaesenc %xmm8, %xmm6, %xmm7
vaesenc %xmm6, %xmm5, %xmm6
vaesenc %xmm5, %xmm3, %xmm5
vaesenc %xmm3, %xmm9, %xmm3
vaesenc %xmm9, %xmm4, %xmm4
vpxor %xmm4, %xmm10, %xmm4
vpxor %xmm7, %xmm12, %xmm7
addq $0x80, %rcx
addq $0x100, %rax            # imm = 0x100
cmpq %rbx, %rax
jbe 0x197f
vmovdqa %xmm2, 0x70(%rsp)
vmovdqa %xmm1, 0x60(%rsp)
vmovdqa %xmm0, 0x50(%rsp)
vmovdqa %xmm7, 0x40(%rsp)
vmovdqa %xmm6, 0x30(%rsp)
vmovdqa %xmm5, 0x20(%rsp)
vmovdqa %xmm3, 0x10(%rsp)
vmovdqa %xmm4, (%rsp)
movq %rbx, %rdx
andq $0x7f, %rdx
je 0x1b95
addq %rcx, %r13
addq %r14, %rcx
movq %rsp, %rdi
movq %r13, %rsi
callq 0x1050
vmovq %rbx, %xmm0
vmovq %r12, %xmm1
vpunpcklqdq %xmm0, %xmm1, %xmm0 # xmm0 = xmm1[0],xmm0[0]
vpsllq $0x3, %xmm0, %xmm5
vmovdqa (%rsp), %xmm2
vmovdqa 0x10(%rsp), %xmm1
vmovdqa 0x20(%rsp), %xmm0
vmovdqa 0x30(%rsp), %xmm3
vmovdqa 0x70(%rsp), %xmm8
vmovdqa 0x60(%rsp), %xmm4
vpxor %xmm5, %xmm0, %xmm7
vmovdqa 0x50(%rsp), %xmm5
vmovdqa 0x40(%rsp), %xmm6
movl $0x7, %eax
vaesenc %xmm2, %xmm8, %xmm9
vaesenc %xmm8, %xmm4, %xmm8
vaesenc %xmm4, %xmm5, %xmm4
vaesenc %xmm5, %xmm6, %xmm5
vaesenc %xmm6, %xmm3, %xmm6
vaesenc %xmm3, %xmm0, %xmm3
vaesenc %xmm0, %xmm1, %xmm0
vaesenc %xmm1, %xmm2, %xmm1
vpxor %xmm7, %xmm9, %xmm2
vpxor %xmm7, %xmm6, %xmm6
decl %eax
jne 0x1be0
vmovdqa %xmm8, 0x70(%rsp)
vmovdqa %xmm5, 0x50(%rsp)
vmovdqa %xmm6, 0x40(%rsp)
vmovdqa %xmm3, 0x30(%rsp)
vmovdqa %xmm0, 0x20(%rsp)
vmovdqa %xmm1, 0x10(%rsp)
vmovdqa %xmm2, (%rsp)
vpternlogq $0x96, %xmm4, %xmm6, %xmm5
vpternlogq $0x96, %xmm3, %xmm5, %xmm0
vpternlogq $0x96, %xmm1, %xmm2, %xmm0
vmovdqa %xmm0, 0x60(%rsp)
leaq 0x10(%rbx), %rax
movq %rax, (%r15)
vmovdqu %xmm0, (%r14,%rbx)
xorl %eax, %eax
addq $0x80, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq