// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/htscodecs/htscodecs/fqzcomp_qual.c
// Function: read_array
static int read_array(unsigned char *in, size_t in_size, unsigned int *array, int size) {
    unsigned char R[1024];
    int i, j, z, last = -1, nb = 0;

    size = MIN(1024, size);

    // Remove level one of run-len encoding
    for (i = j = z = 0; z < size && i < in_size; i++) {
        int run = in[i];
        R[j++] = run;
        z += run;
        if (run == last) {
            if (i+1 >= in_size)
                return -1;
            int copy = in[++i];
            z += run * copy;
            while (copy-- && z <= size && j < 1024)
                R[j++] = run;
        }
        if (j >= 1024)
            return -1;
        last = run;
    }
    nb = i;

    // Now expand inner level of run-length encoding
    int R_max = j;
    for (i = j = z = 0; j < size; i++) {
        int run_len = 0;
        int run_part;
        if (z >= R_max)
            return -1;
        do {
            run_part = R[z++];
            run_len += run_part;
        } while (run_part == 255 && z < R_max);
        if (run_part == 255)
            return -1;

        while (run_len && j < size)
            run_len--, array[j++] = i;
    }

    return nb;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x388, %rsp            # imm = 0x388
testl %ecx, %ecx
setle %al
testq %rsi, %rsi
sete %r9b
xorl %r8d, %r8d
orb %al, %r9b
movl $0x0, %eax
jne 0x63de3
movl $0xffffffff, %r9d       # imm = 0xFFFFFFFF
xorl %r10d, %r10d
xorl %eax, %eax
xorl %ebp, %ebp
xorl %r8d, %r8d
movb (%rdi,%r10), %r15b
movzbl %r15b, %r11d
leal 0x1(%r8), %r10d
movslq %r8d, %rbx
movb %r11b, -0x80(%rsp,%rbx)
addl %r11d, %ebp
cmpl %r11d, %r9d
jne 0x63d9d
movslq %eax, %rbx
incq %rbx
cmpq %rsi, %rbx
jae 0x63dbb
movzbl (%rdi,%rbx), %eax
movl %eax, %r14d
imull %r11d, %r14d
addl %ebp, %r14d
testl %eax, %eax
je 0x63da2
movslq %r10d, %r12
addl %eax, %r8d
incl %r8d
negl %eax
xorl %ebp, %ebp
cmpl %ecx, %r14d
jg 0x63dde
cmpq $0x3ff, %r12            # imm = 0x3FF
jg 0x63dde
movb %r15b, -0x80(%rsp,%r12)
incq %r12
decl %ebp
cmpl %ebp, %eax
jne 0x63d7c
movl %r8d, %r10d
jmp 0x63da2
movl %ebp, %r14d
movl %eax, %ebx
cmpl $0x400, %r10d           # imm = 0x400
cmovll %r11d, %r9d
setl %r11b
movl %r10d, %r8d
movl %r14d, %ebp
movl %ebx, %eax
jmp 0x63dc1
xorl %r11d, %r11d
movl %r10d, %r8d
testb %r11b, %r11b
je 0x63e8e
incl %eax
cmpl %ecx, %ebp
jge 0x63de3
movslq %eax, %r10
cmpq %rsi, %r10
jb 0x63d36
jmp 0x63de3
subl %ebp, %r10d
jmp 0x63da2
testl %ecx, %ecx
jle 0x63e93
movslq %r8d, %rsi
movl %ecx, %edi
xorl %r9d, %r9d
xorl %r10d, %r10d
xorl %r11d, %r11d
xorl %ebx, %ebx
cmpl %r8d, %r10d
jge 0x63e7c
movslq %r10d, %r12
incq %r12
movl %ebx, %r14d
movzbl -0x81(%rsp,%r12), %r15d
leal (%r14,%r15), %ebx
incl %r10d
cmpl $0xff, %r15d
jne 0x63e2f
leaq 0x1(%r12), %r13
cmpq %rsi, %r12
movq %r13, %r12
jl 0x63e06
cmpl $0xff, %r15d
je 0x63e7a
testl %ebx, %ebx
movb $0x1, %bl
je 0x63e7c
cmpl %ecx, %r11d
jge 0x63e7c
movslq %r11d, %r12
incq %r12
addl %r15d, %r14d
movl $0x1, %ebp
subl %r14d, %ebp
xorl %r14d, %r14d
movl %r14d, %r15d
movl %r9d, -0x4(%rdx,%r12,4)
leal -0x1(%r15), %r14d
cmpl %r15d, %ebp
je 0x63e75
leaq 0x1(%r12), %r15
cmpq %rdi, %r12
movq %r15, %r12
jl 0x63e57
subl %r14d, %r11d
jmp 0x63e7c
xorl %ebx, %ebx
testb %bl, %bl
je 0x63e8e
incl %r9d
cmpl %ecx, %r11d
jl 0x63df9
jmp 0x63e93
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x388, %rsp            # imm = 0x388
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)