// File: /workspace/github_c_makefile_star2_O3/c-zhou[P]oatk/syncasm.c
// Function: scg_arc_coverage
void scg_arc_coverage(scg_t *scg, sr_db_t *sr_db)
{
    // add arcs
    uint64_t i, j, n;
    uint64_t v0, v1;
    uint32_t r0, r1;
    khint_t k;
    kh_u128_t *a_cov; // arc cov
    asmg_t *g;
    asmg_arc_t *a;
    asmg_vtx_t *v;
    sr_t *s;

    g = scg->utg_asmg;
    a_cov = kh_u128_init();
    for (i = 0, n = g->n_arc; i < n; ++i) {
        a = &g->arc[i];
        if (a->del) continue;
        v = &g->vtx[a->v>>1];
        v0 = a->v&1? v->a[0]^1 : v->a[v->n-1];
        v = &g->vtx[a->w>>1];
        v1 = a->w&1? v->a[v->n-1]^1 : v->a[0];
        add_a_cov(a_cov, (uint128_t) v0 << 64 | v1, 0);
    }
    for (i = 0, n = sr_db->n; i < n; ++i) {
        s = &sr_db->a[i];
        if (s->n == 0) continue;
        v0 = s->k_mer[0] >> 1;
        r0 = s->m_pos[0] & 1;
        v0 = v0 << 1 | r0;

        for (j = 1; j < s->n; ++j) {
            v1 = s->k_mer[j] >> 1;
            r1 = s->m_pos[j] & 1;
            v1 = v1 << 1 | r1;

            k = kh_u128_get(a_cov, (uint128_t) v0 << 64 | v1);
            if (k < kh_end(a_cov)) {
                kh_val(a_cov, k) += 1;
                if ((v1^1) != v0 || (v0^1) != v1) {
                    k = kh_u128_get(a_cov, (uint128_t) (v1^1) << 64 | (v0^1));
                    kh_val(a_cov, k) += 1;
                }
            }

            v0 = v1;
        }
    }
    for (i = 0, n = g->n_arc; i < n; ++i) {
        a = &g->arc[i];
        if (a->del) continue;
        v = &g->vtx[a->v>>1];
        v0 = a->v&1? v->a[0]^1 : v->a[v->n-1];
        v = &g->vtx[a->w>>1];
        v1 = a->w&1? v->a[v->n-1]^1 : v->a[0];
        k = kh_u128_get(a_cov, (uint128_t) v0 << 64 | v1);
        a->cov = kh_val(a_cov, k);
    }
    kh_u128_destroy(a_cov);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movq 0x8(%rdi), %rbp
movl $0x1, %esi
movl $0x20, %edx
xorl %edi, %edi
callq 0x1d660
movq %rax, %r13
movq $0x0, 0x18(%rax)
movq 0x18(%rbp), %rbx
testq %rbx, %rbx
je 0x55b0
xorl %r12d, %r12d
leaq 0x14(%rsp), %r15
movq 0x28(%rbp), %rcx
testb $0x40, 0x23(%rcx,%r12)
jne 0x55a3
movq 0x10(%rbp), %rax
movq (%rcx,%r12), %rdi
movq %rdi, %rdx
shrq %rdx
leaq (%rdx,%rdx,4), %rsi
movq 0x8(%rax,%rsi,8), %rdx
testb $0x1, %dil
jne 0x5542
leaq (%rax,%rsi,8), %rsi
movq (%rsi), %rsi
movq -0x8(%rdx,%rsi,8), %rdx
jmp 0x5549
movq (%rdx), %rdx
xorq $0x1, %rdx
movq 0x8(%rcx,%r12), %rdi
movq %rdi, %rcx
shrq %rcx
leaq (%rcx,%rcx,4), %rsi
movq 0x8(%rax,%rsi,8), %rcx
testb $0x1, %dil
jne 0x5568
movq (%rcx), %rsi
jmp 0x5578
leaq (%rax,%rsi,8), %rax
movq (%rax), %rax
movq -0x8(%rcx,%rax,8), %rsi
xorq $0x1, %rsi
movq %r13, %rdi
movq %r15, %rcx
callq 0xcd0b
cmpl $0x0, 0x14(%rsp)
movq 0x10(%r13), %rcx
movl %eax, %eax
leaq (%rax,%rax,2), %rax
leaq 0x10(%rcx,%rax,8), %rax
je 0x559d
xorl %ecx, %ecx
jmp 0x55a0
movq (%rax), %rcx
movq %rcx, (%rax)
addq $0x30, %r12
decq %rbx
jne 0x5507
movq %rbp, 0x8(%rsp)
movq %r13, (%rsp)
movq (%r14), %rax
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x58eb
movq 0x10(%r14), %rax
movq %rax, 0x18(%rsp)
xorl %eax, %eax
movq %rax, 0x28(%rsp)
imulq $0x58, %rax, %rax
movq 0x18(%rsp), %rcx
movl 0x38(%rcx,%rax), %r10d
testq %r10, %r10
je 0x58d8
cmpl $0x1, %r10d
je 0x58d8
addq 0x18(%rsp), %rax
movq 0x40(%rax), %rcx
movq 0x50(%rax), %r14
movq %rcx, 0x30(%rsp)
movl (%rcx), %eax
andl $0x1, %eax
movq (%r14), %rbp
andq $-0x2, %rbp
orq %rax, %rbp
movq (%rsp), %rax
movq 0x10(%rax), %r15
movl $0x1, %r13d
movq (%r14,%r13,8), %rax
andq $-0x2, %rax
movq 0x30(%rsp), %rcx
movl (%rcx,%r13,4), %r12d
andl $0x1, %r12d
orq %rax, %r12
testq %r15, %r15
je 0x58c9
movq (%rsp), %r11
movl (%r11), %edx
movl $0x1, %edi
movl %edx, %ecx
shll %cl, %edi
leal -0x1(%rdi), %r8d
movq %r12, %rax
notq %rax
movq %r12, %rcx
shlq $0x15, %rcx
addq %rax, %rcx
movq %rcx, %rax
shrq $0x18, %rax
xorq %rcx, %rax
imulq $0x109, %rax, %rax      # imm = 0x109
movq %rax, %rcx
shrq $0xe, %rcx
xorq %rax, %rcx
leaq (%rcx,%rcx,4), %rax
leaq (%rcx,%rax,4), %rcx
movq %rcx, %rax
shrq $0x1c, %rax
xorq %rcx, %rax
movq %rbp, %rcx
notq %rcx
movq %rbp, %rsi
shlq $0x15, %rsi
addq %rcx, %rsi
movq %rsi, %rcx
shrq $0x18, %rcx
xorq %rsi, %rcx
imulq $0x109, %rcx, %rcx      # imm = 0x109
movq %rcx, %rsi
shrq $0xe, %rsi
xorq %rcx, %rsi
leaq (%rsi,%rsi,4), %rcx
leaq (%rsi,%rcx,4), %rcx
movq %rcx, %rsi
shrq $0x1c, %rsi
xorl %ecx, %esi
movl $0x80000001, %ecx       # imm = 0x80000001
imull %esi, %ecx
movabsq $-0x7fffffff00000000, %rsi # imm = 0x8000000100000000
imulq %rsi, %rax
orq %rax, %rcx
movq %rcx, %rax
notq %rax
shlq $0x15, %rcx
addq %rax, %rcx
movq %rcx, %rax
shrq $0x18, %rax
xorq %rcx, %rax
imulq $0x109, %rax, %rax      # imm = 0x109
movq %rax, %rcx
shrq $0xe, %rcx
xorq %rax, %rcx
leaq (%rcx,%rcx,4), %rax
leaq (%rcx,%rax,4), %rax
movq %rax, %rcx
shrq $0x1c, %rcx
xorl %eax, %ecx
imull $0x1e3779b9, %ecx, %r9d # imm = 0x1E3779B9
movl %edx, %ecx
negl %ecx
shrl %cl, %r9d
movl $0x20, %eax
subl %edx, %eax
movq 0x8(%r11), %rsi
movl %r9d, %ebx
movl %ebx, %ecx
shrl $0x5, %ecx
movl (%rsi,%rcx,4), %ecx
btl %ebx, %ecx
jae 0x5777
movl %ebx, %ecx
leaq (%rcx,%rcx,2), %rcx
movq 0x8(%r15,%rcx,8), %r11
xorq %rbp, %r11
movq (%r15,%rcx,8), %rcx
xorq %r12, %rcx
orq %r11, %rcx
je 0x5779
incl %ebx
andl %r8d, %ebx
cmpl %r9d, %ebx
jne 0x5746
movl %edi, %ebx
movl %ebx, %r9d
movl %edx, %ecx
shrl %cl, %r9d
testl %r9d, %r9d
jne 0x58c9
movl %ebx, %ecx
leaq (%rcx,%rcx,2), %rcx
incq 0x10(%r15,%rcx,8)
movq %r12, %rdx
xorq $0x1, %rdx
cmpq %rbp, %rdx
je 0x58c9
movq %rbp, %rbx
xorq $0x1, %rbx
xorq $-0x2, %rbp
movq %rbx, %rcx
shlq $0x15, %rcx
addq %rbp, %rcx
movq %rcx, %r9
shrq $0x18, %r9
xorq %rcx, %r9
imulq $0x109, %r9, %rcx       # imm = 0x109
movq %rcx, %r9
shrq $0xe, %r9
xorq %rcx, %r9
leaq (%r9,%r9,4), %rcx
leaq (%r9,%rcx,4), %r9
movq %r9, %rcx
shrq $0x1c, %rcx
xorq %r9, %rcx
movq %r12, %r9
xorq $-0x2, %r9
movq %rdx, %r11
shlq $0x15, %r11
addq %r9, %r11
movq %r11, %r9
shrq $0x18, %r9
xorq %r11, %r9
imulq $0x109, %r9, %r9        # imm = 0x109
movq %r9, %r11
shrq $0xe, %r11
xorq %r9, %r11
leaq (%r11,%r11,4), %r9
leaq (%r11,%r9,4), %r9
movq %r9, %r11
shrq $0x1c, %r11
xorl %r9d, %r11d
movl $0x80000001, %r9d       # imm = 0x80000001
imull %r11d, %r9d
movabsq $-0x7fffffff00000000, %r11 # imm = 0x8000000100000000
imulq %r11, %rcx
orq %rcx, %r9
movq %r9, %rcx
notq %rcx
shlq $0x15, %r9
addq %rcx, %r9
movq %r9, %rcx
shrq $0x18, %rcx
xorq %r9, %rcx
imulq $0x109, %rcx, %rcx      # imm = 0x109
movq %rcx, %r9
shrq $0xe, %r9
xorq %rcx, %r9
leaq (%r9,%r9,4), %rcx
leaq (%r9,%rcx,4), %rcx
movq %rcx, %r9
shrq $0x1c, %r9
xorl %ecx, %r9d
imull $0x1e3779b9, %r9d, %r9d # imm = 0x1E3779B9
movl %eax, %ecx
shrl %cl, %r9d
movl %r9d, %eax
movl %eax, %ecx
shrl $0x5, %ecx
movl (%rsi,%rcx,4), %ecx
btl %eax, %ecx
jae 0x58be
movl %eax, %ecx
leaq (%rcx,%rcx,2), %rcx
movq 0x8(%r15,%rcx,8), %r11
xorq %rdx, %r11
movq (%r15,%rcx,8), %rcx
xorq %rbx, %rcx
orq %r11, %rcx
je 0x58bc
incl %eax
andl %r8d, %eax
cmpl %r9d, %eax
jne 0x5889
jmp 0x58be
movl %eax, %edi
movl %edi, %eax
leaq (%rax,%rax,2), %rax
incq 0x10(%r15,%rax,8)
incq %r13
movq %r12, %rbp
cmpq %r10, %r13
jne 0x562a
movq 0x28(%rsp), %rax
incq %rax
cmpq 0x20(%rsp), %rax
jne 0x55d5
movq 0x8(%rsp), %rsi
movq 0x18(%rsi), %rax
testq %rax, %rax
movq (%rsp), %r13
je 0x5af1
xorl %edx, %edx
movl $0x3fffffff, %edi       # imm = 0x3FFFFFFF
movq 0x28(%rsi), %r8
leaq (%rdx,%rdx,2), %rcx
shlq $0x4, %rcx
movl 0x20(%r8,%rcx), %r9d
btl $0x1e, %r9d
jb 0x5ae5
addq %rcx, %r8
movq 0x10(%rsi), %rcx
movq (%r8), %r11
movq %r11, %rsi
shrq %rsi
leaq (%rsi,%rsi,4), %r10
movq 0x8(%rcx,%r10,8), %rsi
testb $0x1, %r11b
jne 0x5951
leaq (%rcx,%r10,8), %r10
movq (%r10), %r10
movq -0x8(%rsi,%r10,8), %rsi
jmp 0x5958
movq (%rsi), %rsi
xorq $0x1, %rsi
movq 0x8(%r8), %rbx
movq %rbx, %r10
shrq %r10
leaq (%r10,%r10,4), %r11
movq 0x8(%rcx,%r11,8), %r10
testb $0x1, %bl
jne 0x5975
movq (%r10), %r11
jmp 0x5985
leaq (%rcx,%r11,8), %rcx
movq (%rcx), %rcx
movq -0x8(%r10,%rcx,8), %r11
xorq $0x1, %r11
movq 0x10(%r13), %r10
testq %r10, %r10
je 0x5ab9
movb (%r13), %cl
movl $0x1, %r14d
shll %cl, %r14d
movq %r11, %rbx
notq %rbx
movq %r11, %r15
shlq $0x15, %r15
addq %rbx, %r15
movq %r15, %rbx
shrq $0x18, %rbx
xorq %r15, %rbx
imulq $0x109, %rbx, %rbx      # imm = 0x109
movq %rbx, %r15
shrq $0xe, %r15
xorq %rbx, %r15
leaq (%r15,%r15,4), %rbx
leaq (%r15,%rbx,4), %r15
movq %r15, %rbx
shrq $0x1c, %rbx
xorq %r15, %rbx
movq %rsi, %r15
notq %r15
movq %rsi, %r12
shlq $0x15, %r12
addq %r15, %r12
movq %r12, %r15
shrq $0x18, %r15
xorq %r12, %r15
imulq $0x109, %r15, %r15      # imm = 0x109
movq %r15, %r12
shrq $0xe, %r12
xorq %r15, %r12
leaq (%r12,%r12,4), %r15
leaq (%r12,%r15,4), %r15
movq %r15, %r12
shrq $0x1c, %r12
xorl %r15d, %r12d
movl $0x80000001, %r15d      # imm = 0x80000001
imull %r12d, %r15d
movabsq $-0x7fffffff00000000, %r12 # imm = 0x8000000100000000
imulq %r12, %rbx
orq %rbx, %r15
movq %r15, %rbx
notq %rbx
shlq $0x15, %r15
addq %rbx, %r15
movq %r15, %rbx
shrq $0x18, %rbx
xorq %r15, %rbx
imulq $0x109, %rbx, %rbx      # imm = 0x109
movq %rbx, %r15
shrq $0xe, %r15
xorq %rbx, %r15
leaq (%r15,%r15,4), %rbx
leaq (%r15,%rbx,4), %rbx
movq %rbx, %r15
shrq $0x1c, %r15
xorl %ebx, %r15d
imull $0x1e3779b9, %r15d, %ebx # imm = 0x1E3779B9
negb %cl
shrl %cl, %ebx
leal -0x1(%r14), %ecx
movq 0x8(%r13), %r15
movl %ebx, %ebp
movl %ebp, %r12d
shrl $0x5, %r12d
movl (%r15,%r12,4), %r12d
btl %ebp, %r12d
jae 0x5ac0
movl %ebp, %r12d
leaq (%r12,%r12,2), %r12
movq 0x8(%r10,%r12,8), %r13
xorq %rsi, %r13
movq (%r10,%r12,8), %r12
xorq %r11, %r12
orq %r13, %r12
je 0x5abd
incl %ebp
andl %ecx, %ebp
cmpl %ebx, %ebp
jne 0x5a83
jmp 0x5ac0
xorl %ecx, %ecx
jmp 0x5ac7
movl %ebp, %r14d
movl %r14d, %ecx
movq (%rsp), %r13
movq 0x8(%rsp), %rsi
leaq (%rcx,%rcx,2), %rcx
movl 0x10(%r10,%rcx,8), %ecx
andl %edi, %ecx
andl $0x80000000, %r9d       # imm = 0x80000000
orl %ecx, %r9d
movl %r9d, 0x20(%r8)
incq %rdx
cmpq %rax, %rdx
jne 0x5908
testq %r13, %r13
je 0x5b2b
movq 0x10(%r13), %rsi
movq 0x18(%r13), %r14
movq %r14, %rdi
callq 0x1d6fb
movq 0x8(%r13), %rsi
movq %r14, %rdi
callq 0x1d6fb
movq %r14, %rdi
movq %r13, %rsi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1d6fb
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq