// File: /workspace/github_c_makefile_star2_O2/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 %r12
pushq %rbx
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
pushq $0x1
popq %rdi
pushq $0x40
popq %rsi
callq 0x21f0
movq %rax, %rbx
movq %r14, %rdi
callq 0x23e0
movq %rax, 0x28(%rbx)
pushq $0x77
popq %rsi
movq %r12, %rdi
callq 0x2160
testq %rax, %rax
je 0x4fc5
movl $0x2, (%rbx)
pushq $0x2
popq %rbp
jmp 0x4fc7
xorl %ebp, %ebp
pushq $0x62
popq %rsi
movq %r12, %rdi
callq 0x2160
testq %rax, %rax
je 0x4fdc
orl $0x1, %ebp
movl %ebp, (%rbx)
movb (%r14), %al
testb $0x1, %bpl
jne 0x5026
testb $0x2, %bpl
jne 0x5047
cmpb $0x2d, %al
jne 0x4ffa
cmpb $0x0, 0x1(%r14)
je 0x50db
leaq 0x733f(%rip), %rsi      # 0xc340
movq %r14, %rdi
callq 0x2330
testq %rax, %rax
je 0x50be
movq %rax, %rdi
callq 0x46d0
movq %rax, %r12
movq %rax, 0x38(%rbx)
jmp 0x50c1
testb $0x2, %bpl
jne 0x5067
cmpb $0x2d, %al
jne 0x503b
cmpb $0x0, 0x1(%r14)
je 0x50fd
leaq 0x78cc(%rip), %rsi      # 0xc90e
movq %r14, %rdi
jmp 0x507c
cmpb $0x2d, %al
jne 0x5056
cmpb $0x0, 0x1(%r14)
je 0x5117
leaq 0x72e3(%rip), %rsi      # 0xc340
movq %r14, %rdi
callq 0x2360
jmp 0x5081
cmpb $0x2d, %al
jne 0x5076
cmpb $0x0, 0x1(%r14)
je 0x5126
movq %r14, %rdi
movq %r12, %rsi
callq 0x36d8
pushq $0x38
popq %rcx
xorl %r15d, %r15d
movq %rax, %r12
movq %rax, (%rbx,%rcx)
testq %r12, %r12
jne 0x50b2
cmpl $0x2, 0xc196(%rip)      # 0x11230
jge 0x5144
movq %r15, %rdi
callq 0x2050
movq %rbx, %rdi
callq 0x2050
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
xorl %r12d, %r12d
testq %r15, %r15
je 0x50d6
movq %r15, %rdi
callq 0x23e0
pushq $0x30
popq %rcx
movq %rax, %r15
jmp 0x508a
xorl %r15d, %r15d
jmp 0x508e
movq 0xbee6(%rip), %rax      # 0x10fc8
movq (%rax), %rdi
callq 0x2260
leaq 0x724f(%rip), %rsi      # 0xc340
movl %eax, %edi
callq 0x2120
jmp 0x5009
movq 0xbec4(%rip), %rax      # 0x10fc8
movq (%rax), %rdi
callq 0x2260
leaq 0x77fb(%rip), %rsi      # 0xc90e
movl %eax, %edi
jmp 0x513a
movq 0xbea2(%rip), %rax      # 0x10fc0
movq (%rax), %rax
jmp 0x5081
movq 0xbe93(%rip), %rax      # 0x10fc0
movq (%rax), %rdi
callq 0x2260
movl %eax, %edi
movq %r12, %rsi
callq 0x3827
jmp 0x5081
movq 0xbead(%rip), %rax      # 0x10ff8
movq (%rax), %rdi
leaq 0x71ee(%rip), %rsi      # 0xc343
leaq 0x7207(%rip), %rdx      # 0xc363
movq %r14, %rcx
xorl %eax, %eax
callq 0x2220
jmp 0x50a0