// File: /workspace/github_c_makefile_star2_O1/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), %rbx
movl $0x1, %esi
movl $0x20, %edx
xorl %edi, %edi
callq 0x1b528
movq %rbx, %rdx
movq %rax, %rbx
movq $0x0, 0x18(%rax)
movq 0x18(%rdx), %r13
testq %r13, %r13
movq %rdx, 0x8(%rsp)
je 0x5164
xorl %ebp, %ebp
leaq 0x14(%rsp), %r15
movq 0x28(%rdx), %rcx
testb $0x40, 0x23(%rcx,%rbp)
jne 0x5157
movq 0x10(%rdx), %rax
movq (%rcx,%rbp), %rdi
movq %rdi, %rdx
shrq %rdx
leaq (%rdx,%rdx,4), %rsi
movq 0x8(%rax,%rsi,8), %rdx
testb $0x1, %dil
jne 0x50f7
leaq (%rax,%rsi,8), %rsi
movq (%rsi), %rsi
movq -0x8(%rdx,%rsi,8), %rdx
jmp 0x50fe
movq (%rdx), %rdx
xorq $0x1, %rdx
movq 0x8(%rcx,%rbp), %rdi
movq %rdi, %rcx
shrq %rcx
leaq (%rcx,%rcx,4), %rsi
movq 0x8(%rax,%rsi,8), %rcx
testb $0x1, %dil
jne 0x511d
movq (%rcx), %rsi
jmp 0x512d
leaq (%rax,%rsi,8), %rax
movq (%rax), %rax
movq -0x8(%rcx,%rax,8), %rsi
xorq $0x1, %rsi
movq %rbx, %rdi
movq %r15, %rcx
callq 0xc38a
cmpl $0x0, 0x14(%rsp)
je 0x5152
movq 0x10(%rbx), %rcx
movl %eax, %eax
leaq (%rax,%rax,2), %rax
movq $0x0, 0x10(%rcx,%rax,8)
movq 0x8(%rsp), %rdx
addq $0x30, %rbp
decq %r13
jne 0x50bd
movq (%r14), %rax
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x54ae
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), %r8d
testq %r8, %r8
je 0x549b
cmpl $0x1, %r8d
je 0x549b
addq 0x18(%rsp), %rax
movq 0x40(%rax), %rcx
movq 0x50(%rax), %r10
movq %rcx, 0x30(%rsp)
movl (%rcx), %eax
andl $0x1, %eax
movq (%r10), %r13
andq $-0x2, %r13
orq %rax, %r13
movq 0x10(%rbx), %r11
movl $0x1, %r14d
movq (%r10,%r14,8), %rax
andq $-0x2, %rax
movq 0x30(%rsp), %rcx
movl (%rcx,%r14,4), %r15d
andl $0x1, %r15d
orq %rax, %r15
xorl %ebp, %ebp
movl $0x0, %edx
testq %r11, %r11
je 0x5319
movb (%rbx), %cl
movl $0x1, %edx
shll %cl, %edx
movq %r15, %rax
notq %rax
movq %r15, %rsi
shlq $0x15, %rsi
addq %rax, %rsi
movq %rsi, %rax
shrq $0x18, %rax
xorq %rsi, %rax
imulq $0x109, %rax, %rax      # imm = 0x109
movq %rax, %rsi
shrq $0xe, %rsi
xorq %rax, %rsi
leaq (%rsi,%rsi,4), %rax
leaq (%rsi,%rax,4), %rax
movq %rax, %rsi
shrq $0x1c, %rsi
xorq %rax, %rsi
movq %r13, %rax
notq %rax
movq %r13, %r12
shlq $0x15, %r12
addq %rax, %r12
movq %r12, %rax
shrq $0x18, %rax
xorq %r12, %rax
imulq $0x109, %rax, %rax      # imm = 0x109
movq %rax, %r12
shrq $0xe, %r12
xorq %rax, %r12
leaq (%r12,%r12,4), %rax
leaq (%r12,%rax,4), %rax
movq %rax, %r12
shrq $0x1c, %r12
xorl %eax, %r12d
movl $0x80000001, %eax       # imm = 0x80000001
imull %r12d, %eax
movabsq $-0x7fffffff00000000, %rdi # imm = 0x8000000100000000
imulq %rdi, %rsi
orq %rsi, %rax
movq %rax, %rsi
notq %rsi
shlq $0x15, %rax
addq %rsi, %rax
movq %rax, %rsi
shrq $0x18, %rsi
xorq %rax, %rsi
imulq $0x109, %rsi, %rax      # imm = 0x109
movq %rax, %rsi
shrq $0xe, %rsi
xorq %rax, %rsi
leaq (%rsi,%rsi,4), %rax
leaq (%rsi,%rax,4), %rax
movq %rax, %rsi
shrq $0x1c, %rsi
xorl %eax, %esi
imull $0x1e3779b9, %esi, %r12d # imm = 0x1E3779B9
negb %cl
shrl %cl, %r12d
leal -0x1(%rdx), %ecx
movq 0x8(%rbx), %rax
movl %r12d, %esi
movl %esi, %edi
shrl $0x5, %edi
movl (%rax,%rdi,4), %edi
btl %esi, %edi
jae 0x5319
movl %esi, %edi
leaq (%rdi,%rdi,2), %rdi
movq 0x8(%r11,%rdi,8), %r9
xorq %r13, %r9
movq (%r11,%rdi,8), %rdi
xorq %r15, %rdi
orq %r9, %rdi
je 0x5317
incl %esi
andl %ecx, %esi
cmpl %r12d, %esi
jne 0x52e5
jmp 0x5319
movl %esi, %edx
testq %r11, %r11
je 0x5327
movb (%rbx), %cl
movl $0x1, %ebp
shll %cl, %ebp
cmpl %ebp, %edx
jae 0x548c
movl %edx, %eax
leaq (%rax,%rax,2), %rax
incq 0x10(%r11,%rax,8)
movq %r15, %rdx
xorq $0x1, %rdx
cmpq %r13, %rdx
je 0x548c
testq %r11, %r11
je 0x547a
movq %r13, %rsi
movb (%rbx), %cl
movl $0x1, %ebp
shll %cl, %ebp
xorq $0x1, %rsi
xorq $-0x2, %r13
movq %rsi, %rax
shlq $0x15, %rax
addq %r13, %rax
movq %rax, %rdi
shrq $0x18, %rdi
xorq %rax, %rdi
imulq $0x109, %rdi, %rax      # imm = 0x109
movq %rax, %rdi
shrq $0xe, %rdi
xorq %rax, %rdi
leaq (%rdi,%rdi,4), %rax
leaq (%rdi,%rax,4), %rax
movq %rax, %r13
shrq $0x1c, %r13
xorq %rax, %r13
movq %r15, %rax
xorq $-0x2, %rax
movq %rdx, %rdi
shlq $0x15, %rdi
addq %rax, %rdi
movq %rdi, %rax
shrq $0x18, %rax
xorq %rdi, %rax
imulq $0x109, %rax, %rax      # imm = 0x109
movq %rax, %rdi
shrq $0xe, %rdi
xorq %rax, %rdi
leaq (%rdi,%rdi,4), %rax
leaq (%rdi,%rax,4), %rax
movq %rax, %rdi
shrq $0x1c, %rdi
xorl %eax, %edi
movl $0x80000001, %eax       # imm = 0x80000001
imull %edi, %eax
movabsq $-0x7fffffff00000000, %rdi # imm = 0x8000000100000000
imulq %rdi, %r13
orq %r13, %rax
movq %rax, %rdi
notq %rdi
shlq $0x15, %rax
addq %rdi, %rax
movq %rax, %rdi
shrq $0x18, %rdi
xorq %rax, %rdi
imulq $0x109, %rdi, %rax      # imm = 0x109
movq %rax, %rdi
shrq $0xe, %rdi
xorq %rax, %rdi
leaq (%rdi,%rdi,4), %rax
leaq (%rdi,%rax,4), %rax
movq %rax, %rdi
shrq $0x1c, %rdi
xorl %eax, %edi
imull $0x1e3779b9, %edi, %r13d # imm = 0x1E3779B9
negb %cl
shrl %cl, %r13d
leal -0x1(%rbp), %ecx
movq 0x8(%rbx), %rax
movl %r13d, %r12d
movl %r12d, %edi
shrl $0x5, %edi
movl (%rax,%rdi,4), %edi
btl %r12d, %edi
jae 0x5481
movl %r12d, %edi
leaq (%rdi,%rdi,2), %rdi
movq 0x8(%r11,%rdi,8), %r9
xorq %rdx, %r9
movq (%r11,%rdi,8), %rdi
xorq %rsi, %rdi
orq %r9, %rdi
je 0x547e
incl %r12d
andl %ecx, %r12d
cmpl %r13d, %r12d
jne 0x5443
jmp 0x5481
xorl %eax, %eax
jmp 0x5483
movl %r12d, %ebp
movl %ebp, %eax
leaq (%rax,%rax,2), %rax
incq 0x10(%r11,%rax,8)
incq %r14
movq %r15, %r13
cmpq %r8, %r14
jne 0x51d1
movq 0x28(%rsp), %rax
incq %rax
cmpq 0x20(%rsp), %rax
jne 0x5180
movq 0x8(%rsp), %rcx
movq 0x18(%rcx), %rdx
testq %rdx, %rdx
je 0x56af
xorl %esi, %esi
movq 0x28(%rcx), %r8
leaq (%rsi,%rsi,2), %rax
shlq $0x4, %rax
movl 0x20(%r8,%rax), %r9d
btl $0x1e, %r9d
jb 0x56a3
addq %rax, %r8
movq 0x10(%rcx), %rcx
movq (%r8), %r11
movq %r11, %rax
shrq %rax
leaq (%rax,%rax,4), %r10
movq 0x8(%rcx,%r10,8), %rax
testb $0x1, %r11b
jne 0x550b
leaq (%rcx,%r10,8), %r10
movq (%r10), %r10
movq -0x8(%rax,%r10,8), %r10
jmp 0x5512
movq (%rax), %r10
xorq $0x1, %r10
movq 0x8(%r8), %r14
movq %r14, %rax
shrq %rax
leaq (%rax,%rax,4), %r11
movq 0x8(%rcx,%r11,8), %rax
testb $0x1, %r14b
jne 0x5530
movq (%rax), %r14
jmp 0x5540
leaq (%rcx,%r11,8), %rcx
movq (%rcx), %rcx
movq -0x8(%rax,%rcx,8), %r14
xorq $0x1, %r14
movq 0x10(%rbx), %r11
testq %r11, %r11
je 0x5676
movb (%rbx), %cl
movl $0x1, %r15d
shll %cl, %r15d
movq %r14, %rax
notq %rax
movq %r14, %r12
shlq $0x15, %r12
addq %rax, %r12
movq %r12, %rax
shrq $0x18, %rax
xorq %r12, %rax
imulq $0x109, %rax, %rax      # imm = 0x109
movq %rax, %r12
shrq $0xe, %r12
xorq %rax, %r12
leaq (%r12,%r12,4), %rax
leaq (%r12,%rax,4), %rax
movq %rax, %r13
shrq $0x1c, %r13
xorq %rax, %r13
movq %r10, %rax
notq %rax
movq %r10, %r12
shlq $0x15, %r12
addq %rax, %r12
movq %r12, %rax
shrq $0x18, %rax
xorq %r12, %rax
imulq $0x109, %rax, %rax      # imm = 0x109
movq %rax, %r12
shrq $0xe, %r12
xorq %rax, %r12
leaq (%r12,%r12,4), %rax
leaq (%r12,%rax,4), %rax
movq %rax, %r12
shrq $0x1c, %r12
xorl %eax, %r12d
movl $0x80000001, %eax       # imm = 0x80000001
imull %r12d, %eax
movabsq $-0x7fffffff00000000, %rdi # imm = 0x8000000100000000
imulq %rdi, %r13
orq %r13, %rax
movq %rax, %r12
notq %r12
shlq $0x15, %rax
addq %r12, %rax
movq %rax, %r12
shrq $0x18, %r12
xorq %rax, %r12
imulq $0x109, %r12, %rax      # imm = 0x109
movq %rax, %r12
shrq $0xe, %r12
xorq %rax, %r12
leaq (%r12,%r12,4), %rax
leaq (%r12,%rax,4), %rax
movq %rax, %r12
shrq $0x1c, %r12
xorl %eax, %r12d
imull $0x1e3779b9, %r12d, %ebp # imm = 0x1E3779B9
negb %cl
shrl %cl, %ebp
leal -0x1(%r15), %ecx
movq 0x8(%rbx), %rax
movl %ebp, %r12d
movl %r12d, %r13d
shrl $0x5, %r13d
movl (%rax,%r13,4), %r13d
btl %r12d, %r13d
jae 0x567d
movl %r12d, %r13d
leaq (%r13,%r13,2), %r13
movq 0x8(%r11,%r13,8), %rdi
xorq %r10, %rdi
movq (%r11,%r13,8), %r13
xorq %r14, %r13
orq %rdi, %r13
je 0x567a
incl %r12d
andl %ecx, %r12d
cmpl %ebp, %r12d
jne 0x563c
jmp 0x567d
xorl %eax, %eax
jmp 0x5680
movl %r12d, %r15d
movl %r15d, %eax
movq 0x8(%rsp), %rcx
leaq (%rax,%rax,2), %rax
movl 0x10(%r11,%rax,8), %eax
movl $0x3fffffff, %edi       # imm = 0x3FFFFFFF
andl %edi, %eax
andl $0x80000000, %r9d       # imm = 0x80000000
orl %eax, %r9d
movl %r9d, 0x20(%r8)
incq %rsi
cmpq %rdx, %rsi
jne 0x54c2
testq %rbx, %rbx
je 0x56e9
movq 0x10(%rbx), %rsi
movq 0x18(%rbx), %r14
movq %r14, %rdi
callq 0x1b5ca
movq 0x8(%rbx), %rsi
movq %r14, %rdi
callq 0x1b5ca
movq %r14, %rdi
movq %rbx, %rsi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1b5ca
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq