// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/Correct.cpp
// Function: gen_backtrace_adv(window_list*, overlap_region*, All_reads*, hpc_t*, ul_idx_t const*, char*, char*, char*, Correct_dumy*, unsigned int, unsigned int)
inline uint32_t gen_backtrace_adv(window_list *p, overlap_region *z, All_reads *rref, hpc_t *hpc_g, const ul_idx_t *uref, 
char *qstr, char *tstr, char *tstr1, Correct_dumy* dumy, uint32_t rev, uint32_t id)
{
    int64_t qs, qe, ql, aln_l, t_pri_l, thres, ts; 
    int r_ts = 0, t_end; int64_t aux_beg, aux_end;
    char *q_string, *t_string; unsigned int error;
    ///there is no problem for x
    qs = p->x_start; qe = p->x_end; ql = qe + 1 - qs;
    thres = p->error_threshold; aln_l = ql + (thres<<1);

    ///y_start is the real y_start
    ///for the window with cigar, y_start has already reduced extra_begin
    ts = p->y_start; aux_beg = p->extra_begin; aux_end = p->extra_end;
    t_pri_l = aln_l - aux_beg - aux_end;

    q_string = qstr + qs; 
    if(rref) {
        fill_subregion(tstr, ts, t_pri_l, rev, rref, id, aux_beg, aux_end); t_string = tstr;
    } else {
        t_string = return_str_seq(tstr, ts, t_pri_l, rev, hpc_g, uref, id, aux_beg, aux_end);
    }
    
    t_end = Reserve_Banded_BPM_PATH(t_string, aln_l, q_string, ql, thres, &error, &r_ts,
        &(dumy->path_length), dumy->matrix_bit, dumy->path, p->error, p->y_end - ts);

    // assert(error != (unsigned int)-1);
    if(error != (unsigned int)-1) {
        /**
        bit_extz_t exz, exz64; init_bit_extz_t(&exz, thres); init_bit_extz_t(&exz64, thres);
        // ed_band_cal_extension_64_0_w(t_string+r_ts, t_end+1-r_ts, q_string, ql, thres, &exz64);
        // ed_band_cal_extension_64_0_w_trace(t_string+r_ts, t_end+1-r_ts, q_string, ql, thres, &exz64);
        // cigar_check(t_string+r_ts, q_string, &(exz64));
        // exz64.err = INT32_MAX;
        // ed_band_cal_extension_64_0_w_trace(t_string+r_ts, t_end+1-r_ts, q_string, ql, thres, &exz64);
        // cigar_check(t_string+r_ts, q_string, &(exz64));

        // ed_band_cal_extension_infi_0_w(t_string+r_ts, t_end+1-r_ts, q_string, ql, thres, NULL, &exz);
        // ed_band_cal_extension_infi_0_w_trace(t_string+r_ts, t_end+1-r_ts, q_string, ql, thres, NULL, &exz);
        // cigar_check(t_string+r_ts, q_string, &exz);
        // exz.err = INT32_MAX;
        // ed_band_cal_extension_infi_0_w_trace(t_string+r_ts, t_end+1-r_ts, q_string, ql, thres, NULL, &exz);
        // cigar_check(t_string+r_ts, q_string, &exz);
        // assert(exz.err <= (int32_t)error && exz.err >= 0); 
        // assert(exz.err == exz64.err && exz.ps == exz64.ps && exz.pe == exz64.pe && exz.ts == exz64.ts && exz.te == exz64.te);
        
        // ed_band_cal_extension_256_0_w(t_string+r_ts, t_end+1-r_ts, q_string, ql, thres, &exz);
        // ed_band_cal_extension_256_0_w_trace(t_string+r_ts, t_end+1-r_ts, q_string, ql, thres, &exz);
        // cigar_check(t_string+r_ts, q_string, &exz);
        // exz.err = INT32_MAX;
        // ed_band_cal_extension_256_0_w_trace(t_string+r_ts, t_end+1-r_ts, q_string, ql, thres, &exz);
        // cigar_check(t_string+r_ts, q_string, &exz);
        // assert(exz.err <= (int32_t)error && exz.err >= 0); 
        // assert(exz.err == exz64.err && exz.ps == exz64.ps && exz.pe == exz64.pe && exz.ts == exz64.ts && exz.te == exz64.te);

        // char *qr, *tr;
        // gen_rev_str(q_string, &qr, ql); gen_rev_str(t_string+r_ts, &tr, t_end+1-r_ts); 

        // ed_band_cal_extension_64_1_w(tr, t_end+1-r_ts, qr, ql, thres, &exz64);
        // ed_band_cal_extension_64_1_w_trace(tr, t_end+1-r_ts, qr, ql, thres, &exz64);
        // cigar_check(tr, qr, &exz64);
        // exz64.err = INT32_MAX;
        // ed_band_cal_extension_64_1_w_trace(tr, t_end+1-r_ts, qr, ql, thres, &exz64);
        // cigar_check(tr, qr, &exz64);
        // assert(exz.err == exz64.err && exz.ps == (exz64.pl-exz64.pe-1) && exz.pe == (exz64.pl-exz64.ps-1) && exz.ts == (exz64.tl-exz64.te-1) && exz.te == (exz64.tl-exz64.ts-1));

        // ed_band_cal_extension_infi_1_w(tr, t_end+1-r_ts, qr, ql, thres, NULL, &exz);
        // ed_band_cal_extension_infi_1_w_trace(tr, t_end+1-r_ts, qr, ql, thres, NULL, &exz);
        // cigar_check(tr, qr, &exz);
        // exz.err = INT32_MAX;
        // ed_band_cal_extension_infi_1_w_trace(tr, t_end+1-r_ts, qr, ql, thres, NULL, &exz);
        // cigar_check(tr, qr, &exz);
        // assert(exz.err == exz64.err && exz.ps == exz64.ps && exz.pe == exz64.pe && exz.ts == exz64.ts && exz.te == exz64.te);

        // ed_band_cal_extension_256_1_w(tr, t_end+1-r_ts, qr, ql, thres, &exz);
        // ed_band_cal_extension_256_1_w_trace(tr, t_end+1-r_ts, qr, ql, thres, &exz);
        // cigar_check(tr, qr, &exz);
        // exz.err = INT32_MAX;
        // ed_band_cal_extension_256_1_w_trace(tr, t_end+1-r_ts, qr, ql, thres, &exz);
        // cigar_check(tr, qr, &exz);
        // assert(exz.err == exz64.err && exz.ps == exz64.ps && exz.pe == exz64.pe && exz.ts == exz64.ts && exz.te == exz64.te);

        // free(qr); free(tr);


        // ed_band_cal_global_64_w(t_string+r_ts, t_end+1-r_ts, q_string, ql, thres, &exz64);
        // ed_band_cal_global_64_w_trace(t_string+r_ts, t_end+1-r_ts, q_string, ql, thres, &exz64);
        // cigar_check(t_string+r_ts, q_string, &(exz64));
        // exz64.err = INT32_MAX;
        // ed_band_cal_global_64_w_trace(t_string+r_ts, t_end+1-r_ts, q_string, ql, thres, &exz64);
        // cigar_check(t_string+r_ts, q_string, &(exz64));

        // ed_band_cal_global_infi_w(t_string+r_ts, t_end+1-r_ts, q_string, ql, thres, NULL, &exz);
        // ed_band_cal_global_infi_w_trace(t_string+r_ts, t_end+1-r_ts, q_string, ql, thres, NULL, &exz);
        // cigar_check(t_string+r_ts, q_string, &exz);
        // exz.err = INT32_MAX;
        // ed_band_cal_global_infi_w_trace(t_string+r_ts, t_end+1-r_ts, q_string, ql, thres, NULL, &exz);
        // cigar_check(t_string+r_ts, q_string, &exz);
        // assert(exz.err <= (int32_t)error && exz.err >= 0); 
        // assert(exz.err == exz64.err && exz.ps == exz64.ps && exz.pe == exz64.pe && exz.ts == exz64.ts && exz.te == exz64.te);

        // ed_band_cal_global_256_w(t_string+r_ts, t_end+1-r_ts, q_string, ql, thres, &exz);
        // ed_band_cal_global_256_w_trace(t_string+r_ts, t_end+1-r_ts, q_string, ql, thres, &exz);
        // cigar_check(t_string+r_ts, q_string, &exz);
        // exz.err = INT32_MAX;
        // ed_band_cal_global_256_w_trace(t_string+r_ts, t_end+1-r_ts, q_string, ql, thres, &exz);
        // cigar_check(t_string+r_ts, q_string, &exz);
        // assert(exz.err <= (int32_t)error && exz.err >= 0); 
        // assert(exz.err == exz64.err && exz.ps == exz64.ps && exz.pe == exz64.pe && exz.ts == exz64.ts && exz.te == exz64.te);

        
        // ed_band_cal_semi_64_w(t_string, aln_l, q_string, ql, thres, &exz64);
        // ed_band_cal_semi_64_w_trace(t_string, aln_l, q_string, ql, thres, &exz64);
        // cigar_check(t_string, q_string, &(exz64));
        // exz64.err = INT32_MAX;
        // ed_band_cal_semi_64_w_trace(t_string, aln_l, q_string, ql, thres, &exz64);
        // cigar_check(t_string, q_string, &(exz64));

        // ed_band_cal_semi_infi_w(t_string, aln_l, q_string, ql, thres, NULL, &exz);
        // ed_band_cal_semi_infi_w_trace(t_string, aln_l, q_string, ql, thres, NULL, &exz);
        // cigar_check(t_string, q_string, &exz);
        // exz.err = INT32_MAX;
        // ed_band_cal_semi_infi_w_trace(t_string, aln_l, q_string, ql, thres, NULL, &exz);
        // cigar_check(t_string, q_string, &exz);
        // assert(exz.err <= (int32_t)error && exz.err >= 0); 
        // assert(exz.err == exz64.err && exz.pe == exz64.pe && exz.ts == exz64.ts && exz.te == exz64.te);

        // ed_band_cal_semi_256_w(t_string, aln_l, q_string, ql, thres, &exz);
        // ed_band_cal_semi_256_w_trace(t_string, aln_l, q_string, ql, thres, &exz);
        // cigar_check(t_string, q_string, &exz);
        // exz.err = INT32_MAX;
        // ed_band_cal_semi_256_w_trace(t_string, aln_l, q_string, ql, thres, &exz);
        // cigar_check(t_string, q_string, &exz);
        // assert(exz.err <= (int32_t)error && exz.err >= 0); 
        // assert(exz.err == exz64.err && exz.pe == exz64.pe && exz.ts == exz64.ts && exz.te == exz64.te);



        ed_band_cal_semi_64_w_absent_diag(t_string+aux_beg, aln_l-aux_beg-aux_end, q_string, ql, 
                                                                                thres, aux_beg, &exz64);
        // ed_band_cal_semi_64_w_absent_diag_trace(t_string+aux_beg, aln_l-aux_beg-aux_end, q_string, ql, 
        //                                                                         thres, aux_beg, &exz64);
        // cigar_check(t_string+aux_beg, q_string, &(exz64));
        // exz64.err = INT32_MAX;
        // ed_band_cal_semi_64_w_absent_diag_trace(t_string+aux_beg, aln_l-aux_beg-aux_end, q_string, ql, 
        //                                                                         thres, aux_beg, &exz64);
        // cigar_check(t_string+aux_beg, q_string, &(exz64));



        ed_band_cal_semi_infi_w_absent_diag(t_string+aux_beg, aln_l-aux_beg-aux_end, q_string, ql, 
                                                                                thres, aux_beg, NULL, &exz);
        ed_band_cal_semi_infi_w_absent_diag_trace(t_string+aux_beg, aln_l-aux_beg-aux_end, q_string, ql, 
                                                                                thres, aux_beg, NULL, &exz);
        cigar_check(t_string+aux_beg, q_string, &(exz));
        exz.err = INT32_MAX;
        ed_band_cal_semi_infi_w_absent_diag_trace(t_string+aux_beg, aln_l-aux_beg-aux_end, q_string, ql, 
                                                                                thres, aux_beg, NULL, &exz);
        cigar_check(t_string+aux_beg, q_string, &(exz));
        assert(exz.err <= (int32_t)error && exz.err >= 0); 
        assert(exz.err == exz64.err && exz.pe == exz64.pe && exz.ts == exz64.ts && exz.te == exz64.te);
        exz64.err = exz.err; exz64.ps = exz.ps; exz64.pe = exz.pe; exz64.ts = exz.ts; exz64.te = exz.te;


        ed_band_cal_semi_256_w_absent_diag(t_string+aux_beg, aln_l-aux_beg-aux_end, q_string, ql, 
                                                                                thres, aux_beg, &exz);
        ed_band_cal_semi_256_w_absent_diag_trace(t_string+aux_beg, aln_l-aux_beg-aux_end, q_string, ql, 
                                                                                thres, aux_beg, &exz);
        cigar_check(t_string+aux_beg, q_string, &(exz));
        exz.err = INT32_MAX;
        ed_band_cal_semi_256_w_absent_diag_trace(t_string+aux_beg, aln_l-aux_beg-aux_end, q_string, ql, 
                                                                                thres, aux_beg, &exz);
        cigar_check(t_string+aux_beg, q_string, &(exz));
        assert(exz.err <= (int32_t)error && exz.err >= 0); 
        assert(exz.err == exz64.err && exz.ps == exz64.ps && exz.pe == exz64.pe && exz.ts == exz64.ts && exz.te == exz64.te);
        // if((!(exz.err == exz64.err && exz.ps == exz64.ps && exz.pe == exz64.pe && exz.ts == exz64.ts && exz.te == exz64.te)) || (exz.err != (int32_t)error)) {
        //     fprintf(stderr, "\n[M::%s::semi] error::%u, ql::%ld, thres::%ld, exz.err::%d, exz64.err::%d, exz.ps::%d, exz64.ps::%d, exz.pe::%d, exz64.pe::%d, exz.ts::%d, exz64.ts::%d, exz.te::%d, exz64.te::%d\n", __func__, 
        //     error, ql, thres, exz.err, exz64.err, exz.ps, exz64.ps, exz.pe, exz64.pe, exz.ts, exz64.ts, exz.te, exz64.te);
        //     fprintf(stderr, "[tstr] %.*s\n", (int32_t)aln_l, t_string);
        //     fprintf(stderr, "[qstr] %.*s\n", (int32_t)ql, q_string);
        // }
        destroy_bit_extz_t(&exz); destroy_bit_extz_t(&exz64);

        // if(exz.err > (int32_t)error && ql == 1) {
        //     fprintf(stderr, "[M::%s::] error::%u, ed_extension::%d, ql::%ld, thres::%ld\n", 
        //     __func__, error, exz.err, ql, thres);
        //     fprintf(stderr, "[tstr] %.*s\n", t_end+1-r_ts, t_string+r_ts);
        //     fprintf(stderr, "[qstr] %.*s\n", (int32_t)ql, q_string);
        // }
        
        // assert(ed_band_cal_global(t_string+r_ts, t_end+1-r_ts, q_string, ql, thres) == 
        //                 ed_band_cal_global_128bit(t_string+r_ts, t_end+1-r_ts, q_string, ql, thres));
        **/
        
        ///this condition is always wrong
        ///in best case, r_ts = threshold, t_end = aln_l - thres - 1
        if (((t_end+1) == aln_l) || (r_ts == 0)) {
            if(recal_boundary(q_string, tstr1, ql, thres, ts, r_ts, t_end,
            aux_beg, aux_end, error, id, aln_l, rev, dumy, rref, hpc_g, uref, 
            &ts, &r_ts, &t_end, &aux_beg, &aux_end, &error)) {
                p->error = error; p->extra_begin = aux_beg; p->extra_end = aux_end;
                t_string = update_des_str(tstr, ts, aln_l-aux_beg-aux_end, rev, rref, hpc_g, uref,
                                                    id, aux_beg, aux_end, hpc_g?NULL:tstr1);
            }
        }

        generate_cigar(dumy->path, dumy->path_length, p, &(z->w_list), &r_ts, &t_end, &error, q_string, ql, t_string);    

        p->y_start = ts + r_ts - aux_beg; 
        p->y_end = ts + t_end - aux_beg;
        p->error = error;         
        return 1;                     
    }
    p->error = -1;
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %r8, 0x30(%rsp)
movq %rdx, %r8
movq %rsi, 0x90(%rsp)
movq %rdi, %rbx
movl $0x0, 0x1c(%rsp)
movslq (%rdi), %rax
movslq 0x4(%rdi), %rdx
subq %rax, %rdx
movswq 0x16(%rdi), %rsi
movq %rsi, 0x20(%rsp)
leaq (%rdx,%rsi,2), %r13
incq %r13
movslq 0x8(%rdi), %r15
movq %r15, 0x50(%rsp)
movswq 0x10(%rdi), %r10
movq %r10, 0x48(%rsp)
movswq 0x12(%rdi), %rbp
movq %r13, 0x10(%rsp)
subq %r10, %r13
subq %rbp, %r13
movl 0xf0(%rsp), %r12d
addq %rax, %r9
movq %r9, 0x40(%rsp)
movl 0xe8(%rsp), %esi
incq %rdx
movq %rdx, 0x38(%rsp)
movq %rbp, 0x60(%rsp)
movq 0xd0(%rsp), %r9
testq %r8, %r8
movq %r8, 0x58(%rsp)
movq %rcx, 0x80(%rsp)
movq %rbp, 0x78(%rsp)
movq %r10, 0x68(%rsp)
je 0x89fff
leaq (%r9,%r10), %r14
movzbl %sil, %ecx
movq %r14, %rdi
movq %r15, %rsi
movq %r13, %rdx
movq %rbx, 0x8(%rsp)
movq %r9, %rbx
movq %r12, %r9
movq %r10, %r12
callq 0x32ef8
movq %rbx, %rdi
movl $0x4e, %esi
movq %r12, %rdx
callq 0x20e0
addq %r13, %r14
movq %r14, %rdi
movl $0x4e, %esi
movq %rbp, %rdx
callq 0x20e0
movq %rbx, %rdi
movq 0x8(%rsp), %rbx
jmp 0x8a0e5
testq %rcx, %rcx
je 0x8a028
movq (%rcx), %rax
movq 0x10(%rax), %rax
leaq (%r12,%r12,4), %rdx
movq 0x20(%rax,%rdx,8), %rdi
testb %sil, %sil
je 0x8a086
leaq (%rax,%rdx,8), %rax
movl (%rax), %eax
shrl %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
jmp 0x8a088
movq %r9, %rdi
movl $0x4e, %esi
movq %r10, %rdx
movq %r10, %r14
callq 0x20e0
movq 0xd0(%rsp), %rax
addq %rax, %r14
movq 0x30(%rsp), %rax
movq (%rax), %rax
leaq (%r12,%r12,4), %rdx
shlq $0x3, %rdx
addq 0x10(%rax), %rdx
subq $0x8, %rsp
movl 0xf0(%rsp), %eax
movzbl %al, %ecx
xorl %edi, %edi
movq %r14, %rsi
movq %r15, %r8
movq %r13, %r9
pushq $0x0
callq 0x36049
addq $0x10, %rsp
addq %r13, %r14
movq %r14, %rdi
jmp 0x8a0cb
xorl %eax, %eax
addq %rax, %rdi
movq %rbp, %rax
orq %r10, %rax
je 0x8a0e2
movq %rdi, %r14
movq %r9, %rdi
movl $0x4e, %esi
movq %r10, %rdx
movq %r10, %r12
callq 0x20e0
movq 0xd0(%rsp), %rax
addq %rax, %r12
addq %r15, %r14
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x2160
addq %r13, %r12
movq %r12, %rdi
movl $0x4e, %esi
movq %rbp, %rdx
callq 0x20e0
movq 0xd0(%rsp), %rdi
jmp 0x8a0e5
addq %r15, %rdi
movq 0xe0(%rsp), %rcx
leaq 0x7d70(%rcx), %rbp
leaq 0xff0(%rcx), %rax
leaq 0xa14(%rcx), %r14
movswl 0x14(%rbx), %r10d
movl 0xc(%rbx), %r11d
movq %r15, 0x70(%rsp)
subl %r15d, %r11d
leaq 0x1c(%rsp), %r15
movzwl 0x20(%rsp), %r8d
leaq 0x4(%rsp), %r12
movq %rdi, 0x8(%rsp)
movq 0x10(%rsp), %r13
movl %r13d, %esi
movq 0x40(%rsp), %rdx
movq 0x38(%rsp), %rcx
movq %r12, %r9
pushq %r11
pushq %r10
movq %r14, 0x98(%rsp)
pushq %r14
movq %rbp, %r14
pushq %rax
pushq %rbp
pushq %r15
callq 0x85726
addq $0x30, %rsp
movl %eax, 0x2c(%rsp)
movl (%r12), %r10d
cmpl $-0x1, %r10d
je 0x8a2fe
leal 0x1(%rax), %ecx
movslq %ecx, %rcx
cmpq %rcx, %r13
sete %dl
movl 0x1c(%rsp), %ecx
testl %ecx, %ecx
sete %sil
orb %dl, %sil
cmpb $0x1, %sil
jne 0x8a424
movq 0xd8(%rsp), %rsi
movslq %ecx, %r9
cltq
movl 0xf0(%rsp), %ecx
movq %r15, %r12
movl %ecx, %r15d
subq $0x8, %rsp
leaq 0x68(%rsp), %r11
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rdx
movq 0x28(%rsp), %rcx
movq 0x78(%rsp), %r8
leaq 0xc(%rsp), %rbp
pushq %rbp
pushq %r11
leaq 0x60(%rsp), %r11
pushq %r11
leaq 0x4c(%rsp), %r11
pushq %r11
pushq %r12
leaq 0x80(%rsp), %r11
pushq %r11
pushq 0x68(%rsp)
movq 0xc0(%rsp), %r12
pushq %r12
pushq 0xa0(%rsp)
pushq 0x130(%rsp)
movl 0x140(%rsp), %r11d
pushq %r11
pushq %r13
movq %r15, 0x88(%rsp)
pushq %r15
pushq %r10
pushq 0xf0(%rsp)
pushq 0xe8(%rsp)
pushq %rax
callq 0x9c14d
addq $0x90, %rsp
testl %eax, %eax
je 0x8a429
movq %r12, %rdx
movzwl 0x4(%rsp), %eax
movw %ax, 0x14(%rbx)
movq 0x48(%rsp), %r12
movw %r12w, 0x10(%rbx)
movq 0x60(%rsp), %r15
movw %r15w, 0x12(%rbx)
testq %rdx, %rdx
sete %al
movq 0xd8(%rsp), %rsi
testq %rsi, %rsi
setne %cl
movq %rsi, 0x8(%rsp)
testb %cl, %al
jne 0x8a429
movq 0x50(%rsp), %r9
subq %r12, %r13
subq %r15, %r13
movq 0x58(%rsp), %r8
testq %r8, %r8
je 0x8a309
movslq %r12d, %rbp
movq %r14, 0x10(%rsp)
movq 0xd0(%rsp), %r14
leaq (%r14,%rbp), %r12
movl 0xe8(%rsp), %eax
movzbl %al, %ecx
movq %r12, %rdi
movq %r9, %rsi
movq %r13, %rdx
movq 0x20(%rsp), %r9
callq 0x32ef8
movq %r14, %rdi
movl $0x4e, %esi
movq %rbp, %rdx
leaq 0x4(%rsp), %rbp
callq 0x20e0
addq %r13, %r12
movslq %r15d, %rdx
movq %r12, %rdi
movl $0x4e, %esi
callq 0x20e0
movq %r14, 0x8(%rsp)
movq 0x10(%rsp), %r14
jmp 0x8a429
xorl %eax, %eax
movw $0xffff, %cx            # imm = 0xFFFF
jmp 0x8a48e
testq %rdx, %rdx
movl 0xe8(%rsp), %esi
je 0x8a342
movq (%rdx), %rax
movq 0x10(%rax), %rax
movq 0x20(%rsp), %rcx
leaq (%rcx,%rcx,4), %rcx
movq 0x20(%rax,%rcx,8), %rdx
testb %sil, %sil
je 0x8a3bb
leaq (%rax,%rcx,8), %rax
movl (%rax), %eax
shrl %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
jmp 0x8a3bd
movq %r14, 0x10(%rsp)
movq 0xd0(%rsp), %r14
movq %r14, %rdi
movq %rsi, %rbp
movl $0x4e, %esi
movq %r12, %rdx
movq %r9, 0x8(%rsp)
callq 0x20e0
addq %r14, %r12
movq 0x30(%rsp), %rax
movq (%rax), %rax
movq 0x20(%rsp), %rcx
leaq (%rcx,%rcx,4), %rdx
shlq $0x3, %rdx
addq 0x10(%rax), %rdx
subq $0x8, %rsp
movzbl %bpl, %ecx
leaq 0xc(%rsp), %rbp
xorl %edi, %edi
movq %r12, %rsi
movq 0x10(%rsp), %r8
movq %r13, %r9
pushq $0x0
callq 0x36049
addq $0x10, %rsp
addq %r13, %r12
movq %r12, %rdi
movl $0x4e, %esi
movq %r15, %rdx
jmp 0x8a2ea
xorl %eax, %eax
addq %rax, %rdx
movq %r15, %rax
orq %r12, %rax
je 0x8a4a4
movq %r13, 0x10(%rsp)
movq 0xd0(%rsp), %rbp
movq %rdx, %r13
movq %rbp, %rdi
movl $0x4e, %esi
movq %r12, %rdx
movq %r9, 0x8(%rsp)
callq 0x20e0
addq %rbp, %r12
addq 0x8(%rsp), %r13
movq %r12, %rdi
movq %r13, %rsi
movq 0x10(%rsp), %r13
movq %r13, %rdx
callq 0x2160
addq %r13, %r12
movq %r12, %rdi
movl $0x4e, %esi
movq %r15, %rdx
callq 0x20e0
movq %rbp, 0x8(%rsp)
leaq 0x4(%rsp), %rbp
movl (%r14), %esi
movq 0x90(%rsp), %rcx
addq $0x48, %rcx
leaq 0x1c(%rsp), %r15
leaq 0x2c(%rsp), %r12
movq 0x88(%rsp), %rdi
movq %rbx, %rdx
movq %r15, %r8
movq %r12, %r9
pushq 0x8(%rsp)
pushq 0x40(%rsp)
pushq 0x50(%rsp)
pushq %rbp
callq 0x85cd2
addq $0x20, %rsp
movl 0x50(%rsp), %eax
movl (%r15), %ecx
addl %eax, %ecx
movl 0x48(%rsp), %edx
subl %edx, %ecx
movl %ecx, 0x8(%rbx)
subl %edx, %eax
addl (%r12), %eax
movl %eax, 0xc(%rbx)
movzwl 0x4(%rsp), %ecx
movl $0x1, %eax
movw %cx, 0x14(%rbx)
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq %r9, %rdx
movq %rdx, 0x8(%rsp)
jmp 0x8a429