// File: chhylp123[P]hifiasm/inter.cpp
// Function: order_contig_trans(kv_u_trans_t*)
void order_contig_trans(kv_u_trans_t *in)
{
	utepdat_t s; uint64_t i, n_th = asm_opt.thread_num; memset(&s, 0, sizeof(s)); 
    CALLOC(s.hab, n_th); CALLOC(s.buf, n_th); CALLOC(s.ll, n_th); 
    CALLOC(s.gdp, n_th); CALLOC(s.mzs, n_th); CALLOC(s.sps, n_th); 

    for (i = 0; i < n_th; ++i) {
        s.hab[i] = ha_ovec_init(0, 0, 1); s.buf[i] = mg_tbuf_init();
    }

    ctdat_t c; memset(&c, 0, sizeof(c)); c.s = &(s); c.ta = in; 

    c.mm = 0; kt_for(n_th, worker_for_ctg_trans_order, &c, in->idx.n);
	c.mm = 1; kt_for(n_th, worker_for_ctg_trans_order, &c, in->idx.n);

    for (i = 0; i < n_th; ++i) {
        s.sum_len += s.hab[i]->num_read_base; s.n += s.hab[i]->num_correct_base;
        ha_ovec_destroy(s.hab[i]); mg_tbuf_destroy(s.buf[i]); hc_glchain_destroy(&(s.ll[i]));
        hc_gdpchain_destroy(&(s.gdp[i])); kv_destroy(s.mzs[i]); kv_destroy(s.sps[i]);
    }

    free(s.hab); free(s.buf); free(s.ll); free(s.gdp); free(s.mzs); free(s.sps);
    fprintf(stderr, "[M::%s::] # try:%d, # done:%d\n", __func__, s.sum_len, s.n); 

	uint64_t m;
	for (i = m = 0; i < in->n; i++) {
		if(in->a[i].del) continue;
		in->a[m++] = in->a[i];
	}
	in->n = m;
	kt_u_trans_t_idx(in, in->idx.n);
	c.mm = 2; kt_for(n_th, worker_for_ctg_trans_order, &c, in->idx.n);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x8(%rbp)
leaq 0xc4892(%rip), %rax     # 0x3c47f8
movslq 0x7c(%rax), %rax
movq %rax, -0xe8(%rbp)
leaq -0xd8(%rbp), %rdi
xorl %esi, %esi
movl $0xd0, %edx
callq 0x2100
movq -0xe8(%rbp), %rdi
movl $0x8, %esi
callq 0x2140
movq %rax, -0x58(%rbp)
movq -0xe8(%rbp), %rdi
movl $0x8, %esi
callq 0x2140
movq %rax, -0x60(%rbp)
movq -0xe8(%rbp), %rdi
movl $0x68, %esi
callq 0x2140
movq %rax, -0x50(%rbp)
movq -0xe8(%rbp), %rdi
movl $0xc0, %esi
callq 0x2140
movq %rax, -0x48(%rbp)
movq -0xe8(%rbp), %rdi
movl $0x10, %esi
callq 0x2140
movq %rax, -0x78(%rbp)
movq -0xe8(%rbp), %rdi
movl $0x18, %esi
callq 0x2140
movq %rax, -0x70(%rbp)
movq $0x0, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
cmpq -0xe8(%rbp), %rax
jae 0x300068
xorl %esi, %esi
movl $0x1, %edx
movl %esi, %edi
callq 0x14c90
movq %rax, %rdx
movq -0x58(%rbp), %rax
movq -0xe0(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
callq 0x27e560
movq %rax, %rdx
movq -0x60(%rbp), %rax
movq -0xe0(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0xe0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xe0(%rbp)
jmp 0x30000d
leaq -0x140(%rbp), %rdi
xorl %esi, %esi
movl $0x58, %edx
callq 0x2100
leaq -0xd8(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x108(%rbp)
movq $0x0, -0x100(%rbp)
movq -0xe8(%rbp), %rax
movl %eax, %edi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rcx
leaq 0x2a9(%rip), %rsi       # 0x300360
leaq -0x140(%rbp), %rdx
callq 0x16d710
movq $0x1, -0x100(%rbp)
movq -0xe8(%rbp), %rax
movl %eax, %edi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rcx
leaq 0x27a(%rip), %rsi       # 0x300360
leaq -0x140(%rbp), %rdx
callq 0x16d710
movq $0x0, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
cmpq -0xe8(%rbp), %rax
jae 0x3001fa
movq -0x58(%rbp), %rax
movq -0xe0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0xf0(%rax), %rcx
movslq -0x98(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x98(%rbp)
movq -0x58(%rbp), %rax
movq -0xe0(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0xf8(%rax), %rcx
movslq -0xa0(%rbp), %rax
addq %rcx, %rax
movl %eax, -0xa0(%rbp)
movq -0x58(%rbp), %rax
movq -0xe0(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x14f00
movq -0x60(%rbp), %rax
movq -0xe0(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x27e5a0
movq -0x50(%rbp), %rdi
imulq $0x68, -0xe0(%rbp), %rax
addq %rax, %rdi
callq 0x282c10
movq -0x48(%rbp), %rdi
imulq $0xc0, -0xe0(%rbp), %rax
addq %rax, %rdi
callq 0x282c60
movq -0x78(%rbp), %rax
movq -0xe0(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
callq 0x2210
movq -0x70(%rbp), %rax
imulq $0x18, -0xe0(%rbp), %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdi
callq 0x2210
movq -0xe0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xe0(%rbp)
jmp 0x3000fd
movq -0x58(%rbp), %rdi
callq 0x2210
movq -0x60(%rbp), %rdi
callq 0x2210
movq -0x50(%rbp), %rdi
callq 0x2210
movq -0x48(%rbp), %rdi
callq 0x2210
movq -0x78(%rbp), %rdi
callq 0x2210
movq -0x70(%rbp), %rdi
callq 0x2210
movq 0xc3da9(%rip), %rax     # 0x3c3fe0
movq (%rax), %rdi
movl -0x98(%rbp), %ecx
movl -0xa0(%rbp), %r8d
leaq 0x944e6(%rip), %rsi     # 0x394734
leaq 0x953e1(%rip), %rdx     # 0x395636
movb $0x0, %al
callq 0x22a0
movq $0x0, -0x148(%rbp)
movq $0x0, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movq -0x8(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x3002f9
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
imulq $0x30, -0xe0(%rbp), %rcx
addq %rcx, %rax
movb 0x28(%rax), %al
shrb $0x7, %al
cmpb $0x0, %al
je 0x3002a1
jmp 0x3002e2
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rsi
imulq $0x30, -0xe0(%rbp), %rax
addq %rax, %rsi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x148(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x148(%rbp)
imulq $0x30, %rax, %rax
addq %rax, %rdi
movl $0x30, %edx
callq 0x2180
movq -0xe0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xe0(%rbp)
jmp 0x300272
movq -0x148(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movl %eax, %esi
callq 0x104540
movq $0x2, -0x100(%rbp)
movq -0xe8(%rbp), %rax
movl %eax, %edi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rcx
leaq 0x23(%rip), %rsi        # 0x300360
leaq -0x140(%rbp), %rdx
callq 0x16d710
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
nopw %cs:(%rax,%rax)