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

    /*
	 * map byte array block to cipher state
	 * and add initial round key:
	 */
	s0 = GETU32(pt     ) ^ rk[0];
	s1 = GETU32(pt +  4) ^ rk[1];
	s2 = GETU32(pt +  8) ^ rk[2];
	s3 = GETU32(pt + 12) ^ rk[3];
#ifdef FULL_UNROLL
    /* round 1: */
   	t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[ 4];
   	t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[ 5];
   	t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[ 6];
   	t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[ 7];
   	/* round 2: */
   	s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[ 8];
   	s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[ 9];
   	s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[10];
   	s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[11];
    /* round 3: */
   	t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[12];
   	t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[13];
   	t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[14];
   	t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[15];
   	/* round 4: */
   	s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[16];
   	s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[17];
   	s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[18];
   	s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[19];
    /* round 5: */
   	t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[20];
   	t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[21];
   	t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[22];
   	t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[23];
   	/* round 6: */
   	s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[24];
   	s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[25];
   	s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[26];
   	s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[27];
    /* round 7: */
   	t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[28];
   	t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[29];
   	t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[30];
   	t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[31];
   	/* round 8: */
   	s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[32];
   	s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[33];
   	s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[34];
   	s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[35];
    /* round 9: */
   	t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[36];
   	t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[37];
   	t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[38];
   	t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[39];
    if (Nr > 10) {
        /* round 10: */
        s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[40];
        s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[41];
        s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[42];
        s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[43];
        /* round 11: */
        t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[44];
        t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[45];
        t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[46];
        t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[47];
        if (Nr > 12) {
            /* round 12: */
            s0 = Te0[t0 >> 24] ^ Te1[(t1 >> 16) & 0xff] ^ Te2[(t2 >>  8) & 0xff] ^ Te3[t3 & 0xff] ^ rk[48];
            s1 = Te0[t1 >> 24] ^ Te1[(t2 >> 16) & 0xff] ^ Te2[(t3 >>  8) & 0xff] ^ Te3[t0 & 0xff] ^ rk[49];
            s2 = Te0[t2 >> 24] ^ Te1[(t3 >> 16) & 0xff] ^ Te2[(t0 >>  8) & 0xff] ^ Te3[t1 & 0xff] ^ rk[50];
            s3 = Te0[t3 >> 24] ^ Te1[(t0 >> 16) & 0xff] ^ Te2[(t1 >>  8) & 0xff] ^ Te3[t2 & 0xff] ^ rk[51];
            /* round 13: */
            t0 = Te0[s0 >> 24] ^ Te1[(s1 >> 16) & 0xff] ^ Te2[(s2 >>  8) & 0xff] ^ Te3[s3 & 0xff] ^ rk[52];
            t1 = Te0[s1 >> 24] ^ Te1[(s2 >> 16) & 0xff] ^ Te2[(s3 >>  8) & 0xff] ^ Te3[s0 & 0xff] ^ rk[53];
            t2 = Te0[s2 >> 24] ^ Te1[(s3 >> 16) & 0xff] ^ Te2[(s0 >>  8) & 0xff] ^ Te3[s1 & 0xff] ^ rk[54];
            t3 = Te0[s3 >> 24] ^ Te1[(s0 >> 16) & 0xff] ^ Te2[(s1 >>  8) & 0xff] ^ Te3[s2 & 0xff] ^ rk[55];
        }
    }
    rk += Nr << 2;
