// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: gen_debug_hybrid_ug(ul_resolve_t*, usg_t*)
ma_ug_t *gen_debug_hybrid_ug(ul_resolve_t *uidx, usg_t *ng)
{
    ma_ug_t *ug = NULL; uint32_t k, nv, z; usg_arc_t *av; asg_arc_t *p;
    CALLOC(ug, 1); ug->g = asg_init(); 
    ug->u.n = ug->u.m = ng->n; CALLOC(ug->u.a, ug->u.n);
    for (k = 0; k < ng->n; k++) {
        asg_seq_set(ug->g, k, ng->a[k].len, ng->a[k].del);
        ug->g->seq[k].c = 0;

        av = usg_arc_a(ng, (k<<1)); nv = usg_arc_n(ng, (k<<1));
        for (z = 0; z < nv; z++) {
            if(av[z].del) continue;
            p = asg_arc_pushp(ug->g); memset(p, 0, sizeof((*p)));
            p->ul = av[z].ul; p->v = av[z].v; p->ol = av[z].ol; p->del = av[z].del;
        }

        av = usg_arc_a(ng, (k<<1)+1); nv = usg_arc_n(ng, (k<<1)+1);
        for (z = 0; z < nv; z++) {
            if(av[z].del) continue;
            p = asg_arc_pushp(ug->g); memset(p, 0, sizeof((*p)));
            p->ul = av[z].ul; p->v = av[z].v; p->ol = av[z].ol; p->del = av[z].del;
        }

        ug->u.a[k].len = ug->g->seq[k].len; 
        ug->u.a[k].n = ug->u.a[k].m = 1; CALLOC(ug->u.a[k].a, 1); 
        ug->u.a[k].a[0] = (((uint64_t)k)<<33)|((uint64_t)(ug->u.a[k].len));
    }
    asg_cleanup(ug->g);
    

    uint32_t i; ma_utg_t *u; kvec_asg_arc_t_warp e; kv_init(e.a); e.i = 0;
    for (i = 0; i < ug->u.n; i++) {
        ug->g->seq[i].c = PRIMARY_LABLE;
        u = &(ug->u.a[i]);
        if(u->m == 0) continue;
        merge_hybrid_utg_content(u, uidx->l1_ug, uidx->sg, ng, &e);
        ug->g->seq[i].len = u->len;
    }
    kv_destroy(e.a);
    return ug;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, %r14
movq %rdi, 0x28(%rsp)
movl $0x1, %edi
movl $0x38, %esi
callq 0x2120
movq %rax, %rbx
callq 0x9fccc
movq %rax, %r12
movq %rax, 0x18(%rbx)
movq 0x8(%r14), %rdi
movq %rdi, 0x8(%rbx)
movq %rdi, (%rbx)
movl $0x28, %esi
movq %rdi, 0x18(%rsp)
callq 0x2120
movq %rbx, 0x20(%rsp)
movq %rax, (%rsp)
movq %rax, 0x10(%rbx)
cmpq $0x0, 0x8(%r14)
movq %r14, 0x10(%rsp)
je 0x219c2d
xorl %r15d, %r15d
movl $0x80000000, %r13d      # imm = 0x80000000
movl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
xorl %ebp, %ebp
movq (%r14), %rax
imulq $0x78, %r15, %rcx
movl 0x8(%rax,%rcx), %edx
movzbl 0x70(%rax,%rcx), %ecx
movq %r12, %rdi
movl %ebp, %esi
callq 0xa0115
movq 0x20(%r12), %rax
movq %r15, 0x38(%rsp)
movb $0x0, 0x4(%rax,%r15,8)
movq (%r14), %rax
movq %rbp, 0x30(%rsp)
movl %ebp, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
imulq $0x78, %rcx, %rcx
movq %rcx, 0x8(%rsp)
movl 0x10(%rax,%rcx), %ebp
testq %rbp, %rbp
je 0x219ad7
movq 0x8(%rsp), %rcx
movq 0x20(%rax,%rcx), %r15
shlq $0x5, %rbp
xorl %r14d, %r14d
cmpl $0x0, 0xc(%r15,%r14)
js 0x219aca
movl 0x4(%r12), %ecx
andl %ebx, %ecx
movl (%r12), %eax
cmpl %eax, %ecx
jne 0x219a62
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x10, %eax
cmovel %eax, %ecx
movl %ecx, (%r12)
movq 0x8(%r12), %rdi
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rsi
callq 0x2370
movq %rax, 0x8(%r12)
movq 0x8(%r12), %rax
movl 0x4(%r12), %ecx
movl %ecx, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
leal 0x1(%rcx), %esi
andl %ebx, %esi
andl %r13d, %ecx
orl %esi, %ecx
movl %ecx, 0x4(%r12)
leaq (%rdx,%rdx,2), %rcx
xorps %xmm0, %xmm0
movups %xmm0, (%rax,%rcx,8)
movq $0x0, 0x10(%rax,%rcx,8)
movq (%r15,%r14), %rdx
movq %rdx, (%rax,%rcx,8)
movl 0x8(%r15,%r14), %edx
movl %edx, 0x8(%rax,%rcx,8)
movl 0xc(%r15,%r14), %edx
andl %ebx, %edx
movl 0xc(%rax,%rcx,8), %esi
andl %r13d, %esi
orl %edx, %esi
movl %esi, 0xc(%rax,%rcx,8)
movl 0xc(%r15,%r14), %esi
andl %r13d, %esi
orl %edx, %esi
movl %esi, 0xc(%rax,%rcx,8)
addq $0x20, %r14
cmpq %r14, %rbp
jne 0x219a1f
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq 0x8(%rsp), %rcx
movl 0x28(%rax,%rcx), %ebp
testq %rbp, %rbp
je 0x219bb5
movq 0x38(%rax,%rcx), %r15
shlq $0x5, %rbp
xorl %r14d, %r14d
cmpl $0x0, 0xc(%r15,%r14)
js 0x219ba8
movl 0x4(%r12), %ecx
andl %ebx, %ecx
movl (%r12), %eax
cmpl %eax, %ecx
jne 0x219b40
leal (%rax,%rax), %ecx
testl %eax, %eax
movl $0x10, %eax
cmovel %eax, %ecx
movl %ecx, (%r12)
movq 0x8(%r12), %rdi
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rsi
callq 0x2370
movq %rax, 0x8(%r12)
movq 0x8(%r12), %rax
movl 0x4(%r12), %ecx
movl %ecx, %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
leal 0x1(%rcx), %esi
andl %ebx, %esi
andl %r13d, %ecx
orl %esi, %ecx
movl %ecx, 0x4(%r12)
leaq (%rdx,%rdx,2), %rcx
xorps %xmm0, %xmm0
movups %xmm0, (%rax,%rcx,8)
movq $0x0, 0x10(%rax,%rcx,8)
movq (%r15,%r14), %rdx
movq %rdx, (%rax,%rcx,8)
movl 0x8(%r15,%r14), %edx
movl %edx, 0x8(%rax,%rcx,8)
movl 0xc(%r15,%r14), %edx
andl %ebx, %edx
movl 0xc(%rax,%rcx,8), %esi
andl %r13d, %esi
orl %edx, %esi
movl %esi, 0xc(%rax,%rcx,8)
movl 0xc(%r15,%r14), %esi
andl %r13d, %esi
orl %edx, %esi
movl %esi, 0xc(%rax,%rcx,8)
addq $0x20, %r14
cmpq %r14, %rbp
jne 0x219afd
movq 0x20(%r12), %rax
movq 0x38(%rsp), %r14
movl (%rax,%r14,8), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movq %rcx, 0x8(%rsp)
leaq (%r14,%r14,4), %r15
movq (%rsp), %rbp
movl (%rbp,%r15,8), %eax
andl %r13d, %eax
orl %ecx, %eax
movl %eax, (%rbp,%r15,8)
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0xc(%rbp,%r15,8)
movl $0x1, %edi
movl $0x8, %esi
callq 0x2120
movq %rax, 0x18(%rbp,%r15,8)
shlq $0x21, %r14
addq 0x8(%rsp), %r14
movq %r14, (%rax)
movq 0x30(%rsp), %rbp
incl %ebp
movq %rbp, %r15
movq 0x10(%rsp), %r14
cmpq %rbp, 0x8(%r14)
ja 0x2199be
movq %r12, %rdi
callq 0xa02fa
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
cmpq $0x0, 0x18(%rsp)
movq (%rsp), %rsi
je 0x219cc6
movl $0x1, %ebx
xorl %r15d, %r15d
movl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
movl $0x80000000, %r14d      # imm = 0x80000000
movq 0x20(%r12), %rax
movb $0x0, 0x4(%rax,%r15,8)
leaq (%r15,%r15,4), %rax
cmpl $0x0, 0xc(%rsi,%rax,8)
je 0x219cba
movq (%rsp), %rcx
leaq (%rcx,%rax,8), %r13
movq 0x28(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x20(%rax), %rdx
movq %r13, %rdi
movq 0x10(%rsp), %rcx
leaq 0x40(%rsp), %r8
callq 0x213850
movl (%r13), %eax
movq (%rsp), %rsi
andl %ebp, %eax
movq 0x20(%r12), %rcx
movl (%rcx,%r15,8), %edx
andl %r14d, %edx
orl %eax, %edx
movl %edx, (%rcx,%r15,8)
movl %ebx, %r15d
incl %ebx
cmpq %r15, 0x18(%rsp)
ja 0x219c61
movq 0x50(%rsp), %rdi
callq 0x2220
movq 0x20(%rsp), %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq