// File: /workspace/github_c_makefile_star2_O3/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 0x2170
movl $0x24, %eax
xorl %ecx, %ecx
movl (%rbx,%rcx,4), %edx
movl 0x10(%rbx,%rax,4), %esi
movl %esi, (%rbx,%rcx,4)
movl %edx, 0x10(%rbx,%rax,4)
movl 0x4(%rbx,%rcx,4), %edx
movl 0x14(%rbx,%rax,4), %esi
movl %esi, 0x4(%rbx,%rcx,4)
movl %edx, 0x14(%rbx,%rax,4)
movl 0x8(%rbx,%rcx,4), %edx
movl 0x18(%rbx,%rax,4), %esi
movl %esi, 0x8(%rbx,%rcx,4)
movl %edx, 0x18(%rbx,%rax,4)
movl 0xc(%rbx,%rcx,4), %edx
movl 0x1c(%rbx,%rax,4), %esi
movl %esi, 0xc(%rbx,%rcx,4)
movl %edx, 0x1c(%rbx,%rax,4)
addq $0x4, %rcx
leaq -0x4(%rax), %rdx
cmpq %rax, %rcx
movq %rdx, %rax
jb 0x241b
movl $0x1c, %eax
leaq 0x4b8b(%rip), %rcx      # 0x7000
leaq 0x4fb4(%rip), %rdx      # 0x7430
movl $0x3fc, %esi            # imm = 0x3FC
leaq 0x53a8(%rip), %rdi      # 0x7830
movl $0xff, %r8d
leaq 0x579b(%rip), %r9       # 0x7c30
leaq 0x5b94(%rip), %r10      # 0x8030
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
cmpl $0xac, %eax
jne 0x249c
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq