// File: /workspace/github_c_makefile_star2_O3/mjosaarinen[P]brutus/crypto_aead/shellaes128v1d5n64/ref/aesReduced.c
// Function: aesReducedEnc
void aesReducedEnc(const u32 mk[], const u32 sk[], const u8 pt[], u8 ct[]){

    u32 s0, s1, s2, s3, t0, t1, t2, t3;

    s0 = GETU32(pt     ) ^ mk[0];
	s1 = GETU32(pt +  4) ^ mk[1];
	s2 = GETU32(pt +  8) ^ mk[2];
	s3 = GETU32(pt + 12) ^ mk[3];

    /* round 1*/
    t0 =
            Te0[(s0 >> 24)       ] ^
            Te1[(s1 >> 16) & 0xff] ^
            Te2[(s2 >>  8) & 0xff] ^
            Te3[(s3      ) & 0xff] ^
            sk[0];
    t1 =
            Te0[(s1 >> 24)       ] ^
            Te1[(s2 >> 16) & 0xff] ^
            Te2[(s3 >>  8) & 0xff] ^
            Te3[(s0      ) & 0xff] ^
            sk[1];
    t2 =
            Te0[(s2 >> 24)       ] ^
            Te1[(s3 >> 16) & 0xff] ^
            Te2[(s0 >>  8) & 0xff] ^
            Te3[(s1      ) & 0xff] ^
            sk[2];
    t3 =
            Te0[(s3 >> 24)       ] ^
            Te1[(s0 >> 16) & 0xff] ^
            Te2[(s1 >>  8) & 0xff] ^
            Te3[(s2      ) & 0xff] ^
            sk[3];

    /* round 2*/

    s0 =
            Te0[(t0 >> 24)       ] ^
            Te1[(t1 >> 16) & 0xff] ^
            Te2[(t2 >>  8) & 0xff] ^
            Te3[(t3      ) & 0xff] ^
            sk[4];
    s1 =
            Te0[(t1 >> 24)       ] ^
            Te1[(t2 >> 16) & 0xff] ^
            Te2[(t3 >>  8) & 0xff] ^
            Te3[(t0      ) & 0xff] ^
            sk[5];
    s2 =
            Te0[(t2 >> 24)       ] ^
            Te1[(t3 >> 16) & 0xff] ^
            Te2[(t0 >>  8) & 0xff] ^
            Te3[(t1      ) & 0xff] ^
            sk[6];
    s3 =
            Te0[(t3 >> 24)       ] ^
            Te1[(t0 >> 16) & 0xff] ^
            Te2[(t1 >>  8) & 0xff] ^
            Te3[(t2      ) & 0xff] ^
            sk[7];

    /* round 3*/

    t0 =
            Te0[(s0 >> 24)       ] ^
            Te1[(s1 >> 16) & 0xff] ^
            Te2[(s2 >>  8) & 0xff] ^
            Te3[(s3      ) & 0xff] ^
            sk[8];
    t1 =
            Te0[(s1 >> 24)       ] ^
            Te1[(s2 >> 16) & 0xff] ^
            Te2[(s3 >>  8) & 0xff] ^
            Te3[(s0      ) & 0xff] ^
            sk[9];
    t2 =
            Te0[(s2 >> 24)       ] ^
            Te1[(s3 >> 16) & 0xff] ^
            Te2[(s0 >>  8) & 0xff] ^
            Te3[(s1      ) & 0xff] ^
            sk[10];
    t3 =
            Te0[(s3 >> 24)       ] ^
            Te1[(s0 >> 16) & 0xff] ^
            Te2[(s1 >>  8) & 0xff] ^
            Te3[(s2      ) & 0xff] ^
            sk[11];


    /* round 4*/

    s0 =
		(Te0[(t0 >> 24)       ] ) ^
		(Te1[(t1 >> 16) & 0xff]) ^
		(Te2[(t2 >>  8) & 0xff]) ^
		(Te3[(t3      ) & 0xff]) ;

	PUTU32(ct     , s0);

	s1 =
		(Te0[(t1 >> 24)       ] ) ^
		(Te1[(t2 >> 16) & 0xff] ) ^
		(Te2[(t3 >>  8) & 0xff] ) ^
		(Te3[(t0      ) & 0xff] );

	PUTU32(ct +  4, s1);

	s2 =
		(Te0[(t2 >> 24)       ] ) ^
		(Te1[(t3 >> 16) & 0xff] ) ^
		(Te2[(t0 >>  8) & 0xff] ) ^
		(Te3[(t1      ) & 0xff] );

	PUTU32(ct +  8, s2);

	s3 =
		(Te0[(t3 >> 24)       ] ) ^
		(Te1[(t0 >> 16) & 0xff] ) ^
		(Te2[(t1 >>  8) & 0xff] ) ^
		(Te3[(t2      ) & 0xff] );

	PUTU32(ct + 12, s3);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movbel (%rdx), %r13d
xorl (%rdi), %r13d
movbel 0x4(%rdx), %r12d
xorl 0x4(%rdi), %r12d
movbel 0x8(%rdx), %r14d
xorl 0x8(%rdi), %r14d
movbel 0xc(%rdx), %eax
xorl 0xc(%rdi), %eax
movl %r13d, %edx
shrl $0x18, %edx
leaq 0x6ae1(%rip), %r10      # 0x9830
movl %r12d, %r9d
shrl $0xe, %r9d
movl $0x3fc, %edi            # imm = 0x3FC
andl %edi, %r9d
leaq 0x6ecb(%rip), %rdi      # 0x9c30
movl (%r9,%rdi), %r11d
movq %rdi, %r8
xorl (%r10,%rdx,4), %r11d
movq %r10, %rbp
movl %r14d, %r10d
shrl $0x8, %r10d
movl $0xff, %edx
andl %edx, %r10d
leaq 0x72a7(%rip), %r9       # 0xa030
xorl (%r9,%r10,4), %r11d
movl %eax, %ebx
andl %edx, %ebx
leaq 0x7698(%rip), %r10      # 0xa430
xorl (%r10,%rbx,4), %r11d
movl %r12d, %r15d
shrl $0x18, %r15d
movl %r14d, %ebx
shrl $0xe, %ebx
movl $0x3fc, %edi            # imm = 0x3FC
andl %edi, %ebx
movl (%rbx,%r8), %ebx
movq %rbp, %rdi
xorl (%rbp,%r15,4), %ebx
movl %eax, %r15d
shrl $0x8, %r15d
andl %edx, %r15d
xorl (%r9,%r15,4), %ebx
movl %r13d, %r15d
andl %edx, %r15d
xorl (%r10,%r15,4), %ebx
movl %r14d, %ebp
shrl $0x18, %ebp
movl %eax, %r15d
shrl $0xe, %r15d
movl $0x3fc, %r10d           # imm = 0x3FC
andl %r10d, %r15d
movl (%r15,%r8), %r15d
xorl (%rdi,%rbp,4), %r15d
movl %r13d, %ebp
shrl $0x8, %ebp
andl %edx, %ebp
xorl (%r9,%rbp,4), %r15d
movl %r12d, %ebp
andl %edx, %ebp
leaq 0x7626(%rip), %r10      # 0xa430
xorl (%r10,%rbp,4), %r15d
xorl (%rsi), %r11d
xorl 0x4(%rsi), %ebx
xorl 0x8(%rsi), %r15d
shrl $0x18, %eax
shrl $0xe, %r13d
movl $0x3fc, %r10d           # imm = 0x3FC
andl %r10d, %r13d
movl (%r13,%r8), %ebp
xorl (%rdi,%rax,4), %ebp
movq %rdi, %r10
shrl $0x8, %r12d
andl %edx, %r12d
xorl (%r9,%r12,4), %ebp
andl %edx, %r14d
leaq 0x75e8(%rip), %r8       # 0xa430
xorl (%r8,%r14,4), %ebp
xorl 0xc(%rsi), %ebp
movl %r11d, %eax
shrl $0x18, %eax
movl %ebx, %r14d
shrl $0xe, %r14d
movl $0x3fc, %r13d           # imm = 0x3FC
andl %r13d, %r14d
leaq 0x6dc4(%rip), %rdi      # 0x9c30
movl (%r14,%rdi), %r14d
xorl (%r10,%rax,4), %r14d
movl %r15d, %eax
shrl $0x8, %eax
andl %edx, %eax
xorl (%r9,%rax,4), %r14d
movl %ebp, %eax
andl %edx, %eax
xorl (%r8,%rax,4), %r14d
movl %ebx, %eax
shrl $0x18, %eax
movl %r15d, %r12d
shrl $0xe, %r12d
andl %r13d, %r12d
movl (%r12,%rdi), %r12d
xorl (%r10,%rax,4), %r12d
movl %ebp, %eax
shrl $0x8, %eax
andl %edx, %eax
xorl (%r9,%rax,4), %r12d
movl %r11d, %eax
andl %edx, %eax
xorl (%r8,%rax,4), %r12d
movl %r15d, %eax
shrl $0x18, %eax
movl %ebp, %r13d
shrl $0xe, %r13d
movl $0x3fc, %edi            # imm = 0x3FC
andl %edi, %r13d
leaq 0x6d61(%rip), %r10      # 0x9c30
movl (%r13,%r10), %r13d
leaq 0x6955(%rip), %rdi      # 0x9830
xorl (%rdi,%rax,4), %r13d
movl %r11d, %eax
shrl $0x8, %eax
andl %edx, %eax
xorl (%r9,%rax,4), %r13d
movl %ebx, %eax
andl %edx, %eax
xorl (%r8,%rax,4), %r13d
xorl 0x10(%rsi), %r14d
xorl 0x14(%rsi), %r12d
xorl 0x18(%rsi), %r13d
shrl $0x18, %ebp
shrl $0xe, %r11d
movl $0x3fc, %eax            # imm = 0x3FC
andl %eax, %r11d
movl (%r11,%r10), %eax
xorl (%rdi,%rbp,4), %eax
shrl $0x8, %ebx
andl %edx, %ebx
xorl (%r9,%rbx,4), %eax
andl %edx, %r15d
xorl (%r8,%r15,4), %eax
xorl 0x1c(%rsi), %eax
movl %r14d, %ebx
shrl $0x18, %ebx
movl %r12d, %r11d
shrl $0xe, %r11d
movl $0x3fc, %ebp            # imm = 0x3FC
andl %ebp, %r11d
movl (%r11,%r10), %r11d
xorl (%rdi,%rbx,4), %r11d
movl %r13d, %ebx
shrl $0x8, %ebx
andl %edx, %ebx
xorl (%r9,%rbx,4), %r11d
movl %eax, %ebx
andl %edx, %ebx
xorl (%r8,%rbx,4), %r11d
movl %r12d, %r15d
shrl $0x18, %r15d
movl %r13d, %ebx
shrl $0xe, %ebx
andl %ebp, %ebx
movl (%rbx,%r10), %ebx
xorl (%rdi,%r15,4), %ebx
movl %eax, %r15d
shrl $0x8, %r15d
andl %edx, %r15d
xorl (%r9,%r15,4), %ebx
movl %r14d, %r15d
andl %edx, %r15d
xorl (%r8,%r15,4), %ebx
movl %r13d, %ebp
shrl $0x18, %ebp
movl %eax, %r15d
shrl $0xe, %r15d
movl $0x3fc, %r10d           # imm = 0x3FC
andl %r10d, %r15d
leaq 0x6c8b(%rip), %r10      # 0x9c30
movl (%r15,%r10), %r15d
xorl (%rdi,%rbp,4), %r15d
movl %r14d, %ebp
shrl $0x8, %ebp
andl %edx, %ebp
xorl (%r9,%rbp,4), %r15d
movl %r12d, %ebp
andl %edx, %ebp
xorl (%r8,%rbp,4), %r15d
shrl $0x18, %eax
shrl $0xe, %r14d
movl $0x3fc, %ebp            # imm = 0x3FC
andl %ebp, %r14d
leaq 0x6c58(%rip), %r8       # 0x9c30
movl (%r14,%r8), %r14d
xorl (%rdi,%rax,4), %r14d
shrl $0x8, %r12d
andl %edx, %r12d
xorl (%r9,%r12,4), %r14d
xorl 0x20(%rsi), %r11d
xorl 0x24(%rsi), %ebx
xorl 0x28(%rsi), %r15d
andl %edx, %r13d
leaq 0x7430(%rip), %r10      # 0xa430
xorl (%r10,%r13,4), %r14d
xorl 0x2c(%rsi), %r14d
movl %r11d, %esi
shrl $0x18, %esi
movl %ebx, %eax
shrl $0xe, %eax
andl %ebp, %eax
movl (%rax,%r8), %eax
xorl (%rdi,%rsi,4), %eax
movl %r15d, %esi
shrl $0x8, %esi
andl %edx, %esi
xorl (%r9,%rsi,4), %eax
movl %r14d, %esi
andl %edx, %esi
xorl (%r10,%rsi,4), %eax
movl %eax, %esi
shrl $0x18, %esi
movb %sil, (%rcx)
movl %eax, %esi
shrl $0x10, %esi
movb %sil, 0x1(%rcx)
movb %ah, 0x2(%rcx)
movb %al, 0x3(%rcx)
movl %ebx, %esi
shrl $0x18, %esi
movl %r15d, %eax
shrl $0xe, %eax
andl %ebp, %eax
movl (%rax,%r8), %eax
xorl (%rdi,%rsi,4), %eax
movl %r14d, %esi
shrl $0x8, %esi
andl %edx, %esi
xorl (%r9,%rsi,4), %eax
movl %r11d, %esi
andl %edx, %esi
xorl (%r10,%rsi,4), %eax
movl %eax, %esi
shrl $0x18, %esi
movb %sil, 0x4(%rcx)
movl %eax, %esi
shrl $0x10, %esi
movb %sil, 0x5(%rcx)
movb %ah, 0x6(%rcx)
movb %al, 0x7(%rcx)
movl %r15d, %esi
shrl $0x18, %esi
movl %r14d, %eax
shrl $0xe, %eax
andl %ebp, %eax
movl (%rax,%r8), %eax
xorl (%rdi,%rsi,4), %eax
movl %r11d, %esi
shrl $0x8, %esi
andl %edx, %esi
xorl (%r9,%rsi,4), %eax
movl %ebx, %esi
andl %edx, %esi
xorl (%r10,%rsi,4), %eax
movl %eax, %esi
shrl $0x18, %esi
movb %sil, 0x8(%rcx)
movl %eax, %esi
shrl $0x10, %esi
movb %sil, 0x9(%rcx)
movb %ah, 0xa(%rcx)
movb %al, 0xb(%rcx)
shrl $0xe, %r11d
andl %ebp, %r11d
movl (%r11,%r8), %eax
shrl $0x18, %r14d
xorl (%rdi,%r14,4), %eax
shrl $0x8, %ebx
andl %edx, %ebx
xorl (%r9,%rbx,4), %eax
andl %edx, %r15d
xorl (%r10,%r15,4), %eax
movl %eax, %edx
shrl $0x18, %edx
movb %dl, 0xc(%rcx)
movl %eax, %edx
shrl $0x10, %edx
movb %dl, 0xd(%rcx)
movb %ah, 0xe(%rcx)
movb %al, 0xf(%rcx)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq