// File: /workspace/github_c_makefile_star2_O0/mjosaarinen[P]brutus/crypto_aead/aegis128/aesni/encrypt.c
// Function: aegis128_initialization
void aegis128_initialization(const unsigned char *key, const unsigned char *iv, __m128i *state)
{
       int i;

        __m128i  tmp;
        __m128i  keytmp = _mm_load_si128((__m128i*)key);
        __m128i  ivtmp  = _mm_load_si128((__m128i*)iv);

        state[0] =  ivtmp;
        state[1] = _mm_set_epi8(0xdd,0x28,0xb5,0x73,0x42,0x31,0x11,0x20,0xf1,0x2f,0xc2,0x6d,0x55,0x18,0x3d,0xdb);
        state[2] = _mm_set_epi8(0x62,0x79,0xe9,0x90,0x59,0x37,0x22,0x15,0x0d,0x08,0x05,0x03,0x02,0x01,0x1, 0x0);
        state[3] = _mm_xor_si128(keytmp, _mm_set_epi8(0x62,0x79,0xe9,0x90,0x59,0x37,0x22,0x15,0x0d,0x08,0x05,0x03,0x02,0x01,0x1,0x0));
        state[4] = _mm_xor_si128(keytmp, _mm_set_epi8(0xdd,0x28,0xb5,0x73,0x42,0x31,0x11,0x20,0xf1,0x2f,0xc2,0x6d,0x55,0x18,0x3d,0xdb));
        state[0] = _mm_xor_si128(state[0], keytmp);

        keytmp   = _mm_xor_si128(keytmp, ivtmp); 
        for (i = 0; i < 10; i++)  {
             //state update function
             tmp = state[4];
             state[4] = _mm_aesenc_si128(state[3], state[4]);
             state[3] = _mm_aesenc_si128(state[2], state[3]);
             state[2] = _mm_aesenc_si128(state[1], state[2]);
             state[1] = _mm_aesenc_si128(state[0], state[1]);
             state[0] = _mm_aesenc_si128(tmp, state[0]);

             //xor msg with state[0]
             keytmp   = _mm_xor_si128(keytmp, ivtmp);
             state[0] = _mm_xor_si128(state[0], keytmp);
        }
}

