// File: /workspace/github_cpp_makefile_star2_O2/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, %rbx
movq %rdi, 0x28(%rsp)
pushq $0x1
popq %rdi
pushq $0x38
popq %rsi
callq 0x2120
movq %rax, %r14
callq 0x68f5d
movq %rax, %r12
movq %rax, 0x18(%r14)
movq %rbx, 0x8(%rsp)
movq 0x8(%rbx), %rbx
movq %rbx, 0x8(%r14)
movq %rbx, (%r14)
pushq $0x28
popq %rsi
movq %rbx, %rdi
callq 0x2120
movq %r14, 0x20(%rsp)
movq %rax, 0x10(%rsp)
movq %rax, 0x10(%r14)
xorl %eax, %eax
movl $0x80000000, %r13d      # imm = 0x80000000
movl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
movq %rbx, 0x30(%rsp)
movl %eax, %r15d
cmpq %r15, %rbx
jbe 0x1d5ffa
movq 0x8(%rsp), %rbx
movq (%rbx), %rax
imulq $0x78, %r15, %rcx
movl 0x8(%rax,%rcx), %edx
movzbl 0x70(%rax,%rcx), %ecx
movq %r12, %rdi
movl %r15d, %esi
callq 0x69316
movq 0x20(%r12), %rax
movb $0x0, 0x4(%rax,%r15,8)
movq (%rbx), %rax
movq %r15, 0x18(%rsp)
movl %r15d, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
imulq $0x78, %rcx, %rcx
movq 0x20(%rax,%rcx), %rbp
movq %rcx, 0x38(%rsp)
movl 0x10(%rax,%rcx), %ebx
shlq $0x5, %rbx
xorl %r15d, %r15d
cmpq %r15, %rbx
je 0x1d5f22
cmpl $0x0, 0xc(%rbp,%r15)
js 0x1d5f1c
movq %r12, %rdi
callq 0x1ab555
andq $0x0, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq (%rbp,%r15), %rcx
movq %rcx, (%rax)
movl 0x8(%rbp,%r15), %ecx
movl %ecx, 0x8(%rax)
movl 0xc(%rbp,%r15), %ecx
andl %r14d, %ecx
movl %ecx, 0xc(%rax)
movl 0xc(%rbp,%r15), %edx
andl %r13d, %edx
orl %ecx, %edx
movl %edx, 0xc(%rax)
addq $0x20, %r15
jmp 0x1d5ed4
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq 0x38(%rsp), %rcx
movq 0x38(%rax,%rcx), %rbp
movl 0x28(%rax,%rcx), %ebx
shlq $0x5, %rbx
xorl %r15d, %r15d
cmpq %r15, %rbx
je 0x1d5f8d
cmpl $0x0, 0xc(%rbp,%r15)
js 0x1d5f87
movq %r12, %rdi
callq 0x1ab555
andq $0x0, 0x10(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq (%rbp,%r15), %rcx
movq %rcx, (%rax)
movl 0x8(%rbp,%r15), %ecx
movl %ecx, 0x8(%rax)
movl 0xc(%rbp,%r15), %ecx
andl %r14d, %ecx
movl %ecx, 0xc(%rax)
movl 0xc(%rbp,%r15), %edx
andl %r13d, %edx
orl %ecx, %edx
movl %edx, 0xc(%rax)
addq $0x20, %r15
jmp 0x1d5f3f
movq 0x20(%r12), %rax
movq 0x18(%rsp), %rcx
movl (%rax,%rcx,8), %ebx
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
imulq $0x28, %rcx, %r15
movq 0x10(%rsp), %rbp
movl (%rbp,%r15), %eax
andl %r13d, %eax
orl %ebx, %eax
movl %eax, (%rbp,%r15)
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0xc(%rbp,%r15)
pushq $0x1
popq %rdi
pushq $0x8
popq %rsi
callq 0x2120
movq %rax, 0x18(%rbp,%r15)
movq 0x18(%rsp), %rdx
movq %rdx, %rcx
shlq $0x21, %rcx
orq %rbx, %rcx
movq %rcx, (%rax)
leal 0x1(%rdx), %eax
movq 0x8(%rsp), %rcx
movq 0x8(%rcx), %rbx
jmp 0x1d5e73
movq %r12, %rdi
callq 0x694eb
xorps %xmm0, %xmm0
leaq 0x40(%rsp), %r15
movaps %xmm0, 0x10(%r15)
movaps %xmm0, (%r15)
xorl %ebx, %ebx
movl $0x80000000, %r14d      # imm = 0x80000000
movq 0x10(%rsp), %rbp
movl %ebx, %ebx
cmpq %rbx, 0x30(%rsp)
jbe 0x1d607e
movq 0x20(%r12), %rax
movb $0x0, 0x4(%rax,%rbx,8)
imulq $0x28, %rbx, %r13
cmpl $0x0, 0xc(%rbp,%r13)
je 0x1d607a
addq %rbp, %r13
movq 0x28(%rsp), %rax
movq 0x18(%rax), %rsi
movq 0x20(%rax), %rdx
movq %r13, %rdi
movq 0x8(%rsp), %rcx
movq %r15, %r8
callq 0x1cfe19
movl (%r13), %eax
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl %ecx, %eax
movq 0x20(%r12), %rcx
movl (%rcx,%rbx,8), %edx
andl %r14d, %edx
orl %eax, %edx
movl %edx, (%rcx,%rbx,8)
incl %ebx
jmp 0x1d6020
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