// File: /workspace/github_cpp_makefile_star2_O2/chhylp123[P]hifiasm/Correct.cpp
// Function: append_unmatched_wins(overlap_region*, long)
void append_unmatched_wins(overlap_region *z, int64_t block_s)
{
    int64_t nw, aw = z->w_list.n, k, m, w_id, wn_id, w_s, w_e, idx_e;
    nw = get_num_wins(z->x_pos_s, z->x_pos_e+1, block_s);
    assert(nw >= aw && aw > 0);
    if(nw == aw) return;///done
    kv_resize(window_list, z->w_list, (uint64_t)nw); z->w_list.n = nw;
    for (k = aw-1, idx_e = nw; k >= 0; k--) {
        w_id = get_win_id_by_e(z, z->w_list.a[k].x_end, block_s, &w_s);
        assert(w_s == z->w_list.a[k].x_start && w_id < idx_e && k <= w_id);
        if(k != w_id) z->w_list.a[w_id] = z->w_list.a[k];
        for (m = w_id+1, w_e = z->w_list.a[k].x_end; m < idx_e; m++) {
            z->w_list.a[m].cidx = z->w_list.a[m].clen = 0;
            z->w_list.a[m].y_start = z->w_list.a[m].y_end = -1;
            z->w_list.a[m].error = z->w_list.a[m].error_threshold = -1;
            z->w_list.a[m].extra_begin = z->w_list.a[m].extra_end = 0;
            z->w_list.a[m].x_start = w_e + 1;
            wn_id = get_win_id_by_s(z, z->w_list.a[m].x_start, block_s, &w_e);
            z->w_list.a[m].x_end = w_e;
            assert(wn_id == m);
        }
        idx_e = w_id;
    }

    if(idx_e > 0) {
        for (m = 0, w_e = (int64_t)z->x_pos_s-1; m < idx_e; m++) {
            z->w_list.a[m].cidx = z->w_list.a[m].clen = 0;
            z->w_list.a[m].y_start = z->w_list.a[m].y_end = -1;
            z->w_list.a[m].error = z->w_list.a[m].error_threshold = -1;
            z->w_list.a[m].extra_begin = z->w_list.a[m].extra_end = 0;
            z->w_list.a[m].x_start = w_e + 1;
            wn_id = get_win_id_by_s(z, z->w_list.a[m].x_start, block_s, &w_e);
            z->w_list.a[m].x_end = w_e;
            assert(wn_id == m);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq 0x48(%rdi), %r13
movl 0x4(%rdi), %ecx
movl 0x8(%rdi), %esi
incl %esi
movq %rcx, %rax
xorl %edx, %edx
idivq %rbx
subq %rcx, %rdx
addq %rdx, %rsi
movq %rsi, %rax
cqto
idivq %rbx
movq %rax, %r15
xorl %eax, %eax
testq %rdx, %rdx
setg %cl
testq %r13, %r13
jle 0x1d1db
movb %cl, %al
addq %rax, %r15
cmpq %r13, %r15
jl 0x1d1db
je 0x1d18e
movq %rdi, %r14
cmpq %r15, 0x50(%rdi)
jae 0x1cfe5
leaq -0x1(%r15), %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rsi
shrq $0x10, %rsi
orq %rax, %rsi
incq %rsi
movq %rsi, 0x50(%r14)
movq 0x58(%r14), %rdi
shlq $0x5, %rsi
callq 0x2370
movq %rax, 0x58(%r14)
movq %r15, 0x48(%r14)
movq %rsp, %r12
testq %r13, %r13
jle 0x1d0f8
decq %r13
movq 0x58(%r14), %rsi
movq %r13, %r8
shlq $0x5, %r8
movslq 0x4(%rsi,%r8), %rdi
movl 0x4(%r14), %ecx
movq %rcx, %rax
xorl %edx, %edx
idivq %rbx
movq %rcx, %r9
subq %rdx, %r9
movq %rdi, %rax
subq %r9, %rax
cqto
idivq %rbx
movq %rax, %rdx
imulq %rbx, %rdx
addq %r9, %rdx
cmpq %rcx, %rdx
cmovleq %rcx, %rdx
cmpq %r15, %rax
jge 0x1d1bc
movslq (%rsi,%r8), %rcx
cmpq %rcx, %rdx
jne 0x1d1bc
leaq (%rsi,%r8), %rdx
cmpq %rax, %r13
jg 0x1d1bc
movq %r13, 0x10(%rsp)
je 0x1d080
movq %rax, %rcx
shlq $0x5, %rcx
movups (%rdx), %xmm0
movups 0x10(%rdx), %xmm1
movups %xmm1, 0x10(%rsi,%rcx)
movups %xmm0, (%rsi,%rcx)
movq 0x58(%r14), %rsi
movslq 0x4(%rsi,%r8), %rdi
movq %rdi, (%rsp)
movq %rax, %r13
shlq $0x5, %r13
movq %rax, 0x8(%rsp)
movq %rax, %rbp
incq %rbp
cmpq %r15, %rbp
jge 0x1d0e9
andq $0x0, 0x38(%rsi,%r13)
orq $-0x1, 0x28(%rsi,%r13)
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %rax, 0x30(%rsi,%r13)
incl %edi
movl %edi, 0x20(%rsi,%r13)
movslq %edi, %rsi
movq %r14, %rdi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x51f8b
movq (%rsp), %rdi
movq 0x58(%r14), %rsi
movl %edi, 0x24(%rsi,%r13)
addq $0x20, %r13
cmpq %rax, %rbp
je 0x1d093
jmp 0x1d19d
movq 0x8(%rsp), %r15
movq 0x10(%rsp), %r13
jmp 0x1cfec
testq %r15, %r15
jle 0x1d18e
movl 0x4(%r14), %ecx
decq %rcx
movq %rsp, %r12
movq %rcx, (%r12)
negq %r15
pushq $-0x1
popq %r13
xorl %ebp, %ebp
leaq (%r15,%r13), %rax
cmpq $-0x1, %rax
je 0x1d18e
movq 0x58(%r14), %rax
andq $0x0, 0x18(%rax,%rbp)
orq $-0x1, 0x8(%rax,%rbp)
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
movq %rdx, 0x10(%rax,%rbp)
incl %ecx
movl %ecx, (%rax,%rbp)
movslq %ecx, %rsi
movq %r14, %rdi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x51f8b
movq (%rsp), %rcx
movq 0x58(%r14), %rdx
movl %ecx, 0x4(%rdx,%rbp)
incq %r13
addq $0x20, %rbp
cmpq %rax, %r13
je 0x1d118
leaq 0x1c662b(%rip), %rdi    # 0x1e37a1
leaq 0x1c6526(%rip), %rsi    # 0x1e36a3
leaq 0x1c65ac(%rip), %rcx    # 0x1e3730
movl $0x537, %edx            # imm = 0x537
callq 0x2110
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1c65fd(%rip), %rdi    # 0x1e37a1
leaq 0x1c64f8(%rip), %rsi    # 0x1e36a3
leaq 0x1c657e(%rip), %rcx    # 0x1e3730
movl $0x529, %edx            # imm = 0x529
callq 0x2110
leaq 0x1c65a3(%rip), %rdi    # 0x1e3766
leaq 0x1c64d9(%rip), %rsi    # 0x1e36a3
leaq 0x1c655f(%rip), %rcx    # 0x1e3730
movl $0x51f, %edx            # imm = 0x51F
callq 0x2110
leaq 0x1c653b(%rip), %rdi    # 0x1e371d
leaq 0x1c64ba(%rip), %rsi    # 0x1e36a3
leaq 0x1c6540(%rip), %rcx    # 0x1e3730
movl $0x51a, %edx            # imm = 0x51A
callq 0x2110