// File: /workspace/github_cpp_makefile_star2_O1/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, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x2090
leaq 0x64(%rax), %rdi
callq 0x2280
movq %rax, %r12
leaq 0x273e7(%rip), %rsi     # 0x23d81f
leaq 0x2090e(%rip), %rcx     # 0x236d4d
xorl %r15d, %r15d
movq %rax, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x1d151(%rip), %rsi     # 0x2335a7
movq %r12, %rdi
callq 0x2210
movq %rax, %r14
movq %r12, %rdi
callq 0x2220
testq %r14, %r14
jne 0x216480
movq %r15, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, 0x8(%rsp)
leaq 0x20(%rsp), %r15
movl $0x8, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0x22f0
movq (%r15), %rbx
testq %rbx, %rbx
je 0x216546
leaq 0x34(%rsp), %r15
leaq 0x38(%rsp), %r12
leaq 0x40(%rsp), %r13
leaq 0x1c(%rsp), %rbp
movl $0x4, %esi
movl $0x1, %edx
movq %rbp, %rdi
movq %r14, %rcx
callq 0x22f0
movl $0x4, %esi
movl $0x1, %edx
movq %rbp, %rdi
movq %r14, %rcx
callq 0x22f0
movl $0x4, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0x22f0
movl $0x4, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %r14, %rcx
callq 0x22f0
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %r14, %rcx
callq 0x22f0
movl 0x40(%rsp), %esi
shlq $0x3, %rsi
movq %r14, %rdi
movl $0x1, %edx
callq 0x21b0
decq %rbx
jne 0x2164bf
movl $0x8, %ebx
movl $0x8, %esi
movq %r14, %rdi
movl $0x1, %edx
callq 0x21b0
movq 0x8(%rsp), %r12
cmpq $0x0, (%r12)
je 0x2165a0
xorl %r15d, %r15d
movl $0x4, %esi
movq %r14, %rdi
movl $0x1, %edx
callq 0x21b0
movq 0x10(%r12), %rax
movl (%rax,%rbx), %esi
movq %r14, %rdi
movl $0x1, %edx
callq 0x21b0
incq %r15
addq $0x10, %rbx
cmpq (%r12), %r15
jb 0x21656c
leaq 0x28(%rsp), %r15
movl $0x8, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0x22f0
movq (%r15), %rsi
shlq $0x2, %rsi
movq %r14, %rdi
movl $0x1, %edx
callq 0x21b0
movl $0x8, %esi
movl $0x1, %edx
movq %r15, %rdi
movq %r14, %rcx
callq 0x22f0
movq (%r15), %rsi
shlq $0x3, %rsi
movq %r14, %rdi
movl $0x1, %edx
callq 0x21b0
leaq 0x50(%r12), %rdi
movl $0x8, %esi
movl $0x1, %edx
movq %rdi, 0x10(%rsp)
movq %r14, %rcx
callq 0x22f0
movq 0x50(%r12), %rax
cmpq %rax, (%r12)
jne 0x2168c7
cmpq 0x58(%r12), %rax
jbe 0x216678
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
incq %rcx
movq %rcx, 0x58(%r12)
movq 0x48(%r12), %rdi
imulq $0x58, %rcx, %rsi
callq 0x2370
movq %rax, 0x48(%r12)
movq 0x73961(%rip), %rax     # 0x289fe0
movq (%rax), %rdi
movl (%r12), %r8d
movl 0x50(%r12), %ecx
leaq 0x271d8(%rip), %rsi     # 0x23d86a
leaq 0x271f1(%rip), %rdx     # 0x23d88a
xorl %eax, %eax
callq 0x22b0
cmpq $0x0, 0x50(%r12)
je 0x2168b4
movl $0x40, %ebp
xorl %ebx, %ebx
movq 0x48(%r12), %r15
leaq (%r15,%rbp), %r12
addq $-0x40, %r12
leaq 0x10(%r15,%rbp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x22f0
leaq (%r15,%rbp), %r13
addq $-0x28, %r13
movl $0x4, %esi
movl $0x1, %edx
movq %r13, %rdi
movq %r14, %rcx
callq 0x22f0
movl $0x8, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %r14, %rcx
callq 0x22f0
movq -0x18(%r13), %rax
cmpq -0x10(%r13), %rax
jbe 0x21675e
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, -0x38(%r15,%rbp)
movq -0x30(%r15,%rbp), %rdi
callq 0x2370
movq %rax, -0x30(%r15,%rbp)
leaq (%r15,%rbp), %r12
addq $-0x20, %r12
movq -0x20(%r12), %rdx
movq -0x10(%r12), %rdi
movl $0x1, %esi
movq %r14, %rcx
callq 0x22f0
movl $0x8, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %r14, %rcx
callq 0x22f0
movq (%r12), %rax
cmpq 0x8(%r12), %rax
jbe 0x2167f5
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x1(%rcx), %rax
movq %rax, -0x18(%r15,%rbp)
movq -0x10(%r15,%rbp), %rdi
leaq 0x4(,%rcx,4), %rax
leaq (%rax,%rax,8), %rsi
callq 0x2370
movq %rax, -0x10(%r15,%rbp)
leaq (%r15,%rbp), %r12
movq -0x20(%r15,%rbp), %rdx
movq -0x10(%r15,%rbp), %rdi
movl $0x24, %esi
movq %r14, %rcx
callq 0x22f0
movl $0x8, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %r14, %rcx
callq 0x22f0
movq (%r15,%rbp), %rax
cmpq 0x8(%r15,%rbp), %rax
movq 0x8(%rsp), %r12
jbe 0x216889
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x1(%rcx), %rax
movq %rax, 0x8(%r15,%rbp)
movq -0x8(%r15,%rbp), %rdi
leaq 0x4(,%rcx,4), %rsi
callq 0x2370
movq %rax, -0x8(%r15,%rbp)
movq -0x8(%r15,%rbp), %rdi
movq (%r15,%rbp), %rdx
movl $0x4, %esi
movq %r14, %rcx
callq 0x22f0
incq %rbx
addq $0x58, %rbp
movq 0x10(%rsp), %rax
cmpq (%rax), %rbx
jb 0x2166b3
movq %r14, %rdi
callq 0x2190
movl $0x1, %r15d
jmp 0x21646e
leaq 0x26f63(%rip), %rdi     # 0x23d831
leaq 0x22a50(%rip), %rsi     # 0x239325
leaq 0x26f66(%rip), %rcx     # 0x23d842
movl $0x39dd, %edx           # imm = 0x39DD
callq 0x2110