// File: /workspace/github_c_makefile_star2_O0/mjosaarinen[P]brutus/crypto_aead/shellaes128v1d5n64/ref/aes.c
// Function: aesEncrypt
void aesEncrypt(const u32 rk[/*4*(Nr + 1)*/], const u8 pt[], u8 ct[]) {

	u32 s0, s1, s2, s3, t0, t1, t2, t3;
    int r;
    int Nr=10;

    /*
	 * 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];

    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];

    }

    /*
	 * 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:
movq %rdi, -0x8(%rsp)
movq %rsi, -0x10(%rsp)
movq %rdx, -0x18(%rsp)
movl $0xa, -0x40(%rsp)
movq -0x10(%rsp), %rax
movzbl (%rax), %eax
shll $0x18, %eax
movq -0x10(%rsp), %rcx
movzbl 0x1(%rcx), %ecx
shll $0x10, %ecx
xorl %ecx, %eax
movq -0x10(%rsp), %rcx
movzbl 0x2(%rcx), %ecx
shll $0x8, %ecx
xorl %ecx, %eax
movq -0x10(%rsp), %rcx
movzbl 0x3(%rcx), %ecx
xorl %ecx, %eax
movq -0x8(%rsp), %rcx
xorl (%rcx), %eax
movl %eax, -0x1c(%rsp)
movq -0x10(%rsp), %rax
movzbl 0x4(%rax), %eax
shll $0x18, %eax
movq -0x10(%rsp), %rcx
movzbl 0x5(%rcx), %ecx
shll $0x10, %ecx
xorl %ecx, %eax
movq -0x10(%rsp), %rcx
movzbl 0x6(%rcx), %ecx
shll $0x8, %ecx
xorl %ecx, %eax
movq -0x10(%rsp), %rcx
movzbl 0x7(%rcx), %ecx
xorl %ecx, %eax
movq -0x8(%rsp), %rcx
xorl 0x4(%rcx), %eax
movl %eax, -0x20(%rsp)
movq -0x10(%rsp), %rax
movzbl 0x8(%rax), %eax
shll $0x18, %eax
movq -0x10(%rsp), %rcx
movzbl 0x9(%rcx), %ecx
shll $0x10, %ecx
xorl %ecx, %eax
movq -0x10(%rsp), %rcx
movzbl 0xa(%rcx), %ecx
shll $0x8, %ecx
xorl %ecx, %eax
movq -0x10(%rsp), %rcx
movzbl 0xb(%rcx), %ecx
xorl %ecx, %eax
movq -0x8(%rsp), %rcx
xorl 0x8(%rcx), %eax
movl %eax, -0x24(%rsp)
movq -0x10(%rsp), %rax
movzbl 0xc(%rax), %eax
shll $0x18, %eax
movq -0x10(%rsp), %rcx
movzbl 0xd(%rcx), %ecx
shll $0x10, %ecx
xorl %ecx, %eax
movq -0x10(%rsp), %rcx
movzbl 0xe(%rcx), %ecx
shll $0x8, %ecx
xorl %ecx, %eax
movq -0x10(%rsp), %rcx
movzbl 0xf(%rcx), %ecx
xorl %ecx, %eax
movq -0x8(%rsp), %rcx
xorl 0xc(%rcx), %eax
movl %eax, -0x28(%rsp)
movl -0x40(%rsp), %eax
sarl %eax
movl %eax, -0x3c(%rsp)
movl -0x1c(%rsp), %eax
shrl $0x18, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x7893(%rip), %rax      # 0xa430
movl (%rax,%rcx,4), %eax
movl -0x20(%rsp), %ecx
shrl $0x10, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x7c78(%rip), %rcx      # 0xa830
xorl (%rcx,%rdx,4), %eax
movl -0x24(%rsp), %ecx
shrl $0x8, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x805d(%rip), %rcx      # 0xac30
xorl (%rcx,%rdx,4), %eax
movl -0x28(%rsp), %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x8445(%rip), %rcx      # 0xb030
xorl (%rcx,%rdx,4), %eax
movq -0x8(%rsp), %rcx
xorl 0x10(%rcx), %eax
movl %eax, -0x2c(%rsp)
movl -0x20(%rsp), %eax
shrl $0x18, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x7824(%rip), %rax      # 0xa430
movl (%rax,%rcx,4), %eax
movl -0x24(%rsp), %ecx
shrl $0x10, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x7c09(%rip), %rcx      # 0xa830
xorl (%rcx,%rdx,4), %eax
movl -0x28(%rsp), %ecx
shrl $0x8, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x7fee(%rip), %rcx      # 0xac30
xorl (%rcx,%rdx,4), %eax
movl -0x1c(%rsp), %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x83d6(%rip), %rcx      # 0xb030
xorl (%rcx,%rdx,4), %eax
movq -0x8(%rsp), %rcx
xorl 0x14(%rcx), %eax
movl %eax, -0x30(%rsp)
movl -0x24(%rsp), %eax
shrl $0x18, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x77b5(%rip), %rax      # 0xa430
movl (%rax,%rcx,4), %eax
movl -0x28(%rsp), %ecx
shrl $0x10, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x7b9a(%rip), %rcx      # 0xa830
xorl (%rcx,%rdx,4), %eax
movl -0x1c(%rsp), %ecx
shrl $0x8, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x7f7f(%rip), %rcx      # 0xac30
xorl (%rcx,%rdx,4), %eax
movl -0x20(%rsp), %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x8367(%rip), %rcx      # 0xb030
xorl (%rcx,%rdx,4), %eax
movq -0x8(%rsp), %rcx
xorl 0x18(%rcx), %eax
movl %eax, -0x34(%rsp)
movl -0x28(%rsp), %eax
shrl $0x18, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x7746(%rip), %rax      # 0xa430
movl (%rax,%rcx,4), %eax
movl -0x1c(%rsp), %ecx
shrl $0x10, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x7b2b(%rip), %rcx      # 0xa830
xorl (%rcx,%rdx,4), %eax
movl -0x20(%rsp), %ecx
shrl $0x8, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x7f10(%rip), %rcx      # 0xac30
xorl (%rcx,%rdx,4), %eax
movl -0x24(%rsp), %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x82f8(%rip), %rcx      # 0xb030
xorl (%rcx,%rdx,4), %eax
movq -0x8(%rsp), %rcx
xorl 0x1c(%rcx), %eax
movl %eax, -0x38(%rsp)
movq -0x8(%rsp), %rax
addq $0x20, %rax
movq %rax, -0x8(%rsp)
movl -0x3c(%rsp), %eax
addl $-0x1, %eax
movl %eax, -0x3c(%rsp)
cmpl $0x0, %eax
jne 0x2d6a
jmp 0x2f2a
movl -0x2c(%rsp), %eax
shrl $0x18, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x76b4(%rip), %rax      # 0xa430
movl (%rax,%rcx,4), %eax
movl -0x30(%rsp), %ecx
shrl $0x10, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x7a99(%rip), %rcx      # 0xa830
xorl (%rcx,%rdx,4), %eax
movl -0x34(%rsp), %ecx
shrl $0x8, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x7e7e(%rip), %rcx      # 0xac30
xorl (%rcx,%rdx,4), %eax
movl -0x38(%rsp), %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x8266(%rip), %rcx      # 0xb030
xorl (%rcx,%rdx,4), %eax
movq -0x8(%rsp), %rcx
xorl (%rcx), %eax
movl %eax, -0x1c(%rsp)
movl -0x30(%rsp), %eax
shrl $0x18, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x7646(%rip), %rax      # 0xa430
movl (%rax,%rcx,4), %eax
movl -0x34(%rsp), %ecx
shrl $0x10, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x7a2b(%rip), %rcx      # 0xa830
xorl (%rcx,%rdx,4), %eax
movl -0x38(%rsp), %ecx
shrl $0x8, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x7e10(%rip), %rcx      # 0xac30
xorl (%rcx,%rdx,4), %eax
movl -0x2c(%rsp), %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x81f8(%rip), %rcx      # 0xb030
xorl (%rcx,%rdx,4), %eax
movq -0x8(%rsp), %rcx
xorl 0x4(%rcx), %eax
movl %eax, -0x20(%rsp)
movl -0x34(%rsp), %eax
shrl $0x18, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x75d7(%rip), %rax      # 0xa430
movl (%rax,%rcx,4), %eax
movl -0x38(%rsp), %ecx
shrl $0x10, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x79bc(%rip), %rcx      # 0xa830
xorl (%rcx,%rdx,4), %eax
movl -0x2c(%rsp), %ecx
shrl $0x8, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x7da1(%rip), %rcx      # 0xac30
xorl (%rcx,%rdx,4), %eax
movl -0x30(%rsp), %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x8189(%rip), %rcx      # 0xb030
xorl (%rcx,%rdx,4), %eax
movq -0x8(%rsp), %rcx
xorl 0x8(%rcx), %eax
movl %eax, -0x24(%rsp)
movl -0x38(%rsp), %eax
shrl $0x18, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x7568(%rip), %rax      # 0xa430
movl (%rax,%rcx,4), %eax
movl -0x2c(%rsp), %ecx
shrl $0x10, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x794d(%rip), %rcx      # 0xa830
xorl (%rcx,%rdx,4), %eax
movl -0x30(%rsp), %ecx
shrl $0x8, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x7d32(%rip), %rcx      # 0xac30
xorl (%rcx,%rdx,4), %eax
movl -0x34(%rsp), %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x811a(%rip), %rcx      # 0xb030
xorl (%rcx,%rdx,4), %eax
movq -0x8(%rsp), %rcx
xorl 0xc(%rcx), %eax
movl %eax, -0x28(%rsp)
jmp 0x2b8b
movl -0x2c(%rsp), %eax
shrl $0x18, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x60c4(%rip), %rax      # 0x9000
movl (%rax,%rcx,4), %eax
andl $0xff000000, %eax       # imm = 0xFF000000
movl -0x30(%rsp), %ecx
shrl $0x10, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x60a4(%rip), %rcx      # 0x9000
movl (%rcx,%rdx,4), %ecx
andl $0xff0000, %ecx         # imm = 0xFF0000
xorl %ecx, %eax
movl -0x34(%rsp), %ecx
shrl $0x8, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x6081(%rip), %rcx      # 0x9000
movl (%rcx,%rdx,4), %ecx
andl $0xff00, %ecx           # imm = 0xFF00
xorl %ecx, %eax
movl -0x38(%rsp), %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x6061(%rip), %rcx      # 0x9000
movl (%rcx,%rdx,4), %ecx
andl $0xff, %ecx
xorl %ecx, %eax
movq -0x8(%rsp), %rcx
xorl (%rcx), %eax
movl %eax, -0x1c(%rsp)
movl -0x1c(%rsp), %eax
shrl $0x18, %eax
movb %al, %cl
movq -0x18(%rsp), %rax
movb %cl, (%rax)
movl -0x1c(%rsp), %eax
shrl $0x10, %eax
movb %al, %cl
movq -0x18(%rsp), %rax
movb %cl, 0x1(%rax)
movl -0x1c(%rsp), %eax
shrl $0x8, %eax
movb %al, %cl
movq -0x18(%rsp), %rax
movb %cl, 0x2(%rax)
movl -0x1c(%rsp), %eax
movb %al, %cl
movq -0x18(%rsp), %rax
movb %cl, 0x3(%rax)
movl -0x30(%rsp), %eax
shrl $0x18, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x5ff9(%rip), %rax      # 0x9000
movl (%rax,%rcx,4), %eax
andl $0xff000000, %eax       # imm = 0xFF000000
movl -0x34(%rsp), %ecx
shrl $0x10, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x5fd9(%rip), %rcx      # 0x9000
movl (%rcx,%rdx,4), %ecx
andl $0xff0000, %ecx         # imm = 0xFF0000
xorl %ecx, %eax
movl -0x38(%rsp), %ecx
shrl $0x8, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x5fb6(%rip), %rcx      # 0x9000
movl (%rcx,%rdx,4), %ecx
andl $0xff00, %ecx           # imm = 0xFF00
xorl %ecx, %eax
movl -0x2c(%rsp), %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x5f96(%rip), %rcx      # 0x9000
movl (%rcx,%rdx,4), %ecx
andl $0xff, %ecx
xorl %ecx, %eax
movq -0x8(%rsp), %rcx
xorl 0x4(%rcx), %eax
movl %eax, -0x20(%rsp)
movl -0x20(%rsp), %eax
shrl $0x18, %eax
movb %al, %cl
movq -0x18(%rsp), %rax
movb %cl, 0x4(%rax)
movl -0x20(%rsp), %eax
shrl $0x10, %eax
movb %al, %cl
movq -0x18(%rsp), %rax
movb %cl, 0x5(%rax)
movl -0x20(%rsp), %eax
shrl $0x8, %eax
movb %al, %cl
movq -0x18(%rsp), %rax
movb %cl, 0x6(%rax)
movl -0x20(%rsp), %eax
movb %al, %cl
movq -0x18(%rsp), %rax
movb %cl, 0x7(%rax)
movl -0x34(%rsp), %eax
shrl $0x18, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x5f2c(%rip), %rax      # 0x9000
movl (%rax,%rcx,4), %eax
andl $0xff000000, %eax       # imm = 0xFF000000
movl -0x38(%rsp), %ecx
shrl $0x10, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x5f0c(%rip), %rcx      # 0x9000
movl (%rcx,%rdx,4), %ecx
andl $0xff0000, %ecx         # imm = 0xFF0000
xorl %ecx, %eax
movl -0x2c(%rsp), %ecx
shrl $0x8, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x5ee9(%rip), %rcx      # 0x9000
movl (%rcx,%rdx,4), %ecx
andl $0xff00, %ecx           # imm = 0xFF00
xorl %ecx, %eax
movl -0x30(%rsp), %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x5ec9(%rip), %rcx      # 0x9000
movl (%rcx,%rdx,4), %ecx
andl $0xff, %ecx
xorl %ecx, %eax
movq -0x8(%rsp), %rcx
xorl 0x8(%rcx), %eax
movl %eax, -0x24(%rsp)
movl -0x24(%rsp), %eax
shrl $0x18, %eax
movb %al, %cl
movq -0x18(%rsp), %rax
movb %cl, 0x8(%rax)
movl -0x24(%rsp), %eax
shrl $0x10, %eax
movb %al, %cl
movq -0x18(%rsp), %rax
movb %cl, 0x9(%rax)
movl -0x24(%rsp), %eax
shrl $0x8, %eax
movb %al, %cl
movq -0x18(%rsp), %rax
movb %cl, 0xa(%rax)
movl -0x24(%rsp), %eax
movb %al, %cl
movq -0x18(%rsp), %rax
movb %cl, 0xb(%rax)
movl -0x38(%rsp), %eax
shrl $0x18, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x5e5f(%rip), %rax      # 0x9000
movl (%rax,%rcx,4), %eax
andl $0xff000000, %eax       # imm = 0xFF000000
movl -0x2c(%rsp), %ecx
shrl $0x10, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x5e3f(%rip), %rcx      # 0x9000
movl (%rcx,%rdx,4), %ecx
andl $0xff0000, %ecx         # imm = 0xFF0000
xorl %ecx, %eax
movl -0x30(%rsp), %ecx
shrl $0x8, %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x5e1c(%rip), %rcx      # 0x9000
movl (%rcx,%rdx,4), %ecx
andl $0xff00, %ecx           # imm = 0xFF00
xorl %ecx, %eax
movl -0x34(%rsp), %ecx
andl $0xff, %ecx
movl %ecx, %ecx
movl %ecx, %edx
leaq 0x5dfc(%rip), %rcx      # 0x9000
movl (%rcx,%rdx,4), %ecx
andl $0xff, %ecx
xorl %ecx, %eax
movq -0x8(%rsp), %rcx
xorl 0xc(%rcx), %eax
movl %eax, -0x28(%rsp)
movl -0x28(%rsp), %eax
shrl $0x18, %eax
movb %al, %cl
movq -0x18(%rsp), %rax
movb %cl, 0xc(%rax)
movl -0x28(%rsp), %eax
shrl $0x10, %eax
movb %al, %cl
movq -0x18(%rsp), %rax
movb %cl, 0xd(%rax)
movl -0x28(%rsp), %eax
shrl $0x8, %eax
movb %al, %cl
movq -0x18(%rsp), %rax
movb %cl, 0xe(%rax)
movl -0x28(%rsp), %eax
movb %al, %cl
movq -0x18(%rsp), %rax
movb %cl, 0xf(%rax)
retq
nopl (%rax)