// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/ecovlp.cpp
// Function: init_cns_g(cns_gfa*, char*, unsigned long, unsigned int)
void init_cns_g(cns_gfa *cns, char *s, uint64_t sl, uint32_t rid)
{
    uint32_t m0 = cns->m, m1 = sl + 2, k; cns_t *p;
    if ((*cns).m < (m1)) { ///equal to kv_resize()
        (*cns).m = (m1); 
        (--((*cns).m), ((*cns).m)|=((*cns).m)>>1, ((*cns).m)|=((*cns).m)>>2, ((*cns).m)|=((*cns).m)>>4, ((*cns).m)|=((*cns).m)>>8, ((*cns).m)|=((*cns).m)>>16, ++((*cns).m)); 
        (*cns).a = (cns_t*)realloc((*cns).a, sizeof(cns_t) * (*cns).m); 
        if((*cns).m > m0) {
            memset((*cns).a + m0, 0, sizeof(cns_t)*((*cns).m-m0));
        }
    }
    (*cns).n = 0; (*cns).si = 0; (*cns).ei = 1; (*cns).off = 2;

    p = &((*cns).a[(*cns).n++]); p->arc.nou = p->arc.n = p->c = p->f = p->sc = 0; ///beg
    p = &((*cns).a[(*cns).n++]); p->arc.nou = p->arc.n = p->c = p->f = p->sc = 0; ///end
    (*cns).bb0 = (*cns).n;

    for (k = 0; k < sl; k++) {
        p = &((*cns).a[(*cns).n++]); p->arc.nou = p->arc.n = p->f = 0;
        p->c = seq_nt6_table[(uint32_t)(s[k])]; p->sc = 1;
        
        if(k + 1 < sl) insert_cns_arc(cns, k + (*cns).off, k + 1 + (*cns).off, 1, 1, rid);

        if(k > 0) insert_cns_arc(cns, k + (*cns).off, k - 1 + (*cns).off, 0, 1, rid);
    }
    
    if(sl) {
        insert_cns_arc(cns, (*cns).si, 0 + (*cns).off, 1, 1, rid); insert_cns_arc(cns, 0 + (*cns).off, (*cns).si, 0, 1, rid);
        insert_cns_arc(cns, sl - 1 + (*cns).off, (*cns).ei, 1, 1, rid); insert_cns_arc(cns, (*cns).ei, sl - 1 + (*cns).off, 0, 1, rid);
    } else {
        insert_cns_arc(cns, (*cns).si, (*cns).ei, 1, 1, rid); 
        insert_cns_arc(cns, (*cns).ei, (*cns).si, 0, 1, rid);
    }

    // prt_cns_arc(cns, 0, __func__);
    // prt_cns_arc(cns, 1, __func__);

    (*cns).bn = (*cns).n; (*cns).bb1 = (*cns).n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %r12d
movq %rdx, %rbp
movq %rsi, 0x20(%rsp)
movq %rdi, %r14
movq 0x8(%rdi), %rbx
leal 0x2(%rdx), %eax
cmpq %rax, %rbx
jae 0x179dbe
decq %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
leaq 0x1(%rcx), %rax
movq %rax, 0x8(%r14)
movq 0x10(%r14), %rdi
leaq 0x8(,%rcx,8), %rax
leaq (%rax,%rax,4), %rsi
callq 0x2370
movq %rax, 0x10(%r14)
movq 0x8(%r14), %rcx
movl %ebx, %edx
subq %rdx, %rcx
jbe 0x179dbe
leaq (%rdx,%rdx,4), %rdx
leaq (%rax,%rdx,8), %rdi
shlq $0x3, %rcx
leaq (%rcx,%rcx,4), %rdx
xorl %esi, %esi
callq 0x20e0
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 0x18(%r14)
movl $0x2, 0x20(%r14)
movq 0x10(%r14), %rax
movq $0x1, (%r14)
xorl %esi, %esi
movl %esi, (%rax)
movq %rsi, 0x8(%rax)
movq %rsi, 0x18(%rax)
movq (%r14), %rax
movq 0x10(%r14), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r14)
leaq (%rax,%rax,4), %rax
movl %esi, (%rcx,%rax,8)
movq %rsi, 0x8(%rcx,%rax,8)
movq %rsi, 0x18(%rcx,%rax,8)
movl (%r14), %eax
movl %eax, 0x28(%r14)
testq %rbp, %rbp
je 0x17a288
movl %r12d, 0x14(%rsp)
xorl %eax, %eax
xorl %ebx, %ebx
movq %rbp, 0x18(%rsp)
movq (%r14), %rcx
movq 0x10(%r14), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, (%r14)
leaq (%rcx,%rcx,4), %rcx
andb $-0x5, (%rdx,%rcx,8)
xorl %esi, %esi
movq %rsi, 0x8(%rdx,%rcx,8)
movq %rsi, 0x18(%rdx,%rcx,8)
movq 0x20(%rsp), %rsi
movsbq (%rsi,%rax), %rax
movl %eax, %eax
leaq 0x1107d3(%rip), %rsi    # 0x28a630
movzbl (%rsi,%rax), %eax
andl $0x3, %eax
orl $0x8, %eax
movl %eax, (%rdx,%rcx,8)
leal 0x1(%rbx), %r12d
cmpq %rbp, %r12
jae 0x179f5d
movl 0x20(%r14), %r15d
leal (%rbx,%r15), %r13d
movq (%r14), %rax
cmpq %r13, %rax
jbe 0x17a42d
movq 0x10(%r14), %rax
leaq (,%r13,4), %rdx
addq %r13, %rdx
movq 0x10(%rax,%rdx,8), %rcx
cmpq %rcx, 0x8(%rax,%rdx,8)
jne 0x179eee
leaq (%rax,%rdx,8), %rdx
addq $0x8, %rdx
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rsi
leaq (,%r13,8), %rcx
leaq (%rcx,%rcx,4), %rbp
movq %rsi, 0x10(%rax,%rbp)
movq 0x8(%rdx), %rsi
movq 0x18(%rdx), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x10(%r14), %rcx
movq %rax, 0x20(%rcx,%rbp)
movq 0x18(%rsp), %rbp
leal (%rbx,%r15), %esi
incl %esi
movq 0x10(%r14), %rdi
leaq (,%r13,8), %rax
leaq (%rax,%rax,4), %rdx
movq 0x8(%rdi,%rdx), %rax
movq 0x20(%rdi,%rdx), %rcx
leaq 0x1(%rax), %r8
movq %r8, 0x8(%rdi,%rdx)
movl $0x1, 0x4(%rcx,%rax,8)
andl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movl %esi, (%rcx,%rax,8)
movq 0x10(%r14), %rdi
movq 0x18(%rdi,%rdx), %rsi
incq %rsi
movq %rsi, 0x18(%rdi,%rdx)
cmpq 0x8(%rdi,%rdx), %rsi
jae 0x179f5d
addq %rdi, %rdx
addq $0x8, %rdx
movq 0x18(%rdx), %rdx
movq -0x8(%rdx,%rsi,8), %rdi
movq (%rcx,%rax,8), %r8
movq %r8, -0x8(%rdx,%rsi,8)
movq %rdi, (%rcx,%rax,8)
testl %ebx, %ebx
je 0x17a002
movl 0x20(%r14), %r15d
leal (%rbx,%r15), %r8d
movq (%r14), %rax
cmpq %r8, %rax
jbe 0x17a405
movq 0x10(%r14), %rax
leaq (%r8,%r8,4), %r13
movq 0x10(%rax,%r13,8), %rcx
cmpq %rcx, 0x8(%rax,%r13,8)
jne 0x179fd5
leaq (%rax,%r13,8), %rdx
addq $0x8, %rdx
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %ecx
cmoveq %rcx, %rsi
leaq (,%r8,8), %rcx
leaq (%rcx,%rcx,4), %rbp
movq %rsi, 0x10(%rax,%rbp)
movq 0x8(%rdx), %rsi
movq 0x18(%rdx), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x10(%r14), %rcx
movq %rax, 0x20(%rcx,%rbp)
movq 0x18(%rsp), %rbp
leal (%rbx,%r15), %eax
decl %eax
movq 0x10(%r14), %rcx
movq 0x8(%rcx,%r13,8), %rdx
movq 0x20(%rcx,%r13,8), %rsi
leaq 0x1(%rdx), %rdi
movq %rdi, 0x8(%rcx,%r13,8)
movl $0x1, 0x4(%rsi,%rdx,8)
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, (%rsi,%rdx,8)
movl %r12d, %eax
movl %r12d, %ebx
cmpq %rbp, %rax
jb 0x179e28
movl 0x18(%r14), %r12d
movl 0x20(%r14), %ebp
movq (%r14), %rax
cmpq %r12, %rax
jbe 0x17a467
movq 0x10(%r14), %rax
leaq (%r12,%r12,4), %rdx
movq 0x10(%rax,%rdx,8), %rcx
cmpq %rcx, 0x8(%rax,%rdx,8)
jne 0x17a07c
leaq (%rax,%rdx,8), %rdx
addq $0x8, %rdx
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %ecx
cmovneq %rsi, %rcx
leaq (,%r12,8), %rsi
leaq (%rsi,%rsi,4), %rbx
movq %rcx, 0x10(%rax,%rbx)
movq 0x8(%rdx), %rsi
movq 0x18(%rdx), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x10(%r14), %rcx
movq %rax, 0x20(%rcx,%rbx)
movq 0x10(%r14), %rsi
shlq $0x3, %r12
leaq (%r12,%r12,4), %rdx
movq 0x8(%rsi,%rdx), %rax
movq 0x20(%rsi,%rdx), %rcx
leaq 0x1(%rax), %rdi
movq %rdi, 0x8(%rsi,%rdx)
movl $0x1, 0x4(%rcx,%rax,8)
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
movl %ebp, (%rcx,%rax,8)
movq 0x10(%r14), %rdi
movq 0x18(%rdi,%rdx), %rsi
incq %rsi
movq %rsi, 0x18(%rdi,%rdx)
cmpq 0x8(%rdi,%rdx), %rsi
jae 0x17a0e1
addq %rdi, %rdx
addq $0x8, %rdx
movq 0x18(%rdx), %rdx
movq -0x8(%rdx,%rsi,8), %rdi
movq (%rcx,%rax,8), %r8
movq %r8, -0x8(%rdx,%rsi,8)
movq %rdi, (%rcx,%rax,8)
movl 0x20(%r14), %r8d
movl 0x18(%r14), %ebp
movq (%r14), %rax
cmpq %r8, %rax
jbe 0x17a48b
movq 0x10(%r14), %rax
leaq (%r8,%r8,4), %rbx
movq 0x10(%rax,%rbx,8), %rcx
cmpq %rcx, 0x8(%rax,%rbx,8)
jne 0x17a148
leaq (%rax,%rbx,8), %rdx
addq $0x8, %rdx
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %ecx
cmovneq %rsi, %rcx
shlq $0x3, %r8
leaq (%r8,%r8,4), %r15
movq %rcx, 0x10(%rax,%r15)
movq 0x8(%rdx), %rsi
movq 0x18(%rdx), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x10(%r14), %rcx
movq %rax, 0x20(%rcx,%r15)
movq 0x10(%r14), %rax
movq 0x8(%rax,%rbx,8), %rcx
movq 0x20(%rax,%rbx,8), %rdx
leaq 0x1(%rcx), %rsi
movq %rsi, 0x8(%rax,%rbx,8)
movl $0x1, 0x4(%rdx,%rcx,8)
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
movl %ebp, (%rdx,%rcx,8)
movq 0x18(%rsp), %rax
decl %eax
movl 0x20(%r14), %r12d
movq %rax, %r15
addl %eax, %r12d
movl 0x1c(%r14), %ebp
movq (%r14), %rax
cmpq %r12, %rax
jbe 0x17a467
movq 0x10(%r14), %rax
leaq (%r12,%r12,4), %rdx
movq 0x10(%rax,%rdx,8), %rcx
cmpq %rcx, 0x8(%rax,%rdx,8)
jne 0x17a1e8
leaq (%rax,%rdx,8), %rdx
addq $0x8, %rdx
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %ecx
cmovneq %rsi, %rcx
leaq (,%r12,8), %rsi
leaq (%rsi,%rsi,4), %rbx
movq %rcx, 0x10(%rax,%rbx)
movq 0x8(%rdx), %rsi
movq 0x18(%rdx), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x10(%r14), %rcx
movq %rax, 0x20(%rcx,%rbx)
movq 0x10(%r14), %rsi
shlq $0x3, %r12
leaq (%r12,%r12,4), %rdx
movq 0x8(%rsi,%rdx), %rax
movq 0x20(%rsi,%rdx), %rcx
leaq 0x1(%rax), %rdi
movq %rdi, 0x8(%rsi,%rdx)
movl $0x1, 0x4(%rcx,%rax,8)
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
movl %ebp, (%rcx,%rax,8)
movq 0x10(%r14), %rdi
movq 0x18(%rdi,%rdx), %rsi
incq %rsi
movq %rsi, 0x18(%rdi,%rdx)
cmpq 0x8(%rdi,%rdx), %rsi
jae 0x17a24d
addq %rdi, %rdx
addq $0x8, %rdx
movq 0x18(%rdx), %rdx
movq -0x8(%rdx,%rsi,8), %rdi
movq (%rcx,%rax,8), %r8
movq %r8, -0x8(%rdx,%rsi,8)
movq %rdi, (%rcx,%rax,8)
movl 0x1c(%r14), %r12d
movq %r15, %rbx
addl 0x20(%r14), %ebx
movq (%r14), %rax
cmpq %r12, %rax
ja 0x17a371
movq 0x10fd75(%rip), %rcx    # 0x289fe0
movq (%rcx), %rdi
movl %eax, (%rsp)
leaq 0xb9378(%rip), %rsi     # 0x2335f0
leaq 0xb93a2(%rip), %rdx     # 0x233621
movl 0x14(%rsp), %ecx
jmp 0x17a4ed
movl 0x18(%r14), %r15d
movl 0x1c(%r14), %ebp
movq (%r14), %rax
cmpq %r15, %rax
jbe 0x17a4ac
movq 0x10(%r14), %rax
leaq (%r15,%r15,4), %rdx
movq 0x10(%rax,%rdx,8), %rcx
cmpq %rcx, 0x8(%rax,%rdx,8)
jne 0x17a2f3
leaq (%rax,%rdx,8), %rdx
addq $0x8, %rdx
leaq (%rcx,%rcx), %rsi
testq %rcx, %rcx
movl $0x2, %ecx
cmovneq %rsi, %rcx
leaq (,%r15,8), %rsi
leaq (%rsi,%rsi,4), %rbx
movq %rcx, 0x10(%rax,%rbx)
movq 0x8(%rdx), %rsi
movq 0x18(%rdx), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x10(%r14), %rcx
movq %rax, 0x20(%rcx,%rbx)
movl %r12d, %ecx
movq 0x10(%r14), %rsi
shlq $0x3, %r15
leaq (%r15,%r15,4), %rdx
movq 0x8(%rsi,%rdx), %rax
movq 0x20(%rsi,%rdx), %r9
leaq 0x1(%rax), %rdi
movq %rdi, 0x8(%rsi,%rdx)
movl $0x1, 0x4(%r9,%rax,8)
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
movl %ebp, (%r9,%rax,8)
movq 0x10(%r14), %rdi
movq 0x18(%rdi,%rdx), %rsi
incq %rsi
movq %rsi, 0x18(%rdi,%rdx)
cmpq 0x8(%rdi,%rdx), %rsi
jae 0x17a35d
addq %rdi, %rdx
addq $0x8, %rdx
movq 0x18(%rdx), %rdx
movq -0x8(%rdx,%rsi,8), %rdi
movq (%r9,%rax,8), %r8
movq %r8, -0x8(%rdx,%rsi,8)
movq %rdi, (%r9,%rax,8)
movl 0x1c(%r14), %r12d
movl 0x18(%r14), %ebx
movq (%r14), %rax
cmpq %r12, %rax
jbe 0x17a4d2
movq 0x10(%r14), %rax
leaq (%r12,%r12,4), %rdx
movq 0x10(%rax,%rdx,8), %rcx
cmpq %rcx, 0x8(%rax,%rdx,8)
jne 0x17a3bf
leaq (%rax,%rdx,8), %rax
addq $0x8, %rax
leaq (%rcx,%rcx), %rdx
testq %rcx, %rcx
movl $0x2, %ecx
cmovneq %rdx, %rcx
movq %rcx, 0x8(%rax)
movq 0x8(%rax), %rsi
movq 0x18(%rax), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x10(%r14), %rcx
leaq (%r12,%r12,4), %rdx
movq %rax, 0x20(%rcx,%rdx,8)
movq 0x10(%r14), %rax
leaq (%r12,%r12,4), %rcx
movq 0x8(%rax,%rcx,8), %rdx
movq 0x20(%rax,%rcx,8), %rsi
leaq 0x1(%rdx), %rdi
movq %rdi, 0x8(%rax,%rcx,8)
movl $0x1, 0x4(%rsi,%rdx,8)
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
movl %ebx, (%rsi,%rdx,8)
movl (%r14), %eax
movl %eax, 0x24(%r14)
movl %eax, 0x2c(%r14)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10fbd4(%rip), %rcx    # 0x289fe0
movq (%rcx), %rdi
leal (%rbx,%r15), %r9d
decl %r9d
movl %eax, (%rsp)
leaq 0xb91d0(%rip), %rsi     # 0x2335f0
leaq 0xb91fa(%rip), %rdx     # 0x233621
movl 0x14(%rsp), %ecx
jmp 0x17a456
movq 0x10fbac(%rip), %rcx    # 0x289fe0
movq (%rcx), %rdi
leal (%rbx,%r15), %r9d
incl %r9d
movl %eax, (%rsp)
leaq 0xb91a8(%rip), %rsi     # 0x2335f0
leaq 0xb91d2(%rip), %rdx     # 0x233621
movl 0x14(%rsp), %ecx
movl %r13d, %r8d
xorl %eax, %eax
callq 0x22b0
movl $0x1, %edi
callq 0x2250
movq 0x10fb72(%rip), %rcx    # 0x289fe0
movq (%rcx), %rdi
movl %eax, (%rsp)
leaq 0xb9175(%rip), %rsi     # 0x2335f0
leaq 0xb919f(%rip), %rdx     # 0x233621
movl 0x14(%rsp), %ecx
movl %r12d, %r8d
jmp 0x17a4cd
movq 0x10fb4e(%rip), %rcx    # 0x289fe0
movq (%rcx), %rdi
movl %eax, (%rsp)
leaq 0xb9151(%rip), %rsi     # 0x2335f0
leaq 0xb917b(%rip), %rdx     # 0x233621
movl 0x14(%rsp), %ecx
jmp 0x17a4cd
movq 0x10fb2d(%rip), %rcx    # 0x289fe0
movq (%rcx), %rdi
movl %eax, (%rsp)
leaq 0xb9130(%rip), %rsi     # 0x2335f0
leaq 0xb915a(%rip), %rdx     # 0x233621
movl %r12d, %ecx
movl %r15d, %r8d
movl %ebp, %r9d
jmp 0x17a456
movq 0x10fb07(%rip), %rdx    # 0x289fe0
movq (%rdx), %rdi
movl %eax, (%rsp)
leaq 0xb910a(%rip), %rsi     # 0x2335f0
leaq 0xb9134(%rip), %rdx     # 0x233621
movl %r12d, %r8d
movl %ebx, %r9d
jmp 0x17a456