// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/sam.c
// Function: fastq_state_set
int fastq_state_set(samFile *fp, enum hts_fmt_option opt, ...) {
    va_list args;

    if (!fp)
        return -1;
    if (!fp->state)
        if (!(fp->state = fastq_state_init(fp->format.format == fastq_format
                                           ? '@' : '>')))
            return -1;

    fastq_state *x = (fastq_state *)fp->state;

    switch (opt) {
    case FASTQ_OPT_CASAVA:
        x->casava = 1;
        break;

    case FASTQ_OPT_NAME2:
        x->sra_names = 1;
        break;

    case FASTQ_OPT_AUX: {
        va_start(args, opt);
        x->aux = 1;
        char *tag = va_arg(args, char *);
        va_end(args);
        if (tag && strcmp(tag, "1") != 0) {
            if (!x->tags)
                if (!(x->tags = kh_init(tag)))
                    return -1;

            size_t i, tlen = strlen(tag);
            for (i = 0; i+3 <= tlen+1; i += 3) {
                if (tag[i+0] == ',' || tag[i+1] == ',' ||
                    !(tag[i+2] == ',' || tag[i+2] == '\0')) {
                    hts_log_warning("Bad tag format '%.3s'; skipping option", tag+i);
                    break;
                }
                int ret, tcode = tag[i+0]*256 + tag[i+1];
                kh_put(tag, x->tags, tcode, &ret);
                if (ret < 0)
                    return -1;
            }
        }
        break;
    }

    case FASTQ_OPT_BARCODE: {
        va_start(args, opt);
        char *bc = va_arg(args, char *);
        va_end(args);
        strncpy(x->BC, bc, 2);
        x->BC[2] = 0;
        break;
    }

    case FASTQ_OPT_RNUM:
        x->rnum = 1;
        break;

    default:
        break;
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rdx, 0x40(%rsp)
movq %rcx, 0x48(%rsp)
movq %r8, 0x50(%rsp)
movq %r9, 0x58(%rsp)
testb %al, %al
je 0x2946a
movdqa %xmm0, 0x60(%rsp)
movaps %xmm1, 0x70(%rsp)
movaps %xmm2, 0x80(%rsp)
movaps %xmm3, 0x90(%rsp)
movaps %xmm4, 0xa0(%rsp)
movaps %xmm5, 0xb0(%rsp)
movaps %xmm6, 0xc0(%rsp)
movaps %xmm7, 0xd0(%rsp)
testq %rdi, %rdi
je 0x29592
movl %esi, %r14d
movq %rdi, %r15
movq 0x40(%rdi), %rbx
testq %rbx, %rbx
jne 0x294bc
movl 0x4c(%r15), %ebp
movl $0x1, %edi
movl $0x80, %esi
callq 0x4300
testq %rax, %rax
je 0x2958a
movq %rax, %rbx
cmpl $0x11, %ebp
sete %al
movb $0x0, 0x6e(%rbx)
movw $0x4342, 0x6c(%rbx)     # imm = 0x4342
addb %al, %al
addb $0x3e, %al
movb %al, 0x78(%rbx)
movq %rbx, 0x40(%r15)
xorl %ebp, %ebp
addl $0xfffffc18, %r14d      # imm = 0xFFFFFC18
cmpl $0x4, %r14d
ja 0x29597
leaq 0x6ddbe(%rip), %rax     # 0x97294
movslq (%rax,%r14,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movl $0x1, 0x60(%rbx)
jmp 0x29597
movl $0x1, 0x7c(%rbx)
jmp 0x29597
movl $0x1, 0x68(%rbx)
jmp 0x29597
leaq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0x120(%rsp), %rax
movq %rax, 0x8(%rsp)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rsp)
movl $0x10, %ecx
cmpq $0x28, %rcx
ja 0x295ab
movl $0x10, %eax
addq 0x10(%rsp), %rax
addl $0x8, %ecx
movl %ecx, (%rsp)
jmp 0x295b9
leaq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0x120(%rsp), %rax
movq %rax, 0x8(%rsp)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rsp)
movl $0x1, 0x64(%rbx)
movl (%rsp), %ecx
cmpq $0x28, %rcx
ja 0x295d0
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x8, %ecx
movl %ecx, (%rsp)
jmp 0x295de
movq $0x0, 0x40(%r15)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq (%rax), %rsi
leaq 0x6c(%rbx), %rdi
movl $0x2, %edx
callq 0x4250
movb $0x0, 0x6e(%rbx)
jmp 0x29597
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq (%rax), %r14
testq %r14, %r14
je 0x29597
cmpb $0x31, (%r14)
jne 0x295f3
cmpb $0x0, 0x1(%r14)
je 0x29597
cmpq $0x0, 0x70(%rbx)
jne 0x29612
movl $0x1, %edi
movl $0x28, %esi
callq 0x4300
movq %rax, 0x70(%rbx)
testq %rax, %rax
je 0x29592
movq %r14, %rdi
callq 0x41d0
incq %rax
movq %rax, 0x28(%rsp)
cmpq $0x3, %rax
jb 0x29597
movl $0x3, %eax
xorl %r13d, %r13d
movq %r14, 0x20(%rsp)
leaq (%r14,%r13), %rcx
movsbl (%r14,%r13), %ebp
cmpl $0x2c, %ebp
je 0x297ce
movsbl 0x1(%rcx), %r15d
cmpl $0x2c, %r15d
je 0x297ce
movq %rax, %r13
movzbl 0x2(%rcx), %eax
testl %eax, %eax
je 0x2966e
cmpl $0x2c, %eax
jne 0x297ce
movq 0x70(%rbx), %r12
movl 0x8(%r12), %eax
cmpl 0xc(%r12), %eax
jb 0x296a3
movl (%r12), %esi
movl 0x4(%r12), %eax
addl %eax, %eax
cmpl %eax, %esi
jbe 0x29691
decl %esi
jmp 0x29693
incl %esi
movq %r12, %rdi
callq 0x32ed9
testl %eax, %eax
js 0x29592
shll $0x8, %ebp
addl %r15d, %ebp
movl (%r12), %esi
leal -0x1(%rsi), %r8d
movl %r8d, %edi
andl %ebp, %edi
movq 0x10(%r12), %rax
movl %edi, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %edx
leal (%rdi,%rdi), %ecx
shrl %cl, %edx
testb $0x2, %dl
je 0x296d1
movl %edi, %edx
jmp 0x2974e
movl $0x1, %r10d
movl %edi, %r9d
movl %esi, %edx
movl %r9d, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %r11d
leal (%r9,%r9), %ecx
andl $0x1e, %ecx
movl %r11d, %r15d
shrl %cl, %r15d
testb $0x2, %r15b
jne 0x2972e
testb $0x1, %r15b
jne 0x2970d
movq 0x18(%r12), %r15
movl %r9d, %r14d
cmpl %ebp, (%r15,%r14,4)
je 0x2972e
btl %ecx, %r11d
cmovbl %r9d, %edx
addl %r10d, %r9d
andl %r8d, %r9d
incl %r10d
cmpl %edi, %r9d
jne 0x296dc
movb $0x1, %cl
movl %esi, %r8d
cmpl %esi, %edx
je 0x2973e
jmp 0x2974e
shrl %cl, %r11d
testb $0x2, %r11b
sete %cl
movl %edx, %r8d
movl %r9d, %edi
cmpl %esi, %r8d
cmovel %edi, %r8d
testb %cl, %cl
cmovnel %edi, %r8d
movl %r8d, %edx
movl %edx, %esi
shrl $0x4, %esi
movl (%rax,%rsi,4), %edi
leal (%rdx,%rdx), %ecx
andl $0x1e, %ecx
shrl %cl, %edi
testb $0x2, %dil
jne 0x29787
testb $0x1, %dil
je 0x297b3
movq 0x18(%r12), %rdi
movl %edx, %edx
movl %ebp, (%rdi,%rdx,4)
movl $0x3, %edx
shll %cl, %edx
notl %edx
andl %edx, (%rax,%rsi,4)
incl 0x4(%r12)
jmp 0x297b3
movq 0x18(%r12), %rdi
movl %edx, %edx
movl %ebp, (%rdi,%rdx,4)
movl $0x3, %edx
shll %cl, %edx
notl %edx
andl %edx, (%rax,%rsi,4)
movq 0x4(%r12), %xmm0
psubd 0x6d904(%rip), %xmm0    # 0x970b0
movq %xmm0, 0x4(%r12)
leaq 0x3(%r13), %rax
xorl %ebp, %ebp
cmpq 0x28(%rsp), %rax
movq 0x20(%rsp), %r14
jbe 0x29639
jmp 0x29597
leaq 0x6e412(%rip), %rsi     # 0x97be7
leaq 0x6e41b(%rip), %rdx     # 0x97bf7
xorl %ebp, %ebp
movl $0x3, %edi
xorl %eax, %eax
callq 0x13de5
jmp 0x29597