// File: /workspace/github_c_makefile_star2_O1/janmojzis[P]mcencrypt/poly1305.c
// Function: poly1305_blocks
void poly1305_blocks(poly1305_ctx *ctx, const unsigned char *m, unsigned long long n) {

    unsigned long long d0, d1, d2, d3, d4;
    unsigned long c;
    unsigned long h0 = ctx->h[0];
    unsigned long h1 = ctx->h[1];
    unsigned long h2 = ctx->h[2];
    unsigned long h3 = ctx->h[3];
    unsigned long h4 = ctx->h[4];
    unsigned long r0 = ctx->r[0];
    unsigned long r1 = ctx->r[1];
    unsigned long r2 = ctx->r[2];
    unsigned long r3 = ctx->r[3];
    unsigned long r4 = ctx->r[4];
    unsigned long s1 = ctx->s[1];
    unsigned long s2 = ctx->s[2];
    unsigned long s3 = ctx->s[3];
    unsigned long s4 = ctx->s[4];

    while (n > 0) {

        /* h += m[i] */
        if (n >= 16) {
            h0 += (unpack(m     )     ) & 0x3ffffff;
            h1 += (unpack(m +  3) >> 2) & 0x3ffffff;
            h2 += (unpack(m +  6) >> 4) & 0x3ffffff;
            h3 += (unpack(m +  9) >> 6) & 0x3ffffff;
            h4 += (unpack(m + 12) >> 8) | 16777216;
            m += 16;
            n -= 16;
        }
        else {
            unsigned char mm[16];
            long long i;
            for (i = 0; i < 16; ++i) mm[i] = 0;
            for (i = 0; i <  n; ++i) mm[i] = m[i];
            mm[i] = 1;
            h0 += (unpack(mm     )     ) & 0x3ffffff;
            h1 += (unpack(mm +  3) >> 2) & 0x3ffffff;
            h2 += (unpack(mm +  6) >> 4) & 0x3ffffff;
            h3 += (unpack(mm +  9) >> 6) & 0x3ffffff;
            h4 += (unpack(mm + 12) >> 8);
            m += n;
            n = 0;
        }

        /* h *= r */
        d0 = ((unsigned long long)h0 * r0) + ((unsigned long long)h1 * s4) + ((unsigned long long)h2 * s3) + ((unsigned long long)h3 * s2) + ((unsigned long long)h4 * s1);
        d1 = ((unsigned long long)h0 * r1) + ((unsigned long long)h1 * r0) + ((unsigned long long)h2 * s4) + ((unsigned long long)h3 * s3) + ((unsigned long long)h4 * s2);
        d2 = ((unsigned long long)h0 * r2) + ((unsigned long long)h1 * r1) + ((unsigned long long)h2 * r0) + ((unsigned long long)h3 * s4) + ((unsigned long long)h4 * s3);
        d3 = ((unsigned long long)h0 * r3) + ((unsigned long long)h1 * r2) + ((unsigned long long)h2 * r1) + ((unsigned long long)h3 * r0) + ((unsigned long long)h4 * s4);
        d4 = ((unsigned long long)h0 * r4) + ((unsigned long long)h1 * r3) + ((unsigned long long)h2 * r2) + ((unsigned long long)h3 * r1) + ((unsigned long long)h4 * r0);

        /* (partial) h %= p */
                      c = (unsigned long)(d0 >> 26); h0 = (unsigned long)d0 & 0x3ffffff;
        d1 += c;      c = (unsigned long)(d1 >> 26); h1 = (unsigned long)d1 & 0x3ffffff;
        d2 += c;      c = (unsigned long)(d2 >> 26); h2 = (unsigned long)d2 & 0x3ffffff;
        d3 += c;      c = (unsigned long)(d3 >> 26); h3 = (unsigned long)d3 & 0x3ffffff;
        d4 += c;      c = (unsigned long)(d4 >> 26); h4 = (unsigned long)d4 & 0x3ffffff;
        h0 += c * 5;  c =                (h0 >> 26); h0 =                h0 & 0x3ffffff;
        h1 += c;
    }

    ctx->h[0] = h0;
    ctx->h[1] = h1;
    ctx->h[2] = h2;
    ctx->h[3] = h3;
    ctx->h[4] = h4;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq (%rdi), %r10
movq 0x8(%rdi), %r11
movq 0x10(%rdi), %r13
movq 0x18(%rdi), %r15
movq 0x20(%rdi), %rbp
testq %rdx, %rdx
movq %rdi, -0x40(%rsp)
je 0x62e5
movq 0x28(%rdi), %rax
movq %rax, -0x50(%rsp)
movq 0x30(%rdi), %rcx
movq %rcx, -0x8(%rsp)
movq 0x38(%rdi), %rax
movq %rax, -0x48(%rsp)
movq 0x40(%rdi), %rax
movq %rax, -0x10(%rsp)
movq 0x48(%rdi), %rax
movq %rax, -0x18(%rsp)
movq 0x58(%rdi), %rax
movq %rax, -0x20(%rsp)
movq 0x60(%rdi), %rax
movq %rax, -0x28(%rsp)
movq 0x68(%rdi), %rax
movq %rax, -0x30(%rsp)
movq 0x70(%rdi), %rax
movq %rax, -0x38(%rsp)
xorps %xmm0, %xmm0
cmpq $0x10, %rdx
jb 0x6063
movzwl (%rsi), %r9d
movzbl 0x2(%rsi), %r8d
shll $0x10, %r8d
orq %r9, %r8
movzbl 0x3(%rsi), %ebx
movzbl 0x4(%rsi), %r9d
shll $0x8, %r9d
movzbl 0x5(%rsi), %r14d
shll $0x10, %r14d
orl %r9d, %r14d
movzbl 0x6(%rsi), %r9d
movzbl 0x7(%rsi), %r12d
shll $0x8, %r12d
orl %r9d, %r12d
shll $0x18, %r9d
orl %r14d, %r9d
orl %ebx, %r9d
shll $0x18, %ebx
orq %r8, %rbx
movzbl 0x8(%rsi), %r14d
shll $0x10, %r14d
orl %r12d, %r14d
movzbl 0x9(%rsi), %r8d
movzbl 0xa(%rsi), %r12d
shll $0x8, %r12d
orl %r8d, %r12d
shll $0x18, %r8d
orl %r14d, %r8d
movzbl 0xb(%rsi), %r14d
shll $0x10, %r14d
orl %r12d, %r14d
movzbl 0xc(%rsi), %r12d
shll $0x18, %r12d
orl %r14d, %r12d
movzbl 0xf(%rsi), %r14d
shll $0x10, %r14d
movzwl 0xd(%rsi), %ecx
addq %rcx, %r14
addq $0x1000000, %r14        # imm = 0x1000000
addq $0x10, %rsi
movq %rsi, -0x58(%rsp)
addq $-0x10, %rdx
movq %rdx, -0x60(%rsp)
jmp 0x613d
movaps %xmm0, -0x78(%rsp)
cmpq $0x1, %rdx
movq %rdx, %r8
adcq $0x0, %r8
xorl %r9d, %r9d
movb (%rsi,%r9), %cl
movb %cl, -0x78(%rsp,%r9)
incq %r9
cmpq %r9, %r8
jne 0x6076
movb $0x1, -0x78(%rsp,%r9)
movzwl -0x78(%rsp), %ecx
movzbl -0x76(%rsp), %r8d
shll $0x10, %r8d
orq %rcx, %r8
movzbl -0x75(%rsp), %ebx
movzbl -0x74(%rsp), %ecx
shll $0x8, %ecx
movzbl -0x73(%rsp), %r14d
shll $0x10, %r14d
orl %ecx, %r14d
movzbl -0x72(%rsp), %ecx
movzbl -0x71(%rsp), %r12d
shll $0x8, %r12d
orl %ecx, %r12d
movl %ecx, %r9d
shll $0x18, %r9d
orl %r14d, %r9d
orl %ebx, %r9d
shll $0x18, %ebx
orq %r8, %rbx
movzbl -0x70(%rsp), %ecx
shll $0x10, %ecx
orl %r12d, %ecx
movzbl -0x6f(%rsp), %r8d
movzbl -0x6e(%rsp), %r14d
shll $0x8, %r14d
orl %r8d, %r14d
shll $0x18, %r8d
orl %ecx, %r8d
movzbl -0x6d(%rsp), %ecx
shll $0x10, %ecx
orl %r14d, %ecx
movl -0x6c(%rsp), %r12d
shll $0x18, %r12d
orl %ecx, %r12d
movzwl -0x6b(%rsp), %ecx
movzbl -0x69(%rsp), %r14d
shll $0x10, %r14d
orq %rcx, %r14
addq %rdx, %rsi
movq %rsi, -0x58(%rsp)
movq $0x0, -0x60(%rsp)
addq %rbp, %r14
movl $0x3ffffff, %eax        # imm = 0x3FFFFFF
andq %rax, %rbx
addq %r10, %rbx
shrl $0x2, %r9d
movl $0x3ffffff, %eax        # imm = 0x3FFFFFF
andl %eax, %r9d
addq %r11, %r9
shrl $0x4, %r8d
andl %eax, %r8d
addq %r13, %r8
shrl $0x6, %r12d
addq %r15, %r12
movq %rbx, %rcx
movq -0x50(%rsp), %rax
imulq %rax, %rcx
movq %rax, %r13
movq %r9, %rdi
movq -0x38(%rsp), %rsi
imulq %rsi, %rdi
addq %rcx, %rdi
movq %r8, %rcx
movq -0x30(%rsp), %rdx
imulq %rdx, %rcx
movq %r12, %r10
movq -0x28(%rsp), %rax
imulq %rax, %r10
movq %r14, %r11
imulq -0x20(%rsp), %r11
addq %r10, %r11
addq %rcx, %r11
addq %rdi, %r11
movq %rbx, %rcx
movq -0x8(%rsp), %r15
imulq %r15, %rcx
movq %r9, %r10
imulq %r13, %r10
movq %r13, %rbp
addq %rcx, %r10
movq %r8, %rcx
imulq %rsi, %rcx
movq %r12, %r13
imulq %rdx, %r13
movq %r14, %rdi
imulq %rax, %rdi
addq %r13, %rdi
addq %rcx, %rdi
addq %r10, %rdi
movq %rbx, %rcx
movq -0x48(%rsp), %rax
imulq %rax, %rcx
movq %r9, %r13
imulq %r15, %r13
addq %rcx, %r13
movq %r8, %rcx
imulq %rbp, %rcx
movq %r12, %rbp
imulq %rsi, %rbp
movq %r14, %r10
imulq %rdx, %r10
addq %rbp, %r10
addq %rcx, %r10
addq %r13, %r10
movq %rbx, %rcx
movq -0x10(%rsp), %rdx
imulq %rdx, %rcx
movq %r9, %r13
imulq %rax, %r13
addq %rcx, %r13
movq %r12, %rcx
movq -0x50(%rsp), %rax
imulq %rax, %rcx
movq %r14, %rbp
imulq %rsi, %rbp
addq %rcx, %rbp
movq %r8, %rcx
imulq %r15, %rcx
addq %rcx, %rbp
addq %r13, %rbp
imulq -0x18(%rsp), %rbx
imulq %rdx, %r9
addq %rbx, %r9
imulq %r15, %r12
imulq %rax, %r14
addq %r12, %r14
imulq -0x48(%rsp), %r8
addq %r8, %r14
addq %r9, %r14
movq %r11, %r8
shrq $0x1a, %r8
addq %rdi, %r8
movl $0x3ffffff, %eax        # imm = 0x3FFFFFF
andq %rax, %r11
movq %r8, %r13
shrq $0x1a, %r13
addq %r10, %r13
andq %rax, %r8
movq %r13, %r15
shrq $0x1a, %r15
addq %rbp, %r15
movq %r15, %rbp
shrq $0x1a, %rbp
addq %r14, %rbp
movq %rbp, %rcx
shrq $0x1a, %rcx
leaq (%rcx,%rcx,4), %r10
addq %r11, %r10
movq %r10, %r11
shrq $0x1a, %r11
addq %r8, %r11
andq %rax, %r13
andq %rax, %r15
andq %rax, %rbp
andq %rax, %r10
movq -0x60(%rsp), %rdx
testq %rdx, %rdx
movq -0x58(%rsp), %rsi
jne 0x5fa5
movq -0x40(%rsp), %rax
movq %r10, (%rax)
movq %r11, 0x8(%rax)
movq %r13, 0x10(%rax)
movq %r15, 0x18(%rax)
movq %rbp, 0x20(%rax)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq