// File: /workspace/github_c_makefile_star2_O0/mjosaarinen[P]brutus/crypto_aead/elmd1001v2/ref/aes_round_6.h
// Function: AES_set_decrypt_key_6
int AES_set_decrypt_key_6(const unsigned char *userKey, const int bits,
			 AES_KEY *key) {

        u32 *rk;
	int i, j, status;
	u32 temp;

	/* first, start with an encryption schedule */
	status = AES_set_encrypt_key_6(userKey, bits, key);
	if (status < 0)
		return status;

	rk = key->rd_key;

	/* invert the order of the round keys: */
	for (i = 0, j = 4*(key->rounds); 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 < (key->rounds); i++) {
		rk += 4;
		rk[0] =
			Td0[Te1[(rk[0] >> 24)       ] & 0xff] ^
			Td1[Te1[(rk[0] >> 16) & 0xff] & 0xff] ^
			Td2[Te1[(rk[0] >>  8) & 0xff] & 0xff] ^
			Td3[Te1[(rk[0]      ) & 0xff] & 0xff];
		rk[1] =
			Td0[Te1[(rk[1] >> 24)       ] & 0xff] ^
			Td1[Te1[(rk[1] >> 16) & 0xff] & 0xff] ^
			Td2[Te1[(rk[1] >>  8) & 0xff] & 0xff] ^
			Td3[Te1[(rk[1]      ) & 0xff] & 0xff];
		rk[2] =
			Td0[Te1[(rk[2] >> 24)       ] & 0xff] ^
			Td1[Te1[(rk[2] >> 16) & 0xff] & 0xff] ^
			Td2[Te1[(rk[2] >>  8) & 0xff] & 0xff] ^
			Td3[Te1[(rk[2]      ) & 0xff] & 0xff];
		rk[3] =
			Td0[Te1[(rk[3] >> 24)       ] & 0xff] ^
			Td1[Te1[(rk[3] >> 16) & 0xff] & 0xff] ^
			Td2[Te1[(rk[3] >>  8) & 0xff] & 0xff] ^
			Td3[Te1[(rk[3]      ) & 0xff] & 0xff];
	
	}
	return 0;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movl %esi, 0x24(%rsp)
movq %rdx, 0x18(%rsp)
movq 0x28(%rsp), %rdi
movl 0x24(%rsp), %esi
movq 0x18(%rsp), %rdx
callq 0x1080
movl %eax, 0x4(%rsp)
cmpl $0x0, 0x4(%rsp)
jge 0x141d
movl 0x4(%rsp), %eax
movl %eax, 0x34(%rsp)
jmp 0x18dc
movq 0x18(%rsp), %rax
movq %rax, 0x10(%rsp)
movl $0x0, 0xc(%rsp)
movq 0x18(%rsp), %rax
movl 0xf0(%rax), %eax
shll $0x2, %eax
movl %eax, 0x8(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x8(%rsp), %eax
jge 0x158e
movq 0x10(%rsp), %rax
movslq 0xc(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, (%rsp)
movq 0x10(%rsp), %rax
movslq 0x8(%rsp), %rcx
movl (%rax,%rcx,4), %edx
movq 0x10(%rsp), %rax
movslq 0xc(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl (%rsp), %edx
movq 0x10(%rsp), %rax
movslq 0x8(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movq 0x10(%rsp), %rax
movl 0xc(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, (%rsp)
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq 0x10(%rsp), %rax
movl 0xc(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl (%rsp), %edx
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq 0x10(%rsp), %rax
movl 0xc(%rsp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, (%rsp)
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq 0x10(%rsp), %rax
movl 0xc(%rsp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl (%rsp), %edx
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq 0x10(%rsp), %rax
movl 0xc(%rsp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, (%rsp)
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq 0x10(%rsp), %rax
movl 0xc(%rsp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl (%rsp), %edx
movq 0x10(%rsp), %rax
movl 0x8(%rsp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl 0xc(%rsp), %eax
addl $0x4, %eax
movl %eax, 0xc(%rsp)
movl 0x8(%rsp), %eax
subl $0x4, %eax
movl %eax, 0x8(%rsp)
jmp 0x1441
movl $0x1, 0xc(%rsp)
movl 0xc(%rsp), %eax
movq 0x18(%rsp), %rcx
cmpl 0xf0(%rcx), %eax
jge 0x18d4
movq 0x10(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movl (%rax), %eax
shrl $0x18, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x4632(%rip), %rax      # 0x5c00
movl (%rax,%rcx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x4a4f(%rip), %rax      # 0x6030
movl (%rax,%rcx,4), %ecx
movq 0x10(%rsp), %rax
movl (%rax), %eax
shrl $0x10, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x4602(%rip), %rax      # 0x5c00
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x4e1f(%rip), %rax      # 0x6430
xorl (%rax,%rdx,4), %ecx
movq 0x10(%rsp), %rax
movl (%rax), %eax
shrl $0x8, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x45d2(%rip), %rax      # 0x5c00
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x51ef(%rip), %rax      # 0x6830
xorl (%rax,%rdx,4), %ecx
movq 0x10(%rsp), %rax
movl (%rax), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x45a5(%rip), %rax      # 0x5c00
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x55c2(%rip), %rax      # 0x6c30
xorl (%rax,%rdx,4), %ecx
movq 0x10(%rsp), %rax
movl %ecx, (%rax)
movq 0x10(%rsp), %rax
movl 0x4(%rax), %eax
shrl $0x18, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x4572(%rip), %rax      # 0x5c00
movl (%rax,%rcx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x498f(%rip), %rax      # 0x6030
movl (%rax,%rcx,4), %ecx
movq 0x10(%rsp), %rax
movl 0x4(%rax), %eax
shrl $0x10, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x4541(%rip), %rax      # 0x5c00
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x4d5e(%rip), %rax      # 0x6430
xorl (%rax,%rdx,4), %ecx
movq 0x10(%rsp), %rax
movl 0x4(%rax), %eax
shrl $0x8, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x4510(%rip), %rax      # 0x5c00
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x512d(%rip), %rax      # 0x6830
xorl (%rax,%rdx,4), %ecx
movq 0x10(%rsp), %rax
movl 0x4(%rax), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x44e2(%rip), %rax      # 0x5c00
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x54ff(%rip), %rax      # 0x6c30
xorl (%rax,%rdx,4), %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x4(%rax)
movq 0x10(%rsp), %rax
movl 0x8(%rax), %eax
shrl $0x18, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x44ae(%rip), %rax      # 0x5c00
movl (%rax,%rcx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x48cb(%rip), %rax      # 0x6030
movl (%rax,%rcx,4), %ecx
movq 0x10(%rsp), %rax
movl 0x8(%rax), %eax
shrl $0x10, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x447d(%rip), %rax      # 0x5c00
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x4c9a(%rip), %rax      # 0x6430
xorl (%rax,%rdx,4), %ecx
movq 0x10(%rsp), %rax
movl 0x8(%rax), %eax
shrl $0x8, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x444c(%rip), %rax      # 0x5c00
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x5069(%rip), %rax      # 0x6830
xorl (%rax,%rdx,4), %ecx
movq 0x10(%rsp), %rax
movl 0x8(%rax), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x441e(%rip), %rax      # 0x5c00
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x543b(%rip), %rax      # 0x6c30
xorl (%rax,%rdx,4), %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x8(%rax)
movq 0x10(%rsp), %rax
movl 0xc(%rax), %eax
shrl $0x18, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x43ea(%rip), %rax      # 0x5c00
movl (%rax,%rcx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x4807(%rip), %rax      # 0x6030
movl (%rax,%rcx,4), %ecx
movq 0x10(%rsp), %rax
movl 0xc(%rax), %eax
shrl $0x10, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x43b9(%rip), %rax      # 0x5c00
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x4bd6(%rip), %rax      # 0x6430
xorl (%rax,%rdx,4), %ecx
movq 0x10(%rsp), %rax
movl 0xc(%rax), %eax
shrl $0x8, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x4388(%rip), %rax      # 0x5c00
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x4fa5(%rip), %rax      # 0x6830
xorl (%rax,%rdx,4), %ecx
movq 0x10(%rsp), %rax
movl 0xc(%rax), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x435a(%rip), %rax      # 0x5c00
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x5377(%rip), %rax      # 0x6c30
xorl (%rax,%rdx,4), %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0xc(%rax)
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x1596
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)