// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: reload_uovl(all_ul_t*, char*)
int64_t reload_uovl(all_ul_t *x, char* file_name)
{
    char* gfa_name = NULL; MALLOC(gfa_name, strlen(file_name)+100);
    sprintf(gfa_name, "%s.%s.ul.ovlp.bin", file_name, "re");
    FILE* fp = fopen(gfa_name, "r"); free(gfa_name);
    if (!fp) return 0;
    uint64_t k; size_t kn; ul_vec_t *p = NULL;

    ///skip test ug
    size_t tt, i; uint32_t t; ma_utg_t ua;
    fread(&tt, sizeof(tt), 1, fp);
    for (i = 0; i < tt; i++) {
        fread(&t, sizeof(t), 1, fp);
        fread(&t, sizeof(t), 1, fp);
        fread(&(ua.start), sizeof(ua.start), 1, fp);
        fread(&(ua.end), sizeof(ua.end), 1, fp);
        fread(&(ua.n), sizeof(ua.n), 1, fp);
        fseek(fp, sizeof(uint64_t)*ua.n, SEEK_CUR);
        // fread(ua.a, sizeof(uint64_t), ua.n, fp);
    }



    fseek(fp, sizeof(x->nid.n), SEEK_CUR);
	for (k = 0; k < x->nid.n; k++) {
        fseek(fp, sizeof(x->nid.a[k].n), SEEK_CUR); 
        fseek(fp, sizeof((*(x->nid.a[k].a)))*x->nid.a[k].n, SEEK_CUR);
	}

    // free(x->ridx.idx.a); x->ridx.idx.a = NULL;
    fread(&kn, sizeof(kn), 1, fp); 
    fseek(fp, sizeof((*(x->ridx.idx.a)))*kn, SEEK_CUR);

    // free(x->ridx.occ.a); x->ridx.occ.a = NULL;
    fread(&kn, sizeof(kn), 1, fp); 
    fseek(fp, sizeof((*(x->ridx.occ.a)))*kn, SEEK_CUR);

    fread(&x->n, sizeof(x->n), 1, fp); assert(x->nid.n == x->n);
    if(x->n > x->m) kv_resize(ul_vec_t, *x, x->n);    
    fprintf(stderr, "[M::%s] x->n::%u, x->nid.n::%u\n", __func__, (uint32_t)x->n, (uint32_t)x->nid.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); 
        if(p->r_base.n > p->r_base.m) kv_resize(uint8_t, p->r_base, 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); 
        if(p->bb.n > p->bb.m) kv_resize(uc_block_t, p->bb, 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); 
        if(p->N_site.n > p->N_site.m) kv_resize(uint32_t, p->N_site, p->N_site.n);        
        fread(p->N_site.a, sizeof((*(p->N_site.a))), p->N_site.n, fp);
    }
    fclose(fp);
    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %rbx
movq %rdi, %r13
movq %rsi, %rdi
callq 0x2090
leaq 0x64(%rax), %rdi
callq 0x2280
movq %rax, %r15
leaq 0x28b5f(%rip), %rsi     # 0x1fbac2
leaq 0x21f7b(%rip), %rcx     # 0x1f4ee5
xorl %r12d, %r12d
movq %rax, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x1e736(%rip), %rsi     # 0x1f16b7
movq %r15, %rdi
callq 0x2210
movq %rax, %r14
movq %r15, %rdi
callq 0x2220
testq %r14, %r14
jne 0x1d2fab
movq %r12, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, 0x8(%rsp)
leaq 0x20(%rsp), %rbx
pushq $0x8
popq %r15
pushq $0x1
popq %r12
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x22f0
movq (%rbx), %rax
movq %rax, (%rsp)
xorl %ebx, %ebx
leaq 0x1c(%rsp), %r13
pushq $0x4
popq %rbp
jmp 0x1d3052
movq %r13, %rdi
movq %rbp, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x22f0
movq %r13, %rdi
movq %rbp, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x22f0
leaq 0x34(%rsp), %rdi
movq %rbp, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x22f0
leaq 0x38(%rsp), %rdi
movq %rbp, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x22f0
leaq 0x40(%rsp), %rdi
movq %rbp, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x22f0
movl 0x40(%rsp), %esi
shlq $0x3, %rsi
movq %r14, %rdi
pushq $0x1
popq %rdx
callq 0x21b0
incq %rbx
cmpq (%rsp), %rbx
jb 0x1d2fe1
pushq $0x1
popq %rbx
movq %r14, %rdi
movq %r15, %rsi
movl %ebx, %edx
callq 0x21b0
xorl %r13d, %r13d
pushq $0x4
popq %r12
movq 0x8(%rsp), %rbp
jmp 0x1d309c
movq %r14, %rdi
movq %r12, %rsi
movl %ebx, %edx
callq 0x21b0
movq 0x10(%rbp), %rax
movl (%rax,%r15), %esi
movq %r14, %rdi
movl %ebx, %edx
callq 0x21b0
incq %r13
addq $0x10, %r15
cmpq (%rbp), %r13
jb 0x1d3076
leaq 0x28(%rsp), %r15
pushq $0x8
popq %rbx
pushq $0x1
popq %r12
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x22f0
movq (%r15), %rsi
shlq $0x2, %rsi
pushq $0x1
popq %rbp
movq %r14, %rdi
movl %ebp, %edx
callq 0x21b0
movq %r15, %rdi
movq %rbx, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x22f0
movq (%r15), %rsi
shlq $0x3, %rsi
movq %r14, %rdi
movl %ebp, %edx
movq 0x8(%rsp), %r15
callq 0x21b0
leaq 0x50(%r15), %rdi
movq %rdi, 0x10(%rsp)
movq %rbx, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x22f0
movq (%r15), %r8
cmpq 0x50(%r15), %r8
jne 0x1d33ab
cmpq 0x58(%r15), %r8
jbe 0x1d3179
decq %r8
movq %r8, %rax
shrq %rax
orq %r8, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x10, %rax
orq %rcx, %rax
incq %rax
movq %rax, 0x58(%r15)
movq 0x48(%r15), %rdi
imulq $0x58, %rax, %rsi
callq 0x2370
movq %rax, 0x48(%r15)
movq (%r15), %r8
movq 0x50(%r15), %rcx
jmp 0x1d317c
movq %r8, %rcx
movq 0x7fe5d(%rip), %rax     # 0x252fe0
movq (%rax), %rdi
leaq 0x28980(%rip), %rsi     # 0x1fbb0d
leaq 0x28999(%rip), %rdx     # 0x1fbb2d
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x22b0
pushq $0x40
popq %rbp
pushq $0x1
popq %r12
movq 0x10(%rsp), %rax
cmpq (%rax), %rbx
jae 0x1d339e
movq %rbx, (%rsp)
movq 0x8(%rsp), %rax
movq 0x48(%rax), %r13
leaq -0x40(,%rbp), %rbx
addq %r13, %rbx
leaq 0x10(%r13,%rbp), %rdi
movq %r12, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x22f0
leaq -0x28(,%rbp), %r15
addq %r13, %r15
movq %r15, %rdi
pushq $0x4
popq %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x22f0
movq %rbx, %rdi
pushq $0x8
popq %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x22f0
movq -0x18(%r15), %rdx
cmpq -0x10(%r15), %rdx
jbe 0x1d3269
decq %rdx
movq %rdx, %rax
shrq %rax
orq %rdx, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rsi
shrq $0x10, %rsi
orq %rcx, %rsi
incq %rsi
movq %rsi, -0x38(%r13,%rbp)
movq -0x30(%r13,%rbp), %rdi
callq 0x2370
movq %rax, %rdi
movq %rax, -0x30(%r13,%rbp)
movq -0x40(%r13,%rbp), %rdx
jmp 0x1d326e
movq -0x30(%r13,%rbp), %rdi
movq %r12, %rsi
movq %r14, %rcx
callq 0x22f0
leaq -0x20(,%rbp), %rbx
addq %r13, %rbx
movq %rbx, %rdi
pushq $0x8
popq %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x22f0
movq (%rbx), %rdx
cmpq 0x8(%rbx), %rdx
jbe 0x1d32f7
decq %rdx
movq %rdx, %rax
shrq %rax
orq %rdx, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x10, %rax
orq %rcx, %rax
incq %rax
movq %rax, -0x18(%r13,%rbp)
movq -0x10(%r13,%rbp), %rdi
imulq $0x24, %rax, %rsi
callq 0x2370
movq %rax, %rdi
movq %rax, -0x10(%r13,%rbp)
movq -0x20(%r13,%rbp), %rdx
jmp 0x1d32fc
movq -0x10(%r13,%rbp), %rdi
movq (%rsp), %rbx
pushq $0x24
popq %rsi
movq %r14, %rcx
callq 0x22f0
movq %r13, %rdi
addq %rbp, %rdi
pushq $0x8
popq %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x22f0
movq -0x8(%r13,%rbp), %rdi
movq (%r13,%rbp), %rdx
cmpq 0x8(%r13,%rbp), %rdx
jbe 0x1d3387
decq %rdx
movq %rdx, %rax
shrq %rax
orq %rdx, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x10, %rax
orq %rcx, %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%r13,%rbp)
leaq 0x4(,%rax,4), %rsi
callq 0x2370
movq %rax, %rdi
movq %rax, -0x8(%r13,%rbp)
movq (%r13,%rbp), %rdx
pushq $0x4
popq %rsi
movq %r14, %rcx
callq 0x22f0
incq %rbx
addq $0x58, %rbp
jmp 0x1d31a4
movq %r14, %rdi
callq 0x2190
jmp 0x1d2f99
leaq 0x28722(%rip), %rdi     # 0x1fbad4
leaq 0x24120(%rip), %rsi     # 0x1f74d9
leaq 0x28725(%rip), %rcx     # 0x1fbae5
movl $0x39dd, %edx           # imm = 0x39DD
callq 0x2110