// File: chhylp123[P]hifiasm/gfa_ut.cpp
// Function: append_integer_seq_frag(ma_ug_t*, uc_block_t*, poa_g_t*, long, long, unsigned long*, long, unsigned long, long, long)
void append_integer_seq_frag(ma_ug_t *ug, uc_block_t *raw, poa_g_t *g, int64_t g_beg, int64_t g_end, uint64_t *str, int64_t str_occ, uint64_t is_rev, int64_t str_id, int64_t str_off)
{
    // if(str_occ <= 0) return;
    uint32_t nid; 
    // if((g_beg >= 0 || g_end >= 0) && str_occ < 2) return;
    if(g_beg < 0 && g_end < 0) {//add new nodes
        insert_poa_nodes_0(ug, raw, g, str, str_occ, is_rev, str_id, str_off);
        return;
    }

    if(g_beg < 0 && g_end >= 0) {///add nodes to the left end
        assert(str_occ >= 1);
        update_poa_nid_occ(ug, raw, g, g_end, str, (is_rev?(0):(str_occ-1)), is_rev);
        if(str_occ < 2) return;
        insert_poa_nodes_0(ug, raw, g, (is_rev?(str+1):(str)), str_occ-1, is_rev, str_id, str_off+(is_rev?(1):(0)));
        
        push_poa_arch_0(g, g->seq.n-1, g_end, str_id, str_off + (is_rev?(1):(str_occ-2)), 
                                                                str_off + (is_rev?(0):(str_occ-1)));
        return;
    }

    if(g_beg >= 0 && g_end < 0) {///add nodes to the right end
        assert(str_occ >= 1);
        update_poa_nid_occ(ug, raw, g, g_beg, str, (is_rev?(str_occ-1):(0)), is_rev);
        if(str_occ < 2) return;
        nid = g->seq.n;///backup
        insert_poa_nodes_0(ug, raw, g, (is_rev?(str):(str+1)), str_occ-1, is_rev, str_id, str_off+(is_rev?(0):(1)));
        push_poa_arch_0(g, g_beg, nid, str_id, str_off + (is_rev?(str_occ-1):(0)), 
                                                        str_off + (is_rev?(str_occ-2):(1)));
        return;
    }

    if(g_beg >= 0 && g_end >= 0) {///add nodes to the middle
        assert(str_occ >= 2);
        update_poa_nid_occ(ug, raw, g, g_beg, str, (is_rev?(str_occ-1):(0)), is_rev);
        update_poa_nid_occ(ug, raw, g, g_end, str, (is_rev?(0):(str_occ-1)), is_rev);
        if(str_occ > 2) {///insert new nodes
            nid = g->seq.n;///backup
            insert_poa_nodes_0(ug, raw, g, str+1, str_occ-2, is_rev, str_id, str_off+1);
            push_poa_arch_0(g, g_beg, nid, str_id, str_off + (is_rev?(str_occ-1):(0)),
                                                            str_off + (is_rev?(str_occ-2):(1))); 
            push_poa_arch_0(g, g->seq.n-1, g_end, str_id, str_off + (is_rev?(1):(str_occ-2)),
                                                            str_off + (is_rev?(0):(str_occ-1)));
        } else {
            ///add an edge between g_beg and g_end
            update_poa_arch_0(g, g_beg, g_end, str_id, str_off + (is_rev?(str_occ-1):(0)), 
                                                        str_off + (is_rev?(0):(str_occ-1)));
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x290, %rsp            # imm = 0x290
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq %rdx, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
movq %r8, -0x38(%rbp)
movq %r9, -0x40(%rbp)
cmpq $0x0, -0x30(%rbp)
jge 0x330237
cmpq $0x0, -0x38(%rbp)
jge 0x330237
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x40(%rbp), %rcx
movq 0x10(%rbp), %r8
movq 0x18(%rbp), %r9
movq 0x20(%rbp), %r10
movq 0x28(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x32f6e0
jmp 0x330af5
cmpq $0x0, -0x30(%rbp)
jge 0x33045f
cmpq $0x0, -0x38(%rbp)
jl 0x33045f
cmpq $0x1, 0x10(%rbp)
jl 0x330256
jmp 0x330275
leaq 0x67762(%rip), %rdi     # 0x3979bf
leaq 0x65f55(%rip), %rsi     # 0x3961b9
movl $0x15c7, %edx           # imm = 0x15C7
leaq 0x6775c(%rip), %rcx     # 0x3979cc
callq 0x2130
movq -0x18(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, 0x18(%rbp)
je 0x3302ac
xorl %eax, %eax
movq %rax, -0x78(%rbp)
jmp 0x3302b8
movq 0x10(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x78(%rbp)
movq -0x50(%rbp), %r8
movq -0x58(%rbp), %rcx
movq -0x60(%rbp), %rdx
movq -0x68(%rbp), %rsi
movq -0x70(%rbp), %rdi
movq -0x78(%rbp), %r9
movq 0x18(%rbp), %rax
movq %rax, (%rsp)
callq 0x32f550
cmpq $0x2, 0x10(%rbp)
jge 0x3302e9
jmp 0x330af5
movq -0x18(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x80(%rbp)
cmpq $0x0, 0x18(%rbp)
je 0x33031f
movq -0x40(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x98(%rbp)
jmp 0x33032a
movq -0x40(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x80(%rbp), %rdx
movq -0x88(%rbp), %rsi
movq -0x90(%rbp), %rdi
movq -0x98(%rbp), %rcx
movq 0x10(%rbp), %r8
subq $0x1, %r8
movq 0x18(%rbp), %r9
movq 0x20(%rbp), %r10
movq 0x28(%rbp), %rax
movq 0x18(%rbp), %r14
xorl %r11d, %r11d
movl $0x1, %ebx
cmpq $0x0, %r14
cmovnel %ebx, %r11d
movslq %r11d, %r11
addq %r11, %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x32f6e0
movq -0x28(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
subq $0x1, %rax
movl %eax, -0xb0(%rbp)
movq -0x38(%rbp), %rax
movl %eax, -0xac(%rbp)
movq 0x20(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq 0x28(%rbp), %rax
movq %rax, -0xa0(%rbp)
cmpq $0x0, 0x18(%rbp)
je 0x3303d0
movl $0x1, %eax
movq %rax, -0xc0(%rbp)
jmp 0x3303df
movq 0x10(%rbp), %rax
subq $0x2, %rax
movq %rax, -0xc0(%rbp)
movq -0xa0(%rbp), %rax
movq -0xc0(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0xd0(%rbp)
movq 0x28(%rbp), %rax
movq %rax, -0xc8(%rbp)
cmpq $0x0, 0x18(%rbp)
je 0x330414
xorl %eax, %eax
movq %rax, -0xd8(%rbp)
jmp 0x330423
movq 0x10(%rbp), %rax
subq $0x1, %rax
movq %rax, -0xd8(%rbp)
movq -0xd0(%rbp), %r8
movq -0xa8(%rbp), %rcx
movl -0xac(%rbp), %edx
movl -0xb0(%rbp), %esi
movq -0xb8(%rbp), %rdi
movq -0xc8(%rbp), %r9
movq -0xd8(%rbp), %rax
addq %rax, %r9
callq 0x32fc10
jmp 0x330af5
cmpq $0x0, -0x30(%rbp)
jl 0x3306bc
cmpq $0x0, -0x38(%rbp)
jge 0x3306bc
cmpq $0x1, 0x10(%rbp)
jl 0x33047e
jmp 0x33049d
leaq 0x6753a(%rip), %rdi     # 0x3979bf
leaq 0x65d2d(%rip), %rsi     # 0x3961b9
movl $0x15d2, %edx           # imm = 0x15D2
leaq 0x67534(%rip), %rcx     # 0x3979cc
callq 0x2130
movq -0x18(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0xe0(%rbp)
cmpq $0x0, 0x18(%rbp)
je 0x3304ec
movq 0x10(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x108(%rbp)
jmp 0x3304f7
xorl %eax, %eax
movq %rax, -0x108(%rbp)
jmp 0x3304f7
movq -0xe0(%rbp), %r8
movq -0xe8(%rbp), %rcx
movq -0xf0(%rbp), %rdx
movq -0xf8(%rbp), %rsi
movq -0x100(%rbp), %rdi
movq -0x108(%rbp), %r9
movq 0x18(%rbp), %rax
movq %rax, (%rsp)
callq 0x32f550
cmpq $0x2, 0x10(%rbp)
jge 0x33053a
jmp 0x330af5
movq -0x28(%rbp), %rax
movq (%rax), %rax
movl %eax, -0x44(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x110(%rbp)
cmpq $0x0, 0x18(%rbp)
je 0x330579
movq -0x40(%rbp), %rax
movq %rax, -0x128(%rbp)
jmp 0x330588
movq -0x40(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x128(%rbp)
movq -0x110(%rbp), %rdx
movq -0x118(%rbp), %rsi
movq -0x120(%rbp), %rdi
movq -0x128(%rbp), %rcx
movq 0x10(%rbp), %r8
subq $0x1, %r8
movq 0x18(%rbp), %r9
movq 0x20(%rbp), %r10
movq 0x28(%rbp), %rax
movq 0x18(%rbp), %r14
movl $0x1, %r11d
xorl %ebx, %ebx
cmpq $0x0, %r14
cmovnel %ebx, %r11d
movslq %r11d, %r11
addq %r11, %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x32f6e0
movq -0x28(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0x30(%rbp), %rax
movl %eax, -0x140(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x13c(%rbp)
movq 0x20(%rbp), %rax
movq %rax, -0x138(%rbp)
movq 0x28(%rbp), %rax
movq %rax, -0x130(%rbp)
cmpq $0x0, 0x18(%rbp)
je 0x33062c
movq 0x10(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x150(%rbp)
jmp 0x330637
xorl %eax, %eax
movq %rax, -0x150(%rbp)
jmp 0x330637
movq -0x130(%rbp), %rax
movq -0x150(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x160(%rbp)
movq 0x28(%rbp), %rax
movq %rax, -0x158(%rbp)
cmpq $0x0, 0x18(%rbp)
je 0x330672
movq 0x10(%rbp), %rax
subq $0x2, %rax
movq %rax, -0x168(%rbp)
jmp 0x330680
movl $0x1, %eax
movq %rax, -0x168(%rbp)
jmp 0x330680
movq -0x160(%rbp), %r8
movq -0x138(%rbp), %rcx
movl -0x13c(%rbp), %edx
movl -0x140(%rbp), %esi
movq -0x148(%rbp), %rdi
movq -0x158(%rbp), %r9
movq -0x168(%rbp), %rax
addq %rax, %r9
callq 0x32fc10
jmp 0x330af5
cmpq $0x0, -0x30(%rbp)
jl 0x330af5
cmpq $0x0, -0x38(%rbp)
jl 0x330af5
cmpq $0x2, 0x10(%rbp)
jl 0x3306db
jmp 0x3306fa
leaq 0x6736e(%rip), %rdi     # 0x397a50
leaq 0x65ad0(%rip), %rsi     # 0x3961b9
movl $0x15dd, %edx           # imm = 0x15DD
leaq 0x672d7(%rip), %rcx     # 0x3979cc
callq 0x2130
movq -0x18(%rbp), %rax
movq %rax, -0x190(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x170(%rbp)
cmpq $0x0, 0x18(%rbp)
je 0x330749
movq 0x10(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x198(%rbp)
jmp 0x330754
xorl %eax, %eax
movq %rax, -0x198(%rbp)
jmp 0x330754
movq -0x170(%rbp), %r8
movq -0x178(%rbp), %rcx
movq -0x180(%rbp), %rdx
movq -0x188(%rbp), %rsi
movq -0x190(%rbp), %rdi
movq -0x198(%rbp), %r9
movq 0x18(%rbp), %rax
movq %rax, (%rsp)
callq 0x32f550
movq -0x18(%rbp), %rax
movq %rax, -0x1c0(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x1b8(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x1a0(%rbp)
cmpq $0x0, 0x18(%rbp)
je 0x3307d4
xorl %eax, %eax
movq %rax, -0x1c8(%rbp)
jmp 0x3307e3
movq 0x10(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x1c8(%rbp)
movq -0x1a0(%rbp), %r8
movq -0x1a8(%rbp), %rcx
movq -0x1b0(%rbp), %rdx
movq -0x1b8(%rbp), %rsi
movq -0x1c0(%rbp), %rdi
movq -0x1c8(%rbp), %r9
movq 0x18(%rbp), %rax
movq %rax, (%rsp)
callq 0x32f550
cmpq $0x2, 0x10(%rbp)
jle 0x330a20
movq -0x28(%rbp), %rax
movq (%rax), %rax
movl %eax, -0x44(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq -0x40(%rbp), %rcx
addq $0x8, %rcx
movq 0x10(%rbp), %r8
subq $0x2, %r8
movq 0x18(%rbp), %r9
movq 0x20(%rbp), %r10
movq 0x28(%rbp), %rax
addq $0x1, %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x32f6e0
movq -0x28(%rbp), %rax
movq %rax, -0x1e8(%rbp)
movq -0x30(%rbp), %rax
movl %eax, -0x1e0(%rbp)
movl -0x44(%rbp), %eax
movl %eax, -0x1dc(%rbp)
movq 0x20(%rbp), %rax
movq %rax, -0x1d8(%rbp)
movq 0x28(%rbp), %rax
movq %rax, -0x1d0(%rbp)
cmpq $0x0, 0x18(%rbp)
je 0x3308b5
movq 0x10(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x1f0(%rbp)
jmp 0x3308c0
xorl %eax, %eax
movq %rax, -0x1f0(%rbp)
jmp 0x3308c0
movq -0x1d0(%rbp), %rax
movq -0x1f0(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x200(%rbp)
movq 0x28(%rbp), %rax
movq %rax, -0x1f8(%rbp)
cmpq $0x0, 0x18(%rbp)
je 0x3308fb
movq 0x10(%rbp), %rax
subq $0x2, %rax
movq %rax, -0x208(%rbp)
jmp 0x330909
movl $0x1, %eax
movq %rax, -0x208(%rbp)
jmp 0x330909
movq -0x200(%rbp), %r8
movq -0x1d8(%rbp), %rcx
movl -0x1dc(%rbp), %edx
movl -0x1e0(%rbp), %esi
movq -0x1e8(%rbp), %rdi
movq -0x1f8(%rbp), %r9
movq -0x208(%rbp), %rax
addq %rax, %r9
callq 0x32fc10
movq -0x28(%rbp), %rax
movq %rax, -0x228(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
subq $0x1, %rax
movl %eax, -0x220(%rbp)
movq -0x38(%rbp), %rax
movl %eax, -0x21c(%rbp)
movq 0x20(%rbp), %rax
movq %rax, -0x218(%rbp)
movq 0x28(%rbp), %rax
movq %rax, -0x210(%rbp)
cmpq $0x0, 0x18(%rbp)
je 0x330991
movl $0x1, %eax
movq %rax, -0x230(%rbp)
jmp 0x3309a0
movq 0x10(%rbp), %rax
subq $0x2, %rax
movq %rax, -0x230(%rbp)
movq -0x210(%rbp), %rax
movq -0x230(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x240(%rbp)
movq 0x28(%rbp), %rax
movq %rax, -0x238(%rbp)
cmpq $0x0, 0x18(%rbp)
je 0x3309d5
xorl %eax, %eax
movq %rax, -0x248(%rbp)
jmp 0x3309e4
movq 0x10(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x248(%rbp)
movq -0x240(%rbp), %r8
movq -0x218(%rbp), %rcx
movl -0x21c(%rbp), %edx
movl -0x220(%rbp), %esi
movq -0x228(%rbp), %rdi
movq -0x238(%rbp), %r9
movq -0x248(%rbp), %rax
addq %rax, %r9
callq 0x32fc10
jmp 0x330af3
movq -0x28(%rbp), %rax
movq %rax, -0x268(%rbp)
movq -0x30(%rbp), %rax
movl %eax, -0x260(%rbp)
movq -0x38(%rbp), %rax
movl %eax, -0x25c(%rbp)
movq 0x20(%rbp), %rax
movq %rax, -0x258(%rbp)
movq 0x28(%rbp), %rax
movq %rax, -0x250(%rbp)
cmpq $0x0, 0x18(%rbp)
je 0x330a6d
movq 0x10(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x270(%rbp)
jmp 0x330a78
xorl %eax, %eax
movq %rax, -0x270(%rbp)
jmp 0x330a78
movq -0x250(%rbp), %rax
movq -0x270(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x280(%rbp)
movq 0x28(%rbp), %rax
movq %rax, -0x278(%rbp)
cmpq $0x0, 0x18(%rbp)
je 0x330aad
xorl %eax, %eax
movq %rax, -0x288(%rbp)
jmp 0x330abc
movq 0x10(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x288(%rbp)
movq -0x280(%rbp), %r8
movq -0x258(%rbp), %rcx
movl -0x25c(%rbp), %edx
movl -0x260(%rbp), %esi
movq -0x268(%rbp), %rdi
movq -0x278(%rbp), %r9
movq -0x288(%rbp), %rax
addq %rax, %r9
callq 0x32ff00
jmp 0x330af5
addq $0x290, %rsp            # imm = 0x290
popq %rbx
popq %r14
popq %rbp
retq
nopw %cs:(%rax,%rax)