// File: /workspace/github_c_makefile_star2_O3/mjosaarinen[P]brutus/crypto_aead/elmd1001v2/ref/aes_round_6.h
// Function: AES_encrypt_r6
void AES_encrypt_r6(const unsigned char *in, unsigned char *out,
		 const AES_KEY *key) {

	const u32 *rk;
	u32 s0, s1, s2, s3, t0, t1, t2, t3;

	assert(in && out && key);
	rk = key->rd_key;

	/*
	 * map byte array block to cipher state
	 * and add initial round key:
	 */
	s0 = GETU32(in     ) ^ rk[0];
	s1 = GETU32(in +  4) ^ rk[1];
	s2 = GETU32(in +  8) ^ rk[2];
	s3 = GETU32(in + 12) ^ rk[3];

	/* round 1: */
   	t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[ 4];
   	t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[ 5];
   	t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[ 6];
   	t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[ 7];
   	/* round 2: */
   	s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[ 8];
   	s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[ 9];
   	s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[10];
   	s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[11];
	/* round 3: */
   	t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[12];
   	t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[13];
   	t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[14];
   	t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[15];
   	/* round 4: */
   	s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[16];
   	s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[17];
   	s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[18];
   	s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[19];
	/* round 5: */
   	t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[20];
   	t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[21];
   	t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[22];
   	t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[23];
	/* round 6: */
   	s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[24];
   	s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[25];
   	s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[26];
   	s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[27];
	
   	
        PUTU32(out     , s0);
	PUTU32(out +  4, s1);
	PUTU32(out +  8, s2);
	PUTU32(out + 12, s3);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r8
movbel (%rdi), %r15d
xorl (%rdx), %r15d
movbel 0x4(%rdi), %ebx
xorl 0x4(%rdx), %ebx
movbel 0x8(%rdi), %ecx
xorl 0x8(%rdx), %ecx
movbel 0xc(%rdi), %eax
xorl 0xc(%rdx), %eax
movl %r15d, %edx
shrl $0x18, %edx
leaq 0x3350(%rip), %r10      # 0x4820
movl %ebx, %edi
shrl $0xe, %edi
movl $0x3fc, %r9d            # imm = 0x3FC
andl %r9d, %edi
leaq 0x373b(%rip), %r14      # 0x4c20
movl (%rdi,%r14), %r11d
xorl (%r10,%rdx,4), %r11d
movq %r10, %r12
movl %ecx, %edx
shrl $0x8, %edx
movl $0xff, %ebp
andl %ebp, %edx
leaq 0x2b1d(%rip), %r13      # 0x4020
xorl (%r13,%rdx,4), %r11d
movl %eax, %edx
andl %ebp, %edx
leaq 0x2f0d(%rip), %r10      # 0x4420
xorl (%r10,%rdx,4), %r11d
movl %ebx, %edx
shrl $0x18, %edx
movl %ecx, %edi
shrl $0xe, %edi
andl %r9d, %edi
movl (%rdi,%r14), %r14d
xorl (%r12,%rdx,4), %r14d
movq %r12, %r9
movl %eax, %edx
shrl $0x8, %edx
andl %ebp, %edx
xorl (%r13,%rdx,4), %r14d
movl %r15d, %edx
andl %ebp, %edx
xorl (%r10,%rdx,4), %r14d
movl %ecx, %edx
shrl $0x18, %edx
movl %eax, %edi
shrl $0xe, %edi
movl $0x3fc, %r10d           # imm = 0x3FC
andl %r10d, %edi
leaq 0x36c2(%rip), %r10      # 0x4c20
movl (%rdi,%r10), %r12d
xorl (%r9,%rdx,4), %r12d
movl %r15d, %edx
shrl $0x8, %edx
andl %ebp, %edx
xorl (%r13,%rdx,4), %r12d
movl %ebx, %edx
andl %ebp, %edx
leaq 0x2ea2(%rip), %r10      # 0x4420
xorl (%r10,%rdx,4), %r12d
xorl 0x10(%r8), %r11d
xorl 0x14(%r8), %r14d
xorl 0x18(%r8), %r12d
shrl $0x18, %eax
shrl $0xe, %r15d
movl $0x3fc, %edx            # imm = 0x3FC
andl %edx, %r15d
movl $0x3fc, %r9d            # imm = 0x3FC
leaq 0x3676(%rip), %r13      # 0x4c20
movl (%r15,%r13), %edi
leaq 0x326b(%rip), %rdx      # 0x4820
xorl (%rdx,%rax,4), %edi
shrl $0x8, %ebx
andl %ebp, %ebx
leaq 0x2a5c(%rip), %r15      # 0x4020
xorl (%r15,%rbx,4), %edi
andl %ebp, %ecx
xorl (%r10,%rcx,4), %edi
xorl 0x1c(%r8), %edi
movl %r11d, %eax
shrl $0x18, %eax
movl %r14d, %ecx
shrl $0xe, %ecx
andl %r9d, %ecx
movl (%rcx,%r13), %ebx
xorl (%rdx,%rax,4), %ebx
movl %r12d, %eax
shrl $0x8, %eax
andl %ebp, %eax
xorl (%r15,%rax,4), %ebx
movq %r15, %r9
movl %edi, %eax
andl %ebp, %eax
xorl (%r10,%rax,4), %ebx
movl %r14d, %eax
shrl $0x18, %eax
movl %r12d, %ecx
shrl $0xe, %ecx
movl $0x3fc, %r15d           # imm = 0x3FC
andl %r15d, %ecx
movl (%rcx,%r13), %r15d
xorl (%rdx,%rax,4), %r15d
movl %edi, %eax
shrl $0x8, %eax
andl %ebp, %eax
xorl (%r9,%rax,4), %r15d
movl %r11d, %eax
andl %ebp, %eax
xorl (%r10,%rax,4), %r15d
movl %r12d, %eax
shrl $0x18, %eax
movl %edi, %ecx
shrl $0xe, %ecx
movl $0x3fc, %ebp            # imm = 0x3FC
andl %ebp, %ecx
movl (%rcx,%r13), %r13d
xorl (%rdx,%rax,4), %r13d
movl %r11d, %eax
shrl $0x8, %eax
movl $0xff, %ecx
andl %ecx, %eax
xorl (%r9,%rax,4), %r13d
movl %r14d, %eax
andl %ecx, %eax
movl $0xff, %ebp
xorl (%r10,%rax,4), %r13d
xorl 0x20(%r8), %ebx
xorl 0x24(%r8), %r15d
xorl 0x28(%r8), %r13d
shrl $0x18, %edi
shrl $0xe, %r11d
movl $0x3fc, %eax            # imm = 0x3FC
andl %eax, %r11d
leaq 0x3595(%rip), %rax      # 0x4c20
movl (%r11,%rax), %ecx
xorl (%rdx,%rdi,4), %ecx
movq %rdx, %r10
shrl $0x8, %r14d
andl %ebp, %r14d
xorl (%r9,%r14,4), %ecx
andl %ebp, %r12d
leaq 0x2d76(%rip), %r14      # 0x4420
xorl (%r14,%r12,4), %ecx
xorl 0x2c(%r8), %ecx
movl %ebx, %eax
shrl $0x18, %eax
movl %r15d, %edx
shrl $0xe, %edx
movl $0x3fc, %edi            # imm = 0x3FC
andl %edi, %edx
leaq 0x3555(%rip), %rdi      # 0x4c20
movl (%rdx,%rdi), %r11d
xorl (%r10,%rax,4), %r11d
movl %r13d, %eax
shrl $0x8, %eax
andl %ebp, %eax
movq %r9, %r12
xorl (%r9,%rax,4), %r11d
movl %ecx, %eax
andl %ebp, %eax
xorl (%r14,%rax,4), %r11d
movl %r15d, %eax
shrl $0x18, %eax
movl %r13d, %edx
shrl $0xe, %edx
movl $0x3fc, %r9d            # imm = 0x3FC
andl %r9d, %edx
movl (%rdx,%rdi), %r14d
xorl (%r10,%rax,4), %r14d
movl %ecx, %eax
shrl $0x8, %eax
andl %ebp, %eax
xorl (%r12,%rax,4), %r14d
movq %r12, %r9
movl %ebx, %eax
andl %ebp, %eax
leaq 0x2d00(%rip), %rdi      # 0x4420
xorl (%rdi,%rax,4), %r14d
movl %r13d, %eax
shrl $0x18, %eax
movl %ecx, %edx
shrl $0xe, %edx
movl $0x3fc, %r12d           # imm = 0x3FC
andl %r12d, %edx
leaq 0x34e1(%rip), %r12      # 0x4c20
movl (%rdx,%r12), %r12d
xorl (%r10,%rax,4), %r12d
movl %ebx, %eax
shrl $0x8, %eax
andl %ebp, %eax
xorl (%r9,%rax,4), %r12d
movl %r15d, %eax
andl %ebp, %eax
xorl (%rdi,%rax,4), %r12d
movq %rdi, %rax
xorl 0x30(%r8), %r11d
xorl 0x34(%r8), %r14d
xorl 0x38(%r8), %r12d
shrl $0x18, %ecx
shrl $0xe, %ebx
movl $0x3fc, %edx            # imm = 0x3FC
andl %edx, %ebx
leaq 0x34a2(%rip), %rdx      # 0x4c20
movl (%rbx,%rdx), %edi
xorl (%r10,%rcx,4), %edi
shrl $0x8, %r15d
andl %ebp, %r15d
xorl (%r9,%r15,4), %edi
movq %r9, %r10
andl %ebp, %r13d
movq %rax, %r15
xorl (%rax,%r13,4), %edi
xorl 0x3c(%r8), %edi
movl %r11d, %eax
shrl $0x18, %eax
movl %r14d, %ecx
shrl $0xe, %ecx
movl $0x3fc, %r9d            # imm = 0x3FC
andl %r9d, %ecx
movl (%rcx,%rdx), %ebx
movq %rdx, %r9
leaq 0x305d(%rip), %r13      # 0x4820
xorl (%r13,%rax,4), %ebx
movl %r12d, %eax
shrl $0x8, %eax
andl %ebp, %eax
movq %r10, %rdx
xorl (%r10,%rax,4), %ebx
movl %edi, %eax
andl %ebp, %eax
movq %r15, %r10
xorl (%r15,%rax,4), %ebx
movl %r14d, %eax
shrl $0x18, %eax
movl %r12d, %ecx
shrl $0xe, %ecx
movl $0x3fc, %r15d           # imm = 0x3FC
andl %r15d, %ecx
movl (%rcx,%r9), %r15d
xorl (%r13,%rax,4), %r15d
movq %r13, %r9
movl %edi, %eax
shrl $0x8, %eax
andl %ebp, %eax
xorl (%rdx,%rax,4), %r15d
movl %r11d, %eax
andl %ebp, %eax
xorl (%r10,%rax,4), %r15d
movl %r12d, %eax
shrl $0x18, %eax
movl %edi, %ecx
shrl $0xe, %ecx
movl $0x3fc, %r13d           # imm = 0x3FC
andl %r13d, %ecx
leaq 0x33ee(%rip), %r13      # 0x4c20
movl (%rcx,%r13), %r13d
xorl (%r9,%rax,4), %r13d
movl %r11d, %eax
shrl $0x8, %eax
andl %ebp, %eax
xorl (%rdx,%rax,4), %r13d
movl %r14d, %eax
andl %ebp, %eax
xorl (%r10,%rax,4), %r13d
xorl 0x40(%r8), %ebx
xorl 0x44(%r8), %r15d
xorl 0x48(%r8), %r13d
shrl $0x18, %edi
shrl $0xe, %r11d
movl $0x3fc, %eax            # imm = 0x3FC
andl %eax, %r11d
leaq 0x33af(%rip), %rax      # 0x4c20
movl (%r11,%rax), %ecx
xorl (%r9,%rdi,4), %ecx
shrl $0x8, %r14d
andl %ebp, %r14d
xorl (%rdx,%r14,4), %ecx
andl %ebp, %r12d
xorl (%r10,%r12,4), %ecx
xorl 0x4c(%r8), %ecx
movl %ebx, %eax
shrl $0x18, %eax
movl %r15d, %edx
shrl $0xe, %edx
movl $0x3fc, %r14d           # imm = 0x3FC
andl %r14d, %edx
leaq 0x3376(%rip), %rdi      # 0x4c20
movl (%rdx,%rdi), %r11d
xorl (%r9,%rax,4), %r11d
movl %r13d, %eax
shrl $0x8, %eax
andl %ebp, %eax
leaq 0x275f(%rip), %r12      # 0x4020
xorl (%r12,%rax,4), %r11d
movl %ecx, %eax
andl %ebp, %eax
xorl (%r10,%rax,4), %r11d
movl %r15d, %eax
shrl $0x18, %eax
movl %r13d, %edx
shrl $0xe, %edx
andl %r14d, %edx
movl (%rdx,%rdi), %r14d
movq %rdi, %r9
leaq 0x2f36(%rip), %rdx      # 0x4820
xorl (%rdx,%rax,4), %r14d
movl %ecx, %eax
shrl $0x8, %eax
andl %ebp, %eax
xorl (%r12,%rax,4), %r14d
movq %r12, %rdi
movl %ebx, %eax
andl %ebp, %eax
xorl (%r10,%rax,4), %r14d
movl %r13d, %eax
shrl $0x18, %eax
movl %ecx, %edx
shrl $0xe, %edx
movl $0x3fc, %r12d           # imm = 0x3FC
andl %r12d, %edx
movl (%rdx,%r9), %r12d
leaq 0x2efd(%rip), %rdx      # 0x4820
xorl (%rdx,%rax,4), %r12d
movl %ebx, %eax
shrl $0x8, %eax
andl %ebp, %eax
xorl (%rdi,%rax,4), %r12d
movl %r15d, %eax
andl %ebp, %eax
xorl (%r10,%rax,4), %r12d
movq %r10, %rax
xorl 0x50(%r8), %r11d
xorl 0x54(%r8), %r14d
xorl 0x58(%r8), %r12d
shrl $0x18, %ecx
shrl $0xe, %ebx
movl $0x3fc, %r10d           # imm = 0x3FC
andl %r10d, %ebx
movl (%rbx,%r9), %r10d
movq %r9, %rbx
xorl (%rdx,%rcx,4), %r10d
shrl $0x8, %r15d
andl %ebp, %r15d
xorl (%rdi,%r15,4), %r10d
andl %ebp, %r13d
xorl (%rax,%r13,4), %r10d
xorl 0x5c(%r8), %r10d
movl %r11d, %eax
shrl $0x18, %eax
movl %r14d, %ecx
shrl $0xe, %ecx
movl $0x3fc, %r9d            # imm = 0x3FC
andl %r9d, %ecx
movq %rbx, %r15
movl (%rcx,%rbx), %ebx
movq %rdx, %rdi
xorl (%rdx,%rax,4), %ebx
movl %r14d, %eax
shrl $0x18, %eax
movl %r12d, %ecx
shrl $0xe, %ecx
andl %r9d, %ecx
movl (%rcx,%r15), %edx
xorl (%rdi,%rax,4), %edx
movl %r12d, %eax
shrl $0x18, %eax
movl %r10d, %ecx
shrl $0xe, %ecx
andl %r9d, %ecx
movl (%rcx,%r15), %ecx
xorl (%rdi,%rax,4), %ecx
movl %r11d, %r15d
movl %r11d, %r13d
shrl $0xe, %r11d
andl %r9d, %r11d
movl %r10d, %r9d
movl %r10d, %edi
shrl $0x18, %r10d
leaq 0x323b(%rip), %rax      # 0x4c20
movl (%r11,%rax), %eax
leaq 0x2e30(%rip), %r11      # 0x4820
xorl (%r11,%r10,4), %eax
movl %r12d, %r10d
shrl $0x8, %r10d
andl %ebp, %r10d
leaq 0x261b(%rip), %r11      # 0x4020
xorl (%r11,%r10,4), %ebx
shrl $0x8, %edi
movl $0xff, %r10d
andl %r10d, %edi
xorl (%r11,%rdi,4), %edx
shrl $0x8, %r13d
andl %r10d, %r13d
xorl (%r11,%r13,4), %ecx
movl %r14d, %edi
shrl $0x8, %r14d
andl %r10d, %r14d
xorl (%r11,%r14,4), %eax
andl %r10d, %r9d
movl $0xff, %r11d
leaq 0x29de(%rip), %r10      # 0x4420
xorl (%r10,%r9,4), %ebx
andl %r11d, %r15d
xorl (%r10,%r15,4), %edx
andl %r11d, %edi
xorl (%r10,%rdi,4), %ecx
andl %r11d, %r12d
xorl (%r10,%r12,4), %eax
xorl 0x60(%r8), %ebx
xorl 0x64(%r8), %edx
xorl 0x68(%r8), %ecx
xorl 0x6c(%r8), %eax
movl %ebx, %edi
shrl $0x18, %edi
movb %dil, (%rsi)
movl %ebx, %edi
shrl $0x10, %edi
movb %dil, 0x1(%rsi)
movb %bh, 0x2(%rsi)
movb %bl, 0x3(%rsi)
movl %edx, %edi
shrl $0x18, %edi
movb %dil, 0x4(%rsi)
movl %edx, %edi
shrl $0x10, %edi
movb %dil, 0x5(%rsi)
movb %dh, 0x6(%rsi)
movb %dl, 0x7(%rsi)
movl %ecx, %edx
shrl $0x18, %edx
movb %dl, 0x8(%rsi)
movl %ecx, %edx
shrl $0x10, %edx
movb %dl, 0x9(%rsi)
movb %ch, 0xa(%rsi)
movb %cl, 0xb(%rsi)
movl %eax, %ecx
shrl $0x18, %ecx
movb %cl, 0xc(%rsi)
movl %eax, %ecx
shrl $0x10, %ecx
movb %cl, 0xd(%rsi)
movb %ah, 0xe(%rsi)
movb %al, 0xf(%rsi)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq