// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/htscodecs/htscodecs/rANS_static32x16pr.c
// Function: rans_compress_O0_32x16
unsigned char *rans_compress_O0_32x16(unsigned char *in,
                                      unsigned int in_size,
                                      unsigned char *out,
                                      unsigned int *out_size) {
    unsigned char *cp, *out_end, *out_free = NULL;
    RansEncSymbol syms[256];
    RansState ransN[NX];
    uint8_t* ptr;
    uint32_t F[256+MAGIC] = {0};
    int i, j, tab_size = 0, x, z;
    // -20 for order/size/meta
    unsigned int bound = rans_compress_bound_4x16(in_size,0)-20;

    if (!out) {
        *out_size = bound;
        out = out_free = malloc(*out_size);
    }
    if (!out || bound > *out_size)
        return NULL;

    // If "out" isn't word aligned, tweak out_end/ptr to ensure it is.
    // We already added more round in bound to allow for this.
    if (((size_t)out)&1)
        bound--;
    ptr = out_end = out + bound;

    if (in_size == 0)
        goto empty;

    // Compute statistics
    double e = hist8e(in, in_size, F);
    int low_ent = e < 2;

    // Normalise so frequences sum to power of 2
    uint32_t fsum = in_size;
    uint32_t max_val = round2(fsum);
    if (max_val > TOTFREQ)
        max_val = TOTFREQ;

    if (normalise_freq(F, fsum, max_val) < 0) {
        free(out_free);
        return NULL;
    }
    fsum=max_val;

    cp = out;
    cp += encode_freq(cp, F);
    tab_size = cp-out;
    //write(2, out+4, cp-(out+4));

    if (normalise_freq(F, fsum, TOTFREQ) < 0) {
        free(out_free);
        return NULL;
    }

    // Encode statistics.
    for (x = j = 0; j < 256; j++) {
        if (F[j]) {
            RansEncSymbolInit(&syms[j], x, F[j], TF_SHIFT);
            x += F[j];
        }
    }

    for (z = 0; z < NX; z++)
      RansEncInit(&ransN[z]);

    z = i = in_size&(NX-1);
    while (z-- > 0)
      RansEncPutSymbol(&ransN[z], &ptr, &syms[in[in_size-(i-z)]]);

    if (low_ent) {
        // orig
        // gcc   446
        // clang 427
        for (i=(in_size &~(NX-1)); likely(i>0); i-=NX) {
            for (z = NX-1; z >= 0; z-=4) {
                RansEncSymbol *s0 = &syms[in[i-(NX-z+0)]];
                RansEncSymbol *s1 = &syms[in[i-(NX-z+1)]];
                RansEncSymbol *s2 = &syms[in[i-(NX-z+2)]];
                RansEncSymbol *s3 = &syms[in[i-(NX-z+3)]];
                RansEncPutSymbol_branched(&ransN[z-0], &ptr, s0);
                RansEncPutSymbol_branched(&ransN[z-1], &ptr, s1);
                RansEncPutSymbol_branched(&ransN[z-2], &ptr, s2);
                RansEncPutSymbol_branched(&ransN[z-3], &ptr, s3);
                if (NX%8 == 0) {
                    z -= 4;
                    RansEncSymbol *s0 = &syms[in[i-(NX-z+0)]];
                    RansEncSymbol *s1 = &syms[in[i-(NX-z+1)]];
                    RansEncSymbol *s2 = &syms[in[i-(NX-z+2)]];
                    RansEncSymbol *s3 = &syms[in[i-(NX-z+3)]];
                    RansEncPutSymbol_branched(&ransN[z-0], &ptr, s0);
                    RansEncPutSymbol_branched(&ransN[z-1], &ptr, s1);
                    RansEncPutSymbol_branched(&ransN[z-2], &ptr, s2);
                    RansEncPutSymbol_branched(&ransN[z-3], &ptr, s3);
                }
            }
            if (z < -1) abort();
        }
    } else {
        // Branchless version optimises poorly with gcc unless we have
        // AVX2 capability, so have a custom rewrite of it.
        uint16_t* ptr16 = (uint16_t *)ptr;
        for (i=(in_size &~(NX-1)); likely(i>0); i-=NX) {
            // Unrolled copy of below, because gcc doesn't optimise this
            // well in the original form.
            //
            // Gcc11:   328 MB/s (this) vs 208 MB/s (orig)
            // Clang10: 352 MB/s (this) vs 340 MB/s (orig)
            //
            // for (z = NX-1; z >= 0; z-=4) {
            //  RansEncSymbol *s0 = &syms[in[i-(NX-z+0)]];
            //  RansEncSymbol *s1 = &syms[in[i-(NX-z+1)]];
            //  RansEncSymbol *s2 = &syms[in[i-(NX-z+2)]];
            //  RansEncSymbol *s3 = &syms[in[i-(NX-z+3)]];
            //  RansEncPutSymbol(&ransN[z-0], &ptr, s0);
            //  RansEncPutSymbol(&ransN[z-1], &ptr, s1);
            //  RansEncPutSymbol(&ransN[z-2], &ptr, s2);
            //  RansEncPutSymbol(&ransN[z-3], &ptr, s3);
            // }

            for (z = NX-1; z >= 0; z-=4) {
                // RansEncPutSymbol added in-situ
                RansState *rp = &ransN[z]-3;
                RansEncSymbol *sy[4];
                uint8_t *C = &in[i-(NX-z)]-3;

                sy[0] = &syms[C[3]];
                sy[1] = &syms[C[2]];

                int c0  = rp[3-0] > sy[0]->x_max;
                int c1  = rp[3-1] > sy[1]->x_max;

#ifdef HTSCODECS_LITTLE_ENDIAN
                ptr16[-1] = rp[3-0]; ptr16 -= c0;
                ptr16[-1] = rp[3-1]; ptr16 -= c1;
#else
                ((uint8_t *)&ptr16[-1])[0] = rp[3-0];
                ((uint8_t *)&ptr16[-1])[1] = rp[3-0]>>8;
                ptr16 -= c0;
                ((uint8_t *)&ptr16[-1])[0] = rp[3-1];
                ((uint8_t *)&ptr16[-1])[1] = rp[3-1]>>8;
                ptr16 -= c1;
#endif

                rp[3-0] = c0 ? rp[3-0]>>16 : rp[3-0];
                rp[3-1] = c1 ? rp[3-1]>>16 : rp[3-1];

                sy[2] = &syms[C[1]];
                sy[3] = &syms[C[0]];

                int c2  = rp[3-2] > sy[2]->x_max;
                int c3  = rp[3-3] > sy[3]->x_max;
#ifdef HTSCODECS_LITTLE_ENDIAN
                ptr16[-1] = rp[3-2]; ptr16 -= c2;
                ptr16[-1] = rp[3-3]; ptr16 -= c3;
#else
                ((uint8_t *)&ptr16[-1])[0] = rp[3-2];
                ((uint8_t *)&ptr16[-1])[1] = rp[3-2]>>8;
                ptr16 -= c2;
                ((uint8_t *)&ptr16[-1])[0] = rp[3-3];
                ((uint8_t *)&ptr16[-1])[1] = rp[3-3]>>8;
                ptr16 -= c3;
#endif
                rp[3-2] = c2 ? rp[3-2]>>16 : rp[3-2];
                rp[3-3] = c3 ? rp[3-3]>>16 : rp[3-3];

                int k;
                for (k = 0; k < 4; k++) {
                    uint64_t r64 = (uint64_t)rp[3-k];
                    uint32_t q = (r64 * sy[k]->rcp_freq) >> sy[k]->rcp_shift;
                    rp[3-k] += sy[k]->bias + q*sy[k]->cmpl_freq;
                }
            }
            if (z < -1) abort();
        }
        ptr = (uint8_t *)ptr16;
    }
    for (z = NX-1; z >= 0; z--)
        RansEncFlush(&ransN[z], &ptr);

 empty:
    // Finalise block size and return it
    *out_size = (out_end - ptr) + tab_size;

    memmove(out + tab_size, ptr, out_end-ptr);

    return out;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2d68, %rsp           # imm = 0x2D68
movq %rcx, %r15
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, 0x10(%rsp)
leaq 0x4a0(%rsp), %rdi
movl $0x420, %edx            # imm = 0x420
xorl %esi, %esi
callq 0x4260
movl %ebp, %edi
xorl %esi, %esi
callq 0x4edbc
movl %eax, %ecx
leal -0x14(%rcx), %ebx
movq %r14, 0x8(%rsp)
testq %r14, %r14
je 0x5c637
xorl %r14d, %r14d
cmpl (%r15), %ebx
jbe 0x5c658
jmp 0x5ce12
movl %ebx, (%r15)
movl %ebx, %edi
movq %rcx, %r14
callq 0x4680
movq %r14, %rcx
movq %rax, %r14
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x5c968
movq %r15, 0x78(%rsp)
addl $-0x15, %ecx
movq 0x8(%rsp), %rax
testb $0x1, %al
cmovel %ebx, %ecx
addq %rax, %rcx
movq %rcx, 0x18(%rsp)
testl %ebp, %ebp
je 0x5c970
movq %rcx, 0x70(%rsp)
leaq 0xce0(%rsp), %rbx
xorl %r15d, %r15d
movl $0x420, %edx            # imm = 0x420
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4260
leaq 0x80(%rsp), %rdi
movl $0x420, %edx            # imm = 0x420
xorl %esi, %esi
callq 0x4260
leaq 0x8c0(%rsp), %rdi
movl $0x420, %edx            # imm = 0x420
xorl %esi, %esi
callq 0x4260
leaq 0x2940(%rsp), %rdi
movl $0x420, %edx            # imm = 0x420
xorl %esi, %esi
callq 0x4260
leaq 0x2520(%rsp), %rdi
movl $0x420, %edx            # imm = 0x420
xorl %esi, %esi
callq 0x4260
leaq 0x2100(%rsp), %rdi
movl $0x420, %edx            # imm = 0x420
xorl %esi, %esi
callq 0x4260
leaq 0x1ce0(%rsp), %rdi
movl $0x420, %edx            # imm = 0x420
xorl %esi, %esi
callq 0x4260
movl %ebp, %r12d
cvtsi2sd %r12, %xmm1
movsd 0x188ef(%rip), %xmm0    # 0x75010
movsd %xmm1, 0x28(%rsp)
divsd %xmm1, %xmm0
callq 0x4390
movl %ebp, %eax
andl $-0x8, %eax
movq 0x10(%rsp), %rdx
cmpq %rax, %r15
jae 0x5c7c4
movzbl (%rdx,%r15), %ecx
incl 0x4a0(%rsp,%rcx,4)
movzbl 0x1(%rdx,%r15), %ecx
incl 0xce0(%rsp,%rcx,4)
movzbl 0x2(%rdx,%r15), %ecx
incl 0x80(%rsp,%rcx,4)
movzbl 0x3(%rdx,%r15), %ecx
incl 0x8c0(%rsp,%rcx,4)
movzbl 0x4(%rdx,%r15), %ecx
incl 0x2940(%rsp,%rcx,4)
movzbl 0x5(%rdx,%r15), %ecx
incl 0x2520(%rsp,%rcx,4)
movzbl 0x6(%rdx,%r15), %ecx
incl 0x2100(%rsp,%rcx,4)
movzbl 0x7(%rdx,%r15), %ecx
incl 0x1ce0(%rsp,%rcx,4)
addq $0x8, %r15
jmp 0x5c73a
movq 0x10(%rsp), %rax
movzbl (%rax,%r15), %eax
incq %r15
incl 0x4a0(%rsp,%rax,4)
cmpq %r12, %r15
jb 0x5c7b0
divsd 0x21127(%rip), %xmm0    # 0x7d8f8
xorpd %xmm3, %xmm3
xorl %eax, %eax
cmpq $0x400, %rax            # imm = 0x400
je 0x5c845
movl 0x80(%rsp,%rax), %ecx
addl 0xce0(%rsp,%rax), %ecx
addl 0x8c0(%rsp,%rax), %ecx
addl 0x2940(%rsp,%rax), %ecx
addl 0x2520(%rsp,%rax), %ecx
addl 0x2100(%rsp,%rax), %ecx
addl 0x1ce0(%rsp,%rax), %ecx
addl 0x4a0(%rsp,%rax), %ecx
movl %ecx, 0x4a0(%rsp,%rax)
cvtsi2sd %rcx, %xmm1
orl $0x1, %ecx
bsrl %ecx, %ecx
xorl $-0x20, %ecx
addl $0x21, %ecx
cvtsi2sd %ecx, %xmm2
addsd %xmm0, %xmm2
mulsd %xmm1, %xmm2
subsd %xmm2, %xmm3
addq $0x4, %rax
jmp 0x5c7d7
movsd %xmm3, (%rsp)
leal -0x1(%rbp), %eax
movl %eax, %ecx
shrl %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x2, %eax
orl %ecx, %eax
movl %eax, %ecx
shrl $0x4, %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x8, %eax
orl %ecx, %eax
movl %eax, %r15d
shrl $0x10, %r15d
orl %eax, %r15d
incl %r15d
movl $0x1000, %eax           # imm = 0x1000
cmpl %eax, %r15d
cmovael %eax, %r15d
leaq 0x4a0(%rsp), %rdi
movl %ebp, %esi
movl %r15d, %edx
callq 0x5ce27
testl %eax, %eax
js 0x5c960
movsd (%rsp), %xmm0
divsd 0x28(%rsp), %xmm0
movsd %xmm0, (%rsp)
leaq 0x4a0(%rsp), %rsi
movq 0x8(%rsp), %r12
movq %r12, %rdi
callq 0x5ee3c
movslq %eax, %rdi
addq %r12, %rdi
xorl %r12d, %r12d
cmpq $0x100, %r12            # imm = 0x100
je 0x5c8f3
movl 0x4a0(%rsp,%r12,4), %esi
testl %esi, %esi
je 0x5c8ee
movq %rdi, %r13
callq 0x5eeba
movl %eax, %eax
addq %rax, %r13
movq %r13, %rdi
incq %r12
jmp 0x5c8c9
movq %rdi, %r12
leaq 0x4a0(%rsp), %rdi
movl %r15d, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x5ce27
testl %eax, %eax
js 0x5c960
subl 0x8(%rsp), %r12d
movq %r12, 0x68(%rsp)
xorl %r12d, %r12d
pushq $0xc
popq %r13
xorl %r15d, %r15d
movsd (%rsp), %xmm1
cmpq $0x100, %r12            # imm = 0x100
je 0x5c97d
movl 0x4a0(%rsp,%r12,4), %r14d
testl %r14d, %r14d
je 0x5c957
movq %rbx, %rdi
movl %r15d, %esi
movl %r14d, %edx
movl %r13d, %ecx
callq 0x5cf4a
movsd (%rsp), %xmm1
addl %r14d, %r15d
incq %r12
addq $0x10, %rbx
jmp 0x5c928
movq %r14, %rdi
callq 0x45c0
xorl %r14d, %r14d
jmp 0x5ce12
xorl %eax, %eax
movq %rcx, %rdx
movq %rcx, %rsi
jmp 0x5cdf5
xorl %eax, %eax
cmpq $0x20, %rax
je 0x5c995
movl $0x8000, 0x80(%rsp,%rax,4) # imm = 0x8000
incq %rax
jmp 0x5c97f
movl %ebp, %eax
andl $-0x20, %eax
andl $0x1f, %ebp
movq %rax, 0x20(%rsp)
leal -0x20(%rax), %r15d
leaq 0x1f(%r15), %r12
leaq (%rsp,%rbp,4), %rbx
addq $0x7c, %rbx
leaq 0x18(%rsp), %r14
testq %rbp, %rbp
jle 0x5c9f3
leaq -0x1(%rbp), %r13
addl %r12d, %ebp
movq 0x10(%rsp), %rax
movzbl (%rax,%rbp), %eax
shll $0x4, %eax
leaq (%rsp,%rax), %rdx
addq $0xce0, %rdx            # imm = 0xCE0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5d041
movsd (%rsp), %xmm1
addq $-0x4, %rbx
movq %r13, %rbp
jmp 0x5c9b7
movsd 0x20185(%rip), %xmm0    # 0x7cb80
ucomisd %xmm1, %xmm0
jbe 0x5cc25
movslq %r15d, %rax
leaq 0x18(%rax), %rcx
movq %rcx, 0x60(%rsp)
leaq 0x19(%rax), %rcx
movq %rcx, 0x58(%rsp)
leaq 0x1a(%rax), %rcx
movq %rcx, 0x50(%rsp)
leaq 0x1b(%rax), %rcx
movq %rcx, 0x48(%rsp)
leaq 0x1c(%rax), %rcx
movq %rcx, 0x40(%rsp)
leaq 0x1d(%rax), %rcx
movq %rcx, 0x38(%rsp)
leaq 0x1e(%rax), %rcx
movq %rcx, 0x30(%rsp)
addq $0x1f, %rax
movq %rax, 0x28(%rsp)
movq 0x20(%rsp), %rax
movq 0x10(%rsp), %rbx
testl %eax, %eax
jle 0x5cdc6
addl $-0x20, %eax
movq %rax, 0x20(%rsp)
leaq 0xe0(%rsp), %r14
xorl %r12d, %r12d
movq %r12, %rax
addq $0x1f, %rax
js 0x5cbeb
movq 0x28(%rsp), %rax
addl %r12d, %eax
cltq
movzbl (%rbx,%rax), %eax
shll $0x4, %eax
leaq (%rsp,%rax), %rdx
addq $0xce0, %rdx            # imm = 0xCE0
movq 0x30(%rsp), %rax
addl %r12d, %eax
cltq
movzbl (%rbx,%rax), %eax
shll $0x4, %eax
addq %rsp, %rax
addq $0xce0, %rax            # imm = 0xCE0
movq %rax, (%rsp)
movq 0x38(%rsp), %rax
addl %r12d, %eax
cltq
movzbl (%rbx,%rax), %eax
shll $0x4, %eax
leaq (%rsp,%rax), %rbp
addq $0xce0, %rbp            # imm = 0xCE0
movq 0x40(%rsp), %rax
addl %r12d, %eax
cltq
movzbl (%rbx,%rax), %eax
shll $0x4, %eax
leaq (%rsp,%rax), %r13
addq $0xce0, %r13            # imm = 0xCE0
leaq 0x1c(%r14), %rdi
leaq 0x18(%rsp), %r15
movq %r15, %rsi
callq 0x5d07a
leaq 0x18(%r14), %rdi
movq %r15, %rsi
movq (%rsp), %rdx
callq 0x5d07a
leaq 0x14(%r14), %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x5d07a
leaq 0x10(%r14), %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x5d07a
movq 0x48(%rsp), %rax
addl %r12d, %eax
cltq
movzbl (%rbx,%rax), %eax
shll $0x4, %eax
leaq (%rsp,%rax), %rdx
addq $0xce0, %rdx            # imm = 0xCE0
movq 0x50(%rsp), %rax
addl %r12d, %eax
cltq
movzbl (%rbx,%rax), %eax
shll $0x4, %eax
addq %rsp, %rax
addq $0xce0, %rax            # imm = 0xCE0
movq %rax, (%rsp)
movq 0x58(%rsp), %rax
addl %r12d, %eax
cltq
movzbl (%rbx,%rax), %eax
shll $0x4, %eax
leaq (%rsp,%rax), %r13
addq $0xce0, %r13            # imm = 0xCE0
movq 0x60(%rsp), %rax
addl %r12d, %eax
cltq
movzbl (%rbx,%rax), %eax
shll $0x4, %eax
leaq (%rsp,%rax), %rbp
addq $0xce0, %rbp            # imm = 0xCE0
leaq 0xc(%r14), %rdi
movq %r15, %rsi
callq 0x5d07a
leaq 0x8(%r14), %rdi
movq %r15, %rsi
movq (%rsp), %rdx
callq 0x5d07a
leaq 0x4(%r14), %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x5d07a
movq %r14, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x5d07a
addq $-0x8, %r12
addq $-0x20, %r14
jmp 0x5ca75
addq $-0x20, 0x60(%rsp)
addq $-0x20, 0x58(%rsp)
addq $-0x20, 0x50(%rsp)
addq $-0x20, 0x48(%rsp)
addq $-0x20, 0x40(%rsp)
addq $-0x20, 0x38(%rsp)
addq $-0x20, 0x30(%rsp)
addq $-0x20, 0x28(%rsp)
movq 0x20(%rsp), %rax
jmp 0x5ca5a
movq 0x18(%rsp), %rsi
pushq $0x1f
popq %rdx
movq 0x20(%rsp), %rcx
movq 0x10(%rsp), %r13
testl %ecx, %ecx
jle 0x5cdcb
addl $-0x20, %ecx
leaq 0xfc(%rsp), %rdi
movq %rdx, %r8
testq %r8, %r8
js 0x5cc37
movq %rcx, %rax
addl %r8d, %ecx
movslq %ecx, %rcx
movzbl (%r13,%rcx), %r9d
shll $0x4, %r9d
leaq (%rsp,%r9), %r11
addq $0xce0, %r11            # imm = 0xCE0
movq %r11, 0x8c0(%rsp)
movzbl -0x1(%r13,%rcx), %r9d
shll $0x4, %r9d
leaq (%rsp,%r9), %rbx
addq $0xce0, %rbx            # imm = 0xCE0
movl 0x7c(%rsp,%r8,4), %ebp
movl 0x80(%rsp,%r8,4), %r14d
movl %r14d, %r9d
shrl $0x10, %r9d
movl %ebp, %r10d
shrl $0x10, %r10d
xorl %r15d, %r15d
cmpl (%rbx), %ebp
seta %r15b
cmovbel %ebp, %r10d
xorl %r12d, %r12d
cmpl (%r11), %r14d
seta %r12b
cmovbel %r14d, %r9d
movq %rbx, 0x8c8(%rsp)
movw %r14w, -0x2(%rsi)
addl %r12d, %r12d
subq %r12, %rsi
movw %bp, -0x2(%rsi)
addl %r15d, %r15d
subq %r15, %rsi
movl %r9d, 0x80(%rsp,%r8,4)
movl %r10d, 0x7c(%rsp,%r8,4)
movzbl -0x2(%r13,%rcx), %r9d
shll $0x4, %r9d
leaq (%rsp,%r9), %r10
addq $0xce0, %r10            # imm = 0xCE0
movq %r10, 0x8d0(%rsp)
movzbl -0x3(%r13,%rcx), %ecx
shll $0x4, %ecx
addq %rsp, %rcx
addq $0xce0, %rcx            # imm = 0xCE0
movq %rcx, 0x8d8(%rsp)
movl 0x74(%rsp,%r8,4), %r11d
movl 0x78(%rsp,%r8,4), %ebx
movl %ebx, %ebp
shrl $0x10, %ebp
movl %r11d, %r14d
shrl $0x10, %r14d
xorl %r9d, %r9d
cmpl (%rcx), %r11d
seta %r9b
cmovbel %r11d, %r14d
xorl %ecx, %ecx
cmpl (%r10), %ebx
seta %cl
movw %bx, -0x2(%rsi)
cmovbel %ebx, %ebp
addl %ecx, %ecx
subq %rcx, %rsi
movw %r11w, -0x2(%rsi)
negq %r9
movl %ebp, 0x78(%rsp,%r8,4)
movl %r14d, 0x74(%rsp,%r8,4)
movq %rdi, %r10
xorl %r11d, %r11d
cmpq $0x4, %r11
je 0x5cdb2
movl (%r10), %ebx
movq 0x8c0(%rsp,%r11,8), %r14
movl 0x4(%r14), %r15d
imulq %rbx, %r15
movb 0xe(%r14), %cl
shrq %cl, %r15
movzwl 0xc(%r14), %ecx
imull %r15d, %ecx
movl 0x8(%r14), %ebp
addl %ebx, %ebp
addl %ecx, %ebp
movl %ebp, (%r10)
incq %r11
addq $-0x4, %r10
jmp 0x5cd75
leaq (%rsi,%r9,2), %rsi
addq $-0x4, %r8
addq $-0x10, %rdi
movq %rax, %rcx
jmp 0x5cc4d
movq 0x18(%rsp), %rsi
pushq $0x1f
popq %rax
testl %eax, %eax
js 0x5cde6
movl %eax, %ecx
movl 0x80(%rsp,%rcx,4), %ecx
movl %ecx, -0x4(%rsi)
addq $-0x4, %rsi
decl %eax
jmp 0x5cdce
movq %rsi, 0x18(%rsp)
movq 0x70(%rsp), %rdx
movq 0x68(%rsp), %rax
subq %rsi, %rdx
movslq %eax, %rdi
leal (%rdi,%rdx), %eax
movq 0x78(%rsp), %rcx
movl %eax, (%rcx)
movq 0x8(%rsp), %r14
addq %r14, %rdi
callq 0x4830
movq %r14, %rax
addq $0x2d68, %rsp           # imm = 0x2D68
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq