// File: /workspace/github_c_makefile_star2_O0/lh3[P]minimap2/index.c
// Function: mm_idx_bed_read_merge
static mm_idx_intv_t *mm_idx_bed_read_merge(const mm_idx_t *mi, const char *fn, int read_junc, int min_sc)
{
	long n = 0, n0 = 0;
	int32_t i;
	mm_idx_intv_t *I;
	I = mm_idx_bed_read_core(mi, fn, read_junc, min_sc);
	if (I == 0) return 0;
	for (i = 0; i < mi->n_seq; ++i) {
		int32_t j, j0, k;
		mm_idx_intv_t *intv = &I[i];
		n0 += intv->n;
		radix_sort_bed(intv->a, intv->a + intv->n); // sort by st
		for (j = 1, j0 = 0; j <= intv->n; ++j) { // sort by st and then by end
			if (j == intv->n || intv->a[j].st != intv->a[j0].st) {
				radix_sort_end(intv->a + j0, intv->a + j);
				j0 = j;
			}
		}
		for (j = 1, j0 = 0, k = 0; j <= intv->n; ++j) { // merge intervals with the same (st, en)
			if (j == intv->n || intv->a[j].st != intv->a[j0].st || intv->a[j].en != intv->a[j0].en) {
				intv->a[k] = intv->a[j0];
				intv->a[k++].cnt = j - j0;
				j0 = j;
			}
		}
		intv->a = REALLOC(mm_idx_intv1_t, intv->a, k);
		intv->n = intv->m = k;
		n += k;
	}
	if (mm_verbose >= 3)
		fprintf(stderr, "[%s] read %ld introns, %ld of which are non-redundant\n", __func__, n0, n);
	return I;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
movl -0x20(%rbp), %ecx
callq 0xe720
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0xbe11
movq $0x0, -0x8(%rbp)
jmp 0xc079
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0xc03e
movq -0x40(%rbp), %rax
movslq -0x34(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movslq (%rax), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x58(%rbp), %rax
movslq (%rax), %rax
shlq $0x4, %rax
addq %rax, %rsi
callq 0xb810
movl $0x1, -0x44(%rbp)
movl $0x0, -0x48(%rbp)
movl -0x44(%rbp), %eax
movq -0x58(%rbp), %rcx
cmpl (%rcx), %eax
jg 0xbefb
movl -0x44(%rbp), %eax
movq -0x58(%rbp), %rcx
cmpl (%rcx), %eax
je 0xbebd
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x44(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0x58(%rbp), %rcx
movq 0x8(%rcx), %rcx
movslq -0x48(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
je 0xbeee
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rdi
movslq -0x48(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rdi
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rsi
movslq -0x44(%rbp), %rax
shlq $0x4, %rax
addq %rax, %rsi
callq 0xbd10
movl -0x44(%rbp), %eax
movl %eax, -0x48(%rbp)
jmp 0xbef0
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xbe7b
movl $0x1, -0x44(%rbp)
movl $0x0, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x44(%rbp), %eax
movq -0x58(%rbp), %rcx
cmpl (%rcx), %eax
jg 0xbff4
movl -0x44(%rbp), %eax
movq -0x58(%rbp), %rcx
cmpl (%rcx), %eax
je 0xbf84
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x44(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %eax
movq -0x58(%rbp), %rcx
movq 0x8(%rcx), %rcx
movslq -0x48(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
jne 0xbf84
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x44(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x58(%rbp), %rcx
movq 0x8(%rcx), %rcx
movslq -0x48(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
je 0xbfe4
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rax
movslq -0x4c(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq -0x58(%rbp), %rcx
movq 0x8(%rcx), %rcx
movslq -0x48(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rcx
movq %rcx, 0x8(%rax)
movl -0x44(%rbp), %ecx
subl -0x48(%rbp), %ecx
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x4c(%rbp), %edx
movl %edx, %esi
addl $0x1, %esi
movl %esi, -0x4c(%rbp)
movslq %edx, %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movl -0x44(%rbp), %eax
movl %eax, -0x48(%rbp)
jmp 0xbfe6
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0xbf10
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rdi
movslq -0x4c(%rbp), %rsi
shlq $0x4, %rsi
callq 0x2310
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x8(%rax)
movl -0x4c(%rbp), %ecx
movq -0x58(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x58(%rbp), %rax
movl %ecx, (%rax)
movslq -0x4c(%rbp), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xbe18
leaq 0x526cb(%rip), %rax     # 0x5e710
cmpl $0x3, (%rax)
jl 0xc071
movq 0x51fa7(%rip), %rax     # 0x5dff8
movq (%rax), %rdi
movq -0x30(%rbp), %rcx
movq -0x28(%rbp), %r8
leaq 0x4b22a(%rip), %rsi     # 0x5728d
leaq 0x4b25a(%rip), %rdx     # 0x572c4
movb $0x0, %al
callq 0x2250
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)