#else  /* !FULL_UNROLL */
    /*
	 * Nr - 1 full rounds:
	 */
    r = Nr >> 1;
    for (;;) {
        t0 =
            Te0[(s0 >> 24)       ] ^
            Te1[(s1 >> 16) & 0xff] ^
            Te2[(s2 >>  8) & 0xff] ^
            Te3[(s3      ) & 0xff] ^
            rk[4];
        t1 =
            Te0[(s1 >> 24)       ] ^
            Te1[(s2 >> 16) & 0xff] ^
            Te2[(s3 >>  8) & 0xff] ^
            Te3[(s0      ) & 0xff] ^
            rk[5];
        t2 =
            Te0[(s2 >> 24)       ] ^
            Te1[(s3 >> 16) & 0xff] ^
            Te2[(s0 >>  8) & 0xff] ^
            Te3[(s1      ) & 0xff] ^
            rk[6];
        t3 =
            Te0[(s3 >> 24)       ] ^
            Te1[(s0 >> 16) & 0xff] ^
            Te2[(s1 >>  8) & 0xff] ^
            Te3[(s2      ) & 0xff] ^
            rk[7];

        rk += 8;
        if (--r == 0) {
            break;
        }

        s0 =
            Te0[(t0 >> 24)       ] ^
            Te1[(t1 >> 16) & 0xff] ^
            Te2[(t2 >>  8) & 0xff] ^
            Te3[(t3      ) & 0xff] ^
            rk[0];
        s1 =
            Te0[(t1 >> 24)       ] ^
            Te1[(t2 >> 16) & 0xff] ^
            Te2[(t3 >>  8) & 0xff] ^
            Te3[(t0      ) & 0xff] ^
            rk[1];
        s2 =
            Te0[(t2 >> 24)       ] ^
            Te1[(t3 >> 16) & 0xff] ^
            Te2[(t0 >>  8) & 0xff] ^
            Te3[(t1      ) & 0xff] ^
            rk[2];
        s3 =
            Te0[(t3 >> 24)       ] ^
            Te1[(t0 >> 16) & 0xff] ^
            Te2[(t1 >>  8) & 0xff] ^
            Te3[(t2      ) & 0xff] ^
            rk[3];
    }
#endif /* ?FULL_UNROLL */
    /*
	 * apply last round and
	 * map cipher state to byte array block:
	 */
	s0 =
		(Te4[(t0 >> 24)       ] & 0xff000000) ^
		(Te4[(t1 >> 16) & 0xff] & 0x00ff0000) ^
		(Te4[(t2 >>  8) & 0xff] & 0x0000ff00) ^
		(Te4[(t3      ) & 0xff] & 0x000000ff) ^
		rk[0];
	PUTU32(ct     , s0);
	s1 =
		(Te4[(t1 >> 24)       ] & 0xff000000) ^
		(Te4[(t2 >> 16) & 0xff] & 0x00ff0000) ^
		(Te4[(t3 >>  8) & 0xff] & 0x0000ff00) ^
		(Te4[(t0      ) & 0xff] & 0x000000ff) ^
		rk[1];
	PUTU32(ct +  4, s1);
	s2 =
		(Te4[(t2 >> 24)       ] & 0xff000000) ^
		(Te4[(t3 >> 16) & 0xff] & 0x00ff0000) ^
		(Te4[(t0 >>  8) & 0xff] & 0x0000ff00) ^
		(Te4[(t1      ) & 0xff] & 0x000000ff) ^
		rk[2];
	PUTU32(ct +  8, s2);
	s3 =
		(Te4[(t3 >> 24)       ] & 0xff000000) ^
		(Te4[(t0 >> 16) & 0xff] & 0x00ff0000) ^
		(Te4[(t1 >>  8) & 0xff] & 0x0000ff00) ^
		(Te4[(t2      ) & 0xff] & 0x000000ff) ^
		rk[3];
	PUTU32(ct + 12, s3);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movbel (%rdx), %r12d