// Assembly:
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rdi, -0x38(%rsp)
movq %rsi, -0x40(%rsp)
movq %rdx, -0x48(%rsp)
movq -0x38(%rsp), %rax
movq %rax, -0x28(%rsp)
movq -0x28(%rsp), %rax
vmovdqa (%rax), %xmm0
vmovdqa %xmm0, -0x70(%rsp)
movq -0x40(%rsp), %rax
movq %rax, -0x30(%rsp)
movq -0x30(%rsp), %rax
vmovdqa (%rax), %xmm0
vmovdqa %xmm0, -0x80(%rsp)
vmovdqa -0x80(%rsp), %xmm0
movq -0x48(%rsp), %rax
vmovdqa %xmm0, (%rax)
movb $-0x23, 0x5f(%rsp)
movb $0x28, 0x5e(%rsp)
movb $-0x4b, 0x5d(%rsp)
movb $0x73, 0x5c(%rsp)
movb $0x42, 0x5b(%rsp)
movb $0x31, 0x5a(%rsp)
movb $0x11, 0x59(%rsp)
movb $0x20, 0x58(%rsp)
movb $-0xf, 0x57(%rsp)
movb $0x2f, 0x56(%rsp)
movb $-0x3e, 0x55(%rsp)
movb $0x6d, 0x54(%rsp)
movb $0x55, 0x53(%rsp)
movb $0x18, 0x52(%rsp)
movb $0x3d, 0x51(%rsp)
movb $-0x25, 0x50(%rsp)
movzbl 0x50(%rsp), %eax
vmovd %eax, %xmm0
movzbl 0x51(%rsp), %eax
vpinsrb $0x1, %eax, %xmm0, %xmm0
movzbl 0x52(%rsp), %eax
vpinsrb $0x2, %eax, %xmm0, %xmm0
movzbl 0x53(%rsp), %eax
vpinsrb $0x3, %eax, %xmm0, %xmm0
movzbl 0x54(%rsp), %eax
vpinsrb $0x4, %eax, %xmm0, %xmm0
movzbl 0x55(%rsp), %eax
vpinsrb $0x5, %eax, %xmm0, %xmm0
movzbl 0x56(%rsp), %eax
vpinsrb $0x6, %eax, %xmm0, %xmm0
movzbl 0x57(%rsp), %eax
vpinsrb $0x7, %eax, %xmm0, %xmm0
movzbl 0x58(%rsp), %eax
vpinsrb $0x8, %eax, %xmm0, %xmm0
movzbl 0x59(%rsp), %eax
vpinsrb $0x9, %eax, %xmm0, %xmm0
movzbl 0x5a(%rsp), %eax
vpinsrb $0xa, %eax, %xmm0, %xmm0
movzbl 0x5b(%rsp), %eax
vpinsrb $0xb, %eax, %xmm0, %xmm0
movzbl 0x5c(%rsp), %eax
vpinsrb $0xc, %eax, %xmm0, %xmm0
movzbl 0x5d(%rsp), %eax
vpinsrb $0xd, %eax, %xmm0, %xmm0
movzbl 0x5e(%rsp), %eax
vpinsrb $0xe, %eax, %xmm0, %xmm0
movzbl 0x5f(%rsp), %eax
vpinsrb $0xf, %eax, %xmm0, %xmm0
vmovdqa %xmm0, 0x40(%rsp)
vmovdqa 0x40(%rsp), %xmm0
movq -0x48(%rsp), %rax
vmovdqa %xmm0, 0x10(%rax)
movb $0x62, 0x3f(%rsp)
movb $0x79, 0x3e(%rsp)
movb $-0x17, 0x3d(%rsp)
movb $-0x70, 0x3c(%rsp)
movb $0x59, 0x3b(%rsp)
movb $0x37, 0x3a(%rsp)
movb $0x22, 0x39(%rsp)
movb $0x15, 0x38(%rsp)
movb $0xd, 0x37(%rsp)
movb $0x8, 0x36(%rsp)
movb $0x5, 0x35(%rsp)
movb $0x3, 0x34(%rsp)
movb $0x2, 0x33(%rsp)
movb $0x1, 0x32(%rsp)
movb $0x1, 0x31(%rsp)
movb $0x0, 0x30(%rsp)
movzbl 0x30(%rsp), %eax
vmovd %eax, %xmm0
movzbl 0x31(%rsp), %eax
vpinsrb $0x1, %eax, %xmm0, %xmm0
movzbl 0x32(%rsp), %eax
vpinsrb $0x2, %eax, %xmm0, %xmm0
movzbl 0x33(%rsp), %eax
vpinsrb $0x3, %eax, %xmm0, %xmm0
movzbl 0x34(%rsp), %eax
vpinsrb $0x4, %eax, %xmm0, %xmm0
movzbl 0x35(%rsp), %eax
vpinsrb $0x5, %eax, %xmm0, %xmm0
movzbl 0x36(%rsp), %eax
vpinsrb $0x6, %eax, %xmm0, %xmm0
movzbl 0x37(%rsp), %eax
vpinsrb $0x7, %eax, %xmm0, %xmm0
movzbl 0x38(%rsp), %eax
vpinsrb $0x8, %eax, %xmm0, %xmm0
movzbl 0x39(%rsp), %eax
vpinsrb $0x9, %eax, %xmm0, %xmm0
movzbl 0x3a(%rsp), %eax
vpinsrb $0xa, %eax, %xmm0, %xmm0
movzbl 0x3b(%rsp), %eax
vpinsrb $0xb, %eax, %xmm0, %xmm0
movzbl 0x3c(%rsp), %eax
vpinsrb $0xc, %eax, %xmm0, %xmm0
movzbl 0x3d(%rsp), %eax
vpinsrb $0xd, %eax, %xmm0, %xmm0
movzbl 0x3e(%rsp), %eax
vpinsrb $0xe, %eax, %xmm0, %xmm0
movzbl 0x3f(%rsp), %eax
vpinsrb $0xf, %eax, %xmm0, %xmm0
vmovdqa %xmm0, 0x20(%rsp)
vmovdqa 0x20(%rsp), %xmm0
movq -0x48(%rsp), %rax
vmovdqa %xmm0, 0x20(%rax)
vmovdqa -0x70(%rsp), %xmm1
movb $0x62, 0x1f(%rsp)
movb $0x79, 0x1e(%rsp)
movb $-0x17, 0x1d(%rsp)
movb $-0x70, 0x1c(%rsp)
movb $0x59, 0x1b(%rsp)
movb $0x37, 0x1a(%rsp)
movb $0x22, 0x19(%rsp)
movb $0x15, 0x18(%rsp)
movb $0xd, 0x17(%rsp)
movb $0x8, 0x16(%rsp)
movb $0x5, 0x15(%rsp)
movb $0x3, 0x14(%rsp)
movb $0x2, 0x13(%rsp)
movb $0x1, 0x12(%rsp)
movb $0x1, 0x11(%rsp)
movb $0x0, 0x10(%rsp)
movzbl 0x10(%rsp), %eax
vmovd %eax, %xmm0
movzbl 0x11(%rsp), %eax
vpinsrb $0x1, %eax, %xmm0, %xmm0
movzbl 0x12(%rsp), %eax
vpinsrb $0x2, %eax, %xmm0, %xmm0
movzbl 0x13(%rsp), %eax
vpinsrb $0x3, %eax, %xmm0, %xmm0
movzbl 0x14(%rsp), %eax
vpinsrb $0x4, %eax, %xmm0, %xmm0
movzbl 0x15(%rsp), %eax
vpinsrb $0x5, %eax, %xmm0, %xmm0
movzbl 0x16(%rsp), %eax
vpinsrb $0x6, %eax, %xmm0, %xmm0
movzbl 0x17(%rsp), %eax
vpinsrb $0x7, %eax, %xmm0, %xmm0
movzbl 0x18(%rsp), %eax
vpinsrb $0x8, %eax, %xmm0, %xmm0
movzbl 0x19(%rsp), %eax
vpinsrb $0x9, %eax, %xmm0, %xmm0
movzbl 0x1a(%rsp), %eax
vpinsrb $0xa, %eax, %xmm0, %xmm0
movzbl 0x1b(%rsp), %eax
vpinsrb $0xb, %eax, %xmm0, %xmm0
movzbl 0x1c(%rsp), %eax
vpinsrb $0xc, %eax, %xmm0, %xmm0
movzbl 0x1d(%rsp), %eax
vpinsrb $0xd, %eax, %xmm0, %xmm0
movzbl 0x1e(%rsp), %eax
vpinsrb $0xe, %eax, %xmm0, %xmm0
movzbl 0x1f(%rsp), %eax
vpinsrb $0xf, %eax, %xmm0, %xmm0
vmovdqa %xmm0, (%rsp)
vmovdqa (%rsp), %xmm0
vmovdqa %xmm1, 0x110(%rsp)
vmovdqa %xmm0, 0x100(%rsp)
vmovdqa 0x110(%rsp), %xmm0
vmovdqa 0x100(%rsp), %xmm1
vpxor %xmm1, %xmm0, %xmm0
movq -0x48(%rsp), %rax
vmovdqa %xmm0, 0x30(%rax)
vmovdqa -0x70(%rsp), %xmm1
movb $-0x23, -0x1(%rsp)
movb $0x28, -0x2(%rsp)
movb $-0x4b, -0x3(%rsp)
movb $0x73, -0x4(%rsp)
movb $0x42, -0x5(%rsp)
movb $0x31, -0x6(%rsp)
movb $0x11, -0x7(%rsp)
movb $0x20, -0x8(%rsp)
movb $-0xf, -0x9(%rsp)
movb $0x2f, -0xa(%rsp)
movb $-0x3e, -0xb(%rsp)
movb $0x6d, -0xc(%rsp)
movb $0x55, -0xd(%rsp)
movb $0x18, -0xe(%rsp)
movb $0x3d, -0xf(%rsp)
movb $-0x25, -0x10(%rsp)
movzbl -0x10(%rsp), %eax
vmovd %eax, %xmm0
movzbl -0xf(%rsp), %eax
vpinsrb $0x1, %eax, %xmm0, %xmm0
movzbl -0xe(%rsp), %eax
vpinsrb $0x2, %eax, %xmm0, %xmm0
movzbl -0xd(%rsp), %eax
vpinsrb $0x3, %eax, %xmm0, %xmm0
movzbl -0xc(%rsp), %eax
vpinsrb $0x4, %eax, %xmm0, %xmm0
movzbl -0xb(%rsp), %eax
vpinsrb $0x5, %eax, %xmm0, %xmm0
movzbl -0xa(%rsp), %eax
vpinsrb $0x6, %eax, %xmm0, %xmm0
movzbl -0x9(%rsp), %eax
vpinsrb $0x7, %eax, %xmm0, %xmm0
movzbl -0x8(%rsp), %eax
vpinsrb $0x8, %eax, %xmm0, %xmm0
movzbl -0x7(%rsp), %eax
vpinsrb $0x9, %eax, %xmm0, %xmm0
movzbl -0x6(%rsp), %eax
vpinsrb $0xa, %eax, %xmm0, %xmm0
movzbl -0x5(%rsp), %eax
vpinsrb $0xb, %eax, %xmm0, %xmm0
movzbl -0x4(%rsp), %eax
vpinsrb $0xc, %eax, %xmm0, %xmm0
movzbl -0x3(%rsp), %eax
vpinsrb $0xd, %eax, %xmm0, %xmm0
movzbl -0x2(%rsp), %eax
vpinsrb $0xe, %eax, %xmm0, %xmm0
movzbl -0x1(%rsp), %eax
vpinsrb $0xf, %eax, %xmm0, %xmm0
vmovdqa %xmm0, -0x20(%rsp)
vmovdqa -0x20(%rsp), %xmm0
vmovdqa %xmm1, 0xf0(%rsp)
vmovdqa %xmm0, 0xe0(%rsp)
vmovdqa 0xf0(%rsp), %xmm0
vpxor 0xe0(%rsp), %xmm0, %xmm0
movq -0x48(%rsp), %rax
vmovdqa %xmm0, 0x40(%rax)
movq -0x48(%rsp), %rax
vmovdqa (%rax), %xmm1
vmovdqa -0x70(%rsp), %xmm0
vmovdqa %xmm1, 0xd0(%rsp)
vmovdqa %xmm0, 0xc0(%rsp)
vmovdqa 0xd0(%rsp), %xmm0
vpxor 0xc0(%rsp), %xmm0, %xmm0
movq -0x48(%rsp), %rax
vmovdqa %xmm0, (%rax)
vmovdqa -0x70(%rsp), %xmm1
vmovdqa -0x80(%rsp), %xmm0
vmovdqa %xmm1, 0xb0(%rsp)
vmovdqa %xmm0, 0xa0(%rsp)
vmovdqa 0xb0(%rsp), %xmm0
vpxor 0xa0(%rsp), %xmm0, %xmm0
vmovdqa %xmm0, -0x70(%rsp)
movl $0x0, -0x4c(%rsp)
cmpl $0xa, -0x4c(%rsp)
jge 0x1904
movq -0x48(%rsp), %rax
vmovdqa 0x40(%rax), %xmm0
vmovdqa %xmm0, -0x60(%rsp)
movq -0x48(%rsp), %rax
vmovdqa 0x30(%rax), %xmm1
movq -0x48(%rsp), %rax
vmovdqa 0x40(%rax), %xmm0
vmovdqa %xmm1, 0x1b0(%rsp)
vmovdqa %xmm0, 0x1a0(%rsp)
vmovdqa 0x1b0(%rsp), %xmm0
vmovdqa 0x1a0(%rsp), %xmm1
vaesenc %xmm1, %xmm0, %xmm0
movq -0x48(%rsp), %rax
vmovdqa %xmm0, 0x40(%rax)
movq -0x48(%rsp), %rax
vmovdqa 0x20(%rax), %xmm1
movq -0x48(%rsp), %rax
vmovdqa 0x30(%rax), %xmm0
vmovdqa %xmm1, 0x190(%rsp)
vmovdqa %xmm0, 0x180(%rsp)
vmovdqa 0x190(%rsp), %xmm0
vmovdqa 0x180(%rsp), %xmm1
vaesenc %xmm1, %xmm0, %xmm0
movq -0x48(%rsp), %rax
vmovdqa %xmm0, 0x30(%rax)
movq -0x48(%rsp), %rax
vmovdqa 0x10(%rax), %xmm1
movq -0x48(%rsp), %rax
vmovdqa 0x20(%rax), %xmm0
vmovdqa %xmm1, 0x170(%rsp)
vmovdqa %xmm0, 0x160(%rsp)
vmovdqa 0x170(%rsp), %xmm0
vmovdqa 0x160(%rsp), %xmm1
vaesenc %xmm1, %xmm0, %xmm0
movq -0x48(%rsp), %rax
vmovdqa %xmm0, 0x20(%rax)
movq -0x48(%rsp), %rax
vmovdqa (%rax), %xmm1
movq -0x48(%rsp), %rax
vmovdqa 0x10(%rax), %xmm0
vmovdqa %xmm1, 0x150(%rsp)
vmovdqa %xmm0, 0x140(%rsp)
vmovdqa 0x150(%rsp), %xmm0
vmovdqa 0x140(%rsp), %xmm1
vaesenc %xmm1, %xmm0, %xmm0
movq -0x48(%rsp), %rax
vmovdqa %xmm0, 0x10(%rax)
vmovdqa -0x60(%rsp), %xmm1
movq -0x48(%rsp), %rax
vmovdqa (%rax), %xmm0
vmovdqa %xmm1, 0x130(%rsp)
vmovdqa %xmm0, 0x120(%rsp)
vmovdqa 0x130(%rsp), %xmm0
vmovdqa 0x120(%rsp), %xmm1
vaesenc %xmm1, %xmm0, %xmm0
movq -0x48(%rsp), %rax
vmovdqa %xmm0, (%rax)
vmovdqa -0x70(%rsp), %xmm1
vmovdqa -0x80(%rsp), %xmm0
vmovdqa %xmm1, 0x90(%rsp)
vmovdqa %xmm0, 0x80(%rsp)
vmovdqa 0x90(%rsp), %xmm0
vpxor 0x80(%rsp), %xmm0, %xmm0
vmovdqa %xmm0, -0x70(%rsp)
movq -0x48(%rsp), %rax
vmovdqa (%rax), %xmm1
vmovdqa -0x70(%rsp), %xmm0
vmovdqa %xmm1, 0x70(%rsp)
vmovdqa %xmm0, 0x60(%rsp)
vmovdqa 0x70(%rsp), %xmm0
vpxor 0x60(%rsp), %xmm0, %xmm0
movq -0x48(%rsp), %rax
vmovdqa %xmm0, (%rax)
movl -0x4c(%rsp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rsp)
jmp 0x1717
addq $0x1c8, %rsp            # imm = 0x1C8
retq
nopl (%rax)