// File: chhylp123[P]hifiasm/Correct.cpp
// Function: extract_sub_cigar_sv(overlap_region*, long, long, All_reads*, char*, long, UC_Read*, kv_ul_ov_t*, unsigned long, long, long)
int64_t extract_sub_cigar_sv(overlap_region *z, int64_t zid, int64_t wk, All_reads *rref, char *qstr, int64_t ql, UC_Read* tu, kv_ul_ov_t *rr, uint64_t min_err, int64_t hpc_len, int64_t hpc_rr)
{
    int64_t xk = z->w_list.a[wk].x_start, yk = z->w_list.a[wk].y_start; ul_ov_t *cp, *ra; bit_extz_t ez;
    int64_t ck = 0, ex[2], ey[2], el0, tl = Get_READ_LENGTH((*rref), z->y_id), ox[2], oy[2], os, oe, ff, rn, rn1, k; uint32_t cl, rr_n0 = rr->n, is_srt = 1;
    set_bit_extz_t(ez, (*z), wk);
    if(!ez.cigar.n) return -1;
    int64_t cn = ez.cigar.n, wx[2], wy[2]; uint16_t op, op0;
    ex[0] = ex[1] = ey[0] = ey[1] = -1; 
    
    while (ck < cn) {//[s, e)
        wx[0] = xk; wy[0] = yk; el0 = 0;
        op = (ez.cigar.a[ck]>>14); 
        cl = (ez.cigar.a[ck]&(0x3fff));
        if(op!=2) xk += cl; if(op!=3) yk += cl; 
        op0 = op; el0 += cl;
        for (ck++; ck < cn; ck++) {
            op = (ez.cigar.a[ck]>>14); 
            if((!!op) != (!!op0)) break;
            cl = (ez.cigar.a[ck]&(0x3fff));
            if(op!=2) xk += cl; if(op!=3) yk += cl;
            el0 += cl;
        }
        wx[1] = xk; wy[1] = yk; 
        if(op0 == 0) continue;
        ff = 1;


        ox[0] = ((wx[0]>=el0)?(wx[0]-el0):(0)); ox[1] = ((wx[1]+el0<=ql)?(wx[1]+el0):(ql));
        oy[0] = ((wy[0]>=el0)?(wy[0]-el0):(0)); oy[1] = ((wy[1]+el0<=tl)?(wy[1]+el0):(tl));

        if(ex[0] < 0 || ex[1] < 0 || ey[0] < 0 || ey[1] < 0) ff = 0;

        if(ff) {
            os = MAX(ox[0], ex[0]); oe = MIN(ox[1], ex[1]);
            if(oe <= os) ff = 0;

            os = MAX(oy[0], ey[0]); oe = MIN(oy[1], ey[1]);
            if(oe <= os) ff = 0;
        }

        if(ff) {///extend
            ex[0] = MIN(ox[0], ex[0]); ex[1] = MAX(ox[1], ex[1]);
            ey[0] = MIN(oy[0], ey[0]); ey[1] = MAX(oy[1], ey[1]);
        } else {
            if(ex[0] >= 0 && ex[1] >= 0 && ey[0] >= 0 && ey[1] >= 0) {
                kv_pushp(ul_ov_t, *rr, &cp);
                cp->qs = ex[0]; cp->qe = ex[1];
                cp->ts = ey[0]; cp->te = ey[1];
                cp->sec = 0; cp->el = 0; cp->rev = 0;
                if((rr->n > rr_n0 + 1) && (cp->qs < rr->a[rr->n-2].qs)) is_srt = 0;
            } 
            ex[0] = ox[0]; ex[1] = ox[1];
            ey[0] = oy[0]; ey[1] = oy[1];
        }
    }

    if(ex[0] >= 0 && ex[1] >= 0 && ey[0] >= 0 && ey[1] >= 0) {
        kv_pushp(ul_ov_t, *rr, &cp);
        cp->qs = ex[0]; cp->qe = ex[1];
        cp->ts = ey[0]; cp->te = ey[1];
        cp->sec = 0; cp->el = 0; cp->rev = 0;
        if((rr->n > rr_n0 + 1) && (cp->qs < rr->a[rr->n-2].qs)) is_srt = 0;
    } 

    if(rr->n <= rr_n0) return 0;
    if(!is_srt) radix_sort_ul_ov_srt_qs1(rr->a + rr_n0, rr->a + rr->n);

    ra = rr->a + rr_n0; rn = rr->n - rr_n0;
    for (k = ck = 0; k < rn; k++) {
        if(ck > 0 && ra[k].qs < ra[ck - 1].qe) {
            if(ra[k].qe > ra[ck - 1].qe) ra[ck - 1].qe = ra[k].qe;
            if(ra[k].ts < ra[ck - 1].ts) ra[ck - 1].ts = ra[k].ts;
            if(ra[k].te > ra[ck - 1].te) ra[ck - 1].te = ra[k].te;
        } else {
            if((ck > 0) && (ra[ck - 1].qe - ra[ck - 1].qs < min_err) && (ra[ck - 1].te - ra[ck - 1].ts < min_err)) {
                ck--;
            }
            ra[ck++] = ra[k];
        }
    }
    if((ck > 0) && (ra[ck - 1].qe - ra[ck - 1].qs < min_err) && (ra[ck - 1].te - ra[ck - 1].ts < min_err)) ck--;
    if(ck == 0) {
        rr->n = rr_n0;
        return 0;
    }
    rn = ck; ck = 0; xk = z->w_list.a[wk].x_start; yk = z->w_list.a[wk].y_start;
    for (k = ck = rn1 = 0; k < rn; k++) {
        cp = &(ra[k]); 
        cp->qn = iter_sub_cigar_sv(zid, cp, &ez, &ck, &xk, &yk, NULL, -1, NULL, -1, -1, -1, -1, -1, &(ey[0]), &(ey[1]), -1);
        if(cp->qn < min_err) continue;
        assert(ey[0] >= 0 && ey[1] >= 0 && ey[1] >= ey[0]);
        ey[0] -= hpc_len; if(ey[0] < 0) ey[0] = 0;
        ey[1] += hpc_len; if(ey[1] > tl) ey[1] = tl;

        UC_Read_resize(*tu, (ey[1] - ey[0])); ///ystr = tu->seq; 
        recover_UC_Read_sub_region(tu->seq, ey[0], (ey[1] - ey[0]), z->y_pos_strand, rref, z->y_id);
        iter_sub_cigar_sv(zid, cp, &ez, &ck, &xk, &yk, qstr, ql, tu->seq, tl, ey[0], ey[1], hpc_len, hpc_rr, &(ey[0]), &(ey[1]), (min_err<<1));

        ra[rn1++] = *cp;
        // fprintf(stderr, "-[M::%s] rid::%u\t%.*s\tq0::[%u,%u)\tql::%ld\tq1::[%u,%u)\t\terr::%u\tel::%u\n", __func__, z->y_id, (int)Get_NAME_LENGTH(R_INF, z->y_id), Get_NAME(R_INF, z->y_id), cp->qs, cp->qe, ql, cp->ts, cp->te, cp->qn, cp->el);
    }

    // fprintf(stderr, "\n");
    
    rr->n = rr_n0 + rn1;
    if(rn1 > 0) return 1;
    else return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2e8, %rsp            # imm = 0x2E8
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x38(%rbp)
movq %rsi, -0x40(%rbp)
movq %rdx, -0x48(%rbp)
movq %rcx, -0x50(%rbp)
movq %r8, -0x58(%rbp)
movq %r9, -0x60(%rbp)
movq -0x38(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x48(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq (%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x38(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x48(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq 0x8(%rax), %rax
movq %rax, -0x70(%rbp)
movq $0x0, -0x160(%rbp)
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x38(%rbp), %rcx
movl 0x10(%rcx), %ecx
movq (%rax,%rcx,8), %rax
movq %rax, -0x190(%rbp)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, -0x1e8(%rbp)
movl $0x1, -0x1ec(%rbp)
movq -0x38(%rbp), %rax
movq 0x70(%rax), %rax
movq -0x38(%rbp), %rcx
movq 0x58(%rcx), %rcx
movq -0x48(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
movl 0x18(%rcx), %ecx
shlq %rcx
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
movq -0x38(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x48(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %eax
movq %rax, -0xa8(%rbp)
movq %rax, -0xb0(%rbp)
movq -0x38(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x48(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x13c(%rbp)
movq -0x38(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x48(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x138(%rbp)
movq -0x38(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x48(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x148(%rbp)
movq -0x38(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x48(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movl %eax, -0x144(%rbp)
movq -0x38(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x48(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0x14(%rax), %eax
movl %eax, -0x12c(%rbp)
movq -0x38(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x48(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0x14(%rax), %eax
movl %eax, -0x130(%rbp)
cmpq $0x0, -0xb0(%rbp)
jne 0x6fce1
movq $-0x1, -0x30(%rbp)
jmp 0x70d6e
movq -0xb0(%rbp), %rax
movq %rax, -0x1f8(%rbp)
movq $-0x1, -0x178(%rbp)
movq $-0x1, -0x180(%rbp)
movq $-0x1, -0x168(%rbp)
movq $-0x1, -0x170(%rbp)
movq -0x160(%rbp), %rax
cmpq -0x1f8(%rbp), %rax
jge 0x70446
movq -0x68(%rbp), %rax
movq %rax, -0x210(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x220(%rbp)
movq $0x0, -0x188(%rbp)
movq -0xa0(%rbp), %rax
movq -0x160(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
sarl $0xe, %eax
movw %ax, -0x222(%rbp)
movq -0xa0(%rbp), %rax
movq -0x160(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x3fff, %eax           # imm = 0x3FFF
movl %eax, -0x1e4(%rbp)
movzwl -0x222(%rbp), %eax
cmpl $0x2, %eax
je 0x6fda3
movl -0x1e4(%rbp), %eax
addq -0x68(%rbp), %rax
movq %rax, -0x68(%rbp)
movzwl -0x222(%rbp), %eax
cmpl $0x3, %eax
je 0x6fdbd
movl -0x1e4(%rbp), %eax
addq -0x70(%rbp), %rax
movq %rax, -0x70(%rbp)
movw -0x222(%rbp), %ax
movw %ax, -0x224(%rbp)
movl -0x1e4(%rbp), %eax
addq -0x188(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0x160(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x160(%rbp)
movq -0x160(%rbp), %rax
cmpq -0x1f8(%rbp), %rax
jge 0x6fece
movq -0xa0(%rbp), %rax
movq -0x160(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
sarl $0xe, %eax
movw %ax, -0x222(%rbp)
cmpw $0x0, -0x222(%rbp)
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cmpw $0x0, -0x224(%rbp)
setne %cl
xorb $-0x1, %cl
xorb $-0x1, %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
je 0x6fe52
jmp 0x6fece
movq -0xa0(%rbp), %rax
movq -0x160(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x3fff, %eax           # imm = 0x3FFF
movl %eax, -0x1e4(%rbp)
movzwl -0x222(%rbp), %eax
cmpl $0x2, %eax
je 0x6fe89
movl -0x1e4(%rbp), %eax
addq -0x68(%rbp), %rax
movq %rax, -0x68(%rbp)
movzwl -0x222(%rbp), %eax
cmpl $0x3, %eax
je 0x6fea3
movl -0x1e4(%rbp), %eax
addq -0x70(%rbp), %rax
movq %rax, -0x70(%rbp)
movl -0x1e4(%rbp), %eax
addq -0x188(%rbp), %rax
movq %rax, -0x188(%rbp)
movq -0x160(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x160(%rbp)
jmp 0x6fdf1
movq -0x68(%rbp), %rax
movq %rax, -0x208(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x218(%rbp)
movzwl -0x224(%rbp), %eax
cmpl $0x0, %eax
jne 0x6fef5
jmp 0x6fd1b
movq $0x1, -0x1c8(%rbp)
movq -0x210(%rbp), %rax
cmpq -0x188(%rbp), %rax
jl 0x6ff27
movq -0x210(%rbp), %rax
subq -0x188(%rbp), %rax
movq %rax, -0x230(%rbp)
jmp 0x6ff32
xorl %eax, %eax
movq %rax, -0x230(%rbp)
jmp 0x6ff32
movq -0x230(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movq -0x208(%rbp), %rax
addq -0x188(%rbp), %rax
cmpq -0x60(%rbp), %rax
jg 0x6ff6b
movq -0x208(%rbp), %rax
addq -0x188(%rbp), %rax
movq %rax, -0x238(%rbp)
jmp 0x6ff76
movq -0x60(%rbp), %rax
movq %rax, -0x238(%rbp)
movq -0x238(%rbp), %rax
movq %rax, -0x198(%rbp)
movq -0x220(%rbp), %rax
cmpq -0x188(%rbp), %rax
jl 0x6ffab
movq -0x220(%rbp), %rax
subq -0x188(%rbp), %rax
movq %rax, -0x240(%rbp)
jmp 0x6ffb6
xorl %eax, %eax
movq %rax, -0x240(%rbp)
jmp 0x6ffb6
movq -0x240(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq -0x218(%rbp), %rax
addq -0x188(%rbp), %rax
cmpq -0x190(%rbp), %rax
jg 0x6fff2
movq -0x218(%rbp), %rax
addq -0x188(%rbp), %rax
movq %rax, -0x248(%rbp)
jmp 0x70000
movq -0x190(%rbp), %rax
movq %rax, -0x248(%rbp)
movq -0x248(%rbp), %rax
movq %rax, -0x1a8(%rbp)
cmpq $0x0, -0x170(%rbp)
jl 0x70036
cmpq $0x0, -0x168(%rbp)
jl 0x70036
cmpq $0x0, -0x180(%rbp)
jl 0x70036
cmpq $0x0, -0x178(%rbp)
jge 0x70041
movq $0x0, -0x1c8(%rbp)
cmpq $0x0, -0x1c8(%rbp)
je 0x70177
movq -0x1a0(%rbp), %rax
cmpq -0x170(%rbp), %rax
jl 0x7006f
movq -0x1a0(%rbp), %rax
movq %rax, -0x250(%rbp)
jmp 0x7007d
movq -0x170(%rbp), %rax
movq %rax, -0x250(%rbp)
movq -0x250(%rbp), %rax
movq %rax, -0x1b8(%rbp)
movq -0x198(%rbp), %rax
cmpq -0x168(%rbp), %rax
jg 0x700ab
movq -0x198(%rbp), %rax
movq %rax, -0x258(%rbp)
jmp 0x700b9
movq -0x168(%rbp), %rax
movq %rax, -0x258(%rbp)
movq -0x258(%rbp), %rax
movq %rax, -0x1c0(%rbp)
movq -0x1c0(%rbp), %rax
cmpq -0x1b8(%rbp), %rax
jg 0x700e2
movq $0x0, -0x1c8(%rbp)
movq -0x1b0(%rbp), %rax
cmpq -0x180(%rbp), %rax
jl 0x70102
movq -0x1b0(%rbp), %rax
movq %rax, -0x260(%rbp)
jmp 0x70110
movq -0x180(%rbp), %rax
movq %rax, -0x260(%rbp)
movq -0x260(%rbp), %rax
movq %rax, -0x1b8(%rbp)
movq -0x1a8(%rbp), %rax
cmpq -0x178(%rbp), %rax
jg 0x7013e
movq -0x1a8(%rbp), %rax
movq %rax, -0x268(%rbp)
jmp 0x7014c
movq -0x178(%rbp), %rax
movq %rax, -0x268(%rbp)
movq -0x268(%rbp), %rax
movq %rax, -0x1c0(%rbp)
movq -0x1c0(%rbp), %rax
cmpq -0x1b8(%rbp), %rax
jg 0x70175
movq $0x0, -0x1c8(%rbp)
jmp 0x70177
cmpq $0x0, -0x1c8(%rbp)
je 0x7027a
movq -0x1a0(%rbp), %rax
cmpq -0x170(%rbp), %rax
jg 0x701a5
movq -0x1a0(%rbp), %rax
movq %rax, -0x270(%rbp)
jmp 0x701b3
movq -0x170(%rbp), %rax
movq %rax, -0x270(%rbp)
movq -0x270(%rbp), %rax
movq %rax, -0x170(%rbp)
movq -0x198(%rbp), %rax
cmpq -0x168(%rbp), %rax
jl 0x701e1
movq -0x198(%rbp), %rax
movq %rax, -0x278(%rbp)
jmp 0x701ef
movq -0x168(%rbp), %rax
movq %rax, -0x278(%rbp)
movq -0x278(%rbp), %rax
movq %rax, -0x168(%rbp)
movq -0x1b0(%rbp), %rax
cmpq -0x180(%rbp), %rax
jg 0x7021d
movq -0x1b0(%rbp), %rax
movq %rax, -0x280(%rbp)
jmp 0x7022b
movq -0x180(%rbp), %rax
movq %rax, -0x280(%rbp)
movq -0x280(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0x1a8(%rbp), %rax
cmpq -0x178(%rbp), %rax
jl 0x70259
movq -0x1a8(%rbp), %rax
movq %rax, -0x288(%rbp)
jmp 0x70267
movq -0x178(%rbp), %rax
movq %rax, -0x288(%rbp)
movq -0x288(%rbp), %rax
movq %rax, -0x178(%rbp)
jmp 0x70441
cmpq $0x0, -0x170(%rbp)
jl 0x70409
cmpq $0x0, -0x168(%rbp)
jl 0x70409
cmpq $0x0, -0x180(%rbp)
jl 0x70409
cmpq $0x0, -0x178(%rbp)
jl 0x70409
jmp 0x702b4
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x70321
movq 0x18(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x702e5
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
shlq %rax
movq %rax, -0x290(%rbp)
jmp 0x702f3
movl $0x2, %eax
movq %rax, -0x290(%rbp)
jmp 0x702f3
movq -0x290(%rbp), %rcx
movq 0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0x18(%rbp), %rax
movq (%rax), %rdi
movq 0x18(%rbp), %rax
imulq $0x1c, 0x10(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq 0x18(%rbp), %rax
movq %rcx, (%rax)
movq 0x18(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rbp), %rdx
movq 0x8(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x8(%rdx)
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x170(%rbp), %rax
movl %eax, %ecx
movq -0x78(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x168(%rbp), %rax
movl %eax, %ecx
movq -0x78(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x180(%rbp), %rax
movl %eax, %ecx
movq -0x78(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x178(%rbp), %rax
movl %eax, %ecx
movq -0x78(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x78(%rbp), %rax
movl 0x18(%rax), %ecx
andl $0xc0000000, %ecx       # imm = 0xC0000000
orl $0x0, %ecx
movl %ecx, 0x18(%rax)
movq -0x78(%rbp), %rax
movl 0x18(%rax), %ecx
andl $0xbfffffff, %ecx       # imm = 0xBFFFFFFF
orl $0x0, %ecx
movl %ecx, 0x18(%rax)
movq -0x78(%rbp), %rax
movl 0x18(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x0, %ecx
movl %ecx, 0x18(%rax)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x1e8(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jbe 0x70407
movq -0x78(%rbp), %rax
movl 0x4(%rax), %eax
movq 0x18(%rbp), %rcx
movq (%rcx), %rcx
movq 0x18(%rbp), %rdx
movq 0x8(%rdx), %rdx
subq $0x2, %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
jae 0x70407
movl $0x0, -0x1ec(%rbp)
jmp 0x70409
movq -0x1a0(%rbp), %rax
movq %rax, -0x170(%rbp)
movq -0x198(%rbp), %rax
movq %rax, -0x168(%rbp)
movq -0x1b0(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0x1a8(%rbp), %rax
movq %rax, -0x178(%rbp)
jmp 0x6fd1b
cmpq $0x0, -0x170(%rbp)
jl 0x705d5
cmpq $0x0, -0x168(%rbp)
jl 0x705d5
cmpq $0x0, -0x180(%rbp)
jl 0x705d5
cmpq $0x0, -0x178(%rbp)
jl 0x705d5
jmp 0x70480
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x704ed
movq 0x18(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x704b1
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
shlq %rax
movq %rax, -0x298(%rbp)
jmp 0x704bf
movl $0x2, %eax
movq %rax, -0x298(%rbp)
jmp 0x704bf
movq -0x298(%rbp), %rcx
movq 0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq 0x18(%rbp), %rax
movq (%rax), %rdi
movq 0x18(%rbp), %rax
imulq $0x1c, 0x10(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq 0x18(%rbp), %rax
movq %rcx, (%rax)
movq 0x18(%rbp), %rax
movq (%rax), %rax
movq 0x18(%rbp), %rdx
movq 0x8(%rdx), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, 0x8(%rdx)
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x170(%rbp), %rax
movl %eax, %ecx
movq -0x78(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x168(%rbp), %rax
movl %eax, %ecx
movq -0x78(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x180(%rbp), %rax
movl %eax, %ecx
movq -0x78(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x178(%rbp), %rax
movl %eax, %ecx
movq -0x78(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x78(%rbp), %rax
movl 0x18(%rax), %ecx
andl $0xc0000000, %ecx       # imm = 0xC0000000
orl $0x0, %ecx
movl %ecx, 0x18(%rax)
movq -0x78(%rbp), %rax
movl 0x18(%rax), %ecx
andl $0xbfffffff, %ecx       # imm = 0xBFFFFFFF
orl $0x0, %ecx
movl %ecx, 0x18(%rax)
movq -0x78(%rbp), %rax
movl 0x18(%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl $0x0, %ecx
movl %ecx, 0x18(%rax)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x1e8(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
cmpq %rcx, %rax
jbe 0x705d3
movq -0x78(%rbp), %rax
movl 0x4(%rax), %eax
movq 0x18(%rbp), %rcx
movq (%rcx), %rcx
movq 0x18(%rbp), %rdx
movq 0x8(%rdx), %rdx
subq $0x2, %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x4(%rcx), %eax
jae 0x705d3
movl $0x0, -0x1ec(%rbp)
jmp 0x705d5
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x1e8(%rbp), %ecx
cmpq %rcx, %rax
ja 0x705f5
movq $0x0, -0x30(%rbp)
jmp 0x70d6e
cmpl $0x0, -0x1ec(%rbp)
jne 0x7062a
movq 0x18(%rbp), %rax
movq (%rax), %rdi
movl -0x1e8(%rbp), %eax
imulq $0x1c, %rax, %rax
addq %rax, %rdi
movq 0x18(%rbp), %rax
movq (%rax), %rsi
movq 0x18(%rbp), %rax
imulq $0x1c, 0x8(%rax), %rax
addq %rax, %rsi
callq 0x30750
movq 0x18(%rbp), %rax
movq (%rax), %rax
movl -0x1e8(%rbp), %ecx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x80(%rbp)
movq 0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x1e8(%rbp), %ecx
subq %rcx, %rax
movq %rax, -0x1d0(%rbp)
movq $0x0, -0x160(%rbp)
movq $0x0, -0x1e0(%rbp)
movq -0x1e0(%rbp), %rax
cmpq -0x1d0(%rbp), %rax
jge 0x708c8
cmpq $0x0, -0x160(%rbp)
jle 0x707d0
movq -0x80(%rbp), %rax
imulq $0x1c, -0x1e0(%rbp), %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movq -0x80(%rbp), %rcx
movq -0x160(%rbp), %rdx
subq $0x1, %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x8(%rcx), %eax
jae 0x707d0
movq -0x80(%rbp), %rax
imulq $0x1c, -0x1e0(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x80(%rbp), %rcx
movq -0x160(%rbp), %rdx
subq $0x1, %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x8(%rcx), %eax
jbe 0x7071b
movq -0x80(%rbp), %rax
imulq $0x1c, -0x1e0(%rbp), %rcx
addq %rcx, %rax
movl 0x8(%rax), %ecx
movq -0x80(%rbp), %rax
movq -0x160(%rbp), %rdx
subq $0x1, %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x8(%rax)
movq -0x80(%rbp), %rax
imulq $0x1c, -0x1e0(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %eax
movq -0x80(%rbp), %rcx
movq -0x160(%rbp), %rdx
subq $0x1, %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x10(%rcx), %eax
jae 0x70773
movq -0x80(%rbp), %rax
imulq $0x1c, -0x1e0(%rbp), %rcx
addq %rcx, %rax
movl 0x10(%rax), %ecx
movq -0x80(%rbp), %rax
movq -0x160(%rbp), %rdx
subq $0x1, %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x10(%rax)
movq -0x80(%rbp), %rax
imulq $0x1c, -0x1e0(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq -0x80(%rbp), %rcx
movq -0x160(%rbp), %rdx
subq $0x1, %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
cmpl 0x14(%rcx), %eax
jbe 0x707cb
movq -0x80(%rbp), %rax
imulq $0x1c, -0x1e0(%rbp), %rcx
addq %rcx, %rax
movl 0x14(%rax), %ecx
movq -0x80(%rbp), %rax
movq -0x160(%rbp), %rdx
subq $0x1, %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0x14(%rax)
jmp 0x708af
cmpq $0x0, -0x160(%rbp)
jle 0x70864
movq -0x80(%rbp), %rax
movq -0x160(%rbp), %rcx
subq $0x1, %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x80(%rbp), %rcx
movq -0x160(%rbp), %rdx
subq $0x1, %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
subl 0x4(%rcx), %eax
movl %eax, %eax
cmpq 0x20(%rbp), %rax
jae 0x70864
movq -0x80(%rbp), %rax
movq -0x160(%rbp), %rcx
subq $0x1, %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq -0x80(%rbp), %rcx
movq -0x160(%rbp), %rdx
subq $0x1, %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
subl 0x10(%rcx), %eax
movl %eax, %eax
cmpq 0x20(%rbp), %rax
jae 0x70864
movq -0x160(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x160(%rbp)
movq -0x80(%rbp), %rcx
imulq $0x1c, -0x1e0(%rbp), %rax
addq %rax, %rcx
movq -0x80(%rbp), %rax
movq -0x160(%rbp), %rdx
movq %rdx, %rsi
addq $0x1, %rsi
movq %rsi, -0x160(%rbp)
imulq $0x1c, %rdx, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movl 0x18(%rcx), %ecx
movl %ecx, 0x18(%rax)
jmp 0x708b1
movq -0x1e0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1e0(%rbp)
jmp 0x70670
cmpq $0x0, -0x160(%rbp)
jle 0x7095c
movq -0x80(%rbp), %rax
movq -0x160(%rbp), %rcx
subq $0x1, %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x80(%rbp), %rcx
movq -0x160(%rbp), %rdx
subq $0x1, %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
subl 0x4(%rcx), %eax
movl %eax, %eax
cmpq 0x20(%rbp), %rax
jae 0x7095c
movq -0x80(%rbp), %rax
movq -0x160(%rbp), %rcx
subq $0x1, %rcx
imulq $0x1c, %rcx, %rcx
addq %rcx, %rax
movl 0x14(%rax), %eax
movq -0x80(%rbp), %rcx
movq -0x160(%rbp), %rdx
subq $0x1, %rdx
imulq $0x1c, %rdx, %rdx
addq %rdx, %rcx
subl 0x10(%rcx), %eax
movl %eax, %eax
cmpq 0x20(%rbp), %rax
jae 0x7095c
movq -0x160(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x160(%rbp)
cmpq $0x0, -0x160(%rbp)
jne 0x70983
movl -0x1e8(%rbp), %eax
movl %eax, %ecx
movq 0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq $0x0, -0x30(%rbp)
jmp 0x70d6e
movq -0x160(%rbp), %rax
movq %rax, -0x1d0(%rbp)
movq $0x0, -0x160(%rbp)
movq -0x38(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x48(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq (%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x38(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x48(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq 0x8(%rax), %rax
movq %rax, -0x70(%rbp)
movq $0x0, -0x1d8(%rbp)
movq $0x0, -0x160(%rbp)
movq $0x0, -0x1e0(%rbp)
movq -0x1e0(%rbp), %rax
cmpq -0x1d0(%rbp), %rax
jge 0x70d3b
movq -0x80(%rbp), %rax
imulq $0x1c, -0x1e0(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x40(%rbp), %rdi
movq -0x78(%rbp), %rsi
leaq -0x180(%rbp), %r10
leaq -0x180(%rbp), %rax
addq $0x8, %rax
leaq -0x158(%rbp), %rdx
leaq -0x160(%rbp), %rcx
leaq -0x68(%rbp), %r8
leaq -0x70(%rbp), %r9
xorl %r11d, %r11d
movq $0x0, (%rsp)
movq $-0x1, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
movq $-0x1, 0x18(%rsp)
movq $-0x1, 0x20(%rsp)
movq $-0x1, 0x28(%rsp)
movq $-0x1, 0x30(%rsp)
movq $-0x1, 0x38(%rsp)
movq %r10, 0x40(%rsp)
movq %rax, 0x48(%rsp)
movq $-0x1, 0x50(%rsp)
callq 0x6f310
movl %eax, %ecx
movq -0x78(%rbp), %rax
movl %ecx, (%rax)
movq -0x78(%rbp), %rax
movl (%rax), %eax
cmpq 0x20(%rbp), %rax
jae 0x70ac4
jmp 0x70d24
xorl %eax, %eax
cmpq $0x0, -0x180(%rbp)
movb %al, -0x299(%rbp)
jl 0x70aff
xorl %eax, %eax
cmpq $0x0, -0x178(%rbp)
movb %al, -0x299(%rbp)
jl 0x70aff
movq -0x178(%rbp), %rax
cmpq -0x180(%rbp), %rax
setge %al
movb %al, -0x299(%rbp)
movb -0x299(%rbp), %al
testb $0x1, %al
jne 0x70b0b
jmp 0x70b0d
jmp 0x70b2c
leaq 0x313fd5(%rip), %rdi    # 0x384ae9
leaq 0x311800(%rip), %rsi    # 0x38231b
movl $0x49f1, %edx           # imm = 0x49F1
leaq 0x313fed(%rip), %rcx    # 0x384b14
callq 0x2130
movq 0x28(%rbp), %rcx
movq -0x180(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x180(%rbp)
cmpq $0x0, -0x180(%rbp)
jge 0x70b56
movq $0x0, -0x180(%rbp)
movq 0x28(%rbp), %rax
addq -0x178(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x178(%rbp), %rax
cmpq -0x190(%rbp), %rax
jle 0x70b86
movq -0x190(%rbp), %rax
movq %rax, -0x178(%rbp)
jmp 0x70b88
movq 0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x178(%rbp), %rcx
subq -0x180(%rbp), %rcx
cmpq %rcx, %rax
jge 0x70be1
movq 0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x178(%rbp), %rsi
subq -0x180(%rbp), %rsi
shlq $0x0, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x178(%rbp), %rcx
subq -0x180(%rbp), %rcx
movq 0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x70be3
movq 0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x180(%rbp), %rsi
movq -0x178(%rbp), %rdx
subq -0x180(%rbp), %rdx
movq -0x38(%rbp), %rax
movl 0x1c(%rax), %eax
movq -0x50(%rbp), %r8
movq -0x38(%rbp), %rcx
movl 0x10(%rcx), %ecx
movl %ecx, %r9d
movzbl %al, %ecx
callq 0x9a30
movq -0x40(%rbp), %rdi
movq -0x78(%rbp), %rsi
movq -0x58(%rbp), %rax
movq -0x60(%rbp), %rcx
movq %rcx, -0x2b8(%rbp)
movq 0x10(%rbp), %rcx
movq (%rcx), %rcx
movq %rcx, -0x2b0(%rbp)
movq -0x190(%rbp), %r13
movq -0x180(%rbp), %r12
movq -0x178(%rbp), %r15
movq 0x28(%rbp), %r14
movq 0x30(%rbp), %rbx
leaq -0x180(%rbp), %r11
leaq -0x180(%rbp), %r10
addq $0x8, %r10
movq 0x20(%rbp), %rcx
shlq %rcx
movq %rcx, -0x2a8(%rbp)
leaq -0x158(%rbp), %rdx
leaq -0x160(%rbp), %rcx
leaq -0x68(%rbp), %r8
leaq -0x70(%rbp), %r9
movq %rax, (%rsp)
movq -0x2b8(%rbp), %rax
movq %rax, 0x8(%rsp)
movq -0x2b0(%rbp), %rax
movq %rax, 0x10(%rsp)
movq -0x2a8(%rbp), %rax
movq %r13, 0x18(%rsp)
movq %r12, 0x20(%rsp)
movq %r15, 0x28(%rsp)
movq %r14, 0x30(%rsp)
movq %rbx, 0x38(%rsp)
movq %r11, 0x40(%rsp)
movq %r10, 0x48(%rsp)
movq %rax, 0x50(%rsp)
callq 0x6f310
movq -0x78(%rbp), %rcx
movq -0x80(%rbp), %rax
movq -0x1d8(%rbp), %rdx
movq %rdx, %rsi
addq $0x1, %rsi
movq %rsi, -0x1d8(%rbp)
imulq $0x1c, %rdx, %rdx
addq %rdx, %rax
movq (%rcx), %rdx
movq %rdx, (%rax)
movq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x10(%rcx), %rdx
movq %rdx, 0x10(%rax)
movl 0x18(%rcx), %ecx
movl %ecx, 0x18(%rax)
movq -0x1e0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1e0(%rbp)
jmp 0x709f2
movl -0x1e8(%rbp), %eax
movl %eax, %ecx
addq -0x1d8(%rbp), %rcx
movq 0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
cmpq $0x0, -0x1d8(%rbp)
jle 0x70d66
movq $0x1, -0x30(%rbp)
jmp 0x70d6e
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
addq $0x2e8, %rsp            # imm = 0x2E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopw %cs:(%rax,%rax)