// File: chhylp123[P]hifiasm/hic.cpp
// Function: hic_short_align_bench(enzyme const*, enzyme const*, char const*, ha_ug_index*)
int hic_short_align_bench(const enzyme *fn1, const enzyme *fn2, const char *output_file_name, ha_ug_index* idx)
{
    double index_time = yak_realtime();
    sldat_t sl;
    sl.idx = idx;
    ///sl.link = NULL;
    sl.chunk_size = 20000000;
    sl.n_thread = asm_opt.thread_num;
    sl.total_base = sl.total_pair = 0;
    idx->hap_cnt = asm_opt.hap_occ;
    kv_init(sl.hits.a);
    fprintf(stderr, "u.n: %d, uID_bits: %lu, pos_bits: %lu\n", (uint32_t)idx->ug->u.n, idx->uID_bits, idx->pos_bits);
    
    if(!load_hc_hits(&sl.hits, idx->ug, output_file_name))
    {
        // kt_pipeline(3, worker_pipeline, &sl, 3);
        // dedup_hits(&sl.hits);
        alignment_worker_pipeline(&sl, fn1, fn2);
        write_hc_hits(&sl.hits, idx->ug, output_file_name);
    }
    bench_idx bench;
    init_bench_idx(&bench, idx->read_g, idx->ug);
    ///print_bench_idx(&bench, idx->ug);
    evaluate_bench_idx(&bench, &sl.hits, idx->ug);

    destory_bench_idx(&bench);
    kv_destroy(sl.hits.a);
    fprintf(stderr, "[M::%s::%.3f] processed %lu pairs; %lu bases\n", __func__, yak_realtime()-index_time, sl.total_pair, sl.total_base);
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
callq 0x1b7ca0
movsd %xmm0, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq $0x1312d00, -0xa8(%rbp) # imm = 0x1312D00
leaq 0x1b32f6(%rip), %rax    # 0x3c47f8
movslq 0x7c(%rax), %rax
movq %rax, -0xa0(%rbp)
movq $0x0, -0x90(%rbp)
movq $0x0, -0x98(%rbp)
leaq 0x1b32ce(%rip), %rax    # 0x3c47f8
movslq 0x1b8(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x48(%rax)
movq $0x0, -0x80(%rbp)
movq $0x0, -0x88(%rbp)
movq $0x0, -0x78(%rbp)
movq 0x1b2a85(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movl %eax, %edx
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rcx
movq -0x20(%rbp), %rax
movq 0x28(%rax), %r8
leaq 0x17c2eb(%rip), %rsi    # 0x38d86c
movb $0x0, %al
callq 0x22a0
leaq -0xc0(%rbp), %rdi
addq $0x38, %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rdx
callq 0x1d5990
cmpl $0x0, %eax
jne 0x2115d7
movq -0x8(%rbp), %rsi
movq -0x10(%rbp), %rdx
leaq -0xc0(%rbp), %rdi
callq 0x200e50
leaq -0xc0(%rbp), %rdi
addq $0x38, %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rdx
callq 0x1d44d0
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x20(%rbp), %rax
movq (%rax), %rdx
leaq -0x130(%rbp), %rdi
callq 0x210e60
leaq -0xc0(%rbp), %rsi
addq $0x38, %rsi
movq -0x20(%rbp), %rax
movq (%rax), %rdx
leaq -0x130(%rbp), %rdi
callq 0x211290
leaq -0x130(%rbp), %rdi
callq 0x211440
movq -0x78(%rbp), %rdi
callq 0x2210
movq 0x1b29b4(%rip), %rax    # 0x3c3fe0
movq (%rax), %rax
movq %rax, -0x138(%rbp)
callq 0x1b7ca0
movq -0x138(%rbp), %rdi
subsd -0x28(%rbp), %xmm0
movq -0x90(%rbp), %rcx
movq -0x98(%rbp), %r8
leaq 0x17bfde(%rip), %rsi    # 0x38d63a
leaq 0x17c230(%rip), %rdx    # 0x38d893
movb $0x1, %al
callq 0x22a0
movl $0x1, %eax
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
nopl (%rax,%rax)