// File: /workspace/github_c_makefile_star2_O0/DReichLab[P]adna/hts.c
// Function: hts_idx_load_core
static void hts_idx_load_core(hts_idx_t *idx, void *fp, int fmt)
{
	int32_t i, n, is_be;
	int is_bgzf = (fmt != HTS_FMT_BAI);
	is_be = ed_is_big();
	for (i = 0; i < idx->n; ++i) {
		bidx_t *h;
		lidx_t *l = &idx->lidx[i];
		uint32_t key;
		int j, absent;
		hts_bin_t *p;
		h = idx->bidx[i] = kh_init(bin);
		idx_read(is_bgzf, fp, &n, 4);
		if (is_be) ed_swap_4p(&n);
		for (j = 0; j < n; ++j) {
			khint_t k;
			idx_read(is_bgzf, fp, &key, 4);
			if (is_be) ed_swap_4p(&key);
			k = kh_put(bin, h, key, &absent);
			p = &kh_val(h, k);
			if (fmt == HTS_FMT_CSI) {
				idx_read(is_bgzf, fp, &p->loff, 8);
				if (is_be) ed_swap_8p(&p->loff);
			} else p->loff = 0;
			idx_read(is_bgzf, fp, &p->n, 4);
			if (is_be) ed_swap_4p(&p->n);
			p->m = p->n;
			p->list = (hts_pair64_t*)malloc(p->m * 16);
			idx_read(is_bgzf, fp, p->list, p->n<<4);
			if (is_be) swap_bins(p);
		}
		if (fmt != HTS_FMT_CSI) { // load linear index
			int j;
			idx_read(is_bgzf, fp, &l->n, 4);
			if (is_be) ed_swap_4p(&l->n);
			l->m = l->n;
			l->offset = (uint64_t*)malloc(l->n << 3);
			idx_read(is_bgzf, fp, l->offset, l->n << 3);
			if (is_be) for (j = 0; j < l->n; ++j) ed_swap_8p(&l->offset[j]);
			for (j = 1; j < l->n; ++j) // fill missing values; may happen given older samtools and tabix
				if (l->offset[j] == 0) l->offset[j] = l->offset[j-1];
			update_loff(idx, i, 1);
		}
	}
	if (idx_read(is_bgzf, fp, &idx->n_no_coor, 8) != 8) idx->n_no_coor = 0;
	if (is_be) ed_swap_8p(&idx->n_no_coor);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
cmpl $0x1, -0x14(%rbp)
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x24(%rbp)
callq 0xbc50
movl %eax, -0x20(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x14(%rcx), %eax
jge 0xa8e6
movq -0x8(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x18(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
callq 0xc520
movq -0x8(%rbp), %rcx
movq 0x28(%rcx), %rcx
movslq -0x18(%rbp), %rdx
movq %rax, (%rcx,%rdx,8)
movq %rax, -0x30(%rbp)
movl -0x24(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
movl $0x4, %ecx
callq 0xc700
cmpl $0x0, -0x20(%rbp)
je 0xa685
leaq -0x1c(%rbp), %rdi
callq 0x9d80
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0xa7ba
movl -0x24(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq -0x3c(%rbp), %rdx
movl $0x4, %ecx
callq 0xc700
cmpl $0x0, -0x20(%rbp)
je 0xa6bc
leaq -0x3c(%rbp), %rdi
callq 0x9d80
movq -0x30(%rbp), %rdi
movl -0x3c(%rbp), %esi
leaq -0x44(%rbp), %rdx
callq 0xbc70
movl %eax, -0x54(%rbp)
movq -0x30(%rbp), %rax
movq 0x20(%rax), %rax
movl -0x54(%rbp), %ecx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
cmpl $0x0, -0x14(%rbp)
jne 0xa719
movl -0x24(%rbp), %edi
movq -0x10(%rbp), %rsi
movq -0x50(%rbp), %rdx
addq $0x8, %rdx
movl $0x8, %ecx
callq 0xc700
cmpl $0x0, -0x20(%rbp)
je 0xa717
movq -0x50(%rbp), %rdi
addq $0x8, %rdi
callq 0xc650
jmp 0xa725
movq -0x50(%rbp), %rax
movq $0x0, 0x8(%rax)
movl -0x24(%rbp), %edi
movq -0x10(%rbp), %rsi
movq -0x50(%rbp), %rdx
addq $0x4, %rdx
movl $0x4, %ecx
callq 0xc700
cmpl $0x0, -0x20(%rbp)
je 0xa751
movq -0x50(%rbp), %rdi
addq $0x4, %rdi
callq 0x9d80
movq -0x50(%rbp), %rax
movl 0x4(%rax), %ecx
movq -0x50(%rbp), %rax
movl %ecx, (%rax)
movq -0x50(%rbp), %rax
movl (%rax), %eax
shll $0x4, %eax
movslq %eax, %rdi
callq 0x22b0
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x10(%rax)
movl -0x24(%rbp), %edi
movq -0x10(%rbp), %rsi
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x50(%rbp), %rax
movl 0x4(%rax), %eax
shll $0x4, %eax
movslq %eax, %rcx
callq 0xc700
cmpl $0x0, -0x20(%rbp)
je 0xa7aa
movq -0x50(%rbp), %rdi
callq 0xc5e0
jmp 0xa7ac
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0xa68c
cmpl $0x0, -0x14(%rbp)
je 0xa8d6
movl -0x24(%rbp), %edi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rdx
movl $0x4, %ecx
callq 0xc700
cmpl $0x0, -0x20(%rbp)
je 0xa7e8
movq -0x38(%rbp), %rdi
callq 0x9d80
movq -0x38(%rbp), %rax
movl (%rax), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x38(%rbp), %rax
movl (%rax), %eax
shll $0x3, %eax
movslq %eax, %rdi
callq 0x22b0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movl -0x24(%rbp), %edi
movq -0x10(%rbp), %rsi
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x38(%rbp), %rax
movl (%rax), %eax
shll $0x3, %eax
movslq %eax, %rcx
callq 0xc700
cmpl $0x0, -0x20(%rbp)
je 0xa86e
movl $0x0, -0x58(%rbp)
movl -0x58(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl (%rcx), %eax
jge 0xa86c
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdi
movslq -0x58(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
callq 0xc650
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0xa83e
jmp 0xa86e
movl $0x1, -0x58(%rbp)
movl -0x58(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl (%rcx), %eax
jge 0xa8c5
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x58(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0xa8b8
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x58(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x58(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0xa8ba
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0xa875
movq -0x8(%rbp), %rdi
movl -0x18(%rbp), %esi
movl $0x1, %edx
callq 0x8c20
jmp 0xa8d8
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0xa621
movl -0x24(%rbp), %edi
movq -0x10(%rbp), %rsi
movq -0x8(%rbp), %rdx
addq $0x20, %rdx
movl $0x8, %ecx
callq 0xc700
cmpq $0x8, %rax
je 0xa911
movq -0x8(%rbp), %rax
movq $0x0, 0x20(%rax)
cmpl $0x0, -0x20(%rbp)
je 0xa924
movq -0x8(%rbp), %rdi
addq $0x20, %rdi
callq 0xc650
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)