// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/htscodecs/htscodecs/fqzcomp_qual.c
// Function: compress_new_read
static int compress_new_read(fqz_slice *s,
                             fqz_state *state,
                             fqz_gparams *gp,
                             fqz_param *pm,
                             fqz_model *model,
                             RangeCoder *rc,
                             unsigned char *in,
                             size_t *in_i, // in[in_i],
                             unsigned int *last) {
    ssize_t rec = state->rec;
    size_t i = *in_i;
    if (pm->do_sel || (gp->gflags & GFLAG_MULTI_PARAM)) {
        state->s = rec < s->num_records
            ? s->flags[rec] >> 16 // reuse spare bits
            : 0;
        SIMPLE_MODEL(256,_encodeSymbol)(&model->sel, rc, state->s);
    } else {
        state->s = 0;
    }
    int x = (gp->gflags & GFLAG_HAVE_STAB) ? gp->stab[state->s] : state->s;
    pm = &gp->p[x];

    int len = s->len[rec];
    if (!pm->fixed_len || state->first_len) {
        SIMPLE_MODEL(256,_encodeSymbol)(&model->len[0], rc, (len>> 0) & 0xff);
        SIMPLE_MODEL(256,_encodeSymbol)(&model->len[1], rc, (len>> 8) & 0xff);
        SIMPLE_MODEL(256,_encodeSymbol)(&model->len[2], rc, (len>>16) & 0xff);
        SIMPLE_MODEL(256,_encodeSymbol)(&model->len[3], rc, (len>>24) & 0xff);
        state->first_len = 0;
    }

    if (gp->gflags & GFLAG_DO_REV) {
        // no need to reverse complement for V4.0 as the core format
        // already has this feature.
        if (s->flags[rec] & FQZ_FREVERSE)
            SIMPLE_MODEL(2,_encodeSymbol)(&model->revcomp, rc, 1);
        else
            SIMPLE_MODEL(2,_encodeSymbol)(&model->revcomp, rc, 0);
    }

    state->rec++;

    state->qtot = 0;
    state->qlen = 0;

    state->p = len;
    state->delta = 0;
    state->qctx = 0;
    state->prevq = 0;

    *last = pm->context;

    if (pm->do_dedup) {
        // Possible dup of previous read?
        if (i && len == state->last_len &&
            !memcmp(in+i-state->last_len, in+i, len)) {
            SIMPLE_MODEL(2,_encodeSymbol)(&model->dup, rc, 1);
            i += len-1;
            state->p = 0;
            *in_i = i;
            return 1; // is a dup
        } else {
            SIMPLE_MODEL(2,_encodeSymbol)(&model->dup, rc, 0);
        }

        state->last_len = len;
    }

    *in_i = i;

    return 0; // not dup
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x40(%rbp)
movq 0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jne 0x8a8ec
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x8a944
movq -0x40(%rbp), %rax
movq -0x10(%rbp), %rcx
movslq (%rcx), %rcx
cmpq %rcx, %rax
jge 0x8a913
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %eax
shrl $0x10, %eax
movl %eax, -0x54(%rbp)
jmp 0x8a91a
xorl %eax, %eax
movl %eax, -0x54(%rbp)
jmp 0x8a91a
movl -0x54(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x30(%rbp), %rdi
addq $0x1060, %rdi           # imm = 0x1060
movq -0x38(%rbp), %rsi
movq -0x18(%rbp), %rax
movl 0x10(%rax), %eax
movzwl %ax, %edx
callq 0x8ad50
jmp 0x8a94f
movq -0x18(%rbp), %rax
movl $0x0, 0x10(%rax)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x8a972
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
movl 0x10(%rcx), %ecx
movl 0x10(%rax,%rcx,4), %eax
movl %eax, -0x58(%rbp)
jmp 0x8a97c
movq -0x18(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x58(%rbp)
movl -0x58(%rbp), %eax
movl %eax, -0x4c(%rbp)
movq -0x20(%rbp), %rax
movq 0x418(%rax), %rax
movslq -0x4c(%rbp), %rcx
imulq $0x1c64, %rcx, %rcx     # imm = 0x1C64
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x50(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, 0x14(%rax)
je 0x8a9c9
movq -0x18(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
je 0x8aa65
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
movq -0x38(%rbp), %rsi
movl -0x50(%rbp), %eax
sarl $0x0, %eax
andl $0xff, %eax
movzwl %ax, %edx
callq 0x8ad50
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
addq $0x410, %rdi            # imm = 0x410
movq -0x38(%rbp), %rsi
movl -0x50(%rbp), %eax
sarl $0x8, %eax
andl $0xff, %eax
movzwl %ax, %edx
callq 0x8ad50
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
addq $0x820, %rdi            # imm = 0x820
movq -0x38(%rbp), %rsi
movl -0x50(%rbp), %eax
sarl $0x10, %eax
andl $0xff, %eax
movzwl %ax, %edx
callq 0x8ad50
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
addq $0xc30, %rdi            # imm = 0xC30
movq -0x38(%rbp), %rsi
movl -0x50(%rbp), %eax
sarl $0x18, %eax
andl $0xff, %eax
movzwl %ax, %edx
callq 0x8ad50
movq -0x18(%rbp), %rax
movl $0x0, 0x1c(%rax)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x8aabe
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x40(%rbp), %rcx
movl (%rax,%rcx,4), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x8aaa6
movq -0x30(%rbp), %rdi
addq $0x1048, %rdi           # imm = 0x1048
movq -0x38(%rbp), %rsi
movl $0x1, %edx
callq 0x8b640
jmp 0x8aabc
movq -0x30(%rbp), %rdi
addq $0x1048, %rdi           # imm = 0x1048
movq -0x38(%rbp), %rsi
xorl %edx, %edx
callq 0x8b640
jmp 0x8aabe
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x28(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x14(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x18(%rax)
movl -0x50(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x8(%rax)
movq -0x18(%rbp), %rax
movl $0x0, (%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0xc(%rax)
movq -0x28(%rbp), %rax
movzwl (%rax), %ecx
movq 0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x28(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x8abd7
cmpq $0x0, -0x48(%rbp)
je 0x8abb7
movl -0x50(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x20(%rcx), %eax
jne 0x8abb7
movq 0x10(%rbp), %rdi
addq -0x48(%rbp), %rdi
movq -0x18(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, %ecx
xorl %eax, %eax
subq %rcx, %rax
addq %rax, %rdi
movq 0x10(%rbp), %rsi
addq -0x48(%rbp), %rsi
movslq -0x50(%rbp), %rdx
callq 0x41c0
cmpl $0x0, %eax
jne 0x8abb7
movq -0x30(%rbp), %rdi
addq $0x1470, %rdi           # imm = 0x1470
movq -0x38(%rbp), %rsi
movl $0x1, %edx
callq 0x8b640
movl -0x50(%rbp), %eax
subl $0x1, %eax
cltq
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x48(%rbp), %rcx
movq 0x18(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x8abe9
movq -0x30(%rbp), %rdi
addq $0x1470, %rdi           # imm = 0x1470
movq -0x38(%rbp), %rsi
xorl %edx, %edx
callq 0x8b640
movl -0x50(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x48(%rbp), %rcx
movq 0x18(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)