// File: /workspace/github_c_makefile_star2_O1/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 0x2a075
movaps %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 0x2a3c2
movl %esi, %ebx
movq %rdi, %r14
cmpq $0x0, 0x40(%rdi)
jne 0x2a0cb
movl 0x4c(%r14), %ebp
movl $0x1, %edi
movl $0x80, %esi
callq 0x4300
testq %rax, %rax
je 0x2a0bc
cmpl $0x11, %ebp
sete %cl
movb $0x0, 0x6e(%rax)
movw $0x4342, 0x6c(%rax)     # imm = 0x4342
addb %cl, %cl
addb $0x3e, %cl
movb %cl, 0x78(%rax)
jmp 0x2a0be
xorl %eax, %eax
movq %rax, 0x40(%r14)
testq %rax, %rax
je 0x2a3c2
xorl %ebp, %ebp
addl $0xfffffc18, %ebx       # imm = 0xFFFFFC18
cmpl $0x4, %ebx
ja 0x2a3c7
movq 0x40(%r14), %r12
leaq 0x700e1(%rip), %rax     # 0x9a1c8
movslq (%rax,%rbx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movl $0x1, 0x60(%r12)
jmp 0x2a3c7
movl $0x1, 0x7c(%r12)
jmp 0x2a3c7
movl $0x1, 0x68(%r12)
jmp 0x2a3c7
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 0x2a1a3
movl $0x10, %eax
addq 0x10(%rsp), %rax
addl $0x8, %ecx
movl %ecx, (%rsp)
jmp 0x2a1b1
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(%r12)
movl (%rsp), %ecx
cmpq $0x28, %rcx
ja 0x2a1ce
movq %rcx, %rax
addq 0x10(%rsp), %rax
addl $0x8, %ecx
movl %ecx, (%rsp)
jmp 0x2a1dc
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq (%rax), %rsi
leaq 0x6c(%r12), %rdi
movl $0x2, %edx
callq 0x4250
movb $0x0, 0x6e(%r12)
jmp 0x2a3c7
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq (%rax), %rbx
testq %rbx, %rbx
je 0x2a3c7
leaq 0x70c62(%rip), %rsi     # 0x9ae51
movq %rbx, %rdi
callq 0x46c0
testl %eax, %eax
je 0x2a3c7
cmpq $0x0, 0x70(%r12)
jne 0x2a224
movl $0x1, %edi
movl $0x28, %esi
callq 0x4300
movq %rax, 0x70(%r12)
testq %rax, %rax
je 0x2a3c2
movq %rbx, %rdi
callq 0x41d0
incq %rax
movq %rax, 0x28(%rsp)
cmpq $0x3, %rax
jb 0x2a3c7
movl $0x3, %eax
xorl %r13d, %r13d
movq %rbx, 0x20(%rsp)
leaq (%rbx,%r13), %rcx
movsbl (%rbx,%r13), %ebp
cmpl $0x2c, %ebp
je 0x2a3db
movsbl 0x1(%rcx), %r14d
cmpl $0x2c, %r14d
je 0x2a3db
movq %rax, %r13
movzbl 0x2(%rcx), %eax
testl %eax, %eax
je 0x2a280
cmpl $0x2c, %eax
jne 0x2a3db
movq 0x70(%r12), %r15
movl 0x8(%r15), %eax
cmpl 0xc(%r15), %eax
jb 0x2a2b2
movl (%r15), %esi
movl 0x4(%r15), %eax
addl %eax, %eax
cmpl %eax, %esi
jbe 0x2a2a0
decl %esi
jmp 0x2a2a2
incl %esi
movq %r15, %rdi
callq 0x34112
testl %eax, %eax
js 0x2a3c2
shll $0x8, %ebp
addl %r14d, %ebp
movl (%r15), %esi
leal -0x1(%rsi), %r9d
movl %r9d, %edx
andl %ebp, %edx
movq 0x10(%r15), %rax
movl %edx, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %edi
leal (%rdx,%rdx), %ecx
shrl %cl, %edi
testb $0x2, %dil
jne 0x2a356
movl $0x1, %r10d
movl %edx, %r8d
movl %esi, %edi
movl %r8d, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %r11d
leal (%r8,%r8), %ecx
andl $0x1e, %ecx
movl %r11d, %r14d
shrl %cl, %r14d
testb $0x2, %r14b
jne 0x2a330
testb $0x1, %r14b
jne 0x2a316
movq 0x18(%r15), %r14
movl %r8d, %ebx
cmpl %ebp, (%r14,%rbx,4)
je 0x2a330
btl %ecx, %r11d
cmovbl %r8d, %edi
addl %r10d, %r8d
andl %r9d, %r8d
incl %r10d
movl %edi, %ecx
cmpl %edx, %r8d
jne 0x2a2e6
jmp 0x2a332
movl %esi, %ecx
movl %ecx, %edx
cmpl %esi, %ecx
jne 0x2a356
movl %r8d, %ecx
shrl $0x4, %ecx
movl (%rax,%rcx,4), %edx
leal (%r8,%r8), %ecx
shrl %cl, %edx
cmpl %esi, %edi
cmovel %r8d, %edi
testb $0x2, %dl
cmovel %r8d, %edi
movl %edi, %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 0x2a38d
testb $0x1, %dil
je 0x2a3aa
movq 0x18(%r15), %rdi
movl %edx, %edx
movl %ebp, (%rdi,%rdx,4)
movl $0x3, %edx
shll %cl, %edx
notl %edx
andl %edx, (%rax,%rsi,4)
incl 0x4(%r15)
jmp 0x2a3aa
movq 0x18(%r15), %rdi
movl %edx, %edx
movl %ebp, (%rdi,%rdx,4)
movl $0x3, %edx
shll %cl, %edx
notl %edx
andl %edx, (%rax,%rsi,4)
incl 0x4(%r15)
incl 0x8(%r15)
leaq 0x3(%r13), %rax
xorl %ebp, %ebp
cmpq 0x28(%rsp), %rax
movq 0x20(%rsp), %rbx
jbe 0x2a24b
jmp 0x2a3c7
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x707f2(%rip), %rsi     # 0x9abd4
leaq 0x707fb(%rip), %rdx     # 0x9abe4
xorl %ebp, %ebp
movl $0x3, %edi
xorl %eax, %eax
callq 0x14378
jmp 0x2a3c7