// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/aezv3/ref/rijndael-alg-fst.c
// Function: rijndaelDecryptRound
void rijndaelDecryptRound(const u32 rk[/*4*(Nr + 1)*/], int Nr, u8 block[16], int rounds) {
	int r;
	u32 s0, s1, s2, s3, t0, t1, t2, t3;

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

    /*
	 * Nr - 1 full rounds:
	 */
	for (r = (rounds < Nr ? rounds : Nr) - 1; r > 0; r--) {
		t0 =
			Td0[(s0 >> 24)       ] ^
			Td1[(s3 >> 16) & 0xff] ^
			Td2[(s2 >>  8) & 0xff] ^
			Td3[(s1      ) & 0xff] ^
			rk[0];
		t1 =
			Td0[(s1 >> 24)       ] ^
			Td1[(s0 >> 16) & 0xff] ^
			Td2[(s3 >>  8) & 0xff] ^
			Td3[(s2      ) & 0xff] ^
			rk[1];
		t2 =
			Td0[(s2 >> 24)       ] ^
			Td1[(s1 >> 16) & 0xff] ^
			Td2[(s0 >>  8) & 0xff] ^
			Td3[(s3      ) & 0xff] ^
			rk[2];
		t3 =
			Td0[(s3 >> 24)       ] ^
			Td1[(s2 >> 16) & 0xff] ^
			Td2[(s1 >>  8) & 0xff] ^
			Td3[(s0      ) & 0xff] ^
			rk[3];

		s0 = t0;
		s1 = t1;
		s2 = t2;
		s3 = t3;
		rk += 4;

    }

    /*
	 * complete the last round and
	 * map cipher state to byte array block:
	 */
	t0 =
		(Td4[(s0 >> 24)       ] & 0xff000000) ^
		(Td4[(s3 >> 16) & 0xff] & 0x00ff0000) ^
		(Td4[(s2 >>  8) & 0xff] & 0x0000ff00) ^
		(Td4[(s1      ) & 0xff] & 0x000000ff);
	t1 =
		(Td4[(s1 >> 24)       ] & 0xff000000) ^
		(Td4[(s0 >> 16) & 0xff] & 0x00ff0000) ^
		(Td4[(s3 >>  8) & 0xff] & 0x0000ff00) ^
		(Td4[(s2      ) & 0xff] & 0x000000ff);
	t2 =
		(Td4[(s2 >> 24)       ] & 0xff000000) ^
		(Td4[(s1 >> 16) & 0xff] & 0x00ff0000) ^
		(Td4[(s0 >>  8) & 0xff] & 0x0000ff00) ^
		(Td4[(s3      ) & 0xff] & 0x000000ff);
	t3 =
		(Td4[(s3 >> 24)       ] & 0xff000000) ^
		(Td4[(s2 >> 16) & 0xff] & 0x00ff0000) ^
		(Td4[(s1 >>  8) & 0xff] & 0x0000ff00) ^
		(Td4[(s0      ) & 0xff] & 0x000000ff);

	if (rounds == Nr) {
	    t0 ^= rk[0];
	    t1 ^= rk[1];
	    t2 ^= rk[2];
	    t3 ^= rk[3];
	}

	PUTU32(block     , t0);
	PUTU32(block +  4, t1);
	PUTU32(block +  8, t2);
	PUTU32(block + 12, t3);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movbel (%rdx), %eax
xorl (%rdi), %eax
movbel 0x4(%rdx), %r8d
xorl 0x4(%rdi), %r8d
movbel 0x8(%rdx), %r14d
xorl 0x8(%rdi), %r14d
movq %rdx, -0x8(%rsp)
movbel 0xc(%rdx), %r10d
xorl 0xc(%rdi), %r10d
cmpl %esi, %ecx
movl %esi, -0x18(%rsp)
movl %esi, %edx
movl %ecx, -0x14(%rsp)
cmovll %ecx, %edx
addq $0x10, %rdi
movl $0xff, %ebp
leaq 0x1024(%rip), %r15      # 0x48d0
leaq 0x141d(%rip), %r12      # 0x4cd0
leaq 0x1816(%rip), %r11      # 0x50d0
movl $0x3fc, %ebx            # imm = 0x3FC
movl %r10d, %ecx
shrl $0x10, %ecx
movzbl %cl, %r13d
cmpl $0x2, %edx
jl 0x39a3
movl %eax, %ecx
shrl $0x18, %ecx
movl (%r15,%r13,4), %r13d
movl %edx, -0x20(%rsp)
leaq 0xbea(%rip), %rdx       # 0x44d0
xorl (%rdx,%rcx,4), %r13d
movl %r14d, %ecx
shrl $0x8, %ecx
andl %ebp, %ecx
xorl (%r12,%rcx,4), %r13d
movl %r8d, %ecx
andl %ebp, %ecx
xorl (%r11,%rcx,4), %r13d
movl %r8d, %esi
shrl $0x18, %esi
movl %eax, %ecx
shrl $0xe, %ecx
andl %ebx, %ecx
movl (%rcx,%r15), %ecx
xorl (%rdx,%rsi,4), %ecx
movl %r10d, %esi
shrl $0x8, %esi
andl %ebp, %esi
xorl (%r12,%rsi,4), %ecx
movl %r14d, %esi
andl %ebp, %esi
xorl (%r11,%rsi,4), %ecx
movl %r14d, %r9d
shrl $0x18, %r9d
movl %r8d, %esi
shrl $0xe, %esi
andl %ebx, %esi
movl (%rsi,%r15), %esi
xorl (%rdx,%r9,4), %esi
movl %eax, %r9d
shrl $0x8, %r9d
andl %ebp, %r9d
xorl (%r12,%r9,4), %esi
movl %r10d, %r9d
andl %ebp, %r9d
xorl (%r11,%r9,4), %esi
shrl $0x18, %r10d
shrl $0xe, %r14d
andl %ebx, %r14d
movl (%r14,%r15), %r9d
xorl (%rdx,%r10,4), %r9d
movl -0x20(%rsp), %edx
shrl $0x8, %r8d
andl %ebp, %r8d
xorl (%r12,%r8,4), %r9d
andl %ebp, %eax
xorl (%r11,%rax,4), %r9d
xorl (%rdi), %r13d
xorl 0x4(%rdi), %ecx
decl %edx
xorl 0x8(%rdi), %esi
xorl 0xc(%rdi), %r9d
addq $0x10, %rdi
movl %r13d, %eax
movl %ecx, %r8d
movl %esi, %r14d
movl %r9d, %r10d
jmp 0x38bf
leaq 0x2b26(%rip), %r11      # 0x64d0
movl %r14d, %ebx
shrl $0x8, %ebx
movl $0xff, %ebp
andl %ebp, %ebx
movl %r8d, %ecx
andl %ebp, %ecx
movq %rcx, -0x20(%rsp)
movl %eax, %r9d
shrl $0xe, %r9d
movl $0x3fc, %edx            # imm = 0x3FC
andl %edx, %r9d
movl %r14d, %ecx
movl %r14d, %r15d
vmovd (%r11,%r13,4), %xmm0
movl %r8d, %r12d
shrl $0xe, %r12d
andl %edx, %r12d
shrl $0xe, %r14d
andl %edx, %r14d
movl %r8d, %edx
shrl $0x18, %edx
vpinsrd $0x1, (%r11,%rdx,4), %xmm0, %xmm0
movl %r10d, %edx
shrl $0x8, %edx
andl %ebp, %edx
andl %ebp, %ecx
movq %rcx, -0x10(%rsp)
movl %eax, %r13d
shrl $0x8, %r13d
andl %ebp, %r13d
movl %r10d, %esi
andl %ebp, %esi
shrl $0x8, %r8d
andl %ebp, %r8d
movl %eax, %ecx
andl %ebp, %eax
vpinsrd $0x2, (%r12,%r11), %xmm0, %xmm0
shrl $0x18, %r10d
vpinsrd $0x3, (%r11,%r10,4), %xmm0, %xmm1
shrl $0x18, %ecx
vmovd (%r11,%rcx,4), %xmm0
vpinsrd $0x1, (%r9,%r11), %xmm0, %xmm0
shrl $0x18, %r15d
vpinsrd $0x2, (%r11,%r15,4), %xmm0, %xmm0
vpinsrd $0x3, (%r14,%r11), %xmm0, %xmm2
vmovd (%r11,%rbx,4), %xmm0
vpinsrd $0x1, (%r11,%rdx,4), %xmm0, %xmm0
vpinsrd $0x2, (%r11,%r13,4), %xmm0, %xmm0
vpinsrd $0x3, (%r11,%r8,4), %xmm0, %xmm3
movq -0x20(%rsp), %rcx
vmovd (%r11,%rcx,4), %xmm0
movq -0x10(%rsp), %rcx
vpinsrd $0x1, (%r11,%rcx,4), %xmm0, %xmm0
vpinsrd $0x2, (%r11,%rsi,4), %xmm0, %xmm0
vpinsrd $0x3, (%r11,%rax,4), %xmm0, %xmm0
vpandq 0x5df(%rip){1to2}, %xmm2, %xmm2 # 0x4080
vpternlogq $0xf8, 0x5dc(%rip){1to2}, %xmm1, %xmm2 # 0x4088
vpternlogd $0xec, 0x5d9(%rip){1to4}, %xmm2, %xmm3 # 0x4090
vpternlogd $0xec, 0x5d2(%rip){1to4}, %xmm3, %xmm0 # 0x4094
movl -0x18(%rsp), %eax
cmpl %eax, -0x14(%rsp)
jne 0x3ad0
vpxor (%rdi), %xmm0, %xmm0
vmovd %xmm0, %eax
movl %eax, %ecx
shrl $0x18, %ecx
movq -0x8(%rsp), %rdx
movb %cl, (%rdx)
movl %eax, %ecx
shrl $0x10, %ecx
movb %cl, 0x1(%rdx)
movb %ah, 0x2(%rdx)
movb %al, 0x3(%rdx)
vpextrd $0x1, %xmm0, %eax
movl %eax, %ecx
shrl $0x18, %ecx
movb %cl, 0x4(%rdx)
movl %eax, %ecx
shrl $0x10, %ecx
movb %cl, 0x5(%rdx)
movb %ah, 0x6(%rdx)
movb %al, 0x7(%rdx)
vpextrd $0x2, %xmm0, %eax
movl %eax, %ecx
shrl $0x18, %ecx
movb %cl, 0x8(%rdx)
movl %eax, %ecx
shrl $0x10, %ecx
movb %cl, 0x9(%rdx)
movb %ah, 0xa(%rdx)
movb %al, 0xb(%rdx)
vpextrd $0x3, %xmm0, %eax
movl %eax, %ecx
shrl $0x18, %ecx
movb %cl, 0xc(%rdx)
movl %eax, %ecx
shrl $0x10, %ecx
movb %cl, 0xd(%rdx)
movb %ah, 0xe(%rdx)
movb %al, 0xf(%rdx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)