// File: /workspace/github_c_makefile_star2_O0/mjosaarinen[P]brutus/crypto_aead/aes128poetv2aes128ni/ref/poet.c
// Function: process_header
void process_header(poet_ctx_t *ctx,
                    const unsigned char *header,
                    unsigned long long header_len)
{
    __m128i l = ctx->l;
    __m128i sum = encode_parameters(NUM_BLOCKS_PER_PART, INTERMEDIATE_TAGLEN);
    sum = aes_encrypt(vxor(sum, l), ctx->aes_enc);
    l = double_block(l);

    while (header_len >= 8 * BLOCKLEN) {
        sum = vxor(sum, aes_encrypt(vxor(load(header     ), l), ctx->aes_enc));
        l = double_block(l);
        sum = vxor(sum, aes_encrypt(vxor(load(header + 16), l), ctx->aes_enc));
        l = double_block(l);
        sum = vxor(sum, aes_encrypt(vxor(load(header + 32), l), ctx->aes_enc));
        l = double_block(l);
        sum = vxor(sum, aes_encrypt(vxor(load(header + 48), l), ctx->aes_enc));
        l = double_block(l);
        sum = vxor(sum, aes_encrypt(vxor(load(header + 64), l), ctx->aes_enc));
        l = double_block(l);
        sum = vxor(sum, aes_encrypt(vxor(load(header + 80), l), ctx->aes_enc));
        l = double_block(l);
        sum = vxor(sum, aes_encrypt(vxor(load(header + 96), l), ctx->aes_enc));
        l = double_block(l);
        sum = vxor(sum, aes_encrypt(vxor(load(header + 112), l), ctx->aes_enc));
        l = double_block(l);
        header_len -= 8 * BLOCKLEN;
        header += 8 * BLOCKLEN;
    }

    if (header_len >= 4 * BLOCKLEN) {
        sum = vxor(sum, aes_encrypt(vxor(load(header     ), l), ctx->aes_enc));
        l = double_block(l);
        sum = vxor(sum, aes_encrypt(vxor(load(header + 16), l), ctx->aes_enc));
        l = double_block(l);
        sum = vxor(sum, aes_encrypt(vxor(load(header + 32), l), ctx->aes_enc));
        l = double_block(l);
        sum = vxor(sum, aes_encrypt(vxor(load(header + 48), l), ctx->aes_enc));
        l = double_block(l);
        header_len -= 4 * BLOCKLEN;
        header += 4 * BLOCKLEN;
    }

    if (header_len >= 2 * BLOCKLEN) {
        sum = vxor(sum, aes_encrypt(vxor(load(header     ), l), ctx->aes_enc));
        l = double_block(l);
        sum = vxor(sum, aes_encrypt(vxor(load(header + 16), l), ctx->aes_enc));
        l = double_block(l);
        header_len -= 2 * BLOCKLEN;
        header += 2 * BLOCKLEN;
    }

    if (header_len >= BLOCKLEN) {
        sum = vxor(aes_encrypt(vxor(load(header), l), ctx->aes_enc), sum);
        l = double_block(l);
        header_len -= BLOCKLEN;
        header += BLOCKLEN;
    }

    __m128i tmp = one_zero_pad(
        load_n_bytes(header, header_len), BLOCKLEN - header_len
    );
    sum = vxor(aes_encrypt(vxor(l, tmp), ctx->aes_enc), sum);

    ctx->tau = aes_encrypt(sum, ctx->aes_enc);
    ctx->x = ctx->tau;
    ctx->y = vxor(ctx->tau, one);
}

// Assembly:
subq $0x588, %rsp            # imm = 0x588
movq %rdi, 0x128(%rsp)
movq %rsi, 0x120(%rsp)
movq %rdx, 0x118(%rsp)
movq 0x128(%rsp), %rax
vmovdqa 0x210(%rax), %xmm0
vmovdqa %xmm0, 0x100(%rsp)
xorl %eax, %eax
movl %eax, %esi
movq %rsi, %rdi
callq 0x21a0
vmovdqa %xmm0, 0xf0(%rsp)
vmovdqa 0xf0(%rsp), %xmm1
vmovdqa 0x100(%rsp), %xmm0
vmovdqa %xmm1, 0x560(%rsp)
vmovdqa %xmm0, 0x550(%rsp)
vmovdqa 0x560(%rsp), %xmm0
vpxor 0x550(%rsp), %xmm0, %xmm0
movq 0x128(%rsp), %rdi
callq 0x21e0
vmovdqa %xmm0, 0xf0(%rsp)
vmovdqa 0x100(%rsp), %xmm0
callq 0x2460
vmovdqa %xmm0, 0x100(%rsp)
cmpq $0x80, 0x118(%rsp)
jb 0x1b13
vmovdqa 0xf0(%rsp), %xmm0
vmovaps %xmm0, 0x60(%rsp)
movq 0x120(%rsp), %rdi
callq 0x2490
vmovaps %xmm0, %xmm1
vmovdqa 0x100(%rsp), %xmm0
vmovdqa %xmm1, 0x540(%rsp)
vmovdqa %xmm0, 0x530(%rsp)
vmovdqa 0x540(%rsp), %xmm0
vpxor 0x530(%rsp), %xmm0, %xmm0
movq 0x128(%rsp), %rdi
callq 0x21e0
vmovaps 0x60(%rsp), %xmm1
vmovdqa %xmm1, 0x520(%rsp)
vmovdqa %xmm0, 0x510(%rsp)
vmovdqa 0x520(%rsp), %xmm0
vpxor 0x510(%rsp), %xmm0, %xmm0
vmovdqa %xmm0, 0xf0(%rsp)
vmovdqa 0x100(%rsp), %xmm0
callq 0x2460
vmovdqa %xmm0, 0x100(%rsp)
vmovdqa 0xf0(%rsp), %xmm0
vmovaps %xmm0, 0x70(%rsp)
movq 0x120(%rsp), %rdi
addq $0x10, %rdi
callq 0x2490
vmovaps %xmm0, %xmm1
vmovdqa 0x100(%rsp), %xmm0
vmovdqa %xmm1, 0x500(%rsp)
vmovdqa %xmm0, 0x4f0(%rsp)
vmovdqa 0x500(%rsp), %xmm0
vpxor 0x4f0(%rsp), %xmm0, %xmm0
movq 0x128(%rsp), %rdi
callq 0x21e0
vmovaps 0x70(%rsp), %xmm1
vmovdqa %xmm1, 0x4e0(%rsp)
vmovdqa %xmm0, 0x4d0(%rsp)
vmovdqa 0x4e0(%rsp), %xmm0
vpxor 0x4d0(%rsp), %xmm0, %xmm0
vmovdqa %xmm0, 0xf0(%rsp)
vmovdqa 0x100(%rsp), %xmm0
callq 0x2460
vmovdqa %xmm0, 0x100(%rsp)
vmovdqa 0xf0(%rsp), %xmm0
vmovaps %xmm0, 0x80(%rsp)
movq 0x120(%rsp), %rdi
addq $0x20, %rdi
callq 0x2490
vmovaps %xmm0, %xmm1
vmovdqa 0x100(%rsp), %xmm0
vmovdqa %xmm1, 0x4c0(%rsp)
vmovdqa %xmm0, 0x4b0(%rsp)
vmovdqa 0x4c0(%rsp), %xmm0
vpxor 0x4b0(%rsp), %xmm0, %xmm0
movq 0x128(%rsp), %rdi
callq 0x21e0
vmovaps 0x80(%rsp), %xmm1
vmovdqa %xmm1, 0x4a0(%rsp)
vmovdqa %xmm0, 0x490(%rsp)
vmovdqa 0x4a0(%rsp), %xmm0
vpxor 0x490(%rsp), %xmm0, %xmm0
vmovdqa %xmm0, 0xf0(%rsp)
vmovdqa 0x100(%rsp), %xmm0
callq 0x2460
vmovdqa %xmm0, 0x100(%rsp)
vmovdqa 0xf0(%rsp), %xmm0
vmovaps %xmm0, 0x90(%rsp)
movq 0x120(%rsp), %rdi
addq $0x30, %rdi
callq 0x2490
vmovaps %xmm0, %xmm1
vmovdqa 0x100(%rsp), %xmm0
vmovdqa %xmm1, 0x480(%rsp)
vmovdqa %xmm0, 0x470(%rsp)
vmovdqa 0x480(%rsp), %xmm0
vpxor 0x470(%rsp), %xmm0, %xmm0
movq 0x128(%rsp), %rdi
callq 0x21e0
vmovaps 0x90(%rsp), %xmm1
vmovdqa %xmm1, 0x460(%rsp)
vmovdqa %xmm0, 0x450(%rsp)
vmovdqa 0x460(%rsp), %xmm0
vpxor 0x450(%rsp), %xmm0, %xmm0
vmovdqa %xmm0, 0xf0(%rsp)
vmovdqa 0x100(%rsp), %xmm0
callq 0x2460
vmovdqa %xmm0, 0x100(%rsp)
vmovdqa 0xf0(%rsp), %xmm0
vmovaps %xmm0, 0xa0(%rsp)
movq 0x120(%rsp), %rdi
addq $0x40, %rdi
callq 0x2490
vmovaps %xmm0, %xmm1
vmovdqa 0x100(%rsp), %xmm0
vmovdqa %xmm1, 0x440(%rsp)
vmovdqa %xmm0, 0x430(%rsp)
vmovdqa 0x440(%rsp), %xmm0
vpxor 0x430(%rsp), %xmm0, %xmm0
movq 0x128(%rsp), %rdi
callq 0x21e0
vmovaps 0xa0(%rsp), %xmm1
vmovdqa %xmm1, 0x420(%rsp)
vmovdqa %xmm0, 0x410(%rsp)
vmovdqa 0x420(%rsp), %xmm0
vpxor 0x410(%rsp), %xmm0, %xmm0
vmovdqa %xmm0, 0xf0(%rsp)
vmovdqa 0x100(%rsp), %xmm0
callq 0x2460
vmovdqa %xmm0, 0x100(%rsp)
vmovdqa 0xf0(%rsp), %xmm0
vmovaps %xmm0, 0xb0(%rsp)
movq 0x120(%rsp), %rdi
addq $0x50, %rdi
callq 0x2490
vmovaps %xmm0, %xmm1
vmovdqa 0x100(%rsp), %xmm0
vmovdqa %xmm1, 0x400(%rsp)
vmovdqa %xmm0, 0x3f0(%rsp)
vmovdqa 0x400(%rsp), %xmm0
vpxor 0x3f0(%rsp), %xmm0, %xmm0
movq 0x128(%rsp), %rdi
callq 0x21e0
vmovaps 0xb0(%rsp), %xmm1
vmovdqa %xmm1, 0x3e0(%rsp)
vmovdqa %xmm0, 0x3d0(%rsp)
vmovdqa 0x3e0(%rsp), %xmm0
vpxor 0x3d0(%rsp), %xmm0, %xmm0
vmovdqa %xmm0, 0xf0(%rsp)
vmovdqa 0x100(%rsp), %xmm0
callq 0x2460
vmovdqa %xmm0, 0x100(%rsp)
vmovdqa 0xf0(%rsp), %xmm0
vmovaps %xmm0, 0xc0(%rsp)
movq 0x120(%rsp), %rdi
addq $0x60, %rdi
callq 0x2490
vmovaps %xmm0, %xmm1
vmovdqa 0x100(%rsp), %xmm0
vmovdqa %xmm1, 0x3c0(%rsp)
vmovdqa %xmm0, 0x3b0(%rsp)
vmovdqa 0x3c0(%rsp), %xmm0
vpxor 0x3b0(%rsp), %xmm0, %xmm0
movq 0x128(%rsp), %rdi
callq 0x21e0
vmovaps 0xc0(%rsp), %xmm1
vmovdqa %xmm1, 0x3a0(%rsp)
vmovdqa %xmm0, 0x390(%rsp)
vmovdqa 0x3a0(%rsp), %xmm0
vpxor 0x390(%rsp), %xmm0, %xmm0
vmovdqa %xmm0, 0xf0(%rsp)
vmovdqa 0x100(%rsp), %xmm0
callq 0x2460
vmovdqa %xmm0, 0x100(%rsp)
vmovdqa 0xf0(%rsp), %xmm0
vmovaps %xmm0, 0xd0(%rsp)
movq 0x120(%rsp), %rdi
addq $0x70, %rdi
callq 0x2490
vmovaps %xmm0, %xmm1
vmovdqa 0x100(%rsp), %xmm0
vmovdqa %xmm1, 0x380(%rsp)
vmovdqa %xmm0, 0x370(%rsp)
vmovdqa 0x380(%rsp), %xmm0
vpxor 0x370(%rsp), %xmm0, %xmm0
movq 0x128(%rsp), %rdi
callq 0x21e0
vmovaps 0xd0(%rsp), %xmm1
vmovdqa %xmm1, 0x360(%rsp)
vmovdqa %xmm0, 0x350(%rsp)
vmovdqa 0x360(%rsp), %xmm0
vpxor 0x350(%rsp), %xmm0, %xmm0
vmovdqa %xmm0, 0xf0(%rsp)
vmovdqa 0x100(%rsp), %xmm0
callq 0x2460
vmovdqa %xmm0, 0x100(%rsp)
movq 0x118(%rsp), %rax
subq $0x80, %rax
movq %rax, 0x118(%rsp)
movq 0x120(%rsp), %rax
addq $0x80, %rax
movq %rax, 0x120(%rsp)
jmp 0x1570
cmpq $0x40, 0x118(%rsp)
jb 0x1de6
vmovdqa 0xf0(%rsp), %xmm0
vmovaps %xmm0, 0x20(%rsp)
movq 0x120(%rsp), %rdi
callq 0x2490
vmovaps %xmm0, %xmm1
vmovdqa 0x100(%rsp), %xmm0
vmovdqa %xmm1, 0x340(%rsp)
vmovdqa %xmm0, 0x330(%rsp)
vmovdqa 0x340(%rsp), %xmm0
vpxor 0x330(%rsp), %xmm0, %xmm0
movq 0x128(%rsp), %rdi
callq 0x21e0
vmovaps 0x20(%rsp), %xmm1
vmovdqa %xmm1, 0x320(%rsp)
vmovdqa %xmm0, 0x310(%rsp)
vmovdqa 0x320(%rsp), %xmm0
vpxor 0x310(%rsp), %xmm0, %xmm0
vmovdqa %xmm0, 0xf0(%rsp)
vmovdqa 0x100(%rsp), %xmm0
callq 0x2460
vmovdqa %xmm0, 0x100(%rsp)
vmovdqa 0xf0(%rsp), %xmm0
vmovaps %xmm0, 0x30(%rsp)
movq 0x120(%rsp), %rdi
addq $0x10, %rdi
callq 0x2490
vmovaps %xmm0, %xmm1
vmovdqa 0x100(%rsp), %xmm0
vmovdqa %xmm1, 0x300(%rsp)
vmovdqa %xmm0, 0x2f0(%rsp)
vmovdqa 0x300(%rsp), %xmm0
vpxor 0x2f0(%rsp), %xmm0, %xmm0
movq 0x128(%rsp), %rdi
callq 0x21e0
vmovaps 0x30(%rsp), %xmm1
vmovdqa %xmm1, 0x2e0(%rsp)
vmovdqa %xmm0, 0x2d0(%rsp)
vmovdqa 0x2e0(%rsp), %xmm0
vpxor 0x2d0(%rsp), %xmm0, %xmm0
vmovdqa %xmm0, 0xf0(%rsp)
vmovdqa 0x100(%rsp), %xmm0
callq 0x2460
vmovdqa %xmm0, 0x100(%rsp)
vmovdqa 0xf0(%rsp), %xmm0
vmovaps %xmm0, 0x40(%rsp)
movq 0x120(%rsp), %rdi
addq $0x20, %rdi
callq 0x2490
vmovaps %xmm0, %xmm1
vmovdqa 0x100(%rsp), %xmm0
vmovdqa %xmm1, 0x2c0(%rsp)
vmovdqa %xmm0, 0x2b0(%rsp)
vmovdqa 0x2c0(%rsp), %xmm0
vpxor 0x2b0(%rsp), %xmm0, %xmm0
movq 0x128(%rsp), %rdi
callq 0x21e0
vmovaps 0x40(%rsp), %xmm1
vmovdqa %xmm1, 0x2a0(%rsp)
vmovdqa %xmm0, 0x290(%rsp)
vmovdqa 0x2a0(%rsp), %xmm0
vpxor 0x290(%rsp), %xmm0, %xmm0
vmovdqa %xmm0, 0xf0(%rsp)
vmovdqa 0x100(%rsp), %xmm0
callq 0x2460
vmovdqa %xmm0, 0x100(%rsp)
vmovdqa 0xf0(%rsp), %xmm0
vmovaps %xmm0, 0x50(%rsp)
movq 0x120(%rsp), %rdi
addq $0x30, %rdi
callq 0x2490
vmovaps %xmm0, %xmm1
vmovdqa 0x100(%rsp), %xmm0
vmovdqa %xmm1, 0x280(%rsp)
vmovdqa %xmm0, 0x270(%rsp)
vmovdqa 0x280(%rsp), %xmm0
vpxor 0x270(%rsp), %xmm0, %xmm0
movq 0x128(%rsp), %rdi
callq 0x21e0
vmovaps 0x50(%rsp), %xmm1
vmovdqa %xmm1, 0x260(%rsp)
vmovdqa %xmm0, 0x250(%rsp)
vmovdqa 0x260(%rsp), %xmm0
vpxor 0x250(%rsp), %xmm0, %xmm0
vmovdqa %xmm0, 0xf0(%rsp)
vmovdqa 0x100(%rsp), %xmm0
callq 0x2460
vmovdqa %xmm0, 0x100(%rsp)
movq 0x118(%rsp), %rax
subq $0x40, %rax
movq %rax, 0x118(%rsp)
movq 0x120(%rsp), %rax
addq $0x40, %rax
movq %rax, 0x120(%rsp)
cmpq $0x20, 0x118(%rsp)
jb 0x1f67
vmovdqa 0xf0(%rsp), %xmm0
vmovaps %xmm0, (%rsp)
movq 0x120(%rsp), %rdi
callq 0x2490
vmovaps %xmm0, %xmm1
vmovdqa 0x100(%rsp), %xmm0
vmovdqa %xmm1, 0x240(%rsp)
vmovdqa %xmm0, 0x230(%rsp)
vmovdqa 0x240(%rsp), %xmm0
vpxor 0x230(%rsp), %xmm0, %xmm0
movq 0x128(%rsp), %rdi
callq 0x21e0
vmovaps (%rsp), %xmm1
vmovdqa %xmm1, 0x220(%rsp)
vmovdqa %xmm0, 0x210(%rsp)
vmovdqa 0x220(%rsp), %xmm0
vpxor 0x210(%rsp), %xmm0, %xmm0
vmovdqa %xmm0, 0xf0(%rsp)
vmovdqa 0x100(%rsp), %xmm0
callq 0x2460
vmovdqa %xmm0, 0x100(%rsp)
vmovdqa 0xf0(%rsp), %xmm0
vmovaps %xmm0, 0x10(%rsp)
movq 0x120(%rsp), %rdi
addq $0x10, %rdi
callq 0x2490
vmovaps %xmm0, %xmm1
vmovdqa 0x100(%rsp), %xmm0
vmovdqa %xmm1, 0x200(%rsp)
vmovdqa %xmm0, 0x1f0(%rsp)
vmovdqa 0x200(%rsp), %xmm0
vpxor 0x1f0(%rsp), %xmm0, %xmm0
movq 0x128(%rsp), %rdi
callq 0x21e0
vmovaps 0x10(%rsp), %xmm1
vmovdqa %xmm1, 0x1e0(%rsp)
vmovdqa %xmm0, 0x1d0(%rsp)
vmovdqa 0x1e0(%rsp), %xmm0
vpxor 0x1d0(%rsp), %xmm0, %xmm0
vmovdqa %xmm0, 0xf0(%rsp)
vmovdqa 0x100(%rsp), %xmm0
callq 0x2460
vmovdqa %xmm0, 0x100(%rsp)
movq 0x118(%rsp), %rax
subq $0x20, %rax
movq %rax, 0x118(%rsp)
movq 0x120(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x120(%rsp)
cmpq $0x10, 0x118(%rsp)
jb 0x203a
movq 0x120(%rsp), %rdi
callq 0x2490
vmovaps %xmm0, %xmm1
vmovdqa 0x100(%rsp), %xmm0
vmovdqa %xmm1, 0x1c0(%rsp)
vmovdqa %xmm0, 0x1b0(%rsp)
vmovdqa 0x1c0(%rsp), %xmm0
vpxor 0x1b0(%rsp), %xmm0, %xmm0
movq 0x128(%rsp), %rdi
callq 0x21e0
vmovaps %xmm0, %xmm1
vmovdqa 0xf0(%rsp), %xmm0
vmovdqa %xmm1, 0x1a0(%rsp)
vmovdqa %xmm0, 0x190(%rsp)
vmovdqa 0x1a0(%rsp), %xmm0
vpxor 0x190(%rsp), %xmm0, %xmm0
vmovdqa %xmm0, 0xf0(%rsp)
vmovdqa 0x100(%rsp), %xmm0
callq 0x2460
vmovdqa %xmm0, 0x100(%rsp)
movq 0x118(%rsp), %rax
subq $0x10, %rax
movq %rax, 0x118(%rsp)
movq 0x120(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x120(%rsp)
movq 0x120(%rsp), %rdi
movq 0x118(%rsp), %rsi
callq 0x2540
movq 0x118(%rsp), %rax
movl $0x10, %edi
subq %rax, %rdi
callq 0x24b0
vmovdqa %xmm0, 0xe0(%rsp)
vmovdqa 0x100(%rsp), %xmm1
vmovdqa 0xe0(%rsp), %xmm0
vmovdqa %xmm1, 0x180(%rsp)
vmovdqa %xmm0, 0x170(%rsp)
vmovdqa 0x180(%rsp), %xmm0
vmovdqa 0x170(%rsp), %xmm1
vpxor %xmm1, %xmm0, %xmm0
movq 0x128(%rsp), %rdi
callq 0x21e0
vmovaps %xmm0, %xmm1
vmovdqa 0xf0(%rsp), %xmm0
vmovdqa %xmm1, 0x160(%rsp)
vmovdqa %xmm0, 0x150(%rsp)
vmovdqa 0x160(%rsp), %xmm0
vmovdqa 0x150(%rsp), %xmm1
vpxor %xmm1, %xmm0, %xmm0
vmovdqa %xmm0, 0xf0(%rsp)
vmovdqa 0xf0(%rsp), %xmm0
movq 0x128(%rsp), %rdi
callq 0x21e0
movq 0x128(%rsp), %rax
vmovdqa %xmm0, 0x240(%rax)
movq 0x128(%rsp), %rax
vmovdqa 0x240(%rax), %xmm0
vmovdqa %xmm0, 0x220(%rax)
movq 0x128(%rsp), %rax
vmovdqa 0x240(%rax), %xmm1
vpxor %xmm0, %xmm0, %xmm0
vmovdqa %xmm0, 0x570(%rsp)
vmovdqa 0x570(%rsp), %xmm0
movl $0x1, %eax
vpinsrb $0xf, %eax, %xmm0, %xmm0
vmovdqa %xmm1, 0x140(%rsp)
vmovdqa %xmm0, 0x130(%rsp)
vmovdqa 0x140(%rsp), %xmm0
vpxor 0x130(%rsp), %xmm0, %xmm0
movq 0x128(%rsp), %rax
vmovdqa %xmm0, 0x230(%rax)
addq $0x588, %rsp            # imm = 0x588
retq
nopl (%rax)