// File: chhylp123[P]hifiasm/ecovlp.cpp
// Function: handle_chemical_r(unsigned long, unsigned long)
void handle_chemical_r(uint64_t n_thre, uint64_t n_a)
{
    ec_ovec_buf_t *b = NULL; uint64_t k, chem_n = 0, dedup = 0;
    b = gen_ec_ovec_buf_t(n_thre);
    for (k = 0; k < n_thre; ++k) {
        b->a[k].cnt[0] = 0; b->a[k].cnt[1] = 0;
    }

    kt_for(n_thre, worker_hap_dc_ec_chemical_r, b, n_a);

    for (k = 0; k < n_thre; ++k) {
        chem_n += b->a[k].cnt[0]; 
        b->a[k].cnt[0] = 0; b->a[k].cnt[1] = 1;
    }

    kt_for(n_thre, worker_hap_dc_ec_chemical_r, b, n_a);
    
    for (k = 0; k < n_thre; ++k) {
        dedup += b->a[k].cnt[0]; 
        b->a[k].cnt[1] = 2;
    }

    kt_for(n_thre, worker_hap_dc_ec_chemical_r, b, n_a);

    fprintf(stderr, "[M::%s] # chimeric reads: %lu, # arcs:: %lu\n", __func__, chem_n, dedup);

    destroy_ec_ovec_buf_t(b);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x8(%rbp), %rax
movl %eax, %edi
callq 0x24ac00
movq %rax, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x8(%rbp), %rax
jae 0x26b001
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x5c0, -0x20(%rbp), %rcx # imm = 0x5C0
addq %rcx, %rax
movq $0x0, 0xc0(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x5c0, -0x20(%rbp), %rcx # imm = 0x5C0
addq %rcx, %rax
movq $0x0, 0xc8(%rax)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x26afaf
movq -0x8(%rbp), %rax
movl %eax, %edi
movq -0x18(%rbp), %rdx
movq -0x10(%rbp), %rcx
leaq 0x14a(%rip), %rsi       # 0x26b160
callq 0x16d710
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x8(%rbp), %rax
jae 0x26b096
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x5c0, -0x20(%rbp), %rcx # imm = 0x5C0
addq %rcx, %rax
movq 0xc0(%rax), %rax
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x5c0, -0x20(%rbp), %rcx # imm = 0x5C0
addq %rcx, %rax
movq $0x0, 0xc0(%rax)
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x5c0, -0x20(%rbp), %rcx # imm = 0x5C0
addq %rcx, %rax
movq $0x1, 0xc8(%rax)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x26b023
movq -0x8(%rbp), %rax
movl %eax, %edi
movq -0x18(%rbp), %rdx
movq -0x10(%rbp), %rcx
leaq 0xb5(%rip), %rsi        # 0x26b160
callq 0x16d710
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x8(%rbp), %rax
jae 0x26b10e
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x5c0, -0x20(%rbp), %rcx # imm = 0x5C0
addq %rcx, %rax
movq 0xc0(%rax), %rax
addq -0x30(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
imulq $0x5c0, -0x20(%rbp), %rcx # imm = 0x5C0
addq %rcx, %rax
movq $0x2, 0xc8(%rax)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x26b0b8
movq -0x8(%rbp), %rax
movl %eax, %edi
movq -0x18(%rbp), %rdx
movq -0x10(%rbp), %rcx
leaq 0x3d(%rip), %rsi        # 0x26b160
callq 0x16d710
movq 0x158eb1(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r8
leaq 0x125258(%rip), %rsi    # 0x390399
leaq 0x12527e(%rip), %rdx    # 0x3903c6
movb $0x0, %al
callq 0x22a0
movq -0x18(%rbp), %rdi
callq 0x24afe0
addq $0x30, %rsp
popq %rbp
retq
nop