// File: /workspace/github_cpp_makefile_star2_O2/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 $0x38, %rsp
movq %r9, 0x28(%rsp)
movq %rcx, %r14
movq %rdx, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq %rdi, %rbp
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %r8, %r12
shlq $0x20, %r12
addq %rax, %r12
movq %r8, %r13
negq %r13
movq %r8, 0x20(%rsp)
movq %rcx, 0x18(%rsp)
cmpq 0x28(%rsp), %r8
jge 0x1b6787
movq 0x10(%r14), %rax
cmpq $0x0, 0x70(%rsp)
movq %r12, 0x30(%rsp)
je 0x1b6530
movl 0x18(%r14), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
leaq (%rax,%rcx,8), %rax
movq %r13, %rbx
movq -0x8(%rax,%r13,8), %r15
movl %r15d, %r14d
xorl $0x1, %r14d
jmp 0x1b653a
movq %r13, %rbx
movq (%rax,%r8,8), %r14
movq %r14, %r15
movq %r8, (%rsp)
movq (%rbp), %r13
movq 0x10(%rbp), %r12
cmpq 0x8(%rbp), %r13
jne 0x1b6579
leaq (,%r13,2), %rsi
testq %r13, %r13
pushq $0x2
popq %rax
cmoveq %rax, %rsi
movq %rsi, 0x8(%rbp)
shlq $0x3, %rsi
movq %r12, %rdi
callq 0x2370
movq %rax, %r12
movq %rax, 0x10(%rbp)
movq (%rbp), %r13
shrq $0x20, %r15
imulq $0x24, %r15, %rax
addq 0x10(%rsp), %rax
leaq 0x1(%r13), %r15
movq %r15, (%rbp)
movl %r14d, 0x4(%r12,%r13,8)
movl (%rax), %ecx
movl 0xc(%rax), %edi
movl 0x10(%rax), %esi
imulq $0x28, %rcx, %rdx
movq 0x8(%rsp), %rax
addq 0x10(%rax), %rdx
callq 0x1b2312
movl %eax, (%r12,%r13,8)
movq (%rsp), %r8
cmpq 0x20(%rsp), %r8
movq 0x18(%rsp), %r14
movq 0x30(%rsp), %r12
movq %rbx, %r13
jle 0x1b676f
movq 0x18(%rbp), %r8
movq 0x20(%rbp), %rdi
movq 0x28(%rbp), %rax
cmpq %rdi, %r8
jne 0x1b660c
leaq (%r8,%r8), %rsi
testq %r8, %r8
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x20(%rbp)
shlq $0x4, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x28(%rbp)
movq (%rbp), %r15
movq 0x18(%rbp), %r8
movq 0x20(%rbp), %rdi
leaq 0x1(%r8), %rcx
movq %rcx, 0x18(%rbp)
shlq $0x4, %r8
movq %r15, %rdx
shlq $0x21, %rdx
movabsq $-0x100000000, %rsi     # imm = 0xFFFFFFFF00000000
addq %rdx, %rsi
incq %rsi
movq %rsi, (%rax,%r8)
leal -0x3(,%r15,2), %esi
movl %esi, 0x8(%rax,%r8)
cmpq %rdi, %rcx
jne 0x1b6676
leaq (%rdi,%rdi), %rsi
testq %rdi, %rdi
pushq $0x2
popq %rcx
cmoveq %rcx, %rsi
movq %rsi, 0x20(%rbp)
shlq $0x4, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0x28(%rbp)
movq (%rbp), %r15
movq 0x18(%rbp), %rcx
movq %r15, %rdx
shlq $0x21, %rdx
leal (%r15,%r15), %esi
movabsq $-0x3ffffffff, %rdi     # imm = 0xFFFFFFFC00000001
addq %rdi, %rdx
leaq 0x1(%rcx), %rdi
movq %rdi, 0x18(%rbp)
shlq $0x4, %rcx
movq %rdx, (%rax,%rcx)
addl $-0x2, %esi
movl %esi, 0x8(%rax,%rcx)
movq 0xc8(%rbp), %rdx
movq 0xd8(%rbp), %rax
cmpq 0xd0(%rbp), %rdx
jne 0x1b66e8
leaq (%rdx,%rdx), %rcx
testq %rdx, %rdx
pushq $0x2
popq %rdx
cmoveq %rdx, %rcx
movq %rcx, 0xd0(%rbp)
imulq $0x18, %rcx, %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0xd8(%rbp)
movq (%rbp), %r15
movq 0xc8(%rbp), %rdx
imulq $0x18, %rdx, %rsi
incq %rdx
leaq (%rax,%rsi), %rcx
movabsq $0x100000000, %rdi      # imm = 0x100000000
incq %rdi
imulq %r15, %rdi
movabsq $-0x200000001, %r8      # imm = 0xFFFFFFFDFFFFFFFF
addq %r8, %rdi
movq %rdx, 0xc8(%rbp)
movq %rdi, (%rax,%rsi)
cmpq $0x0, 0x70(%rsp)
je 0x1b6753
movl 0x18(%r14), %eax
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl %edx, %eax
addl %r13d, %eax
shlq $0x20, %rax
movq %rax, 0x8(%rcx)
movl 0x18(%r14), %esi
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movq (%rsp), %r8
movq %r8, %rdx
notq %rdx
addq %rsi, %rdx
jmp 0x1b6761
movq %r12, 0x8(%rcx)
movq %r12, %rax
movq (%rsp), %r8
movq %r8, %rdx
addq %rdx, %rax
movq %rax, 0x8(%rcx)
movl 0x78(%rsp), %eax
movl %eax, 0x10(%rcx)
incq %r8
movabsq $0x100000000, %rax      # imm = 0x100000000
addq %rax, %r12
decq %r13
jmp 0x1b64f5
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq