// File: /workspace/github_cpp_makefile_star2_O3/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, 0x20(%rsp)
movl $0x1, %edi
movl $0x38, %esi
callq 0x2120
movq %rax, %rbx
callq 0xa0485
movq %rax, %r12
movq %rax, 0x18(%rbx)
movq 0x8(%r14), %r15
movq %r15, 0x8(%rbx)
movq %r15, (%rbx)
movl $0x28, %esi
movq %r15, %rdi
callq 0x2120
movq %rbx, 0x18(%rsp)
movq %rax, (%rsp)
movq %rax, 0x10(%rbx)
movq %r15, 0x8(%rsp)
testq %r15, %r15
je 0x225159
xorl %ebx, %ebx
movl $0x80000000, %r15d      # imm = 0x80000000
movl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
xorl %r13d, %r13d
movq %r14, 0x10(%rsp)
movq (%r14), %rax
imulq $0x78, %rbx, %rcx
movl 0x8(%rax,%rcx), %edx
movzbl 0x70(%rax,%rcx), %ecx
movq %r12, %rdi
movl %r13d, %esi
callq 0xa0887
movq 0x20(%r12), %rax
movq %rbx, 0x38(%rsp)
movb $0x0, 0x4(%rax,%rbx,8)
movq (%r14), %rax
movq %r13, 0x30(%rsp)
movl %r13d, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
imulq $0x78, %rcx, %rcx
movl 0x10(%rax,%rcx), %r14d
testq %r14, %r14
je 0x22500b
movq %rcx, 0x28(%rsp)
movq 0x20(%rax,%rcx), %r13
shlq $0x5, %r14
xorl %ebx, %ebx
cmpl $0x0, 0xc(%r13,%rbx)
js 0x224ff1
movl 0x4(%r12), %edx
movl %edx, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl (%r12), %ecx
jne 0x224f9c
leal (%rcx,%rcx), %eax
testl %ecx, %ecx
movl $0x10, %ecx
cmovel %ecx, %eax
movl %eax, (%r12)
movq 0x8(%r12), %rdi
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
callq 0x2370
movq %rax, 0x8(%r12)
movl 0x4(%r12), %edx
movl %edx, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
jmp 0x224fa1
movq 0x8(%r12), %rax
leal 0x1(%rdx), %esi
andl %ebp, %esi
andl %r15d, %edx
orl %esi, %edx
movl %edx, 0x4(%r12)
movl %ecx, %ecx
leaq (%rcx,%rcx,2), %rcx
xorps %xmm0, %xmm0
movups %xmm0, (%rax,%rcx,8)
movq $0x0, 0x10(%rax,%rcx,8)
movq (%r13,%rbx), %rdx
movq %rdx, (%rax,%rcx,8)
movl 0x8(%r13,%rbx), %edx
movl %edx, 0x8(%rax,%rcx,8)
movl 0xc(%r13,%rbx), %edx
andl %ebp, %edx
movl %edx, 0xc(%rax,%rcx,8)
movl 0xc(%r13,%rbx), %esi
andl %r15d, %esi
orl %edx, %esi
movl %esi, 0xc(%rax,%rcx,8)
addq $0x20, %rbx
cmpq %rbx, %r14
jne 0x224f46
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq 0x28(%rsp), %rcx
movl 0x28(%rax,%rcx), %r14d
testq %r14, %r14
je 0x2250dc
movq 0x38(%rax,%rcx), %r13
shlq $0x5, %r14
xorl %ebx, %ebx
cmpl $0x0, 0xc(%r13,%rbx)
js 0x2250cf
movl 0x4(%r12), %edx
movl %edx, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl (%r12), %ecx
jne 0x22507a
leal (%rcx,%rcx), %eax
testl %ecx, %ecx
movl $0x10, %ecx
cmovel %ecx, %eax
movl %eax, (%r12)
movq 0x8(%r12), %rdi
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
callq 0x2370
movq %rax, 0x8(%r12)
movl 0x4(%r12), %edx
movl %edx, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
jmp 0x22507f
movq 0x8(%r12), %rax
leal 0x1(%rdx), %esi
andl %ebp, %esi
andl %r15d, %edx
orl %esi, %edx
movl %edx, 0x4(%r12)
movl %ecx, %ecx
leaq (%rcx,%rcx,2), %rcx
xorps %xmm0, %xmm0
movups %xmm0, (%rax,%rcx,8)
movq $0x0, 0x10(%rax,%rcx,8)
movq (%r13,%rbx), %rdx
movq %rdx, (%rax,%rcx,8)
movl 0x8(%r13,%rbx), %edx
movl %edx, 0x8(%rax,%rcx,8)
movl 0xc(%r13,%rbx), %edx
andl %ebp, %edx
movl %edx, 0xc(%rax,%rcx,8)
movl 0xc(%r13,%rbx), %esi
andl %r15d, %esi
orl %edx, %esi
movl %esi, 0xc(%rax,%rcx,8)
addq $0x20, %rbx
cmpq %rbx, %r14
jne 0x225024
movq 0x20(%r12), %rax
movq 0x38(%rsp), %rbp
movl (%rax,%rbp,8), %ebx
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
leaq (,%rbp,4), %r14
addq %rbp, %r14
movq (%rsp), %r13
movl (%r13,%r14,8), %eax
andl %r15d, %eax
orl %ebx, %eax
movl %eax, (%r13,%r14,8)
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0xc(%r13,%r14,8)
movl $0x1, %edi
movl $0x8, %esi
callq 0x2120
movq %rax, 0x18(%r13,%r14,8)
shlq $0x21, %rbp
orq %rbx, %rbp
movq %rbp, (%rax)
movl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
movq 0x30(%rsp), %r13
incl %r13d
movq %r13, %rbx
movq 0x10(%rsp), %r14
cmpq %r13, 0x8(%r14)
ja 0x224ee9
movq %r12, %rdi
callq 0xa0a7d
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
cmpq $0x0, 0x8(%rsp)
je 0x2251fb
movq %r14, %r13
movl $0x1, %ebp
xorl %r14d, %r14d
movl $0x80000000, %ebx       # imm = 0x80000000
movq (%rsp), %rsi
movq 0x20(%r12), %rax
movb $0x0, 0x4(%rax,%r14,8)
leaq (%r14,%r14,4), %rax
cmpl $0x0, 0xc(%rsi,%rax,8)
je 0x2251e8
movq (%rsp), %rcx
leaq (%rcx,%rax,8), %r15
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x20(%rax), %rdx
movq %r15, %rdi
movq %r13, %rcx
leaq 0x40(%rsp), %r8
callq 0x21ecc9
movl (%r15), %eax
movq (%rsp), %rsi
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl %ecx, %eax
movq 0x20(%r12), %rcx
movl (%rcx,%r14,8), %edx
andl %ebx, %edx
orl %eax, %edx
movl %edx, (%rcx,%r14,8)
movl %ebp, %r14d
incl %ebp
cmpq %r14, 0x8(%rsp)
ja 0x22518e
movq 0x50(%rsp), %rdi
jmp 0x2251fd
xorl %edi, %edi
callq 0x2220
movq 0x18(%rsp), %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq