// File: chhylp123[P]hifiasm/Correct.cpp
// Function: reassign_sec_err(overlap_region*, asg64_v*, asg64_v*, unsigned long)
void reassign_sec_err(overlap_region* ol, asg64_v *ovidx, asg64_v *buf, uint64_t bid0)
{
    uint64_t bn = buf->n, bid = bid0, oid, mid, m, s, e;
    if(buf->a[bid]&id_set) return;
    kv_push(uint64_t, *buf, bid);
    while (buf->n > bn) {
        bid = buf->a[--buf->n];
        if(buf->a[bid]&id_set) continue;
        buf->a[bid]|=id_set;

        oid = id_get(buf->a[bid]);
        s = ovidx->a[oid]>>32; e = (uint32_t)ovidx->a[oid];
        for (m = s; m < e; m++) {
            mid = ol[(uint32_t)ovidx->a[m]].overlapLen;
            if(mid == (uint32_t)-1) continue;
            if(buf->a[mid]&id_set) continue;
            kv_push(uint64_t, *buf, mid);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x30(%rbp), %rdx
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
andq (%rcx,%rdx,8), %rax
cmpq $0x0, %rax
je 0x6c360
jmp 0x6c5b9
jmp 0x6c362
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x6c3ca
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x6c38f
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x60(%rbp)
jmp 0x6c39a
movl $0x2, %eax
movq %rax, -0x60(%rbp)
jmp 0x6c39a
movq -0x60(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x18(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x6c3ed
movq -0x18(%rbp), %rax
movq (%rax), %rax
cmpq -0x28(%rbp), %rax
jbe 0x6c5b9
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x18(%rbp), %rdx
movq (%rdx), %rcx
movq %rcx, %rsi
addq $-0x1, %rsi
movq %rsi, (%rdx)
movq -0x8(%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x30(%rbp), %rdx
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
andq (%rcx,%rdx,8), %rax
cmpq $0x0, %rax
je 0x6c442
jmp 0x6c3ed
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x30(%rbp), %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
orq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, %eax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x58(%rbp), %rax
jae 0x6c5b4
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
movq -0x48(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movl %ecx, %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movl 0x20(%rax), %eax
movq %rax, -0x40(%rbp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, -0x40(%rbp)
jne 0x6c4f1
jmp 0x6c5a3
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x40(%rbp), %rdx
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
andq (%rcx,%rdx,8), %rax
cmpq $0x0, %rax
je 0x6c516
jmp 0x6c5a3
jmp 0x6c518
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x6c580
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x6c545
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
shlq %rax
movq %rax, -0x68(%rbp)
jmp 0x6c550
movl $0x2, %eax
movq %rax, -0x68(%rbp)
jmp 0x6c550
movq -0x68(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x40(%rbp), %rdx
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x18(%rbp), %rsi
movq (%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, (%rsi)
movq %rdx, (%rax,%rcx,8)
jmp 0x6c5a3
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x6c4ac
jmp 0x6c3ed
addq $0x70, %rsp
popq %rbp
retq
nop