// File: /workspace/github_c_makefile_star2_O3/DReichLab[P]adna/hts.c
// Function: hts_open
htsFile *hts_open(const char *fn, const char *mode, const char *fn_aux)
{
	htsFile *fp;
	fp = (htsFile*)calloc(1, sizeof(htsFile));
	fp->fn = strdup(fn);
	fp->is_be = ed_is_big();
	if (strchr(mode, 'w')) fp->is_write = 1;
	if (strchr(mode, 'b')) fp->is_bin = 1;
	if (fp->is_bin) {
		if (fp->is_write) fp->fp = strcmp(fn, "-")? bgzf_open(fn, mode) : bgzf_dopen(fileno(stdout), mode);
		else fp->fp = strcmp(fn, "-")? bgzf_open(fn, "r") : bgzf_dopen(fileno(stdin), "r");
	} else {
		if (!fp->is_write) {
			gzFile gzfp;
			gzfp = strcmp(fn, "-")? gzopen(fn, "rb") : gzdopen(fileno(stdin), "rb");
			if (gzfp) fp->fp = ks_init(gzfp);
			if (fn_aux) fp->fn_aux = strdup(fn_aux);
		} else fp->fp = strcmp(fn, "-")? fopen(fn, "rb") : stdout;
	}
	if (fp->fp == 0) {
		if (hts_verbose >= 2)
			fprintf(stderr, "[E::%s] fail to open file '%s'\n", __func__, fn);
		free(fp->fn_aux); free(fp);
		return 0;
	}
	return fp;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
movl $0x1, %edi
movl $0x40, %esi
callq 0x21f0
movq %rax, %rbx
movq %r14, %rdi
callq 0x23d0
movq %rax, 0x28(%rbx)
movq %r12, %rdi
movl $0x77, %esi
callq 0x2160
testq %rax, %rax
je 0x55c4
movl $0x2, (%rbx)
movl $0x2, %ebp
jmp 0x55c6
xorl %ebp, %ebp
movq %r12, %rdi
movl $0x62, %esi
callq 0x2160
testq %rax, %rax
je 0x55dd
orl $0x1, %ebp
movl %ebp, (%rbx)
movb (%r14), %al
testb $0x1, %bpl
jne 0x564f
testb $0x2, %bpl
jne 0x5670
cmpb $0x2d, %al
jne 0x55ff
cmpb $0x0, 0x1(%r14)
je 0x570e
leaq 0x8d8a(%rip), %rsi      # 0xe390
movq %r14, %rdi
callq 0x2320
movq %rax, %r13
testq %rax, %rax
je 0x56ef
movl $0x1, %edi
movl $0x20, %esi
callq 0x21f0
movq %rax, %r12
movq %r13, 0x10(%rax)
movl $0x40000, 0x8(%rax)     # imm = 0x40000
movl $0x10000, %edi          # imm = 0x10000
callq 0x22a0
movq %rax, 0x18(%r12)
movq %r12, 0x38(%rbx)
jmp 0x56f2
testb $0x2, %bpl
jne 0x5690
cmpb $0x2d, %al
jne 0x5664
cmpb $0x0, 0x1(%r14)
je 0x5730
leaq 0x931f(%rip), %rsi      # 0xe98a
movq %r14, %rdi
jmp 0x56a5
cmpb $0x2d, %al
jne 0x567f
cmpb $0x0, 0x1(%r14)
je 0x574a
leaq 0x8d0a(%rip), %rsi      # 0xe390
movq %r14, %rdi
callq 0x2350
jmp 0x56aa
cmpb $0x2d, %al
jne 0x569f
cmpb $0x0, 0x1(%r14)
je 0x5759
movq %r14, %rdi
movq %r12, %rsi
callq 0x3ad0
movl $0x38, %ecx
xorl %r15d, %r15d
movq %rax, %r12
movq %rax, (%rbx,%rcx)
testq %r12, %r12
jne 0x56dd
cmpl $0x2, 0xcb5b(%rip)      # 0x12220
jge 0x5777
movq %r15, %rdi
callq 0x2050
movq %rbx, %rdi
callq 0x2050
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r12d, %r12d
testq %r15, %r15
je 0x5709
movq %r15, %rdi
callq 0x23d0
movl $0x30, %ecx
movq %rax, %r15
jmp 0x56b5
xorl %r15d, %r15d
jmp 0x56b9
movq 0xc8b3(%rip), %rax      # 0x11fc8
movq (%rax), %rdi
callq 0x2260
leaq 0x8c6c(%rip), %rsi      # 0xe390
movl %eax, %edi
callq 0x2120
jmp 0x560e
movq 0xc891(%rip), %rax      # 0x11fc8
movq (%rax), %rdi
callq 0x2260
leaq 0x9244(%rip), %rsi      # 0xe98a
movl %eax, %edi
jmp 0x576d
movq 0xc86f(%rip), %rax      # 0x11fc0
movq (%rax), %rax
jmp 0x56aa
movq 0xc860(%rip), %rax      # 0x11fc0
movq (%rax), %rdi
callq 0x2260
movl %eax, %edi
movq %r12, %rsi
callq 0x3c2b
jmp 0x56aa
movq 0xc87a(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
leaq 0x8c0b(%rip), %rsi      # 0xe393
leaq 0x8c24(%rip), %rdx      # 0xe3b3
movq %r14, %rcx
xorl %eax, %eax
callq 0x2220
jmp 0x56cb