// File: /workspace/github_cpp_makefile_star2_O3/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 %rdx, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq %r9, 0x28(%rsp)
movq %r8, (%rsp)
cmpq %r9, %r8
jge 0x202474
movq %rcx, %r14
movq %rdi, %rbp
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq (%rsp), %rbx
movq %rbx, %r13
notq %r13
movq %rbx, %rcx
shlq $0x20, %rcx
addq %rax, %rcx
movq %rcx, 0x8(%rsp)
movq %r14, 0x10(%rsp)
movq 0x10(%r14), %rax
cmpq $0x0, 0x70(%rsp)
movq %r13, 0x30(%rsp)
je 0x202224
movl 0x18(%r14), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
leaq (%rax,%rcx,8), %rax
movq (%rax,%r13,8), %r15
movl %r15d, %r13d
xorl $0x1, %r13d
jmp 0x20222b
movq (%rax,%rbx,8), %r13
movq %r13, %r15
movq (%rbp), %r14
movq 0x10(%rbp), %r12
cmpq 0x8(%rbp), %r14
jne 0x202264
leaq (%r14,%r14), %rsi
testq %r14, %r14
movl $0x2, %eax
cmoveq %rax, %rsi
movq %rsi, 0x8(%rbp)
shlq $0x3, %rsi
movq %r12, %rdi
callq 0x2370
movq %rax, %r12
movq %rax, 0x10(%rbp)
movq (%rbp), %r14
shrq $0x20, %r15
leaq (%r15,%r15,8), %rax
movq 0x20(%rsp), %rcx
leaq (%rcx,%rax,4), %rax
leaq 0x1(%r14), %r15
movq %r15, (%rbp)
movl %r13d, 0x4(%r12,%r14,8)
movl (%rax), %ecx
movl 0xc(%rax), %edi
movl 0x10(%rax), %esi
leaq (%rcx,%rcx,4), %rdx
shlq $0x3, %rdx
movq 0x18(%rsp), %rax
addq 0x10(%rax), %rdx
callq 0x1fe266
movl %eax, (%r12,%r14,8)
cmpq (%rsp), %rbx
movq 0x10(%rsp), %r14
movabsq $0x100000000, %r12      # imm = 0x100000000
movq 0x30(%rsp), %r13
jle 0x20245e
movq 0x18(%rbp), %r8
movq 0x20(%rbp), %rdi
movq 0x28(%rbp), %rax
cmpq %rdi, %r8
jne 0x202303
leaq (%r8,%r8), %rsi
testq %r8, %r8
movl $0x2, %ecx
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 0x20236f
leaq (%rdi,%rdi), %rsi
testq %rdi, %rdi
movl $0x2, %ecx
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), %rcx
movq 0xd8(%rbp), %rax
cmpq 0xd0(%rbp), %rcx
jne 0x2023e7
leaq (%rcx,%rcx), %rdx
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rdx
movq %rdx, 0xd0(%rbp)
shlq $0x3, %rdx
leaq (%rdx,%rdx,2), %rsi
movq %rax, %rdi
callq 0x2370
movq %rax, 0xd8(%rbp)
movq (%rbp), %r15
movq 0xc8(%rbp), %rcx
leaq 0x1(%rcx), %rdx
leaq 0x1(%r12), %rsi
imulq %r15, %rsi
movabsq $-0x200000001, %rdi     # imm = 0xFFFFFFFDFFFFFFFF
addq %rdi, %rsi
movq %rdx, 0xc8(%rbp)
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rax
movq %rsi, (%rax)
cmpq $0x0, 0x70(%rsp)
je 0x202443
movl 0x18(%r14), %ecx
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl %edx, %ecx
addl %r13d, %ecx
shlq $0x20, %rcx
addq %r12, %rcx
movq %rcx, 0x8(%rax)
movl 0x18(%r14), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
addq %r13, %rdx
jmp 0x20244f
movq 0x8(%rsp), %rcx
movq %rcx, 0x8(%rax)
movq %rbx, %rdx
addq %rdx, %rcx
movq %rcx, 0x8(%rax)
movq 0x78(%rsp), %rcx
movl %ecx, 0x10(%rax)
incq %rbx
decq %r13
addq %r12, 0x8(%rsp)
cmpq %rbx, 0x28(%rsp)
jne 0x2021f8
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq