// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/shellaes128v1d5n64/ref/aes.c
// Function: aesKeySetupDec
void aesKeySetupDec(u32 rk[], const u8 key[]) {

	int Nr, i, j;
	u32 temp;

    Nr=10;

	/* expand the cipher key: */
	aesKeySetupEnc(rk, key);

	/* invert the order of the round keys: */

	for (i = 0, j = 4*Nr; i < j; i += 4, j -= 4) {
		temp = rk[i    ]; rk[i    ] = rk[j    ]; rk[j    ] = temp;
		temp = rk[i + 1]; rk[i + 1] = rk[j + 1]; rk[j + 1] = temp;
		temp = rk[i + 2]; rk[i + 2] = rk[j + 2]; rk[j + 2] = temp;
		temp = rk[i + 3]; rk[i + 3] = rk[j + 3]; rk[j + 3] = temp;
	}

	/* apply the inverse MixColumn transform to all round keys but the first and the last: */

	for (i = 1; i < Nr; i++) {
		rk += 4;
		rk[0] =
			Td0[Te4[(rk[0] >> 24)       ] & 0xff] ^
			Td1[Te4[(rk[0] >> 16) & 0xff] & 0xff] ^
			Td2[Te4[(rk[0] >>  8) & 0xff] & 0xff] ^
			Td3[Te4[(rk[0]      ) & 0xff] & 0xff];
		rk[1] =
			Td0[Te4[(rk[1] >> 24)       ] & 0xff] ^
			Td1[Te4[(rk[1] >> 16) & 0xff] & 0xff] ^
			Td2[Te4[(rk[1] >>  8) & 0xff] & 0xff] ^
			Td3[Te4[(rk[1]      ) & 0xff] & 0xff];
		rk[2] =
			Td0[Te4[(rk[2] >> 24)       ] & 0xff] ^
			Td1[Te4[(rk[2] >> 16) & 0xff] & 0xff] ^
			Td2[Te4[(rk[2] >>  8) & 0xff] & 0xff] ^
			Td3[Te4[(rk[2]      ) & 0xff] & 0xff];
		rk[3] =
			Td0[Te4[(rk[3] >> 24)       ] & 0xff] ^
			Td1[Te4[(rk[3] >> 16) & 0xff] & 0xff] ^
			Td2[Te4[(rk[3] >>  8) & 0xff] & 0xff] ^
			Td3[Te4[(rk[3]      ) & 0xff] & 0xff];
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
callq 0x2180
pushq $0x28
popq %rax
xorl %ecx, %ecx
cmpq %rax, %rcx
jae 0x24a9
movl (%rbx,%rcx,4), %edx
movl (%rbx,%rax,4), %esi
movl %esi, (%rbx,%rcx,4)
movl %edx, (%rbx,%rax,4)
movl 0x4(%rbx,%rcx,4), %edx
movl 0x4(%rbx,%rax,4), %esi
movl %esi, 0x4(%rbx,%rcx,4)
movl %edx, 0x4(%rbx,%rax,4)
movl 0x8(%rbx,%rcx,4), %edx
movl 0x8(%rbx,%rax,4), %esi
movl %esi, 0x8(%rbx,%rcx,4)
movl %edx, 0x8(%rbx,%rax,4)
movl 0xc(%rbx,%rcx,4), %edx
movl 0xc(%rbx,%rax,4), %esi
movl %esi, 0xc(%rbx,%rcx,4)
movl %edx, 0xc(%rbx,%rax,4)
addq $0x4, %rcx
addq $-0x4, %rax
jmp 0x245e
pushq $0x1c
popq %rax
leaq 0x3b4d(%rip), %rcx      # 0x6000
leaq 0x3f76(%rip), %rdx      # 0x6430
movl $0x3fc, %esi            # imm = 0x3FC
leaq 0x436a(%rip), %rdi      # 0x6830
movl $0xff, %r8d
leaq 0x475d(%rip), %r9       # 0x6c30
leaq 0x4b56(%rip), %r10      # 0x7030
cmpl $0xac, %eax
je 0x2618
movl -0xc(%rbx,%rax), %r14d
movl -0x8(%rbx,%rax), %r11d
movl %r14d, %r15d
shrl $0x18, %r15d
movzbl (%rcx,%r15,4), %r15d
movl %r14d, %r12d
shrl $0xe, %r12d
andl %esi, %r12d
movzbl (%r12,%rcx), %r12d
movl (%rdi,%r12,4), %ebp
xorl (%rdx,%r15,4), %ebp
movl %r14d, %r15d
shrl $0x8, %r15d
andl %r8d, %r15d
movzbl (%rcx,%r15,4), %r15d
xorl (%r9,%r15,4), %ebp
andl %r8d, %r14d
movzbl (%rcx,%r14,4), %r14d
xorl (%r10,%r14,4), %ebp
movl %ebp, -0xc(%rbx,%rax)
movl %r11d, %r14d
shrl $0x18, %r14d
movzbl (%rcx,%r14,4), %r14d
movl %r11d, %r15d
shrl $0xe, %r15d
andl %esi, %r15d
movzbl (%r15,%rcx), %r15d
movl (%rdi,%r15,4), %ebp
xorl (%rdx,%r14,4), %ebp
movl %r11d, %r14d
shrl $0x8, %r14d
andl %r8d, %r14d
movzbl (%rcx,%r14,4), %r14d
xorl (%r9,%r14,4), %ebp
andl %r8d, %r11d
movzbl (%rcx,%r11,4), %r11d
xorl (%r10,%r11,4), %ebp
movl %ebp, -0x8(%rbx,%rax)
movl -0x4(%rbx,%rax), %r11d
movl %r11d, %r14d
shrl $0x18, %r14d
movzbl (%rcx,%r14,4), %r14d
movl %r11d, %r15d
shrl $0xe, %r15d
andl %esi, %r15d
movzbl (%r15,%rcx), %r15d
movl (%rdi,%r15,4), %ebp
xorl (%rdx,%r14,4), %ebp
movl %r11d, %r14d
shrl $0x8, %r14d
andl %r8d, %r14d
movzbl (%rcx,%r14,4), %r14d
xorl (%r9,%r14,4), %ebp
andl %r8d, %r11d
movzbl (%rcx,%r11,4), %r11d
xorl (%r10,%r11,4), %ebp
movl %ebp, -0x4(%rbx,%rax)
movl (%rbx,%rax), %r11d
movl %r11d, %r14d
shrl $0x18, %r14d
movzbl (%rcx,%r14,4), %r14d
movl %r11d, %r15d
shrl $0xe, %r15d
andl %esi, %r15d
movzbl (%r15,%rcx), %r15d
movl (%rdi,%r15,4), %ebp
xorl (%rdx,%r14,4), %ebp
movl %r11d, %r14d
shrl $0x8, %r14d
andl %r8d, %r14d
movzbl (%rcx,%r14,4), %r14d
xorl (%r9,%r14,4), %ebp
andl %r8d, %r11d
movzbl (%rcx,%r11,4), %r11d
xorl (%r10,%r11,4), %ebp
movl %ebp, (%rbx,%rax)
addq $0x10, %rax
jmp 0x24da
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq