// File: /workspace/github_c_makefile_star2_O0/mjosaarinen[P]brutus/crypto_aead/hs1sivv2/ref/encrypt.c
// Function: prf_hash2
void prf_hash2(uint64_t *h, uint32_t *in, unsigned inbytes, uint32_t *nhkey,
               uint64_t *polykey, uint64_t *asukey) {
    uint64_t s0 = 1, s1 = 1;
    unsigned i=0, j;

    /* Hash full blocks of HS1_SIV_NH_LEN bytes */
    while (inbytes >= HS1_SIV_NH_LEN) {
        uint64_t a0 = 0, a1 = 0;
        for (i=0;i<HS1_SIV_NH_LEN/4;i+=8) {
            a0 += (uint64_t)(read32le(in+i+0) + nhkey[i+0]) *
                            (read32le(in+i+2) + nhkey[i+2]);
            a0 += (uint64_t)(read32le(in+i+1) + nhkey[i+1]) *
                            (read32le(in+i+3) + nhkey[i+3]);
            a1 += (uint64_t)(read32le(in+i+0) + nhkey[i+4]) *
                            (read32le(in+i+2) + nhkey[i+6]);
            a1 += (uint64_t)(read32le(in+i+1) + nhkey[i+5]) *
                            (read32le(in+i+3) + nhkey[i+7]);
            a0 += (uint64_t)(read32le(in+i+4) + nhkey[i+4]) *
                            (read32le(in+i+6) + nhkey[i+6]);
            a0 += (uint64_t)(read32le(in+i+5) + nhkey[i+5]) *
                            (read32le(in+i+7) + nhkey[i+7]);
            a1 += (uint64_t)(read32le(in+i+4) + nhkey[i+8]) *
                            (read32le(in+i+6) + nhkey[i+10]);
            a1 += (uint64_t)(read32le(in+i+5) + nhkey[i+9]) *
                            (read32le(in+i+7) + nhkey[i+11]);
        }
        s0 = poly_step(s0, a0&m60, polykey[0]);
        s1 = poly_step(s1, a1&m60, polykey[1]);
        inbytes -= HS1_SIV_NH_LEN;
        in += HS1_SIV_NH_LEN/4;
    }
    /* If partial block remains, hash it */
    i=0;
    if (inbytes != 0) {
        uint64_t a0 = 0, a1 = 0;
        while (inbytes >= 16) {
            a0 += (uint64_t)(read32le(in+i+0) + nhkey[i+0]) *
                            (read32le(in+i+2) + nhkey[i+2]);
            a0 += (uint64_t)(read32le(in+i+1) + nhkey[i+1]) *
                            (read32le(in+i+3) + nhkey[i+3]);
            a1 += (uint64_t)(read32le(in+i+0) + nhkey[i+4]) *
                            (read32le(in+i+2) + nhkey[i+6]);
            a1 += (uint64_t)(read32le(in+i+1) + nhkey[i+5]) *
                            (read32le(in+i+3) + nhkey[i+7]);
            i += 4; inbytes -= 16;
        }
        if (inbytes) {
            uint32_t tail[4] = {0,0,0,0};
            for (j=0;j<inbytes;j++)
                ((unsigned char *)tail)[j] = ((unsigned char *)(in+i))[j];
            a0 += (uint64_t)(read32le(tail+0) + nhkey[i+0]) *
                            (read32le(tail+2) + nhkey[i+2]);
            a0 += (uint64_t)(read32le(tail+1) + nhkey[i+1]) *
                            (read32le(tail+3) + nhkey[i+3]);
            a1 += (uint64_t)(read32le(tail+0) + nhkey[i+4]) *
                            (read32le(tail+2) + nhkey[i+6]);
            a1 += (uint64_t)(read32le(tail+1) + nhkey[i+5]) *
                            (read32le(tail+3) + nhkey[i+7]);
            a0 += inbytes;
            a1 += inbytes;
        }
        s0 = poly_step(s0, a0&m60, polykey[0]);
        s1 = poly_step(s1, a1&m60, polykey[1]);
    }
    s0 = poly_finalize(s0);
    s1 = poly_finalize(s1);
    #if (HS1_SIV_HASH_RNDS > 4)
    write64le(h, (uint64_t)asu_hash(s1, asukey+3) << 32 | asu_hash(s0, asukey));
    #else
    (void)asukey;
    write64le(h,s0);
    write64le(h+1,s1);
    #endif
}

