// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/inter.cpp
// Function: load_all_ul_t(all_ul_t*, char*, All_reads*, ma_ug_t*)
int32_t load_all_ul_t(all_ul_t *x, char* file_name, All_reads *hR, ma_ug_t *ug)
{
	char* gfa_name = NULL; MALLOC(gfa_name, strlen(file_name)+50);
	sprintf(gfa_name, "%s.ul.ovlp.bin", file_name);
	FILE* fp = fopen(gfa_name, "r"); free(gfa_name);
	if (!fp) return 0;
	if(ug && (!test_dbug(ug, fp))) {
		fprintf(stderr, "[M::%s] Renew UL Index\n", __func__);
		fclose(fp);
		return 0;
    }

	destory_all_ul_t(x); 
	memset(x, 0, sizeof(*x)); x->hR = hR; init_aux_table();
	uint64_t k; ul_vec_t *p = NULL;
	
	fread(&x->nid.n, sizeof(x->nid.n), 1, fp); x->nid.m = x->nid.n; MALLOC(x->nid.a, x->nid.n); 
	for (k = 0; k < x->nid.n; k++) {
		fread(&x->nid.a[k].n, sizeof(x->nid.a[k].n), 1, fp); MALLOC(x->nid.a[k].a, x->nid.a[k].n);
		fread(x->nid.a[k].a, sizeof((*(x->nid.a[k].a))), x->nid.a[k].n, fp);
	}

	fread(&x->ridx.idx.n, sizeof(x->ridx.idx.n), 1, fp); x->ridx.idx.m = x->ridx.idx.n; MALLOC(x->ridx.idx.a, x->ridx.idx.n);
	fread(x->ridx.idx.a, sizeof((*(x->ridx.idx.a))), x->ridx.idx.n, fp);

	fread(&x->ridx.occ.n, sizeof(x->ridx.occ.n), 1, fp); x->ridx.occ.m = x->ridx.occ.n; MALLOC(x->ridx.occ.a, x->ridx.occ.n);
	fread(x->ridx.occ.a, sizeof((*(x->ridx.occ.a))), x->ridx.occ.n, fp);

	fread(&x->n, sizeof(x->n), 1, fp); x->m = x->n; MALLOC(x->a, x->n);
	for (k = 0; k < x->n; k++) {
		p = &(x->a[k]);
		fread(&p->dd, sizeof(p->dd), 1, fp);
		fread(&p->rlen, sizeof(p->rlen), 1, fp);

		fread(&p->r_base.n, sizeof(p->r_base.n), 1, fp); p->r_base.m = p->r_base.n; MALLOC(p->r_base.a, p->r_base.n);
		fread(p->r_base.a, sizeof((*(p->r_base.a))), p->r_base.n, fp);

		fread(&p->bb.n, sizeof(p->bb.n), 1, fp); p->bb.m = p->bb.n; MALLOC(p->bb.a, p->bb.n);
		fread(p->bb.a, sizeof((*(p->bb.a))), p->bb.n, fp);

		fread(&p->N_site.n, sizeof(p->N_site.n), 1, fp); p->N_site.m = p->N_site.n; MALLOC(p->N_site.a, p->N_site.n);
		fread(p->N_site.a, sizeof((*(p->N_site.a))), p->N_site.n, fp);
	}

	fprintf(stderr, "[M::%s] Index has been loaded.\n", __func__);
	fclose(fp);
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r12
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %rbp
movq %rsi, %rdi
callq 0x2090
leaq 0x32(%rax), %rdi
callq 0x2280
movq %rax, %r13
leaq 0x6170c(%rip), %rsi     # 0x23d822
xorl %r14d, %r14d
movq %rax, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x5747a(%rip), %rsi     # 0x2335a7
movq %r13, %rdi
callq 0x2210
movq %rax, %rbx
movq %r13, %rdi
callq 0x2220
testq %rbx, %rbx
jne 0x1dc157
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
testq %r12, %r12
je 0x1dc17a
movq %r12, %rdi
movq %rbx, %rsi
callq 0xc270e
testl %eax, %eax
jne 0x1dc17a
xorl %r14d, %r14d
leaq 0x5204e(%rip), %rsi     # 0x22e1c3
jmp 0x1dc43d
movq %rbp, %rdi
callq 0x34807
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rbp)
movups %xmm0, 0x40(%rbp)
movups %xmm0, 0x30(%rbp)
movups %xmm0, 0x20(%rbp)
movups %xmm0, 0x10(%rbp)
movups %xmm0, (%rbp)
movq %r15, 0x60(%rbp)
callq 0x3366f
movl $0x8, %r14d
movl $0x8, %esi
movl $0x1, %edx
movq %rbp, %rdi
movq %rbx, %rcx
callq 0x22f0
movq (%rbp), %rdi
movq %rdi, 0x8(%rbp)
shlq $0x4, %rdi
callq 0x2280
movq %rax, 0x10(%rbp)
cmpq $0x0, (%rbp)
je 0x1dc22c
xorl %r15d, %r15d
movq 0x10(%rbp), %rdi
addq %r14, %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x22f0
movq 0x10(%rbp), %r12
movl (%r12,%r14), %edi
callq 0x2280
movq %rax, -0x8(%r12,%r14)
movl (%r12,%r14), %edx
movl $0x1, %esi
movq %rax, %rdi
movq %rbx, %rcx
callq 0x22f0
incq %r15
addq $0x10, %r14
cmpq (%rbp), %r15
jb 0x1dc1e0
leaq 0x18(%rbp), %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x22f0
movq 0x18(%rbp), %r15
movq %r15, 0x20(%rbp)
leaq (,%r15,4), %rdi
callq 0x2280
movq %rax, 0x28(%rbp)
movl $0x4, %esi
movq %rax, %rdi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x22f0
leaq 0x30(%rbp), %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x22f0
movq 0x30(%rbp), %r15
movq %r15, 0x38(%rbp)
leaq (,%r15,8), %rdi
callq 0x2280
movq %rax, 0x40(%rbp)
movl $0x8, %esi
movq %rax, %rdi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x22f0
leaq 0x50(%rbp), %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x22f0
movq 0x50(%rbp), %rax
movq %rax, 0x58(%rbp)
imulq $0x58, %rax, %rdi
callq 0x2280
movq %rax, 0x48(%rbp)
movl $0x1, %r14d
leaq 0x51dee(%rip), %rsi     # 0x22e0d6
cmpq $0x0, 0x50(%rbp)
je 0x1dc43d
movq %rbp, 0x8(%rsp)
movl $0x40, %ebp
xorl %r14d, %r14d
movq 0x8(%rsp), %rax
movq 0x48(%rax), %r12
leaq (%r12,%rbp), %rax
movq %rax, 0x10(%rsp)
leaq (%r12,%rbp), %r13
addq $-0x40, %r13
leaq 0x10(%r12,%rbp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x22f0
leaq (%r12,%rbp), %r15
addq $-0x28, %r15
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %rbx, %rcx
callq 0x22f0
movl $0x8, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x22f0
movq -0x18(%r15), %r13
movq %r13, -0x10(%r15)
movq %r13, %rdi
callq 0x2280
movq %rax, -0x8(%r15)
movl $0x1, %esi
movq %rax, %rdi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x22f0
leaq (%r12,%rbp), %r13
addq $-0x20, %r13
movl $0x8, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %rbx, %rcx
callq 0x22f0
movq (%r13), %r15
movq %r15, 0x8(%r13)
leaq (,%r15,4), %rax
leaq (%rax,%rax,8), %rdi
callq 0x2280
movq %rax, 0x10(%r13)
movl $0x24, %esi
movq %rax, %rdi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x22f0
movl $0x8, %esi
movl $0x1, %edx
movq 0x10(%rsp), %rdi
movq %rbx, %rcx
callq 0x22f0
movq 0x20(%r13), %r15
movq %r15, 0x28(%r13)
leaq (,%r15,4), %rdi
callq 0x2280
movq %rax, 0x18(%r13)
movl $0x4, %esi
movq %rax, %rdi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x22f0
incq %r14
addq $0x58, %rbp
movq 0x8(%rsp), %rax
cmpq 0x50(%rax), %r14
jb 0x1dc300
movl $0x1, %r14d
leaq 0x51c99(%rip), %rsi     # 0x22e0d6
movq 0xadb9c(%rip), %rax     # 0x289fe0
movq (%rax), %rdi
leaq 0x5c1ea(%rip), %rdx     # 0x238638
xorl %eax, %eax
callq 0x22b0
movq %rbx, %rdi
callq 0x2190
jmp 0x1dc145