// File: /workspace/github_cpp_makefile_star2_O3/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 0x180ac8
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, %r13
movq %rax, 0x10(%r14)
movq 0x8(%r14), %rax
subq %rbx, %rax
jbe 0x180acc
leaq (%rbx,%rbx,4), %rcx
leaq (,%rcx,8), %rdi
addq %r13, %rdi
shlq $0x3, %rax
leaq (%rax,%rax,4), %rdx
xorl %esi, %esi
callq 0x20e0
jmp 0x180acc
movq 0x10(%r14), %r13
movabsq $0x100000000, %rax      # imm = 0x100000000
movq %rax, 0x18(%r14)
movl $0x2, 0x20(%r14)
movq $0x1, (%r14)
xorl %esi, %esi
movl %esi, (%r13)
movq %rsi, 0x8(%r13)
movq %rsi, 0x18(%r13)
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 0x180f65
movl %r12d, 0x14(%rsp)
xorl %r12d, %r12d
xorl %ebx, %ebx
movq %rbp, 0x18(%rsp)
movq (%r14), %rax
movq 0x10(%r14), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%r14)
leaq (%rax,%rax,4), %rax
andb $-0x5, (%rcx,%rax,8)
xorl %edx, %edx
movq %rdx, 0x8(%rcx,%rax,8)
movq %rdx, 0x18(%rcx,%rax,8)
movq 0x20(%rsp), %rdx
movsbq (%rdx,%r12), %rdx
movl %edx, %edx
leaq 0x114ac6(%rip), %rsi    # 0x295630
movzbl (%rsi,%rdx), %edx
andl $0x3, %edx
orl $0x8, %edx
movl %edx, (%rcx,%rax,8)
leal 0x1(%rbx), %r12d
cmpq %rbp, %r12
jae 0x180c61
movl 0x20(%r14), %r15d
leal (%rbx,%r15), %r13d
movq (%r14), %rax
cmpq %r13, %rax
jbe 0x1810fc
movq 0x10(%r14), %rcx
leaq (,%r13,4), %rdx
addq %r13, %rdx
movq 0x8(%rcx,%rdx,8), %rax
cmpq 0x10(%rcx,%rdx,8), %rax
jne 0x180bfc
leaq (%rcx,%rdx,8), %rdx
addq $0x8, %rdx
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
leaq (,%r13,8), %rax
leaq (%rax,%rax,4), %rbp
movq %rsi, 0x10(%rcx,%rbp)
movq 0x18(%rdx), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x10(%r14), %rcx
movq %rax, 0x20(%rcx,%rbp)
movq 0x8(%rcx,%rbp), %rax
movq 0x18(%rsp), %rbp
leal (%rbx,%r15), %edi
incl %edi
leaq (,%r13,8), %rdx
leaq (%rdx,%rdx,4), %rsi
movq 0x20(%rcx,%rsi), %rdx
leaq 0x1(%rax), %r8
movq %r8, 0x8(%rcx,%rsi)
movl $0x1, 0x4(%rdx,%rax,8)
andl $0x7fffffff, %edi       # imm = 0x7FFFFFFF
movl %edi, (%rdx,%rax,8)
movq 0x10(%r14), %rdi
movq 0x18(%rdi,%rsi), %rcx
leaq 0x1(%rcx), %r8
movq %r8, 0x18(%rdi,%rsi)
cmpq 0x8(%rdi,%rsi), %r8
jae 0x180c61
addq %rdi, %rsi
addq $0x8, %rsi
movq 0x18(%rsi), %rsi
movq (%rsi,%rcx,8), %rdi
movq (%rdx,%rax,8), %r8
movq %r8, (%rsi,%rcx,8)
movq %rdi, (%rdx,%rax,8)
testl %ebx, %ebx
je 0x180cff
movl 0x20(%r14), %r15d
leal (%rbx,%r15), %r8d
movq (%r14), %rax
cmpq %r8, %rax
jbe 0x1810d4
movq 0x10(%r14), %rcx
leaq (%r8,%r8,4), %r13
movq 0x8(%rcx,%r13,8), %rax
cmpq 0x10(%rcx,%r13,8), %rax
jne 0x180cda
leaq (%rcx,%r13,8), %rdx
addq $0x8, %rdx
leaq (%rax,%rax), %rsi
testq %rax, %rax
movl $0x2, %eax
cmoveq %rax, %rsi
leaq (,%r8,8), %rax
leaq (%rax,%rax,4), %rbp
movq %rsi, 0x10(%rcx,%rbp)
movq 0x18(%rdx), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x10(%r14), %rcx
movq %rax, 0x20(%rcx,%rbp)
movq 0x8(%rcx,%rbp), %rax
movq 0x18(%rsp), %rbp
leal (%rbx,%r15), %edx
decl %edx
movq 0x20(%rcx,%r13,8), %rsi
leaq 0x1(%rax), %rdi
movq %rdi, 0x8(%rcx,%r13,8)
movl $0x1, 0x4(%rsi,%rax,8)
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movl %edx, (%rsi,%rax,8)
movl %r12d, %ebx
cmpq %rbp, %r12
jb 0x180b35
movl 0x18(%r14), %r12d
movl 0x20(%r14), %ebp
movq (%r14), %rax
cmpq %r12, %rax
jbe 0x181136
movq 0x10(%r14), %rcx
leaq (%r12,%r12,4), %rdx
movq 0x8(%rcx,%rdx,8), %rax
cmpq 0x10(%rcx,%rdx,8), %rax
jne 0x180d77
leaq (%rcx,%rdx,8), %rdx
addq $0x8, %rdx
leaq (%rax,%rax), %rdi
testq %rax, %rax
movl $0x2, %esi
cmovneq %rdi, %rsi
leaq (,%r12,8), %rax
leaq (%rax,%rax,4), %rbx
movq %rsi, 0x10(%rcx,%rbx)
movq 0x18(%rdx), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x10(%r14), %rcx
movq %rax, 0x20(%rcx,%rbx)
movq 0x8(%rcx,%rbx), %rax
shlq $0x3, %r12
leaq (%r12,%r12,4), %rsi
movq 0x20(%rcx,%rsi), %rdx
leaq 0x1(%rax), %rdi
movq %rdi, 0x8(%rcx,%rsi)
movl $0x1, 0x4(%rdx,%rax,8)
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
movl %ebp, (%rdx,%rax,8)
movq 0x10(%r14), %rdi
movq 0x18(%rdi,%rsi), %rcx
leaq 0x1(%rcx), %r8
movq %r8, 0x18(%rdi,%rsi)
cmpq 0x8(%rdi,%rsi), %r8
jae 0x180dd2
addq %rdi, %rsi
addq $0x8, %rsi
movq 0x18(%rsi), %rsi
movq (%rsi,%rcx,8), %rdi
movq (%rdx,%rax,8), %r8
movq %r8, (%rsi,%rcx,8)
movq %rdi, (%rdx,%rax,8)
movl 0x20(%r14), %r8d
movl 0x18(%r14), %ebp
movq (%r14), %rax
cmpq %r8, %rax
jbe 0x18115a
movq 0x10(%r14), %rcx
leaq (%r8,%r8,4), %rbx
movq 0x8(%rcx,%rbx,8), %rax
cmpq 0x10(%rcx,%rbx,8), %rax
jne 0x180e3a
leaq (%rcx,%rbx,8), %rdx
addq $0x8, %rdx
leaq (%rax,%rax), %rdi
testq %rax, %rax
movl $0x2, %esi
cmovneq %rdi, %rsi
shlq $0x3, %r8
leaq (%r8,%r8,4), %r15
movq %rsi, 0x10(%rcx,%r15)
movq 0x18(%rdx), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x10(%r14), %rcx
movq %rax, 0x20(%rcx,%r15)
movq 0x8(%rcx,%r15), %rax
movq 0x20(%rcx,%rbx,8), %rdx
leaq 0x1(%rax), %rsi
movq %rsi, 0x8(%rcx,%rbx,8)
movl $0x1, 0x4(%rdx,%rax,8)
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
movl %ebp, (%rdx,%rax,8)
movq 0x18(%rsp), %rax
decl %eax
movl 0x20(%r14), %r12d
movq %rax, %r13
addl %eax, %r12d
movl 0x1c(%r14), %ebp
movq (%r14), %rax
cmpq %r12, %rax
jbe 0x181136
movq 0x10(%r14), %rcx
leaq (%r12,%r12,4), %rdx
movq 0x8(%rcx,%rdx,8), %rax
cmpq 0x10(%rcx,%rdx,8), %rax
jne 0x180ed2
leaq (%rcx,%rdx,8), %rdx
addq $0x8, %rdx
leaq (%rax,%rax), %rdi
testq %rax, %rax
movl $0x2, %esi
cmovneq %rdi, %rsi
leaq (,%r12,8), %rax
leaq (%rax,%rax,4), %rbx
movq %rsi, 0x10(%rcx,%rbx)
movq 0x18(%rdx), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x10(%r14), %rcx
movq %rax, 0x20(%rcx,%rbx)
movq 0x8(%rcx,%rbx), %rax
shlq $0x3, %r12
leaq (%r12,%r12,4), %rsi
movq 0x20(%rcx,%rsi), %rdx
leaq 0x1(%rax), %rdi
movq %rdi, 0x8(%rcx,%rsi)
movl $0x1, 0x4(%rdx,%rax,8)
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
movl %ebp, (%rdx,%rax,8)
movq 0x10(%r14), %rdi
movq 0x18(%rdi,%rsi), %rcx
leaq 0x1(%rcx), %r8
movq %r8, 0x18(%rdi,%rsi)
cmpq 0x8(%rdi,%rsi), %r8
jae 0x180f2d
addq %rdi, %rsi
addq $0x8, %rsi
movq 0x18(%rsi), %rsi
movq (%rsi,%rcx,8), %rdi
movq (%rdx,%rax,8), %r8
movq %r8, (%rsi,%rcx,8)
movq %rdi, (%rdx,%rax,8)
movl 0x1c(%r14), %r8d
addl 0x20(%r14), %r13d
movq (%r14), %rax
cmpq %r8, %rax
ja 0x181040
movq 0x114098(%rip), %rcx    # 0x294fe0
movq (%rcx), %rdi
movl %eax, (%rsp)
leaq 0xbe8eb(%rip), %rsi     # 0x23f840
leaq 0xbe915(%rip), %rdx     # 0x23f871
movl 0x14(%rsp), %ecx
jmp 0x1811bf
movl 0x18(%r14), %r15d
movl 0x1c(%r14), %ebp
movq (%r14), %rax
cmpq %r15, %rax
jbe 0x18117b
movq 0x10(%r14), %rcx
leaq (%r15,%r15,4), %rdx
movq 0x8(%rcx,%rdx,8), %rax
cmpq 0x10(%rcx,%rdx,8), %rax
jne 0x180fd1
leaq (%rcx,%rdx,8), %rdx
addq $0x8, %rdx
leaq (%rax,%rax), %rdi
testq %rax, %rax
movl $0x2, %esi
cmovneq %rdi, %rsi
leaq (,%r15,8), %rax
leaq (%rax,%rax,4), %rbx
movq %rsi, 0x10(%rcx,%rbx)
movq 0x18(%rdx), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x10(%r14), %rcx
movq %rax, 0x20(%rcx,%rbx)
movq 0x8(%rcx,%rbx), %rax
shlq $0x3, %r15
leaq (%r15,%r15,4), %rsi
movq 0x20(%rcx,%rsi), %rdx
leaq 0x1(%rax), %rdi
movq %rdi, 0x8(%rcx,%rsi)
movl $0x1, 0x4(%rdx,%rax,8)
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
movl %ebp, (%rdx,%rax,8)
movq 0x10(%r14), %rdi
movq 0x18(%rdi,%rsi), %rcx
leaq 0x1(%rcx), %r8
movq %r8, 0x18(%rdi,%rsi)
cmpq 0x8(%rdi,%rsi), %r8
jae 0x18102c
addq %rdi, %rsi
addq $0x8, %rsi
movq 0x18(%rsi), %rsi
movq (%rsi,%rcx,8), %rdi
movq (%rdx,%rax,8), %r8
movq %r8, (%rsi,%rcx,8)
movq %rdi, (%rdx,%rax,8)
movl 0x1c(%r14), %r8d
movl 0x18(%r14), %r13d
movq (%r14), %rax
cmpq %r8, %rax
jbe 0x1811a1
movq 0x10(%r14), %rcx
leaq (%r8,%r8,4), %rbx
movq 0x8(%rcx,%rbx,8), %rax
cmpq 0x10(%rcx,%rbx,8), %rax
jne 0x181094
leaq (%rcx,%rbx,8), %rdx
addq $0x8, %rdx
leaq (%rax,%rax), %rdi
testq %rax, %rax
movl $0x2, %esi
cmovneq %rdi, %rsi
shlq $0x3, %r8
leaq (%r8,%r8,4), %r15
movq %rsi, 0x10(%rcx,%r15)
movq 0x18(%rdx), %rdi
shlq $0x3, %rsi
callq 0x2370
movq 0x10(%r14), %rcx
movq %rax, 0x20(%rcx,%r15)
movq 0x8(%rcx,%r15), %rax
leaq (%rcx,%rbx,8), %rcx
addq $0x8, %rcx
movq 0x18(%rcx), %rdx
leaq 0x1(%rax), %rsi
movq %rsi, (%rcx)
movl $0x1, 0x4(%rdx,%rax,8)
andl $0x7fffffff, %r13d      # imm = 0x7FFFFFFF
movl %r13d, (%rdx,%rax,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 0x113f05(%rip), %rcx    # 0x294fe0
movq (%rcx), %rdi
leal (%rbx,%r15), %r9d
decl %r9d
movl %eax, (%rsp)
leaq 0xbe751(%rip), %rsi     # 0x23f840
leaq 0xbe77b(%rip), %rdx     # 0x23f871
movl 0x14(%rsp), %ecx
jmp 0x181125
movq 0x113edd(%rip), %rcx    # 0x294fe0
movq (%rcx), %rdi
leal (%rbx,%r15), %r9d
incl %r9d
movl %eax, (%rsp)
leaq 0xbe729(%rip), %rsi     # 0x23f840
leaq 0xbe753(%rip), %rdx     # 0x23f871
movl 0x14(%rsp), %ecx
movl %r13d, %r8d
xorl %eax, %eax
callq 0x22b0
movl $0x1, %edi
callq 0x2250
movq 0x113ea3(%rip), %rcx    # 0x294fe0
movq (%rcx), %rdi
movl %eax, (%rsp)
leaq 0xbe6f6(%rip), %rsi     # 0x23f840
leaq 0xbe720(%rip), %rdx     # 0x23f871
movl 0x14(%rsp), %ecx
movl %r12d, %r8d
jmp 0x18119c
movq 0x113e7f(%rip), %rcx    # 0x294fe0
movq (%rcx), %rdi
movl %eax, (%rsp)
leaq 0xbe6d2(%rip), %rsi     # 0x23f840
leaq 0xbe6fc(%rip), %rdx     # 0x23f871
movl 0x14(%rsp), %ecx
jmp 0x18119c
movq 0x113e5e(%rip), %rcx    # 0x294fe0
movq (%rcx), %rdi
movl %eax, (%rsp)
leaq 0xbe6b1(%rip), %rsi     # 0x23f840
leaq 0xbe6db(%rip), %rdx     # 0x23f871
movl %r12d, %ecx
movl %r15d, %r8d
movl %ebp, %r9d
jmp 0x181125
movq 0x113e38(%rip), %rcx    # 0x294fe0
movq (%rcx), %rdi
movl %eax, (%rsp)
leaq 0xbe68b(%rip), %rsi     # 0x23f840
leaq 0xbe6b5(%rip), %rdx     # 0x23f871
movl %r12d, %ecx
movl %r13d, %r9d
jmp 0x181125