// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/aezv3/ref/rijndael-alg-fst.c
// Function: rijndaelDecrypt
void rijndaelDecrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 ct[16], u8 pt[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(ct     ) ^ rk[0];
    s1 = GETU32(ct +  4) ^ rk[1];
    s2 = GETU32(ct +  8) ^ rk[2];
    s3 = GETU32(ct + 12) ^ rk[3];
#ifdef FULL_UNROLL
    /* round 1: */
    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[ 4];
    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[ 5];
    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[ 6];
    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[ 7];
    /* round 2: */
    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[ 8];
    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[ 9];
    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[10];
    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[11];
    /* round 3: */
    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[12];
    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[13];
    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[14];
    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[15];
    /* round 4: */
    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[16];
    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[17];
    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[18];
    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[19];
    /* round 5: */
    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[20];
    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[21];
    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[22];
    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[23];
    /* round 6: */
    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[24];
    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[25];
    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[26];
    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[27];
    /* round 7: */
    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[28];
    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[29];
    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[30];
    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[31];
    /* round 8: */
    s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[32];
    s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[33];
    s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[34];
    s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[35];
    /* round 9: */
    t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[36];
    t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[37];
    t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[38];
    t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[39];
    if (Nr > 10) {
        /* round 10: */
        s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[40];
        s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[41];
        s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[42];
        s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[43];
        /* round 11: */
        t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[44];
        t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[45];
        t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[46];
        t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[47];
        if (Nr > 12) {
            /* round 12: */
            s0 = Td0[t0 >> 24] ^ Td1[(t3 >> 16) & 0xff] ^ Td2[(t2 >>  8) & 0xff] ^ Td3[t1 & 0xff] ^ rk[48];
            s1 = Td0[t1 >> 24] ^ Td1[(t0 >> 16) & 0xff] ^ Td2[(t3 >>  8) & 0xff] ^ Td3[t2 & 0xff] ^ rk[49];
            s2 = Td0[t2 >> 24] ^ Td1[(t1 >> 16) & 0xff] ^ Td2[(t0 >>  8) & 0xff] ^ Td3[t3 & 0xff] ^ rk[50];
            s3 = Td0[t3 >> 24] ^ Td1[(t2 >> 16) & 0xff] ^ Td2[(t1 >>  8) & 0xff] ^ Td3[t0 & 0xff] ^ rk[51];
            /* round 13: */
            t0 = Td0[s0 >> 24] ^ Td1[(s3 >> 16) & 0xff] ^ Td2[(s2 >>  8) & 0xff] ^ Td3[s1 & 0xff] ^ rk[52];
            t1 = Td0[s1 >> 24] ^ Td1[(s0 >> 16) & 0xff] ^ Td2[(s3 >>  8) & 0xff] ^ Td3[s2 & 0xff] ^ rk[53];
            t2 = Td0[s2 >> 24] ^ Td1[(s1 >> 16) & 0xff] ^ Td2[(s0 >>  8) & 0xff] ^ Td3[s3 & 0xff] ^ rk[54];
            t3 = Td0[s3 >> 24] ^ Td1[(s2 >> 16) & 0xff] ^ Td2[(s1 >>  8) & 0xff] ^ Td3[s0 & 0xff] ^ rk[55];
        }
    }
	rk += Nr << 2;
#else  /* !FULL_UNROLL */
    /*
     * Nr - 1 full rounds:
     */
    r = Nr >> 1;
    for (;;) {
        t0 =
            Td0[(s0 >> 24)       ] ^
            Td1[(s3 >> 16) & 0xff] ^
            Td2[(s2 >>  8) & 0xff] ^
            Td3[(s1      ) & 0xff] ^
            rk[4];
        t1 =
            Td0[(s1 >> 24)       ] ^
            Td1[(s0 >> 16) & 0xff] ^
            Td2[(s3 >>  8) & 0xff] ^
            Td3[(s2      ) & 0xff] ^
            rk[5];
        t2 =
            Td0[(s2 >> 24)       ] ^
            Td1[(s1 >> 16) & 0xff] ^
            Td2[(s0 >>  8) & 0xff] ^
            Td3[(s3      ) & 0xff] ^
            rk[6];
        t3 =
            Td0[(s3 >> 24)       ] ^
            Td1[(s2 >> 16) & 0xff] ^
            Td2[(s1 >>  8) & 0xff] ^
            Td3[(s0      ) & 0xff] ^
            rk[7];

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

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movbel (%rdx), %r9d
xorl (%rdi), %r9d
movbel 0x4(%rdx), %r13d
xorl 0x4(%rdi), %r13d
movbel 0x8(%rdx), %r10d
xorl 0x8(%rdi), %r10d
movbel 0xc(%rdx), %r11d
movq %rcx, -0x8(%rsp)
xorl 0xc(%rdi), %r11d
sarl %esi
addq $0x2c, %rdi
decl %esi
movl %esi, -0xc(%rsp)
movl $0xff, %ebp
movl %r9d, %edx
shrl $0x18, %edx
movl %r11d, %eax
shrl $0xe, %eax
movl $0x3fc, %ebx            # imm = 0x3FC
andl %ebx, %eax
leaq 0x174e(%rip), %r14      # 0x48d0
movl (%rax,%r14), %eax
leaq 0x1343(%rip), %rcx      # 0x44d0
xorl (%rcx,%rdx,4), %eax
movl %r10d, %edx
shrl $0x8, %edx
andl %ebp, %edx
leaq 0x1b31(%rip), %r15      # 0x4cd0
xorl (%r15,%rdx,4), %eax
movl %r13d, %edx
andl %ebp, %edx
leaq 0x1f21(%rip), %rsi      # 0x50d0
xorl (%rsi,%rdx,4), %eax
movl %r13d, %r8d
shrl $0x18, %r8d
movl %r9d, %edx
shrl $0xe, %edx
andl %ebx, %edx
movl (%rdx,%r14), %edx
xorl (%rcx,%r8,4), %edx
movl %r11d, %r8d
shrl $0x8, %r8d
andl %ebp, %r8d
xorl (%r15,%r8,4), %edx
movl %r10d, %r8d
andl %ebp, %r8d
xorl (%rsi,%r8,4), %edx
movl %r10d, %r12d
shrl $0x18, %r12d
movl %r13d, %r8d
shrl $0xe, %r8d
andl %ebx, %r8d
movl (%r8,%r14), %r8d
xorl (%rcx,%r12,4), %r8d
movl %r9d, %r12d
shrl $0x8, %r12d
andl %ebp, %r12d
xorl (%r15,%r12,4), %r8d
movl %r11d, %r12d
andl %ebp, %r12d
xorl (%rsi,%r12,4), %r8d
shrl $0x18, %r11d
shrl $0xe, %r10d
andl %ebx, %r10d
movl (%r10,%r14), %r12d
xorl (%rcx,%r11,4), %r12d
shrl $0x8, %r13d
andl %ebp, %r13d
xorl (%r15,%r13,4), %r12d
xorl -0x1c(%rdi), %eax
xorl -0x18(%rdi), %edx
xorl -0x14(%rdi), %r8d
andl %ebp, %r9d
xorl (%rsi,%r9,4), %r12d
xorl -0x10(%rdi), %r12d
movl %eax, %r10d
shrl $0x18, %r10d
movl -0xc(%rsp), %ecx
subl $0x1, %ecx
jb 0x333f
movl %ecx, -0xc(%rsp)
movl %r12d, %r9d
shrl $0xe, %r9d
andl %ebx, %r9d
leaq 0x1662(%rip), %r14      # 0x48d0
movl (%r9,%r14), %r9d
leaq 0x1257(%rip), %rcx      # 0x44d0
xorl (%rcx,%r10,4), %r9d
movl %r8d, %r10d
shrl $0x8, %r10d
andl %ebp, %r10d
leaq 0x1a42(%rip), %r15      # 0x4cd0
xorl (%r15,%r10,4), %r9d
movl %edx, %r10d
andl %ebp, %r10d
leaq 0x1e31(%rip), %rsi      # 0x50d0
xorl (%rsi,%r10,4), %r9d
xorl -0xc(%rdi), %r9d
movl %edx, %r10d
shrl $0x18, %r10d
movl %eax, %r11d
shrl $0xe, %r11d
andl %ebx, %r11d
movl (%r11,%r14), %r13d
xorl (%rcx,%r10,4), %r13d
movl %r12d, %r10d
shrl $0x8, %r10d
andl %ebp, %r10d
xorl (%r15,%r10,4), %r13d
movl %r8d, %r10d
andl %ebp, %r10d
xorl (%rsi,%r10,4), %r13d
xorl -0x8(%rdi), %r13d
movl %r8d, %r11d
shrl $0x18, %r11d
movl %edx, %r10d
shrl $0xe, %r10d
andl %ebx, %r10d
movl (%r10,%r14), %r10d
xorl (%rcx,%r11,4), %r10d
movl %eax, %r11d
shrl $0x8, %r11d
andl %ebp, %r11d
xorl (%r15,%r11,4), %r10d
movl %r12d, %r11d
andl %ebp, %r11d
xorl (%rsi,%r11,4), %r10d
xorl -0x4(%rdi), %r10d
shrl $0x18, %r12d
shrl $0xe, %r8d
andl %ebx, %r8d
movl (%r8,%r14), %r11d
xorl (%rcx,%r12,4), %r11d
shrl $0x8, %edx
andl %ebp, %edx
xorl (%r15,%rdx,4), %r11d
andl %ebp, %eax
xorl (%rsi,%rax,4), %r11d
xorl (%rdi), %r11d
addq $0x20, %rdi
jmp 0x3168
leaq 0x318a(%rip), %rcx      # 0x64d0
movzbl 0x3(%rcx,%r10,4), %esi
shll $0x18, %esi
movl %r12d, %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 %edx, %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 %eax, %r11d
shrl $0xe, %r11d
andl %r9d, %r11d
movzbl 0x2(%r11,%rcx), %r11d
shll $0x10, %r11d
orl %r10d, %r11d
movl %r12d, %r10d
shrl $0x8, %r10d
andl %esi, %r10d
movzbl 0x1(%rcx,%r10,4), %r10d
shll $0x8, %r10d
orl %r11d, %r10d
movl %r8d, %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 %edx, %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 %r12d, %r11d
andl %esi, %r11d
movzbl (%rcx,%r11,4), %r11d
orl %r10d, %r11d
xorl -0x4(%rdi), %r11d
movbel %r11d, 0x8(%rbx)
shrl $0x18, %r12d
movzbl 0x3(%rcx,%r12,4), %r10d
shll $0x18, %r10d
shrl $0xe, %r8d
andl %r9d, %r8d
movzbl 0x2(%r8,%rcx), %r8d
shll $0x10, %r8d
orl %r10d, %r8d
shrl $0x8, %edx
andl %esi, %edx
movzbl 0x1(%rcx,%rdx,4), %edx
shll $0x8, %edx
orl %r8d, %edx
andl %esi, %eax
movzbl (%rcx,%rax,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