// Assembly:
subq $0xf8, %rsp
movq %rdi, 0xf0(%rsp)
movq %rsi, 0xe8(%rsp)
movl %edx, 0xe4(%rsp)
movq %rcx, 0xd8(%rsp)
movq %r8, 0xd0(%rsp)
movq %r9, 0xc8(%rsp)
movq $0x1, 0xc0(%rsp)
movq $0x1, 0xb8(%rsp)
movl $0x0, 0xb4(%rsp)
cmpl $0x40, 0xe4(%rsp)
jb 0x2025
movq $0x0, 0xa8(%rsp)
movq $0x0, 0xa0(%rsp)
movl $0x0, 0xb4(%rsp)
cmpl $0x10, 0xb4(%rsp)
jae 0x1f96
movq 0xe8(%rsp), %rdi
movl 0xb4(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
callq 0x1380
movq 0xd8(%rsp), %rcx
movl 0xb4(%rsp), %edx
addl $0x0, %edx
movl %edx, %edx
addl (%rcx,%rdx,4), %eax
movl %eax, %eax
movq %rax, 0x40(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xb4(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
addq $0x8, %rdi
callq 0x1380
movl %eax, %ecx
movq 0x40(%rsp), %rax
movq 0xd8(%rsp), %rdx
movl 0xb4(%rsp), %esi
addl $0x2, %esi
movl %esi, %esi
addl (%rdx,%rsi,4), %ecx
movl %ecx, %ecx
imulq %rcx, %rax
addq 0xa8(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xb4(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
addq $0x4, %rdi
callq 0x1380
movq 0xd8(%rsp), %rcx
movl 0xb4(%rsp), %edx
addl $0x1, %edx
movl %edx, %edx
addl (%rcx,%rdx,4), %eax
movl %eax, %eax
movq %rax, 0x48(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xb4(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
addq $0xc, %rdi
callq 0x1380
movl %eax, %ecx
movq 0x48(%rsp), %rax
movq 0xd8(%rsp), %rdx
movl 0xb4(%rsp), %esi
addl $0x3, %esi
movl %esi, %esi
addl (%rdx,%rsi,4), %ecx
movl %ecx, %ecx
imulq %rcx, %rax
addq 0xa8(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xb4(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
callq 0x1380
movq 0xd8(%rsp), %rcx
movl 0xb4(%rsp), %edx
addl $0x4, %edx
movl %edx, %edx
addl (%rcx,%rdx,4), %eax
movl %eax, %eax
movq %rax, 0x50(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xb4(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
addq $0x8, %rdi
callq 0x1380
movl %eax, %ecx
movq 0x50(%rsp), %rax
movq 0xd8(%rsp), %rdx
movl 0xb4(%rsp), %esi
addl $0x6, %esi
movl %esi, %esi
addl (%rdx,%rsi,4), %ecx
movl %ecx, %ecx
imulq %rcx, %rax
addq 0xa0(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xb4(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
addq $0x4, %rdi
callq 0x1380
movq 0xd8(%rsp), %rcx
movl 0xb4(%rsp), %edx
addl $0x5, %edx
movl %edx, %edx
addl (%rcx,%rdx,4), %eax
movl %eax, %eax
movq %rax, 0x58(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xb4(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
addq $0xc, %rdi
callq 0x1380
movl %eax, %ecx
movq 0x58(%rsp), %rax
movq 0xd8(%rsp), %rdx
movl 0xb4(%rsp), %esi
addl $0x7, %esi
movl %esi, %esi
addl (%rdx,%rsi,4), %ecx
movl %ecx, %ecx
imulq %rcx, %rax
addq 0xa0(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xb4(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
addq $0x10, %rdi
callq 0x1380
movq 0xd8(%rsp), %rcx
movl 0xb4(%rsp), %edx
addl $0x4, %edx
movl %edx, %edx
addl (%rcx,%rdx,4), %eax
movl %eax, %eax
movq %rax, 0x60(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xb4(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
addq $0x18, %rdi
callq 0x1380
movl %eax, %ecx
movq 0x60(%rsp), %rax
movq 0xd8(%rsp), %rdx
movl 0xb4(%rsp), %esi
addl $0x6, %esi
movl %esi, %esi
addl (%rdx,%rsi,4), %ecx
movl %ecx, %ecx
imulq %rcx, %rax
addq 0xa8(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xb4(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
addq $0x14, %rdi
callq 0x1380
movq 0xd8(%rsp), %rcx
movl 0xb4(%rsp), %edx
addl $0x5, %edx
movl %edx, %edx
addl (%rcx,%rdx,4), %eax
movl %eax, %eax
movq %rax, 0x68(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xb4(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
addq $0x1c, %rdi
callq 0x1380
movl %eax, %ecx
movq 0x68(%rsp), %rax
movq 0xd8(%rsp), %rdx
movl 0xb4(%rsp), %esi
addl $0x7, %esi
movl %esi, %esi
addl (%rdx,%rsi,4), %ecx
movl %ecx, %ecx
imulq %rcx, %rax
addq 0xa8(%rsp), %rax
movq %rax, 0xa8(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xb4(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
addq $0x10, %rdi
callq 0x1380
movq 0xd8(%rsp), %rcx
movl 0xb4(%rsp), %edx
addl $0x8, %edx
movl %edx, %edx
addl (%rcx,%rdx,4), %eax
movl %eax, %eax
movq %rax, 0x70(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xb4(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
addq $0x18, %rdi
callq 0x1380
movl %eax, %ecx
movq 0x70(%rsp), %rax
movq 0xd8(%rsp), %rdx
movl 0xb4(%rsp), %esi
addl $0xa, %esi
movl %esi, %esi
addl (%rdx,%rsi,4), %ecx
movl %ecx, %ecx
imulq %rcx, %rax
addq 0xa0(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xb4(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
addq $0x14, %rdi
callq 0x1380
movq 0xd8(%rsp), %rcx
movl 0xb4(%rsp), %edx
addl $0x9, %edx
movl %edx, %edx
addl (%rcx,%rdx,4), %eax
movl %eax, %eax
movq %rax, 0x78(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xb4(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
addq $0x1c, %rdi
callq 0x1380
movl %eax, %ecx
movq 0x78(%rsp), %rax
movq 0xd8(%rsp), %rdx
movl 0xb4(%rsp), %esi
addl $0xb, %esi
movl %esi, %esi
addl (%rdx,%rsi,4), %ecx
movl %ecx, %ecx
imulq %rcx, %rax
addq 0xa0(%rsp), %rax
movq %rax, 0xa0(%rsp)
movl 0xb4(%rsp), %eax
addl $0x8, %eax
movl %eax, 0xb4(%rsp)
jmp 0x1afa
movq 0xc0(%rsp), %rdi
movabsq $0xfffffffffffffff, %rsi # imm = 0xFFFFFFFFFFFFFFF
andq 0xa8(%rsp), %rsi
movq 0xd0(%rsp), %rax
movq (%rax), %rdx
callq 0x2600
movq %rax, 0xc0(%rsp)
movq 0xb8(%rsp), %rdi
movabsq $0xfffffffffffffff, %rsi # imm = 0xFFFFFFFFFFFFFFF
andq 0xa0(%rsp), %rsi
movq 0xd0(%rsp), %rax
movq 0x8(%rax), %rdx
callq 0x2600
movq %rax, 0xb8(%rsp)
movl 0xe4(%rsp), %eax
subl $0x40, %eax
movl %eax, 0xe4(%rsp)
movq 0xe8(%rsp), %rax
addq $0x40, %rax
movq %rax, 0xe8(%rsp)
jmp 0x1ac9
movl $0x0, 0xb4(%rsp)
cmpl $0x0, 0xe4(%rsp)
je 0x259a
movq $0x0, 0x98(%rsp)
movq $0x0, 0x90(%rsp)
cmpl $0x10, 0xe4(%rsp)
jb 0x22c3
movq 0xe8(%rsp), %rdi
movl 0xb4(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
callq 0x1380
movq 0xd8(%rsp), %rcx
movl 0xb4(%rsp), %edx
addl $0x0, %edx
movl %edx, %edx
addl (%rcx,%rdx,4), %eax
movl %eax, %eax
movq %rax, 0x20(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xb4(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
addq $0x8, %rdi
callq 0x1380
movl %eax, %ecx
movq 0x20(%rsp), %rax
movq 0xd8(%rsp), %rdx
movl 0xb4(%rsp), %esi
addl $0x2, %esi
movl %esi, %esi
addl (%rdx,%rsi,4), %ecx
movl %ecx, %ecx
imulq %rcx, %rax
addq 0x98(%rsp), %rax
movq %rax, 0x98(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xb4(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
addq $0x4, %rdi
callq 0x1380
movq 0xd8(%rsp), %rcx
movl 0xb4(%rsp), %edx
addl $0x1, %edx
movl %edx, %edx
addl (%rcx,%rdx,4), %eax
movl %eax, %eax
movq %rax, 0x28(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xb4(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
addq $0xc, %rdi
callq 0x1380
movl %eax, %ecx
movq 0x28(%rsp), %rax
movq 0xd8(%rsp), %rdx
movl 0xb4(%rsp), %esi
addl $0x3, %esi
movl %esi, %esi
addl (%rdx,%rsi,4), %ecx
movl %ecx, %ecx
imulq %rcx, %rax
addq 0x98(%rsp), %rax
movq %rax, 0x98(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xb4(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
callq 0x1380
movq 0xd8(%rsp), %rcx
movl 0xb4(%rsp), %edx
addl $0x4, %edx
movl %edx, %edx
addl (%rcx,%rdx,4), %eax
movl %eax, %eax
movq %rax, 0x30(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xb4(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
addq $0x8, %rdi
callq 0x1380
movl %eax, %ecx
movq 0x30(%rsp), %rax
movq 0xd8(%rsp), %rdx
movl 0xb4(%rsp), %esi
addl $0x6, %esi
movl %esi, %esi
addl (%rdx,%rsi,4), %ecx
movl %ecx, %ecx
imulq %rcx, %rax
addq 0x90(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xb4(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
addq $0x4, %rdi
callq 0x1380
movq 0xd8(%rsp), %rcx
movl 0xb4(%rsp), %edx
addl $0x5, %edx
movl %edx, %edx
addl (%rcx,%rdx,4), %eax
movl %eax, %eax
movq %rax, 0x38(%rsp)
movq 0xe8(%rsp), %rdi
movl 0xb4(%rsp), %eax
shlq $0x2, %rax
addq %rax, %rdi
addq $0xc, %rdi
callq 0x1380
movl %eax, %ecx
movq 0x38(%rsp), %rax
movq 0xd8(%rsp), %rdx
movl 0xb4(%rsp), %esi
addl $0x7, %esi
movl %esi, %esi
addl (%rdx,%rsi,4), %ecx
movl %ecx, %ecx
imulq %rcx, %rax
addq 0x90(%rsp), %rax
movq %rax, 0x90(%rsp)
movl 0xb4(%rsp), %eax
addl $0x4, %eax
movl %eax, 0xb4(%rsp)
movl 0xe4(%rsp), %eax
subl $0x10, %eax
movl %eax, 0xe4(%rsp)
jmp 0x2056
cmpl $0x0, 0xe4(%rsp)
je 0x2535
leaq 0x80(%rsp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x1040
movl $0x0, 0xb0(%rsp)
movl 0xb0(%rsp), %eax
cmpl 0xe4(%rsp), %eax
jae 0x2341
movq 0xe8(%rsp), %rax
movl 0xb4(%rsp), %ecx
shlq $0x2, %rcx
addq %rcx, %rax
movl 0xb0(%rsp), %ecx
movb (%rax,%rcx), %cl
movl 0xb0(%rsp), %eax
movb %cl, 0x80(%rsp,%rax)
movl 0xb0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xb0(%rsp)
jmp 0x22f0
leaq 0x80(%rsp), %rdi
callq 0x1380
movq 0xd8(%rsp), %rcx
movl 0xb4(%rsp), %edx
addl $0x0, %edx
movl %edx, %edx
addl (%rcx,%rdx,4), %eax
movl %eax, %eax
movq %rax, (%rsp)
leaq 0x80(%rsp), %rdi
addq $0x8, %rdi
callq 0x1380
movl %eax, %ecx
movq (%rsp), %rax
movq 0xd8(%rsp), %rdx
movl 0xb4(%rsp), %esi
addl $0x2, %esi
movl %esi, %esi
addl (%rdx,%rsi,4), %ecx
movl %ecx, %ecx
imulq %rcx, %rax
addq 0x98(%rsp), %rax
movq %rax, 0x98(%rsp)
leaq 0x80(%rsp), %rdi
addq $0x4, %rdi
callq 0x1380
movq 0xd8(%rsp), %rcx
movl 0xb4(%rsp), %edx
addl $0x1, %edx
movl %edx, %edx
addl (%rcx,%rdx,4), %eax
movl %eax, %eax
movq %rax, 0x8(%rsp)
leaq 0x80(%rsp), %rdi
addq $0xc, %rdi
callq 0x1380
movl %eax, %ecx
movq 0x8(%rsp), %rax
movq 0xd8(%rsp), %rdx
movl 0xb4(%rsp), %esi
addl $0x3, %esi
movl %esi, %esi
addl (%rdx,%rsi,4), %ecx
movl %ecx, %ecx
imulq %rcx, %rax
addq 0x98(%rsp), %rax
movq %rax, 0x98(%rsp)
leaq 0x80(%rsp), %rdi
callq 0x1380
movq 0xd8(%rsp), %rcx
movl 0xb4(%rsp), %edx
addl $0x4, %edx
movl %edx, %edx
addl (%rcx,%rdx,4), %eax
movl %eax, %eax
movq %rax, 0x10(%rsp)
leaq 0x80(%rsp), %rdi
addq $0x8, %rdi
callq 0x1380
movl %eax, %ecx
movq 0x10(%rsp), %rax
movq 0xd8(%rsp), %rdx
movl 0xb4(%rsp), %esi
addl $0x6, %esi
movl %esi, %esi
addl (%rdx,%rsi,4), %ecx
movl %ecx, %ecx
imulq %rcx, %rax
addq 0x90(%rsp), %rax
movq %rax, 0x90(%rsp)
leaq 0x80(%rsp), %rdi
addq $0x4, %rdi
callq 0x1380
movq 0xd8(%rsp), %rcx
movl 0xb4(%rsp), %edx
addl $0x5, %edx
movl %edx, %edx
addl (%rcx,%rdx,4), %eax
movl %eax, %eax
movq %rax, 0x18(%rsp)
leaq 0x80(%rsp), %rdi
addq $0xc, %rdi
callq 0x1380
movl %eax, %ecx
movq 0x18(%rsp), %rax
movq 0xd8(%rsp), %rdx
movl 0xb4(%rsp), %esi
addl $0x7, %esi
movl %esi, %esi
addl (%rdx,%rsi,4), %ecx
movl %ecx, %ecx
imulq %rcx, %rax
addq 0x90(%rsp), %rax
movq %rax, 0x90(%rsp)
movl 0xe4(%rsp), %eax
addq 0x98(%rsp), %rax
movq %rax, 0x98(%rsp)
movl 0xe4(%rsp), %eax
addq 0x90(%rsp), %rax
movq %rax, 0x90(%rsp)
movq 0xc0(%rsp), %rdi
movabsq $0xfffffffffffffff, %rsi # imm = 0xFFFFFFFFFFFFFFF
andq 0x98(%rsp), %rsi
movq 0xd0(%rsp), %rax
movq (%rax), %rdx
callq 0x2600
movq %rax, 0xc0(%rsp)
movq 0xb8(%rsp), %rdi
movabsq $0xfffffffffffffff, %rsi # imm = 0xFFFFFFFFFFFFFFF
andq 0x90(%rsp), %rsi
movq 0xd0(%rsp), %rax
movq 0x8(%rax), %rdx
callq 0x2600
movq %rax, 0xb8(%rsp)
movq 0xc0(%rsp), %rdi
callq 0x2650
movq %rax, 0xc0(%rsp)
movq 0xb8(%rsp), %rdi
callq 0x2650
movq %rax, 0xb8(%rsp)
movq 0xf0(%rsp), %rdi
movq 0xc0(%rsp), %rsi
callq 0x26a0
movq 0xf0(%rsp), %rdi
addq $0x8, %rdi
movq 0xb8(%rsp), %rsi
callq 0x26a0
addq $0xf8, %rsp
retq
nopw (%rax,%rax)