// File: /workspace/github_c_makefile_star2_O0/mjosaarinen[P]brutus/crypto_aead/aezv3/ref/rijndael-alg-fst.c
// Function: rijndaelKeySetupEnc
int rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits) {
   	int i = 0;
	u32 temp;

	rk[0] = GETU32(cipherKey     );
	rk[1] = GETU32(cipherKey +  4);
	rk[2] = GETU32(cipherKey +  8);
	rk[3] = GETU32(cipherKey + 12);
	if (keyBits == 128) {
		for (;;) {
			temp  = rk[3];
			rk[4] = rk[0] ^
				(Te4[(temp >> 16) & 0xff] & 0xff000000) ^
				(Te4[(temp >>  8) & 0xff] & 0x00ff0000) ^
				(Te4[(temp      ) & 0xff] & 0x0000ff00) ^
				(Te4[(temp >> 24)       ] & 0x000000ff) ^
				rcon[i];
			rk[5] = rk[1] ^ rk[4];
			rk[6] = rk[2] ^ rk[5];
			rk[7] = rk[3] ^ rk[6];
			if (++i == 10) {
				return 10;
			}
			rk += 4;
		}
	}
	rk[4] = GETU32(cipherKey + 16);
	rk[5] = GETU32(cipherKey + 20);
	if (keyBits == 192) {
		for (;;) {
			temp = rk[ 5];
			rk[ 6] = rk[ 0] ^
				(Te4[(temp >> 16) & 0xff] & 0xff000000) ^
				(Te4[(temp >>  8) & 0xff] & 0x00ff0000) ^
				(Te4[(temp      ) & 0xff] & 0x0000ff00) ^
				(Te4[(temp >> 24)       ] & 0x000000ff) ^
				rcon[i];
			rk[ 7] = rk[ 1] ^ rk[ 6];
			rk[ 8] = rk[ 2] ^ rk[ 7];
			rk[ 9] = rk[ 3] ^ rk[ 8];
			if (++i == 8) {
				return 12;
			}
			rk[10] = rk[ 4] ^ rk[ 9];
			rk[11] = rk[ 5] ^ rk[10];
			rk += 6;
		}
	}
	rk[6] = GETU32(cipherKey + 24);
	rk[7] = GETU32(cipherKey + 28);
	if (keyBits == 256) {
        for (;;) {
        	temp = rk[ 7];
        	rk[ 8] = rk[ 0] ^
        		(Te4[(temp >> 16) & 0xff] & 0xff000000) ^
        		(Te4[(temp >>  8) & 0xff] & 0x00ff0000) ^
        		(Te4[(temp      ) & 0xff] & 0x0000ff00) ^
        		(Te4[(temp >> 24)       ] & 0x000000ff) ^
        		rcon[i];
        	rk[ 9] = rk[ 1] ^ rk[ 8];
        	rk[10] = rk[ 2] ^ rk[ 9];
        	rk[11] = rk[ 3] ^ rk[10];
			if (++i == 7) {
				return 14;
			}
        	temp = rk[11];
        	rk[12] = rk[ 4] ^
        		(Te4[(temp >> 24)       ] & 0xff000000) ^
        		(Te4[(temp >> 16) & 0xff] & 0x00ff0000) ^
        		(Te4[(temp >>  8) & 0xff] & 0x0000ff00) ^
        		(Te4[(temp      ) & 0xff] & 0x000000ff);
        	rk[13] = rk[ 5] ^ rk[12];
        	rk[14] = rk[ 6] ^ rk[13];
        	rk[15] = rk[ 7] ^ rk[14];

			rk += 8;
        }
	}
	return 0;
}

