// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/gfa_ut.cpp
// Function: renew_ul_vec_t(ul_vec_t*, ma_ug_t*)
void renew_ul_vec_t(ul_vec_t *x, ma_ug_t *ug)
{
    if(x->bb.n <= 0) return;
    int64_t l, k, z, bn = x->bb.n, dd; int64_t qs = x->bb.a[0].qs, qe;
    for (l = 0, k = 1, qs = 0; k <= bn; k++) {
        if(k == bn || x->bb.a[k].pidx == (uint32_t)-1) {
            if(k - l > 0) {
                for (z = k - 1, dd = 0; z >= l; z--) {
                    if(z > l) {
                        assert(x->bb.a[z].pidx == z-1);
                        dd += x->bb.a[z].pdis;
                    } else {
                        assert(x->bb.a[z].pidx == (uint32_t)-1);
                        dd += ug->g->seq[x->bb.a[z].hid].len;
                    }
                    dd -= (int64_t)(ug->g->seq[x->bb.a[z].hid].len - (x->bb.a[z].te - x->bb.a[z].ts));
                }
                if(dd < 0) dd = 0;
                qe = qs + dd; 
                if(k < bn) {
                    dd = qe + (int64_t)(x->bb.a[k].qs) - (int64_t)(x->bb.a[k-1].qe);
                    if(dd < 0) dd = 0;
                }
                for (z = k - 1; z >= l; z--) {
                    qs = qe - (int64_t)(x->bb.a[z].te - x->bb.a[z].ts);
                    if(qs < 0) qs = 0;
                    x->bb.a[z].qs = qs; x->bb.a[z].qe = qe; 
                    if(z > l) {
                        qe += (int64_t)(ug->g->seq[x->bb.a[z].hid].len - (x->bb.a[z].te - x->bb.a[z].ts));
                        qe -= (int64_t)(x->bb.a[z].pdis);
                        if(qe < 0) qe = 0;
                    }
                }

                if(k < bn) qs = dd;
            }
            l = k;
        }
    }
    x->rlen = x->bb.a[bn-1].qe;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x20(%rdi), %r10
testq %r10, %r10
je 0x1bd3b1
testq %r10, %r10
movl $0x0, %eax
cmovgq %r10, %rax
incq %rax
pushq $0x1
popq %r8
movl $0x7fffffff, %r9d       # imm = 0x7FFFFFFF
xorl %r14d, %r14d
xorl %r11d, %r11d
xorl %ebx, %ebx
movq %r10, (%rsp)
movq %rax, 0x10(%rsp)
cmpq %rax, %r8
je 0x1bd3a2
cmpq %r10, %r8
je 0x1bd24a
movq 0x30(%rdi), %rcx
imulq $0x24, %r8, %rdx
cmpl $-0x1, 0x14(%rcx,%rdx)
jne 0x1bd396
cmpq %r11, %r8
jle 0x1bd2ce
movq %r14, 0x8(%rsp)
leaq -0x1(%r8), %r14
movq %r14, %r12
xorl %r15d, %r15d
cmpq %r11, %r12
jl 0x1bd2d6
movq 0x30(%rdi), %r13
imulq $0x24, %r12, %rbp
movq %r13, %rcx
addq %rbp, %rcx
movl 0x14(%r13,%rbp), %edx
cmpq %r11, %r12
jle 0x1bd29c
decq %r12
cmpq %rdx, %r12
jne 0x1bd3c0
movl (%rcx), %eax
movl 0x18(%rcx), %edx
movq 0x18(%rsi), %rcx
movq 0x20(%rcx), %rcx
movl (%rcx,%rax,8), %ecx
andl %r9d, %ecx
jmp 0x1bd2ba
cmpl $-0x1, %edx
jne 0x1bd3df
movq 0x18(%rsi), %rax
movq 0x20(%rax), %rax
movl (%rcx), %ecx
movl (%rax,%rcx,8), %ecx
andl %r9d, %ecx
decq %r12
movl %ecx, %edx
movl %edx, %eax
subl 0x10(%r13,%rbp), %ecx
addq %rax, %r15
addl 0xc(%r13,%rbp), %ecx
subq %rcx, %r15
jmp 0x1bd25e
movq %r8, %r11
jmp 0x1bd396
testq %r15, %r15
movl $0x0, %eax
cmovleq %rax, %r15
leaq (%r15,%rbx), %r12
cmpq (%rsp), %r8
jge 0x1bd313
movq 0x30(%rdi), %rax
imulq $0x24, %r8, %rcx
movl 0x4(%rax,%rcx), %r15d
addq %r12, %r15
imulq $0x24, %r14, %rcx
movl 0x8(%rax,%rcx), %eax
subq %rax, %r15
testq %r15, %r15
movl $0x0, %eax
cmovleq %rax, %r15
movq 0x8(%rsp), %r13
cmpq %r11, %r14
jl 0x1bd37e
movq 0x30(%rdi), %rdx
movl 0xc(%rdx,%r13), %ebp
movl 0x10(%rdx,%r13), %ecx
movl %ecx, %eax
subl %ebp, %eax
movq %r12, %rbx
subq %rax, %rbx
testq %rbx, %rbx
jg 0x1bd33c
xorl %ebx, %ebx
movl %ebx, 0x4(%rdx,%r13)
movl %r12d, 0x8(%rdx,%r13)
cmpq %r11, %r14
jle 0x1bd375
movq 0x18(%rsi), %rax
movq 0x20(%rax), %rax
movl (%rdx,%r13), %r10d
movl 0x18(%rdx,%r13), %edx
movl (%rax,%r10,8), %eax
andl %r9d, %eax
subl %ecx, %ebp
addl %eax, %ebp
subq %rdx, %r12
addq %rbp, %r12
testq %r12, %r12
jg 0x1bd375
xorl %r12d, %r12d
decq %r14
addq $-0x24, %r13
jmp 0x1bd318
movq (%rsp), %r10
cmpq %r10, %r8
cmovlq %r15, %rbx
movq %r8, %r11
movq 0x10(%rsp), %rax
movq 0x8(%rsp), %r14
incq %r8
addq $0x24, %r14
jmp 0x1bd229
movq 0x30(%rdi), %rax
imulq $0x24, %r10, %rcx
movl -0x1c(%rax,%rcx), %eax
movl %eax, 0x18(%rdi)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3c66b(%rip), %rdi     # 0x1f9a32
leaq 0x3a10b(%rip), %rsi     # 0x1f74d9
leaq 0x3c674(%rip), %rcx     # 0x1f9a49
movl $0x1e1d, %edx           # imm = 0x1E1D
callq 0x2110
leaq 0x3c68e(%rip), %rdi     # 0x1f9a74
leaq 0x3a0ec(%rip), %rsi     # 0x1f74d9
leaq 0x3c655(%rip), %rcx     # 0x1f9a49
movl $0x1e20, %edx           # imm = 0x1E20
callq 0x2110