// File: /workspace/github_c_makefile_star2_O1/mjosaarinen[P]brutus/crypto_aead/aes128poetv2aes4ni/ni/poet.c
// Function: keysetup_encrypt_only
void keysetup_encrypt_only(poet_ctx_t *ctx, const unsigned char key[KEYLEN])
{
    AES_KEY expanded_key;
    __m128i sk = loadu(key);
    __m128i k;
    __m128i k_axu;

    aes_expand_key(sk, expanded_key);

    k = zero;
    ctx->l = one;
    k_axu = two;
    aes_encrypt_3blocks_keysetup(k, ctx->l, k_axu, expanded_key);

    aes_expand_key(k, ctx->aes_enc);
    aesfour_expand_key(k_axu, ctx->aes_axu);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
vmovups (%rsi), %xmm0
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x15f3
vmovdqa 0x2c3e(%rip), %xmm0     # 0x4000
vmovdqa %xmm0, 0x1b0(%rbx)
vmovdqa (%r14), %xmm1
vpxor %xmm0, %xmm1, %xmm0
vmovdqa %xmm0, 0x1b0(%rbx)
vpxor 0x2c2d(%rip), %xmm1, %xmm2 # 0x4010
vmovdqa 0x10(%r14), %xmm3
vaesenc %xmm3, %xmm1, %xmm1
vaesenc %xmm3, %xmm0, %xmm0
vmovdqa %xmm0, 0x1b0(%rbx)
vaesenc %xmm3, %xmm2, %xmm2
vmovdqa 0x20(%r14), %xmm3
vaesenc %xmm3, %xmm1, %xmm1
vaesenc %xmm3, %xmm0, %xmm0
vmovdqa %xmm0, 0x1b0(%rbx)
vaesenc %xmm3, %xmm2, %xmm2
vmovdqa 0x30(%r14), %xmm3
vaesenc %xmm3, %xmm1, %xmm1
vaesenc %xmm3, %xmm0, %xmm0
vmovdqa %xmm0, 0x1b0(%rbx)
vmovdqa 0x40(%r14), %xmm4
vaesenc %xmm3, %xmm2, %xmm2
vaesenc %xmm4, %xmm1, %xmm1
vaesenc %xmm4, %xmm0, %xmm0
vmovdqa %xmm0, 0x1b0(%rbx)
vaesenc %xmm4, %xmm2, %xmm2
vmovdqa 0x50(%r14), %xmm3
vaesenc %xmm3, %xmm1, %xmm1
vaesenc %xmm3, %xmm0, %xmm0
vmovdqa %xmm0, 0x1b0(%rbx)
vaesenc %xmm3, %xmm2, %xmm2
vmovdqa 0x60(%r14), %xmm3
vaesenc %xmm3, %xmm0, %xmm0
vmovdqa %xmm0, 0x1b0(%rbx)
vaesenc %xmm3, %xmm1, %xmm1
vaesenc %xmm3, %xmm2, %xmm2
vmovdqa 0x70(%r14), %xmm3
vaesenc %xmm3, %xmm1, %xmm1
vaesenc %xmm3, %xmm0, %xmm0
vmovdqa %xmm0, 0x1b0(%rbx)
vaesenc %xmm3, %xmm2, %xmm2
vmovdqa 0x80(%r14), %xmm3
vaesenc %xmm3, %xmm1, %xmm1
vaesenc %xmm3, %xmm0, %xmm0
vmovdqa %xmm0, 0x1b0(%rbx)
vaesenc %xmm3, %xmm2, %xmm2
vmovdqa 0x90(%r14), %xmm3
vaesenc %xmm3, %xmm1, %xmm1
vaesenc %xmm3, %xmm0, %xmm4
vmovdqa %xmm4, 0x1b0(%rbx)
vmovdqa 0xa0(%r14), %xmm5
vaesenc %xmm3, %xmm2, %xmm2
vaesenclast %xmm5, %xmm1, %xmm0
vaesenclast %xmm5, %xmm4, %xmm1
vmovdqa %xmm1, 0x1b0(%rbx)
vaesenclast %xmm5, %xmm2, %xmm1
vmovdqa %xmm1, (%rsp)
movq %rbx, %rdi
callq 0x15f3
vmovdqa (%rsp), %xmm4
vaeskeygenassist $0x1, %xmm4, %xmm0
vmovdqu %xmm4, 0x160(%rbx)
vpshufd $0xff, %xmm0, %xmm0     # xmm0 = xmm0[3,3,3,3]
vpslldq $0x4, %xmm4, %xmm1      # xmm1 = zero,zero,zero,zero,xmm4[0,1,2,3,4,5,6,7,8,9,10,11]
vpslldq $0x8, %xmm4, %xmm2      # xmm2 = zero,zero,zero,zero,zero,zero,zero,zero,xmm4[0,1,2,3,4,5,6,7]
vpslldq $0xc, %xmm4, %xmm3      # xmm3 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm4[0,1,2,3]
vpternlogq $0x96, %xmm2, %xmm1, %xmm3
vpternlogq $0x96, %xmm0, %xmm4, %xmm3
vmovdqa %xmm3, 0x170(%rbx)
vaeskeygenassist $0x2, %xmm3, %xmm0
vpshufd $0xff, %xmm0, %xmm0     # xmm0 = xmm0[3,3,3,3]
vpslldq $0x4, %xmm3, %xmm1      # xmm1 = zero,zero,zero,zero,xmm3[0,1,2,3,4,5,6,7,8,9,10,11]
vpslldq $0x8, %xmm3, %xmm2      # xmm2 = zero,zero,zero,zero,zero,zero,zero,zero,xmm3[0,1,2,3,4,5,6,7]
vpslldq $0xc, %xmm3, %xmm4      # xmm4 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm3[0,1,2,3]
vpternlogq $0x96, %xmm2, %xmm1, %xmm4
vpternlogq $0x96, %xmm0, %xmm3, %xmm4
vaeskeygenassist $0x4, %xmm4, %xmm0
vpshufd $0xff, %xmm0, %xmm0     # xmm0 = xmm0[3,3,3,3]
vpslldq $0x4, %xmm4, %xmm1      # xmm1 = zero,zero,zero,zero,xmm4[0,1,2,3,4,5,6,7,8,9,10,11]
vpslldq $0x8, %xmm4, %xmm2      # xmm2 = zero,zero,zero,zero,zero,zero,zero,zero,xmm4[0,1,2,3,4,5,6,7]
vpslldq $0xc, %xmm4, %xmm3      # xmm3 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm4[0,1,2,3]
vpternlogq $0x96, %xmm2, %xmm1, %xmm3
vpternlogq $0x96, %xmm0, %xmm4, %xmm3
vaeskeygenassist $0x8, %xmm3, %xmm0
vmovdqa %xmm4, 0x180(%rbx)
vmovdqa %xmm3, 0x190(%rbx)
vpshufd $0xff, %xmm0, %xmm0     # xmm0 = xmm0[3,3,3,3]
vpslldq $0x4, %xmm3, %xmm1      # xmm1 = zero,zero,zero,zero,xmm3[0,1,2,3,4,5,6,7,8,9,10,11]
vpslldq $0x8, %xmm3, %xmm2      # xmm2 = zero,zero,zero,zero,zero,zero,zero,zero,xmm3[0,1,2,3,4,5,6,7]
vpslldq $0xc, %xmm3, %xmm4      # xmm4 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm3[0,1,2,3]
vpternlogq $0x96, %xmm2, %xmm1, %xmm4
vpternlogq $0x96, %xmm0, %xmm3, %xmm4
vmovdqa %xmm4, 0x1a0(%rbx)
addq $0xc8, %rsp
popq %rbx
popq %r14
retq