// File: chhylp123[P]hifiasm/Correct.cpp
// Function: recal_boundary_non_retrieve_exz(char*, char*, long, long, long, long, long, long, long, long, long, unsigned int, bit_extz_t*, long*, long*, long*)
inline int recal_boundary_non_retrieve_exz(char* qstr, char* tstr, int64_t t_tot_l, 
int64_t ql0, int64_t tl0, int64_t thres,
int64_t toff, int64_t ts0, int64_t te0, int64_t err0, 
int64_t tid, uint32_t rev, bit_extz_t *exz,
int64_t *ts_r, int64_t *aux_beg_r, int64_t *aux_end_r)
{
    int64_t ts, tl, aux_beg, aux_end, t_pri_l, aln_l = ql0 + (thres << 1);
    char *q_string = qstr, *t_string; 

    if(ts0 == 0) {//left boundary
        ts = toff;
    } else if((te0 + 1) == tl0) {//right boundary
        ts = toff + te0 - ql0 + 1;
    } else {
        return 0;
    }
    if(!init_waln(thres, ts, t_tot_l, aln_l, &aux_beg, &aux_end, &ts, &t_pri_l)) return 0;
    if(ts == toff && tl0 == t_pri_l) return 0;//unchanged, make no sense

    tl = t_pri_l; t_string = tstr + ts;

    clear_align(*exz); 
    ed_band_cal_semi_64_w_absent_diag_trace(t_string, tl, q_string, ql0, thres, aux_beg, exz);

    if(is_align(*exz) && exz->err < err0) {
        (*aux_beg_r) = aux_beg;
        (*aux_end_r) = aux_end;
        (*ts_r) = ts;
        return 1;
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq 0x58(%rbp), %rax
movq 0x50(%rbp), %rax
movq 0x48(%rbp), %rax
movq 0x40(%rbp), %rax
movl 0x38(%rbp), %eax
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq -0x38(%rbp), %rcx
shlq %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
cmpq $0x0, 0x18(%rbp)
jne 0xc7175
movq 0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0xc71a7
movq 0x20(%rbp), %rax
addq $0x1, %rax
cmpq -0x30(%rbp), %rax
jne 0xc7199
movq 0x10(%rbp), %rax
addq 0x20(%rbp), %rax
subq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0xc71a5
movl $0x0, -0x4(%rbp)
jmp 0xc72a3
jmp 0xc71a7
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x68(%rbp), %rcx
leaq -0x50(%rbp), %r8
leaq -0x58(%rbp), %r9
leaq -0x40(%rbp), %r10
leaq -0x60(%rbp), %rax
movq %r10, (%rsp)
movq %rax, 0x8(%rsp)
callq 0x33f90
cmpl $0x0, %eax
jne 0xc71e6
movl $0x0, -0x4(%rbp)
jmp 0xc72a3
movq -0x40(%rbp), %rax
cmpq 0x10(%rbp), %rax
jne 0xc7206
movq -0x30(%rbp), %rax
cmpq -0x60(%rbp), %rax
jne 0xc7206
movl $0x0, -0x4(%rbp)
jmp 0xc72a3
movq -0x60(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x18(%rbp), %rax
addq -0x40(%rbp), %rax
movq %rax, -0x78(%rbp)
movq 0x40(%rbp), %rax
movl $0x7fffffff, 0x2c(%rax) # imm = 0x7FFFFFFF
movq -0x78(%rbp), %rdi
movq -0x48(%rbp), %rax
movl %eax, %esi
movq -0x70(%rbp), %rdx
movq -0x28(%rbp), %rax
movl %eax, %ecx
movq -0x38(%rbp), %rax
movl %eax, %r8d
movq -0x50(%rbp), %rax
movl %eax, %r9d
movq 0x40(%rbp), %rax
movq %rax, (%rsp)
callq 0xab870
movq 0x40(%rbp), %rax
movl 0x2c(%rax), %eax
movq 0x40(%rbp), %rcx
cmpl 0x28(%rcx), %eax
jg 0xc729c
movq 0x40(%rbp), %rax
movslq 0x2c(%rax), %rax
cmpq 0x28(%rbp), %rax
jge 0xc729c
movq -0x50(%rbp), %rcx
movq 0x50(%rbp), %rax
movq %rcx, (%rax)
movq -0x58(%rbp), %rcx
movq 0x58(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rcx
movq 0x48(%rbp), %rax
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0xc72a3
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nop