// File: /workspace/github_c_makefile_star2_O0/c-zhou[P]oatk/syncerr.c
// Function: update_syncmer_db
static void update_syncmer_db(sr_db_t *sr_db, syncmer_db_t *scm_db)
{
    uint64_t i, j, k, n, m;
    syncmer_t *scms;
    uint64_t *k_mer, sid;
    uint32_t *m_pos, *c_cov;
    // clean scm_db
    free(scm_db->c); scm_db->c = 0;
    free(scm_db->h); scm_db->h = 0;
    scms = scm_db->a;
    for (i = 0, n = scm_db->n; i < n; ++i)
        scms[i].cov = 0;
    // collect syncmer coverage
    for (i = 0, n = sr_db->n; i < n; ++i) {
        k_mer = sr_db->a[i].k_mer;
        for (j = 0, m = sr_db->a[i].n; j < m; ++j)
            ++scms[k_mer[j]>>1].cov;
    }
    // reallocte k_mer position array
    for (i = 0, n = scm_db->n; i < n; ++i) {
        free(scms[i].m_pos);
        MYMALLOC(scms[i].m_pos, scms[i].cov);
        // set cov to zero which will be recalculated
        scms[i].cov = 0;
    }
    // collect syncmer positions on reads
    MYCALLOC(c_cov, scm_db->n);
    for (i = 0, n = sr_db->n; i < n; ++i) {
        sid = sr_db->a[i].sid;
        k_mer = sr_db->a[i].k_mer;
        m_pos = sr_db->a[i].m_pos;
        for (j = 0, m = sr_db->a[i].n; j < m; ++j) {
            k = k_mer[j] >> 1;
            scms[k].m_pos[scms[k].cov++] = (sid << 32) | (j << 1) | (m_pos[j] & 1);
            if(!(m_pos[j] & 1)) ++c_cov[k];
        }
    }
    // mark syncmers with no coverage as deleted
    // this is necessay as there due to the corner case 
    // for a good syncmer, all copies were error-corrected to others
    // meanwhile other syncmers were error-corrected to become it
    // FIXME the simple solution here is to delete this syncmer
    for (i = 0, n = scm_db->n; i < n; ++i)
        scms[i].del = !c_cov[i];
    free(c_cov);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x2060
movq -0x10(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x2060
movq -0x10(%rbp), %rax
movq $0x0, 0x20(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x1d317
movq -0x40(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x10(%rax), %ecx
andl $0x80000000, %ecx       # imm = 0x80000000
orl $0x0, %ecx
movl %ecx, 0x10(%rax)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x1d2e1
movq $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x1d3d4
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x58, -0x18(%rbp), %rcx
addq %rcx, %rax
movq 0x50(%rax), %rax
movq %rax, -0x48(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x58, -0x18(%rbp), %rcx
addq %rcx, %rax
movl 0x38(%rax), %eax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x1d3c1
movq -0x40(%rbp), %rax
movq -0x48(%rbp), %rcx
movq -0x20(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
shrq %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x10(%rax), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
addl $0x1, %edx
movl 0x10(%rax), %ecx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl $0x80000000, %ecx       # imm = 0x80000000
orl %edx, %ecx
movl %ecx, 0x10(%rax)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x1d36f
jmp 0x1d3c3
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x1d32a
movq $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x1d476
movq -0x40(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rdi
callq 0x2060
movq -0x40(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %edi
shlq $0x3, %rdi
callq 0x2320
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq -0x18(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
movq -0x40(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x10(%rax), %ecx
andl $0x80000000, %ecx       # imm = 0x80000000
orl $0x0, %ecx
movl %ecx, 0x10(%rax)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x1d3e7
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl $0x4, %esi
callq 0x2250
movq %rax, -0x60(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x1d5f0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x58, -0x18(%rbp), %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x58, -0x18(%rbp), %rcx
addq %rcx, %rax
movq 0x50(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x58, -0x18(%rbp), %rcx
addq %rcx, %rax
movq 0x40(%rax), %rax
movq %rax, -0x58(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x58, -0x18(%rbp), %rcx
addq %rcx, %rax
movl 0x38(%rax), %eax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x1d5dd
movq -0x48(%rbp), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq %rax
movq %rax, -0x28(%rbp)
movq -0x50(%rbp), %rdx
shlq $0x20, %rdx
movq -0x20(%rbp), %rax
shlq %rax
orq %rax, %rdx
movq -0x58(%rbp), %rax
movq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %eax
andl $0x1, %eax
movl %eax, %eax
orq %rax, %rdx
movq -0x40(%rbp), %rax
movq -0x28(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movq -0x40(%rbp), %rsi
movq -0x28(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rsi
movl 0x10(%rsi), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %ecx, %r8d
addl $0x1, %r8d
movl 0x10(%rsi), %edi
andl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
andl $0x80000000, %edi       # imm = 0x80000000
orl %r8d, %edi
movl %edi, 0x10(%rsi)
movl %ecx, %ecx
movq %rdx, (%rax,%rcx,8)
movq -0x58(%rbp), %rax
movq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x1d5ca
movq -0x60(%rbp), %rax
movq -0x28(%rbp), %rcx
movl (%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, (%rax,%rcx,4)
jmp 0x1d5cc
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x1d512
jmp 0x1d5df
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x1d49e
movq $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x1d654
movq -0x60(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %edx
movq -0x40(%rbp), %rax
movq -0x18(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x10(%rax), %ecx
andl $0x1, %edx
shll $0x1f, %edx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl %edx, %ecx
movl %ecx, 0x10(%rax)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x1d603
movq -0x60(%rbp), %rdi
callq 0x2060
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)