// File: chhylp123[P]hifiasm/Overlaps.cpp
// Function: merge_utgs(ma_ug_t*, ma_ug_t*)
ma_ug_t *merge_utgs(ma_ug_t *in0, ma_ug_t *in1)
{
    uint64_t k, m[2]; ma_utg_t *su = NULL, *du = NULL;
    m[0] = ((uint64_t)(in0->g->n_seq))<<1;
    m[1] = ((uint64_t)(in0->g->n_seq))<<33;
    ma_ug_t *ug = NULL; CALLOC(ug, 1); ug->g = asg_init();
    ug->g->n_F_seq = in0->g->n_F_seq + in1->g->n_F_seq;
    ug->g->r_seq = in0->g->r_seq + in1->g->r_seq;
    ug->g->m_seq = ug->g->n_seq = in0->g->n_seq + in1->g->n_seq;
    MALLOC(ug->g->seq, ug->g->n_seq);
    memcpy(ug->g->seq, in0->g->seq, sizeof((*(ug->g->seq)))*in0->g->n_seq);
    memcpy(ug->g->seq+in0->g->n_seq, in1->g->seq, sizeof((*(ug->g->seq)))*in1->g->n_seq);

    ug->g->m_arc = ug->g->n_arc = in0->g->n_arc + in1->g->n_arc;
    MALLOC(ug->g->arc, ug->g->n_arc);
    memcpy(ug->g->arc, in0->g->arc, sizeof((*(ug->g->arc)))*in0->g->n_arc);
    for(k = 0; k < in1->g->n_arc; k++) {
        ug->g->arc[k+in0->g->n_arc] = in1->g->arc[k];
        ug->g->arc[k+in0->g->n_arc].v += m[0];
        ug->g->arc[k+in0->g->n_arc].ul += m[1];
    }
    asg_cleanup(ug->g); asg_symm(ug->g);

    ug->u.m = ug->u.n = in0->u.n + in1->u.n;
    MALLOC(ug->u.a, ug->u.n);
    for (k = 0; k < in0->u.n; k++) {
        su = &(in0->u.a[k]); du = &(ug->u.a[k]);
        (*du) = (*su);
        du->s = NULL; du->a = NULL; du->m = du->n = su->n;
        MALLOC(du->a, du->n); memcpy(du->a, su->a, sizeof((*(du->a)))*du->n);
    }
    for (k = 0; k < in1->u.n; k++) {
        su = &(in1->u.a[k]); du = &(ug->u.a[k + in0->u.n]);
        (*du) = (*su);
        du->s = NULL; du->a = NULL; du->m = du->n = su->n;
        MALLOC(du->a, du->n); memcpy(du->a, su->a, sizeof((*(du->a)))*du->n);
    }

    return ug;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
shlq %rax
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
shlq $0x21, %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0x48(%rbp)
movl $0x1, %edi
movl $0x38, %esi
callq 0x2140
movq %rax, -0x48(%rbp)
callq 0xcd150
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x38(%rax), %ecx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
addl 0x38(%rax), %ecx
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movl %ecx, 0x38(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x18(%rax), %ecx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
addl 0x18(%rax), %ecx
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movl %ecx, 0x18(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x14(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
addl %eax, %ecx
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x14(%rax), %edx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl $0x80000000, %edx       # imm = 0x80000000
orl %ecx, %edx
movl %edx, 0x14(%rax)
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movl %ecx, 0x10(%rax)
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %edi
shlq $0x3, %rdi
callq 0x2270
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movq %rcx, 0x20(%rax)
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rsi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %edx
shlq $0x3, %rdx
callq 0x2180
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cltq
shlq $0x3, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rax), %rsi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x14(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %edx
shlq $0x3, %rdx
callq 0x2180
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x4(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x4(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
addl %eax, %ecx
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x4(%rax), %edx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl $0x80000000, %edx       # imm = 0x80000000
orl %ecx, %edx
movl %edx, 0x4(%rax)
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movl %ecx, (%rax)
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x4(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
imulq $0x18, %rax, %rdi
callq 0x2270
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movq %rcx, 0x8(%rax)
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rsi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movl 0x4(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
imulq $0x18, %rax, %rdx
callq 0x2180
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x18(%rcx), %rcx
movl 0x4(%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %ecx, %ecx
cmpq %rcx, %rax
jae 0x12fe90
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rcx
imulq $0x18, -0x18(%rbp), %rax
addq %rax, %rcx
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rdx
movq -0x8(%rbp), %rsi
movq 0x18(%rsi), %rsi
movl 0x4(%rsi), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movl %esi, %esi
addq %rsi, %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rcx
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rdx
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rsi
movq 0x18(%rsi), %rsi
movl 0x4(%rsi), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movl %esi, %esi
addq %rsi, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
addq %rdx, %rcx
movl %ecx, 0x8(%rax)
movq -0x28(%rbp), %rcx
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rax
movq -0x18(%rbp), %rdx
movq -0x8(%rbp), %rsi
movq 0x18(%rsi), %rsi
movl 0x4(%rsi), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movl %esi, %esi
addq %rsi, %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
addq (%rax), %rcx
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x12fd97
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xcdd10
movq -0x48(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0xce020
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
addq (%rax), %rcx
movq -0x48(%rbp), %rax
movq %rcx, (%rax)
movq -0x48(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x48(%rbp), %rax
imulq $0x28, (%rax), %rdi
callq 0x2270
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x10(%rax)
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x12ffaf
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x28, -0x18(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x28, -0x18(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdi
movl $0x28, %edx
callq 0x2180
movq -0x40(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x40(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x38(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x40(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x40(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %edi
shlq $0x3, %rdi
callq 0x2270
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x40(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %edx
shlq $0x3, %rdx
callq 0x2180
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x12fee7
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x130089
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x28, -0x18(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x18(%rbp), %rcx
movq -0x8(%rbp), %rdx
addq (%rdx), %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdi
movl $0x28, %edx
callq 0x2180
movq -0x40(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x40(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x38(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x40(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x40(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %edi
shlq $0x3, %rdi
callq 0x2270
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x40(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x40(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, %edx
shlq $0x3, %rdx
callq 0x2180
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x12ffb7
movq -0x48(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)