// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/htscodecs/htscodecs/fqzcomp_qual.c
// Function: decompress_new_read
static int decompress_new_read(fqz_slice *s,
                               fqz_state *state,
                               fqz_gparams *gp,
                               fqz_param *pm,
                               fqz_model *model,
                               RangeCoder *rc,
                               unsigned char *in, ssize_t *in_i, // in[in_i],
                               unsigned char *uncomp, size_t *out_size,
                               int *rev, char *rev_a, int *len_a,
                               int *lengths, int nlengths) {
    size_t i = *in_i;
    ssize_t rec = state->rec;

    if (pm->do_sel) {
        state->s = SIMPLE_MODEL(256,_decodeSymbol)(&model->sel, rc);
    } else {
        state->s = 0;
    }

    int x = (gp->gflags & GFLAG_HAVE_STAB)
        ? gp->stab[MIN(255, state->s)]
        : state->s;
    if (x >= gp->nparam)
        return -1;
    pm = &gp->p[x];

    unsigned int len = state->last_len;
    if (!pm->fixed_len || state->first_len) {
        len  = SIMPLE_MODEL(256,_decodeSymbol)(&model->len[0], rc);
        len |= SIMPLE_MODEL(256,_decodeSymbol)(&model->len[1], rc)<<8;
        len |= SIMPLE_MODEL(256,_decodeSymbol)(&model->len[2], rc)<<16;
        len |= ((unsigned)SIMPLE_MODEL(256,_decodeSymbol)(&model->len[3], rc))<<24;
        state->first_len = 0;
        state->last_len = len;
    }
    if (len > *out_size-i || len <= 0)
        return -1;

    if (lengths && rec < nlengths)
        lengths[rec] = len;

    if (gp->gflags & GFLAG_DO_REV) {
        *rev = SIMPLE_MODEL(2,_decodeSymbol)(&model->revcomp, rc);
        rev_a[rec] = *rev;
        len_a[rec] = len;
    }

    if (pm->do_dedup) {
        if (SIMPLE_MODEL(2,_decodeSymbol)(&model->dup, rc)) {
            // Dup of last line
            if (len > i)
                return -1;
            memcpy(uncomp+i, uncomp+i-len, len);
            i += len;
            state->p = 0;
            state->rec++;
            *in_i = i;
            return 1; // dup => continue
        }
    }

    state->rec++;
    state->p = len;
    state->delta = 0;
    state->prevq = 0;
    state->qctx = 0;
    state->ctx = pm->context;

    *in_i = i;

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl 0x50(%rbp), %eax
movq 0x48(%rbp), %rax
movq 0x40(%rbp), %rax
movq 0x38(%rbp), %rax
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
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 (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, 0x8(%rax)
je 0x8bf74
movq -0x30(%rbp), %rdi
addq $0x1060, %rdi           # imm = 0x1060
movq -0x38(%rbp), %rsi
callq 0x8c270
movzwl %ax, %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x10(%rax)
jmp 0x8bf7f
movq -0x18(%rbp), %rax
movl $0x0, 0x10(%rax)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x8bfcd
movq -0x20(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x58(%rbp)
movq -0x18(%rbp), %rcx
movl $0xff, %eax
cmpl 0x10(%rcx), %eax
jae 0x8bfb2
movl $0xff, %eax
movl %eax, -0x5c(%rbp)
jmp 0x8bfbc
movq -0x18(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x5c(%rbp)
movq -0x58(%rbp), %rax
movl -0x5c(%rbp), %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x60(%rbp)
jmp 0x8bfd7
movq -0x18(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x60(%rbp)
movl -0x60(%rbp), %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jl 0x8bff5
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8c25a
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 -0x18(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x50(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x0, 0x14(%rax)
je 0x8c034
movq -0x18(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
je 0x8c0cc
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
movq -0x38(%rbp), %rsi
callq 0x8c270
movzwl %ax, %eax
movl %eax, -0x50(%rbp)
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
addq $0x410, %rdi            # imm = 0x410
movq -0x38(%rbp), %rsi
callq 0x8c270
movzwl %ax, %eax
shll $0x8, %eax
orl -0x50(%rbp), %eax
movl %eax, -0x50(%rbp)
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
addq $0x820, %rdi            # imm = 0x820
movq -0x38(%rbp), %rsi
callq 0x8c270
movzwl %ax, %eax
shll $0x10, %eax
orl -0x50(%rbp), %eax
movl %eax, -0x50(%rbp)
movq -0x30(%rbp), %rdi
addq $0x8, %rdi
addq $0xc30, %rdi            # imm = 0xC30
movq -0x38(%rbp), %rsi
callq 0x8c270
movzwl %ax, %eax
shll $0x18, %eax
orl -0x50(%rbp), %eax
movl %eax, -0x50(%rbp)
movq -0x18(%rbp), %rax
movl $0x0, 0x1c(%rax)
movl -0x50(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x20(%rax)
movl -0x50(%rbp), %eax
movq 0x28(%rbp), %rcx
movq (%rcx), %rcx
subq -0x40(%rbp), %rcx
cmpq %rcx, %rax
ja 0x8c0e5
cmpl $0x0, -0x50(%rbp)
ja 0x8c0f1
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8c25a
cmpq $0x0, 0x48(%rbp)
je 0x8c113
movq -0x48(%rbp), %rax
movslq 0x50(%rbp), %rcx
cmpq %rcx, %rax
jge 0x8c113
movl -0x50(%rbp), %edx
movq 0x48(%rbp), %rax
movq -0x48(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x20(%rbp), %rax
movl 0x4(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x8c160
movq -0x30(%rbp), %rdi
addq $0x1048, %rdi           # imm = 0x1048
movq -0x38(%rbp), %rsi
callq 0x8cbe0
movzwl %ax, %ecx
movq 0x30(%rbp), %rax
movl %ecx, (%rax)
movq 0x30(%rbp), %rax
movl (%rax), %eax
movb %al, %dl
movq 0x38(%rbp), %rax
movq -0x48(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x50(%rbp), %edx
movq 0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x28(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x8c200
movq -0x30(%rbp), %rdi
addq $0x1470, %rdi           # imm = 0x1470
movq -0x38(%rbp), %rsi
callq 0x8cbe0
cmpw $0x0, %ax
je 0x8c1fe
movl -0x50(%rbp), %eax
cmpq -0x40(%rbp), %rax
jbe 0x8c19d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x8c25a
movq 0x20(%rbp), %rdi
addq -0x40(%rbp), %rdi
movq 0x20(%rbp), %rsi
addq -0x40(%rbp), %rsi
movl -0x50(%rbp), %eax
movl %eax, %ecx
xorl %eax, %eax
subq %rcx, %rax
addq %rax, %rsi
movl -0x50(%rbp), %eax
movl %eax, %edx
callq 0x43b0
movl -0x50(%rbp), %eax
addq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movl $0x0, 0x4(%rax)
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x28(%rax)
movq -0x40(%rbp), %rcx
movq 0x18(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x8c25a
jmp 0x8c200
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x28(%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, 0xc(%rax)
movq -0x18(%rbp), %rax
movl $0x0, (%rax)
movq -0x28(%rbp), %rax
movzwl (%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x40(%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)