// File: 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
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdi, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
movq %rdx, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x20a0
movq %rax, %rdi
addq $0x64, %rdi
callq 0x2270
movq %rax, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x48(%rbp), %rdi
movq -0x40(%rbp), %rdx
leaq 0x2829f0(%rip), %rsi    # 0x3876d0
movb $0x0, %al
callq 0x2050
movq $0x0, -0x58(%rbp)
movq -0x48(%rbp), %rdi
leaq 0x2946d8(%rip), %rsi    # 0x3993d2
callq 0x2200
movq %rax, -0x50(%rbp)
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpq (%rcx), %rax
jae 0x105037
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movl -0x5c(%rbp), %ecx
imulq $0x30, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movb 0x28(%rax), %al
andb $0x3f, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x104d52
movq -0x58(%rbp), %rax
movb 0x28(%rax), %al
andb $0x3f, %al
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x104d57
jmp 0x105029
movq -0x58(%rbp), %rax
movl (%rax), %ecx
movl 0x4(%rax), %eax
subl %ecx, %eax
cvtsi2ss %rax, %xmm0
leaq 0x2bfa8a(%rip), %rax    # 0x3c47f8
movss 0x170(%rax), %xmm1
mulss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x88(%rbp)
movsd -0x88(%rbp), %xmm1
movq -0x58(%rbp), %rax
movl 0xc(%rax), %ecx
movl 0x10(%rax), %eax
subl %ecx, %eax
cvtsi2ss %rax, %xmm0
leaq 0x2bfa52(%rip), %rax    # 0x3c47f8
mulss 0x170(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
ucomisd %xmm1, %xmm0
jbe 0x104de4
movq -0x58(%rbp), %rax
movl 0xc(%rax), %ecx
movl 0x10(%rax), %eax
subl %ecx, %eax
cvtsi2ss %rax, %xmm0
leaq 0x2bfa28(%rip), %rax    # 0x3c47f8
mulss 0x170(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movsd %xmm0, -0x88(%rbp)
movq -0x58(%rbp), %rax
movl (%rax), %ecx
movl 0x4(%rax), %eax
subl %ecx, %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x78(%rbp)
movsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
movsd -0x80(%rbp), %xmm1
movsd -0x78(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x78(%rbp)
movsd -0x78(%rbp), %xmm0
movsd -0x80(%rbp), %xmm1
movsd 0x281a35(%rip), %xmm2   # 0x386860
mulsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x70(%rbp)
movq -0x58(%rbp), %rax
movl 0xc(%rax), %ecx
movl 0x10(%rax), %eax
subl %ecx, %eax
cvtsi2sd %rax, %xmm0
movsd %xmm0, -0x78(%rbp)
movsd -0x88(%rbp), %xmm0
movsd %xmm0, -0x80(%rbp)
movsd -0x80(%rbp), %xmm1
movsd -0x78(%rbp), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, -0x78(%rbp)
movsd -0x78(%rbp), %xmm0
movsd 0x2819dd(%rip), %xmm1   # 0x386858
mulsd -0x80(%rbp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, -0x68(%rbp)
movsd -0x70(%rbp), %xmm1
movsd -0x68(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x104ebf
movsd -0x70(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
jmp 0x104ecc
movsd -0x68(%rbp), %xmm0
movsd %xmm0, -0x98(%rbp)
movsd -0x98(%rbp), %xmm0
movsd %xmm0, -0x90(%rbp)
movsd -0x90(%rbp), %xmm1
movq -0x58(%rbp), %rax
movsd 0x20(%rax), %xmm0
ucomisd %xmm1, %xmm0
jb 0x104ef8
jmp 0x105029
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rax
movl 0x8(%rax), %edx
addl $0x1, %edx
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x58(%rbp), %rcx
movl 0x8(%rcx), %ecx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
shrl $0x1f, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x2803d7(%rip), %rax    # 0x385303
movsbl (%rax,%rcx), %ecx
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x58(%rbp), %rsi
movl 0x8(%rsi), %esi
imulq $0x28, %rsi, %rsi
addq %rsi, %rax
movl (%rax), %r8d
andl $0x7fffffff, %r8d       # imm = 0x7FFFFFFF
movq -0x58(%rbp), %rax
movl (%rax), %r9d
movq -0x58(%rbp), %rax
movl 0x4(%rax), %r13d
movq -0x58(%rbp), %rax
movb 0x28(%rax), %al
shrb $0x6, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, %esi
leaq 0x27df24(%rip), %rax    # 0x382e9b
movsbl (%rax,%rsi), %r12d
movq -0x58(%rbp), %rax
movl 0x14(%rax), %r15d
addl $0x1, %r15d
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x58(%rbp), %rsi
movl 0x14(%rsi), %esi
imulq $0x28, %rsi, %rsi
addq %rsi, %rax
movl (%rax), %eax
shrl $0x1f, %eax
movl %eax, %eax
movl %eax, %esi
leaq 0x280355(%rip), %rax    # 0x385303
movsbl (%rax,%rsi), %r14d
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x58(%rbp), %rsi
movl 0x14(%rsi), %esi
imulq $0x28, %rsi, %rsi
addq %rsi, %rax
movl (%rax), %ebx
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
movq -0x58(%rbp), %rax
movl 0xc(%rax), %r11d
movq -0x58(%rbp), %rax
movl 0x10(%rax), %r10d
movq -0x58(%rbp), %rax
movsd 0x20(%rax), %xmm0
movq -0x58(%rbp), %rax
movb 0x28(%rax), %al
andb $0x3f, %al
movzbl %al, %eax
leaq 0x2826e8(%rip), %rsi    # 0x3876e5
movl %r13d, (%rsp)
movl %r12d, 0x8(%rsp)
movl %r15d, 0x10(%rsp)
movl %r14d, 0x18(%rsp)
movl %ebx, 0x20(%rsp)
movl %r11d, 0x28(%rsp)
movl %r10d, 0x30(%rsp)
movl %eax, 0x38(%rsp)
movb $0x1, %al
callq 0x22a0
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x104d0a
movq -0x50(%rbp), %rdi
callq 0x21a0
movq -0x48(%rbp), %rdi
callq 0x2210
movq 0x2bef90(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x2826c1(%rip), %rsi    # 0x38771b
leaq 0x28274e(%rip), %rdx    # 0x3877af
movb $0x0, %al
callq 0x22a0
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopw (%rax,%rax)