// File: /workspace/github_cpp_makefile_star2_O1/chhylp123[P]hifiasm/Overlaps.cpp
// Function: dbg_prt_utg_extra_trans(kv_u_trans_t*, ma_ug_t*, char const*)
void dbg_prt_utg_extra_trans(kv_u_trans_t *ta, ma_ug_t *ug, const char *o_n)
{
    char* gfa_name = (char*)malloc(strlen(o_n)+100); 
    FILE *fn = NULL; sprintf(gfa_name, "%s.tran.dbg.ovlp.log", o_n);
    u_trans_t *p = NULL; uint32_t i; fn = fopen(gfa_name, "w");
    double nw[2], ml, uml, sec, fw;
    for (i = 0; i < ta->n; i++) {
        p = &(ta->a[i]);
        if((p->f == RC_0) || (p->f == RC_1)) continue;

        sec = ((p->qe-p->qs)*asm_opt.trans_base_rate);
        if(sec < ((p->te-p->ts)*asm_opt.trans_base_rate)) {
            sec = ((p->te-p->ts)*asm_opt.trans_base_rate);
        }
        ml = p->qe - p->qs; uml = sec; ml -= uml;
        nw[0] = (ml*CHAIN_MATCH) - (uml*CHAIN_UNMATCH);
        ml = p->te - p->ts; uml = sec; ml -= uml;
        nw[1] = (ml*CHAIN_MATCH) - (uml*CHAIN_UNMATCH);
        fw = MIN(nw[0], nw[1]);
        if(fw <= p->nw) continue;

        fprintf(fn, "utg%.6u%c\t%u\t%u\t%u\t%c\tutg%.6u%c\t%u\t%u\t%u\tw(%f)\tf(%u)\n", 
        p->qn+1, "lc"[ug->u.a[p->qn].circ], ug->u.a[p->qn].len, p->qs, p->qe, "+-"[p->rev],
        p->tn+1, "lc"[ug->u.a[p->tn].circ], ug->u.a[p->tn].len, p->ts, p->te, p->nw, p->f);
    }
    fclose(fn); free(gfa_name); fprintf(stderr, "[M::%s::] done\n", __func__);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %r12
movq %rsi, 0x10(%rsp)
movq %rdi, %r14
movq %rdx, %rdi
callq 0x2090
leaq 0x64(%rax), %rdi
callq 0x2280
movq %rax, %rbx
leaq 0x222636(%rip), %rsi    # 0x22aab2
movq %rax, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x233f6e(%rip), %rsi    # 0x23c3fe
movq %rbx, 0x8(%rsp)
movq %rbx, %rdi
callq 0x2210
movq %rax, (%rsp)
cmpq $0x0, (%r14)
je 0x8612
pushq $0x1
popq %rbp
xorl %eax, %eax
leaq 0x2822a1(%rip), %rdi    # 0x28a758
movsd 0x2216c1(%rip), %xmm4   # 0x229b80
movq 0x10(%r14), %rcx
imulq $0x30, %rax, %rdx
movzbl 0x28(%rcx,%rdx), %eax
movl %eax, %r11d
andl $0x3f, %r11d
cmpb $0x2, %r11b
jb 0x8605
addq %rdx, %rcx
movl (%rcx), %r9d
movl 0x4(%rcx), %r10d
movl %r10d, %edx
subl %r9d, %edx
cvtsi2ss %rdx, %xmm0
movss 0x170(%rdi), %xmm1
mulss %xmm1, %xmm0
movl 0x10(%rcx), %r15d
movl 0xc(%rcx), %r12d
movl %r15d, %esi
subl %r12d, %esi
cvtsi2ss %rsi, %xmm2
mulss %xmm1, %xmm2
maxss %xmm0, %xmm2
cvtss2sd %xmm2, %xmm0
cvtsi2sd %rdx, %xmm1
subsd %xmm0, %xmm1
cvtsi2sd %rsi, %xmm2
subsd %xmm0, %xmm2
mulsd %xmm4, %xmm0
addsd %xmm0, %xmm1
addsd %xmm0, %xmm2
movapd %xmm1, %xmm3
cmplesd %xmm2, %xmm3
andpd %xmm3, %xmm1
andnpd %xmm2, %xmm3
orpd %xmm1, %xmm3
movsd 0x20(%rcx), %xmm0
ucomisd %xmm3, %xmm0
jae 0x8605
movl 0x8(%rcx), %esi
movl 0x14(%rcx), %edi
leal 0x1(%rsi), %edx
movq 0x10(%rsp), %rcx
movq 0x10(%rcx), %r13
imulq $0x28, %rsi, %rcx
movl (%r13,%rcx), %r8d
movl %r8d, %ecx
shrl $0x1f, %ecx
leaq 0x2200a4(%rip), %rsi    # 0x22862b
movsbl (%rcx,%rsi), %ecx
movl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
andl %ebx, %r8d
btl $0x6, %eax
leaq 0x21dc25(%rip), %rax    # 0x2261c3
adcq $0x0, %rax
movsbl (%rax), %eax
movq %rax, 0x20(%rsp)
leal 0x1(%rdi), %eax
movq %rax, 0x18(%rsp)
imulq $0x28, %rdi, %rax
movl (%r13,%rax), %r13d
movl %r13d, %eax
shrl $0x1f, %eax
movsbl (%rax,%rsi), %ebx
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl %eax, %r13d
movq (%rsp), %rdi
leaq 0x2224ef(%rip), %rsi    # 0x22aac7
movb $0x1, %al
pushq %r11
pushq %r15
pushq %r12
pushq %r13
pushq %rbx
pushq 0x40(%rsp)
pushq 0x50(%rsp)
pushq %r10
callq 0x22b0
movsd 0x221586(%rip), %xmm4   # 0x229b80
leaq 0x282157(%rip), %rdi    # 0x28a758
addq $0x40, %rsp
movl %ebp, %eax
incl %ebp
cmpq %rax, (%r14)
ja 0x84bf
movq (%rsp), %rdi
callq 0x2190
movq 0x8(%rsp), %rdi
callq 0x2220
movq 0x2819b4(%rip), %rax    # 0x289fe0
movq (%rax), %rdi
leaq 0x2224c7(%rip), %rsi    # 0x22aafd
leaq 0x222554(%rip), %rdx    # 0x22ab91
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x22b0