xorl (%rdi), %r12d
movbel 0x4(%rdx), %ebp
xorl 0x4(%rdi), %ebp
movbel 0x8(%rdx), %r9d
xorl 0x8(%rdi), %r9d
movbel 0xc(%rdx), %r10d
movq %rcx, -0x8(%rsp)
xorl 0xc(%rdi), %r10d
sarl %esi
addq $0x2c, %rdi
decl %esi
movl %esi, -0xc(%rsp)
movl $0xff, %ebx
movl %r12d, %edx
shrl $0x18, %edx
movl %ebp, %eax
shrl $0xe, %eax
movl $0x3fc, %r11d           # imm = 0x3FC
andl %r11d, %eax
leaq 0x2ac6(%rip), %r14      # 0x58d0
movl (%rax,%r14), %eax
leaq 0x26bb(%rip), %rcx      # 0x54d0
xorl (%rcx,%rdx,4), %eax
movl %r9d, %edx
shrl $0x8, %edx
andl %ebx, %edx
leaq 0x2ea9(%rip), %r15      # 0x5cd0
xorl (%r15,%rdx,4), %eax
movl %r10d, %edx
andl %ebx, %edx
leaq 0x3299(%rip), %rsi      # 0x60d0
xorl (%rsi,%rdx,4), %eax
movl %ebp, %r8d
shrl $0x18, %r8d
movl %r9d, %edx
shrl $0xe, %edx
andl %r11d, %edx
movl (%rdx,%r14), %edx
xorl (%rcx,%r8,4), %edx
movl %r10d, %r8d
shrl $0x8, %r8d
andl %ebx, %r8d
xorl (%r15,%r8,4), %edx
movl %r12d, %r8d
andl %ebx, %r8d
xorl (%rsi,%r8,4), %edx
movl %r9d, %r13d
shrl $0x18, %r13d
movl %r10d, %r8d
shrl $0xe, %r8d
andl %r11d, %r8d
movl (%r8,%r14), %r8d
xorl (%rcx,%r13,4), %r8d
movl %r12d, %r13d
shrl $0x8, %r13d
andl %ebx, %r13d
xorl (%r15,%r13,4), %r8d
movl %ebp, %r13d
andl %ebx, %r13d
xorl (%rsi,%r13,4), %r8d
shrl $0x18, %r10d
shrl $0xe, %r12d
andl %r11d, %r12d
movl (%r12,%r14), %r13d
xorl (%rcx,%r10,4), %r13d
shrl $0x8, %ebp
andl %ebx, %ebp
xorl (%r15,%rbp,4), %r13d
xorl -0x1c(%rdi), %eax
xorl -0x18(%rdi), %edx
xorl -0x14(%rdi), %r8d
andl %ebx, %r9d
xorl (%rsi,%r9,4), %r13d
xorl -0x10(%rdi), %r13d
movl %eax, %r9d
shrl $0x18, %r9d
movl -0xc(%rsp), %ecx
subl $0x1, %ecx
jb 0x2fc5
movl %ecx, -0xc(%rsp)
movl %edx, %r10d
shrl $0xe, %r10d
andl %r11d, %r10d
leaq 0x29db(%rip), %r14      # 0x58d0
movl (%r10,%r14), %r12d
leaq 0x25d0(%rip), %rcx      # 0x54d0
xorl (%rcx,%r9,4), %r12d
movl %r8d, %r9d
shrl $0x8, %r9d
andl %ebx, %r9d
leaq 0x2dbb(%rip), %r15      # 0x5cd0
xorl (%r15,%r9,4), %r12d
movl %r13d, %r9d
andl %ebx, %r9d
leaq 0x31aa(%rip), %rsi      # 0x60d0
xorl (%rsi,%r9,4), %r12d
xorl -0xc(%rdi), %r12d
movl %edx, %r9d
shrl $0x18, %r9d
movl %r8d, %r10d
shrl $0xe, %r10d
andl %r11d, %r10d
movl (%r10,%r14), %ebp
xorl (%rcx,%r9,4), %ebp
movl %r13d, %r9d
shrl $0x8, %r9d
andl %ebx, %r9d
xorl (%r15,%r9,4), %ebp
movl %eax, %r9d
andl %ebx, %r9d
xorl (%rsi,%r9,4), %ebp
xorl -0x8(%rdi), %ebp
movl %r8d, %r10d
shrl $0x18, %r10d
movl %r13d, %r9d
shrl $0xe, %r9d
andl %r11d, %r9d
movl (%r9,%r14), %r9d
xorl (%rcx,%r10,4), %r9d
movl %eax, %r10d
shrl $0x8, %r10d
andl %ebx, %r10d
xorl (%r15,%r10,4), %r9d
movl %edx, %r10d
andl %ebx, %r10d
xorl (%rsi,%r10,4), %r9d
xorl -0x4(%rdi), %r9d
shrl $0x18, %r13d
shrl $0xe, %eax
andl %r11d, %eax
movl (%rax,%r14), %r10d
xorl (%rcx,%r13,4), %r10d
shrl $0x8, %edx
andl %ebx, %edx
xorl (%r15,%rdx,4), %r10d
andl %ebx, %r8d
xorl (%rsi,%r8,4), %r10d
xorl (%rdi), %r10d
addq $0x20, %rdi
jmp 0x2def
leaq 0x10d4(%rip), %rcx      # 0x40a0
movzbl 0x3(%rcx,%r9,4), %esi
shll $0x18, %esi
movl %edx, %r10d
shrl $0xe, %r10d
movl $0x3fc, %r9d            # imm = 0x3FC
andl %r9d, %r10d
movzbl 0x2(%r10,%rcx), %r10d
shll $0x10, %r10d
orl %esi, %r10d
movl %r8d, %r11d
shrl $0x8, %r11d
movl $0xff, %esi
andl %esi, %r11d
movzbl 0x1(%rcx,%r11,4), %r11d
shll $0x8, %r11d
orl %r10d, %r11d
movl %r13d, %r10d
andl %esi, %r10d
movzbl (%rcx,%r10,4), %r10d
orl %r11d, %r10d
xorl -0xc(%rdi), %r10d
movq -0x8(%rsp), %rbx
movbel %r10d, (%rbx)
movl %edx, %r10d
shrl $0x18, %r10d
movzbl 0x3(%rcx,%r10,4), %r10d
shll $0x18, %r10d
movl %r8d, %r11d
shrl $0xe, %r11d
andl %r9d, %r11d
movzbl 0x2(%r11,%rcx), %r11d
shll $0x10, %r11d
orl %r10d, %r11d
movl %r13d, %r10d
shrl $0x8, %r10d
andl %esi, %r10d
movzbl 0x1(%rcx,%r10,4), %r10d
shll $0x8, %r10d
orl %r11d, %r10d
movl %eax, %r11d
andl %esi, %r11d
movzbl (%rcx,%r11,4), %r11d
orl %r10d, %r11d
xorl -0x8(%rdi), %r11d
movbel %r11d, 0x4(%rbx)
movl %r8d, %r10d
shrl $0x18, %r10d
movzbl 0x3(%rcx,%r10,4), %r10d
shll $0x18, %r10d
movl %r13d, %r11d
shrl $0xe, %r11d
andl %r9d, %r11d
movzbl 0x2(%r11,%rcx), %r11d
shll $0x10, %r11d
orl %r10d, %r11d
movl %eax, %r10d
shrl $0x8, %r10d
andl %esi, %r10d
movzbl 0x1(%rcx,%r10,4), %r10d
shll $0x8, %r10d
orl %r11d, %r10d
movl %edx, %r11d
andl %esi, %r11d
movzbl (%rcx,%r11,4), %r11d
orl %r10d, %r11d
xorl -0x4(%rdi), %r11d
movbel %r11d, 0x8(%rbx)
shrl $0x18, %r13d
movzbl 0x3(%rcx,%r13,4), %r10d
shll $0x18, %r10d
shrl $0xe, %eax
andl %r9d, %eax
movzbl 0x2(%rax,%rcx), %eax
shll $0x10, %eax
orl %r10d, %eax
shrl $0x8, %edx
andl %esi, %edx
movzbl 0x1(%rcx,%rdx,4), %edx
shll $0x8, %edx
orl %eax, %edx
andl %esi, %r8d
movzbl (%rcx,%r8,4), %eax
orl %edx, %eax
xorl (%rdi), %eax
movbel %eax, 0xc(%rbx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq