// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/htscodecs/htscodecs/fqzcomp_qual.c
// Function: fqz_create_models
static int fqz_create_models(fqz_model *m, fqz_gparams *gp) {
    int i;

    if (!(m->qual = htscodecs_tls_alloc(sizeof(*m->qual) * CTX_SIZE)))
        return -1;

    for (i = 0; i < CTX_SIZE; i++)
        SIMPLE_MODEL(QMAX,_init)(&m->qual[i], gp->max_sym+1);

    for (i = 0; i < 4; i++)
        SIMPLE_MODEL(256,_init)(&m->len[i],256);

    SIMPLE_MODEL(2,_init)(&m->revcomp,2);
    SIMPLE_MODEL(2,_init)(&m->dup,2);
    if (gp->max_sel > 0)
        SIMPLE_MODEL(256,_init)(&m->sel, gp->max_sel+1);

    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl $0x4100000, %edi        # imm = 0x4100000
callq 0x7e144
movq %rax, (%rbx)
testq %rax, %rax
je 0x6126c
movl 0x410(%r14), %ecx
leal 0x1(%rcx), %edx
leaq 0xa(%rax), %rsi
xorl %edi, %edi
movl $0xffef, %r8d           # imm = 0xFFEF
movl $0x0, %r9d
testl %ecx, %ecx
js 0x610d3
xorl %r9d, %r9d
movw %r9w, (%rsi,%r9,4)
movw $0x1, -0x2(%rsi,%r9,4)
incq %r9
cmpq %r9, %rdx
jne 0x610b3
movl %edx, %r9d
cmpl $0xff, %edx
ja 0x610ef
movl %r9d, %r9d
movw %r9w, (%rsi,%r9,4)
movw $0x0, -0x2(%rsi,%r9,4)
incq %r9
cmpq $0x100, %r9             # imm = 0x100
jne 0x610d6
imulq $0x410, %rdi, %r9       # imm = 0x410
addq %rax, %r9
movl %edx, (%r9)
movl %r8d, 0x4(%r9)
movl %r8d, 0x40c(%r9)
movw $0x0, 0x408(%r9)
incq %rdi
addq $0x410, %rsi            # imm = 0x410
cmpq $0x10000, %rdi          # imm = 0x10000
jne 0x610a6
leaq 0x8(%rbx), %rax
leaq 0x10(%rbx), %rcx
xorl %edx, %edx
movq 0x3aa1a(%rip), %xmm0    # 0x9bb50
movdqa 0x3aa22(%rip), %xmm1    # 0x9bb60
movdqa 0x3aa2a(%rip), %xmm2    # 0x9bb70
movabsq $0xffef00000100, %rsi   # imm = 0xFFEF00000100
imulq $0x410, %rdx, %rdi      # imm = 0x410
addq %rax, %rdi
xorl %r8d, %r8d
movdqa %xmm0, %xmm3
movdqa %xmm1, %xmm4
punpcklwd %xmm3, %xmm4    # xmm4 = xmm4[0],xmm3[0],xmm4[1],xmm3[1],xmm4[2],xmm3[2],xmm4[3],xmm3[3]
movdqu %xmm4, (%rcx,%r8,4)
addq $0x4, %r8
paddw %xmm2, %xmm3
cmpq $0x100, %r8             # imm = 0x100
jne 0x61161
movq %rsi, (%rdi)
movl $0xffef, 0x40c(%rdi)    # imm = 0xFFEF
movw $0x0, 0x408(%rdi)
incq %rdx
addq $0x410, %rcx            # imm = 0x410
cmpq $0x4, %rdx
jne 0x61150
movabsq $0x1000100000001, %rcx  # imm = 0x1000100000001
movq %rcx, 0x1050(%rbx)
movabsq $0xffef00000002, %rdx   # imm = 0xFFEF00000002
movq %rdx, 0x1048(%rbx)
movl $0xffef, %esi           # imm = 0xFFEF
movl %esi, 0x105c(%rbx)
xorl %eax, %eax
movw %ax, 0x1058(%rbx)
movq %rcx, 0x1478(%rbx)
movq %rdx, 0x1470(%rbx)
movl %esi, 0x1484(%rbx)
movw %ax, 0x1480(%rbx)
movl 0xc(%r14), %ecx
testl %ecx, %ecx
jle 0x61271
leaq 0x1(%rcx), %rax
xorl %edx, %edx
movw %dx, 0x106a(%rbx,%rdx,4)
movw $0x1, 0x1068(%rbx,%rdx,4)
incq %rdx
cmpq %rdx, %rax
jne 0x61205
cmpl $0xfe, %ecx
ja 0x61248
movq %rax, %rcx
movw %cx, 0x106a(%rbx,%rcx,4)
movw $0x0, 0x1068(%rbx,%rcx,4)
incq %rcx
cmpq $0x100, %rcx            # imm = 0x100
jne 0x6122a
movl %eax, 0x1060(%rbx)
movl $0xffef, %eax           # imm = 0xFFEF
movl %eax, 0x1064(%rbx)
movl %eax, 0x146c(%rbx)
movw $0x0, 0x1468(%rbx)
xorl %eax, %eax
jmp 0x61271
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
retq