// File: /workspace/github_c_makefile_star2_O1/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)
movl (%rbx), %ebp
movl %ebp, %eax
andl $-0x5, %eax
movl %eax, (%rbx)
movq %r12, %rdi
movl $0x77, %esi
callq 0x2160
testq %rax, %rax
je 0x550d
andl $-0x7, %ebp
orl $0x2, %ebp
movl %ebp, (%rbx)
movq %r12, %rdi
movl $0x62, %esi
callq 0x2160
testq %rax, %rax
je 0x5522
orb $0x1, (%rbx)
movl (%rbx), %ebp
leaq 0x8be0(%rip), %rsi      # 0xe10b
movq %r14, %rdi
callq 0x2200
testb $0x1, %bpl
jne 0x5554
testb $0x2, %bpl
jne 0x556e
testl %eax, %eax
je 0x55a2
leaq 0x8de6(%rip), %rsi      # 0xe330
movq %r14, %rdi
callq 0x2320
jmp 0x55bf
testb $0x2, %bpl
jne 0x558a
testl %eax, %eax
je 0x5612
leaq 0x93a7(%rip), %rsi      # 0xe910
movq %r14, %rdi
jmp 0x5598
testl %eax, %eax
je 0x562c
leaq 0x8db3(%rip), %rsi      # 0xe330
movq %r14, %rdi
callq 0x2350
jmp 0x5651
testl %eax, %eax
je 0x5638
movq %r14, %rdi
movq %r12, %rsi
callq 0x3abc
jmp 0x5651
movq 0xca1f(%rip), %rax      # 0x11fc8
movq (%rax), %rdi
callq 0x2260
leaq 0x8d78(%rip), %rsi      # 0xe330
movl %eax, %edi
callq 0x2120
movq %rax, %r12
testq %rax, %rax
je 0x55fe
movl $0x1, %edi
movl $0x20, %esi
callq 0x21f0
movq %rax, %r13
movq %r12, 0x10(%rax)
movl 0x8(%rax), %eax
andl $0x3, %eax
orl $0x40000, %eax          # imm = 0x40000
movl %eax, 0x8(%r13)
movl $0x10000, %edi          # imm = 0x10000
callq 0x22a0
movq %rax, 0x18(%r13)
movq %r13, 0x38(%rbx)
testq %r15, %r15
je 0x565a
movq %r15, %rdi
callq 0x23d0
movl $0x30, %ecx
jmp 0x5656
movq 0xc9af(%rip), %rax      # 0x11fc8
movq (%rax), %rdi
callq 0x2260
leaq 0x92e8(%rip), %rsi      # 0xe910
movl %eax, %edi
jmp 0x564c
movq 0xc98d(%rip), %rax      # 0x11fc0
movq (%rax), %rax
jmp 0x5651
movq 0xc981(%rip), %rax      # 0x11fc0
movq (%rax), %rdi
callq 0x2260
movl %eax, %edi
movq %r12, %rsi
callq 0x3c4f
movl $0x38, %ecx
movq %rax, (%rbx,%rcx)
cmpq $0x0, 0x38(%rbx)
jne 0x567d
cmpl $0x2, 0xcbb8(%rip)      # 0x12220
jge 0x568f
movq 0x30(%rbx), %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
movq 0xc962(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
leaq 0x8c93(%rip), %rsi      # 0xe333
leaq 0x8cac(%rip), %rdx      # 0xe353
movq %r14, %rcx
xorl %eax, %eax
callq 0x2220
jmp 0x566a