// Assembly:
movq %rdi, -0x10(%rsp)
movq %rsi, -0x18(%rsp)
movl %edx, -0x1c(%rsp)
movl $0x0, -0x20(%rsp)
movq -0x18(%rsp), %rax
movzbl (%rax), %ecx
shll $0x18, %ecx
movq -0x18(%rsp), %rax
movzbl 0x1(%rax), %eax
shll $0x10, %eax
xorl %eax, %ecx
movq -0x18(%rsp), %rax
movzbl 0x2(%rax), %eax
shll $0x8, %eax
xorl %eax, %ecx
movq -0x18(%rsp), %rax
movzbl 0x3(%rax), %eax
xorl %eax, %ecx
movq -0x10(%rsp), %rax
movl %ecx, (%rax)
movq -0x18(%rsp), %rax
movzbl 0x4(%rax), %ecx
shll $0x18, %ecx
movq -0x18(%rsp), %rax
movzbl 0x5(%rax), %eax
shll $0x10, %eax
xorl %eax, %ecx
movq -0x18(%rsp), %rax
movzbl 0x6(%rax), %eax
shll $0x8, %eax
xorl %eax, %ecx
movq -0x18(%rsp), %rax
movzbl 0x7(%rax), %eax
xorl %eax, %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x4(%rax)
movq -0x18(%rsp), %rax
movzbl 0x8(%rax), %ecx
shll $0x18, %ecx
movq -0x18(%rsp), %rax
movzbl 0x9(%rax), %eax
shll $0x10, %eax
xorl %eax, %ecx
movq -0x18(%rsp), %rax
movzbl 0xa(%rax), %eax
shll $0x8, %eax
xorl %eax, %ecx
movq -0x18(%rsp), %rax
movzbl 0xb(%rax), %eax
xorl %eax, %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x8(%rax)
movq -0x18(%rsp), %rax
movzbl 0xc(%rax), %ecx
shll $0x18, %ecx
movq -0x18(%rsp), %rax
movzbl 0xd(%rax), %eax
shll $0x10, %eax
xorl %eax, %ecx
movq -0x18(%rsp), %rax
movzbl 0xe(%rax), %eax
shll $0x8, %eax
xorl %eax, %ecx
movq -0x18(%rsp), %rax
movzbl 0xf(%rax), %eax
xorl %eax, %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0xc(%rax)
cmpl $0x80, -0x1c(%rsp)
jne 0x37de
jmp 0x36c0
movq -0x10(%rsp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x24(%rsp)
movq -0x10(%rsp), %rax
movl (%rax), %ecx
movl -0x24(%rsp), %eax
shrl $0x10, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x3916(%rip), %rax      # 0x7000
movl (%rax,%rdx,4), %eax
andl $0xff000000, %eax       # imm = 0xFF000000
xorl %eax, %ecx
movl -0x24(%rsp), %eax
shrl $0x8, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x38f5(%rip), %rax      # 0x7000
movl (%rax,%rdx,4), %eax
andl $0xff0000, %eax         # imm = 0xFF0000
xorl %eax, %ecx
movl -0x24(%rsp), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x38d7(%rip), %rax      # 0x7000
movl (%rax,%rdx,4), %eax
andl $0xff00, %eax           # imm = 0xFF00
xorl %eax, %ecx
movl -0x24(%rsp), %eax
shrl $0x18, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x38bb(%rip), %rax      # 0x7000
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
xorl %eax, %ecx
movslq -0x20(%rsp), %rdx
leaq 0x3ca5(%rip), %rax      # 0x7400
xorl (%rax,%rdx,4), %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x10(%rax)
movq -0x10(%rsp), %rax
movl 0x4(%rax), %ecx
movq -0x10(%rsp), %rax
xorl 0x10(%rax), %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x14(%rax)
movq -0x10(%rsp), %rax
movl 0x8(%rax), %ecx
movq -0x10(%rsp), %rax
xorl 0x14(%rax), %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x18(%rax)
movq -0x10(%rsp), %rax
movl 0xc(%rax), %ecx
movq -0x10(%rsp), %rax
xorl 0x18(%rax), %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x1c(%rax)
movl -0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rsp)
cmpl $0xa, %eax
jne 0x37cb
movl $0xa, -0x4(%rsp)
jmp 0x3c3e
movq -0x10(%rsp), %rax
addq $0x10, %rax
movq %rax, -0x10(%rsp)
jmp 0x36c0
movq -0x18(%rsp), %rax
movzbl 0x10(%rax), %ecx
shll $0x18, %ecx
movq -0x18(%rsp), %rax
movzbl 0x11(%rax), %eax
shll $0x10, %eax
xorl %eax, %ecx
movq -0x18(%rsp), %rax
movzbl 0x12(%rax), %eax
shll $0x8, %eax
xorl %eax, %ecx
movq -0x18(%rsp), %rax
movzbl 0x13(%rax), %eax
xorl %eax, %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x10(%rax)
movq -0x18(%rsp), %rax
movzbl 0x14(%rax), %ecx
shll $0x18, %ecx
movq -0x18(%rsp), %rax
movzbl 0x15(%rax), %eax
shll $0x10, %eax
xorl %eax, %ecx
movq -0x18(%rsp), %rax
movzbl 0x16(%rax), %eax
shll $0x8, %eax
xorl %eax, %ecx
movq -0x18(%rsp), %rax
movzbl 0x17(%rax), %eax
xorl %eax, %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x14(%rax)
cmpl $0xc0, -0x1c(%rsp)
jne 0x39b2
jmp 0x3864
movq -0x10(%rsp), %rax
movl 0x14(%rax), %eax
movl %eax, -0x24(%rsp)
movq -0x10(%rsp), %rax
movl (%rax), %ecx
movl -0x24(%rsp), %eax
shrl $0x10, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x3772(%rip), %rax      # 0x7000
movl (%rax,%rdx,4), %eax
andl $0xff000000, %eax       # imm = 0xFF000000
xorl %eax, %ecx
movl -0x24(%rsp), %eax
shrl $0x8, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x3751(%rip), %rax      # 0x7000
movl (%rax,%rdx,4), %eax
andl $0xff0000, %eax         # imm = 0xFF0000
xorl %eax, %ecx
movl -0x24(%rsp), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x3733(%rip), %rax      # 0x7000
movl (%rax,%rdx,4), %eax
andl $0xff00, %eax           # imm = 0xFF00
xorl %eax, %ecx
movl -0x24(%rsp), %eax
shrl $0x18, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x3717(%rip), %rax      # 0x7000
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
xorl %eax, %ecx
movslq -0x20(%rsp), %rdx
leaq 0x3b01(%rip), %rax      # 0x7400
xorl (%rax,%rdx,4), %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x18(%rax)
movq -0x10(%rsp), %rax
movl 0x4(%rax), %ecx
movq -0x10(%rsp), %rax
xorl 0x18(%rax), %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x1c(%rax)
movq -0x10(%rsp), %rax
movl 0x8(%rax), %ecx
movq -0x10(%rsp), %rax
xorl 0x1c(%rax), %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x20(%rax)
movq -0x10(%rsp), %rax
movl 0xc(%rax), %ecx
movq -0x10(%rsp), %rax
xorl 0x20(%rax), %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x24(%rax)
movl -0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rsp)
cmpl $0x8, %eax
jne 0x396f
movl $0xc, -0x4(%rsp)
jmp 0x3c3e
movq -0x10(%rsp), %rax
movl 0x10(%rax), %ecx
movq -0x10(%rsp), %rax
xorl 0x24(%rax), %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x28(%rax)
movq -0x10(%rsp), %rax
movl 0x14(%rax), %ecx
movq -0x10(%rsp), %rax
xorl 0x28(%rax), %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x2c(%rax)
movq -0x10(%rsp), %rax
addq $0x18, %rax
movq %rax, -0x10(%rsp)
jmp 0x3864
movq -0x18(%rsp), %rax
movzbl 0x18(%rax), %ecx
shll $0x18, %ecx
movq -0x18(%rsp), %rax
movzbl 0x19(%rax), %eax
shll $0x10, %eax
xorl %eax, %ecx
movq -0x18(%rsp), %rax
movzbl 0x1a(%rax), %eax
shll $0x8, %eax
xorl %eax, %ecx
movq -0x18(%rsp), %rax
movzbl 0x1b(%rax), %eax
xorl %eax, %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x18(%rax)
movq -0x18(%rsp), %rax
movzbl 0x1c(%rax), %ecx
shll $0x18, %ecx
movq -0x18(%rsp), %rax
movzbl 0x1d(%rax), %eax
shll $0x10, %eax
xorl %eax, %ecx
movq -0x18(%rsp), %rax
movzbl 0x1e(%rax), %eax
shll $0x8, %eax
xorl %eax, %ecx
movq -0x18(%rsp), %rax
movzbl 0x1f(%rax), %eax
xorl %eax, %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x1c(%rax)
cmpl $0x100, -0x1c(%rsp)     # imm = 0x100
jne 0x3c36
jmp 0x3a38
movq -0x10(%rsp), %rax
movl 0x1c(%rax), %eax
movl %eax, -0x24(%rsp)
movq -0x10(%rsp), %rax
movl (%rax), %ecx
movl -0x24(%rsp), %eax
shrl $0x10, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x359e(%rip), %rax      # 0x7000
movl (%rax,%rdx,4), %eax
andl $0xff000000, %eax       # imm = 0xFF000000
xorl %eax, %ecx
movl -0x24(%rsp), %eax
shrl $0x8, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x357d(%rip), %rax      # 0x7000
movl (%rax,%rdx,4), %eax
andl $0xff0000, %eax         # imm = 0xFF0000
xorl %eax, %ecx
movl -0x24(%rsp), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x355f(%rip), %rax      # 0x7000
movl (%rax,%rdx,4), %eax
andl $0xff00, %eax           # imm = 0xFF00
xorl %eax, %ecx
movl -0x24(%rsp), %eax
shrl $0x18, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x3543(%rip), %rax      # 0x7000
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
xorl %eax, %ecx
movslq -0x20(%rsp), %rdx
leaq 0x392d(%rip), %rax      # 0x7400
xorl (%rax,%rdx,4), %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x20(%rax)
movq -0x10(%rsp), %rax
movl 0x4(%rax), %ecx
movq -0x10(%rsp), %rax
xorl 0x20(%rax), %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x24(%rax)
movq -0x10(%rsp), %rax
movl 0x8(%rax), %ecx
movq -0x10(%rsp), %rax
xorl 0x24(%rax), %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x28(%rax)
movq -0x10(%rsp), %rax
movl 0xc(%rax), %ecx
movq -0x10(%rsp), %rax
xorl 0x28(%rax), %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x2c(%rax)
movl -0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rsp)
cmpl $0x7, %eax
jne 0x3b43
movl $0xe, -0x4(%rsp)
jmp 0x3c3e
movq -0x10(%rsp), %rax
movl 0x2c(%rax), %eax
movl %eax, -0x24(%rsp)
movq -0x10(%rsp), %rax
movl 0x10(%rax), %ecx
movl -0x24(%rsp), %eax
shrl $0x18, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x3497(%rip), %rax      # 0x7000
movl (%rax,%rdx,4), %eax
andl $0xff000000, %eax       # imm = 0xFF000000
xorl %eax, %ecx
movl -0x24(%rsp), %eax
shrl $0x10, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x3476(%rip), %rax      # 0x7000
movl (%rax,%rdx,4), %eax
andl $0xff0000, %eax         # imm = 0xFF0000
xorl %eax, %ecx
movl -0x24(%rsp), %eax
shrl $0x8, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x3455(%rip), %rax      # 0x7000
movl (%rax,%rdx,4), %eax
andl $0xff00, %eax           # imm = 0xFF00
xorl %eax, %ecx
movl -0x24(%rsp), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x3437(%rip), %rax      # 0x7000
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
xorl %eax, %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x30(%rax)
movq -0x10(%rsp), %rax
movl 0x14(%rax), %ecx
movq -0x10(%rsp), %rax
xorl 0x30(%rax), %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x34(%rax)
movq -0x10(%rsp), %rax
movl 0x18(%rax), %ecx
movq -0x10(%rsp), %rax
xorl 0x34(%rax), %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x38(%rax)
movq -0x10(%rsp), %rax
movl 0x1c(%rax), %ecx
movq -0x10(%rsp), %rax
xorl 0x38(%rax), %ecx
movq -0x10(%rsp), %rax
movl %ecx, 0x3c(%rax)
movq -0x10(%rsp), %rax
addq $0x20, %rax
movq %rax, -0x10(%rsp)
jmp 0x3a38
movl $0x0, -0x4(%rsp)
movl -0x4(%rsp), %eax
retq
nopw %cs:(%rax,%rax)