// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: append_unmatch_integer_seq(poa_g_t*, ma_ug_t*, uc_block_t*, ul_str_t*, long, long, long, long)
void append_unmatch_integer_seq(poa_g_t *g, ma_ug_t *ug, uc_block_t *raw, ul_str_t *str, int64_t s, int64_t e, int64_t is_rev, int64_t str_id)
{
    int64_t k; poa_nid_t *nn; poa_arc_t *ae; uint32_t v; uc_block_t *z; emap_t *em;
    for (k = s; k < e; k++) {
        if(is_rev) {
            v = (((uint32_t)str->a[str->cn-k-1])^1);
            z = &(raw[str->a[str->cn-k-1]>>32]);
        }
        else {
            v = ((uint32_t)str->a[k]); z = &(raw[str->a[k]>>32]);
        }
        kv_pushp(poa_nid_t, g->seq, &nn);
        nn->nid = v; nn->occ = ug_occ_w(z->ts, z->te, &(ug->u.a[z->hid])); 
        
        // ug->u.a[v>>1].n;
        if(k > s) {
            kv_pushp(poa_arc_t, g->arc, &ae);
            ae->ul = g->seq.n-1; ae->ul <<= 33; ae->ul += ((uint64_t)(0x100000000)); ae->ul += 1;
            ae->v = g->seq.n-2; ae->v <<= 1; ae->v += 1;

            kv_pushp(poa_arc_t, g->arc, &ae);
            ae->ul = g->seq.n-2; ae->ul <<= 33; ae->ul += 1;
            ae->v = g->seq.n-1; ae->v <<= 1;

            kv_pushp(emap_t, g->e_idx, &em);
            em->pge = g->seq.n-2; em->pge <<= 32; em->pge += g->seq.n-1;
            em->ule = (is_rev?(str->cn-k):(k-1)); em->ule <<= 32; em->ule += (is_rev?(str->cn-k-1):(k));
            em->ulid = str_id;
            // assert((g->seq.a[em->pge>>32].nid^(is_rev?1:0)) == ((uint32_t)str->a[em->ule>>32]));
            // assert((g->seq.a[(uint32_t)em->pge].nid^(is_rev?1:0)) == ((uint32_t)str->a[(uint32_t)em->ule]));
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, (%rsp)
movq %rdx, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq %r9, 0x20(%rsp)
movq %r8, 0x8(%rsp)
cmpq %r9, %r8
jge 0x1f6ede
movq %rdi, %rbp
movq 0x60(%rsp), %rbx
movq 0x8(%rsp), %r12
movq %r12, %r14
notq %r14
testq %rbx, %rbx
je 0x1f6c9f
movq (%rsp), %rcx
movl 0x18(%rcx), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
shlq $0x3, %rax
addq 0x10(%rcx), %rax
movq (%rax,%r14,8), %rbx
movl %ebx, %r13d
xorl $0x1, %r13d
jmp 0x1f6cae
movq (%rsp), %rax
movq 0x10(%rax), %rax
movq (%rax,%r12,8), %r13
movq %r13, %rbx
movq 0x8(%rbp), %rax
cmpq %rax, (%rbp)
jne 0x1f6cdd
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%rbp)
movq 0x10(%rbp), %rdi
shlq $0x3, %rsi
callq 0x2370
movq %rax, 0x10(%rbp)
shrq $0x20, %rbx
leaq (%rbx,%rbx,8), %rax
movq 0x18(%rsp), %rcx
leaq (%rcx,%rax,4), %rax
movq (%rbp), %rbx
movq 0x10(%rbp), %r15
leaq 0x1(%rbx), %rcx
movq %rcx, (%rbp)
movl %r13d, 0x4(%r15,%rbx,8)
movl (%rax), %ecx
movl 0xc(%rax), %edi
movl 0x10(%rax), %esi
leaq (%rcx,%rcx,4), %rdx
shlq $0x3, %rdx
movq 0x10(%rsp), %rax
addq 0x10(%rax), %rdx
callq 0x1f2d50
movl %eax, (%r15,%rbx,8)
cmpq 0x8(%rsp), %r12
movq 0x60(%rsp), %rbx
jle 0x1f6ecd
movq 0x20(%rbp), %rax
cmpq %rax, 0x18(%rbp)
jne 0x1f6d64
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x20(%rbp)
movq 0x28(%rbp), %rdi
shlq $0x4, %rsi
callq 0x2370
movq %rax, 0x28(%rbp)
movq 0x28(%rbp), %rdi
movq (%rbp), %rax
movq 0x18(%rbp), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, 0x18(%rbp)
shlq $0x4, %rcx
leal -0x3(,%rax,2), %esi
shlq $0x21, %rax
movabsq $-0xffffffff, %r8       # imm = 0xFFFFFFFF00000001
addq %r8, %rax
movq %rax, (%rdi,%rcx)
movl %esi, 0x8(%rdi,%rcx)
movq 0x20(%rbp), %rax
cmpq %rax, %rdx
jne 0x1f6dc6
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x20(%rbp)
shlq $0x4, %rsi
callq 0x2370
movq %rax, 0x28(%rbp)
movq 0x28(%rbp), %rax
movq (%rbp), %rcx
movq 0x18(%rbp), %rdx
leaq 0x1(%rdx), %rsi
movq %rsi, 0x18(%rbp)
shlq $0x4, %rdx
leal -0x2(,%rcx,2), %esi
shlq $0x21, %rcx
movabsq $-0x3ffffffff, %rdi     # imm = 0xFFFFFFFC00000001
addq %rdi, %rcx
movq %rcx, (%rax,%rdx)
movl %esi, 0x8(%rax,%rdx)
movq 0xd0(%rbp), %rax
cmpq %rax, 0xc8(%rbp)
jne 0x1f6e40
leaq (%rax,%rax), %rcx
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rcx
movq %rcx, 0xd0(%rbp)
movq 0xd8(%rbp), %rdi
shlq $0x3, %rcx
leaq (%rcx,%rcx,2), %rsi
callq 0x2370
movq %rax, 0xd8(%rbp)
movq (%rbp), %rax
movq 0xc8(%rbp), %rdx
leaq 0x1(%rdx), %rsi
movq %rax, %rcx
shlq $0x20, %rcx
movabsq $-0x200000001, %rdi     # imm = 0xFFFFFFFDFFFFFFFF
addq %rdi, %rax
addq %rcx, %rax
movq 0xd8(%rbp), %rcx
movq %rsi, 0xc8(%rbp)
leaq (%rdx,%rdx,2), %rdx
movq %rax, (%rcx,%rdx,8)
testq %rbx, %rbx
je 0x1f6e95
movq (%rsp), %rax
movl 0x18(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
addq %r14, %rax
incq %rax
jmp 0x1f6e9a
leaq -0x1(%r12), %rax
leaq (%rcx,%rdx,8), %rcx
shlq $0x20, %rax
movq %rax, 0x8(%rcx)
movq %r12, %rdx
testq %rbx, %rbx
je 0x1f6ebe
movq (%rsp), %rdx
movl 0x18(%rdx), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
addq %r14, %rdx
addq %rax, %rdx
movq %rdx, 0x8(%rcx)
movq 0x68(%rsp), %rax
movl %eax, 0x10(%rcx)
incq %r12
decq %r14
cmpq %r12, 0x20(%rsp)
jne 0x1f6c79
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq