// File: /workspace/github_cpp_makefile_star2_O3/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, 0x18(%rsp)
movq %rdi, %rbx
movq %rdx, %rdi
callq 0x2090
leaq 0x64(%rax), %rdi
callq 0x2280
movq %rax, %r14
leaq 0x22e8b6(%rip), %rsi    # 0x236ca2
movq %rax, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2050
leaq 0x2402e2(%rip), %rsi    # 0x2486e2
movq %r14, 0x8(%rsp)
movq %r14, %rdi
callq 0x2210
movq %rax, (%rsp)
movq (%rbx), %rax
testq %rax, %rax
je 0x858b
pushq $0x1
popq %rbp
xorl %edx, %edx
leaq 0x28d32f(%rip), %r8     # 0x295758
movsd 0x22d947(%rip), %xmm4   # 0x235d78
movq %rbx, 0x10(%rsp)
movq 0x10(%rbx), %rcx
imulq $0x30, %rdx, %rdx
movzbl 0x28(%rcx,%rdx), %esi
movl %esi, %r11d
andl $0x3f, %r11d
cmpb $0x2, %r11b
jb 0x857e
addq %rdx, %rcx
movl (%rcx), %r9d
movl 0x4(%rcx), %r10d
movl %r10d, %edx
subl %r9d, %edx
cvtsi2ss %rdx, %xmm0
movss 0x170(%r8), %xmm1
mulss %xmm1, %xmm0
movl 0x10(%rcx), %r15d
movl 0xc(%rcx), %r12d
movl %r15d, %edi
subl %r12d, %edi
cvtsi2ss %rdi, %xmm2
mulss %xmm1, %xmm2
maxss %xmm0, %xmm2
cvtss2sd %xmm2, %xmm0
cvtsi2sd %rdx, %xmm1
subsd %xmm0, %xmm1
cvtsi2sd %rdi, %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 0x857e
movl 0x8(%rcx), %eax
movl 0x14(%rcx), %edi
leal 0x1(%rax), %edx
movq 0x18(%rsp), %rcx
movq 0x10(%rcx), %r14
imulq $0x28, %rax, %rax
movl (%r14,%rax), %r8d
movl %r8d, %eax
shrl $0x1f, %eax
leaq 0x22c23d(%rip), %r13    # 0x23473b
movsbl (%rax,%r13), %ecx
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl %eax, %r8d
btl $0x6, %esi
leaq 0x229dbd(%rip), %rax    # 0x2322d3
adcq $0x0, %rax
movsbl (%rax), %eax
movq %rax, 0x20(%rsp)
leal 0x1(%rdi), %ebx
imulq $0x28, %rdi, %rax
movl (%r14,%rax), %r14d
movl %r14d, %eax
shrl $0x1f, %eax
movsbl (%rax,%r13), %r13d
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
andl %eax, %r14d
movq (%rsp), %rdi
leaq 0x22e76c(%rip), %rsi    # 0x236cb7
movb $0x1, %al
pushq %r11
pushq %r15
pushq %r12
pushq %r14
pushq %r13
pushq %rbx
movq 0x40(%rsp), %rbx
pushq 0x50(%rsp)
pushq %r10
callq 0x22b0
movsd 0x22d808(%rip), %xmm4   # 0x235d78
leaq 0x28d1e1(%rip), %r8     # 0x295758
addq $0x40, %rsp
movq (%rbx), %rax
movl %ebp, %edx
incl %ebp
cmpq %rdx, %rax
ja 0x8436
movq (%rsp), %rdi
callq 0x2190
movq 0x8(%rsp), %rdi
callq 0x2220
movq 0x28ca3b(%rip), %rax    # 0x294fe0
movq (%rax), %rdi
leaq 0x22e73e(%rip), %rsi    # 0x236ced
leaq 0x22e7cb(%rip), %rdx    # 0x236d81
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x22b0