// File: chhylp123[P]hifiasm/ecovlp.cpp
// Function: extract_sub_cigar_ii(overlap_region*, long, All_reads*, long, long, long, long, UC_Read*, ul_ov_t*)
uint32_t extract_sub_cigar_ii(overlap_region *z, int64_t ql, All_reads *rref, int64_t s, int64_t e, int64_t iws, int64_t iwe, UC_Read* tu, ul_ov_t *p)
{
    int64_t wk = ovlp_cur_wid(*p), xk = ovlp_cur_xoff(*p), yk = ovlp_cur_yoff(*p), ck = ovlp_cur_coff(*p), os, oe, ol;
    bit_extz_t ez; int64_t bd = ovlp_bd(*p), s0, e0, ii[2], it[2]; uint32_t res = (uint32_t)-1;
    s0 = ((int64_t)(z->w_list.a[wk].x_start)) + bd; 
    e0 = ((int64_t)(z->w_list.a[wk].x_end)) + 1 - bd;
    if(s < s0) s = s0; if(e > e0) e = e0;///exclude boundary
    if(s > e) return -1;///it is possible s == e
    os = MAX(s, s0); oe = MIN(e, e0);
    if(oe < os) return -1;///it is possible os == oe
    // fprintf(stderr, "[M::%s] s0::%ld, e0::%ld, iws::%ld, iwe::%ld\n", __func__, s0, e0, iws, iwe);
    ///make sure that this alignment block could cover the whole [iws, iwe) -> s0 < iws && e0 > iwe
    // if((s0 >= iws) || (e0 <= iwe)) return -1;///!(s0 < iws && e0 > iwe) -> only consider the alignment that could cover the whole [s, e)
    if(!(((s0 < iws) || (s0 == 0)) && ((e0 > iwe) || (e0 == ql)))) return -1;///!(s0 < iws && e0 > iwe) -> only consider the alignment that could cover the whole [s, e)

    set_bit_extz_t(ez, (*z), wk);
    if(!ez.cigar.n) return -1;
    int64_t cn = ez.cigar.n; uint16_t op; int64_t ws, we, wts, wte, ovlp, cc = 0, cci; 
    if((ck < 0) || (ck > cn)) {//(*ck) == cn is allowed
        ck = 0; xk = ez.ts; yk = ez.ps;
    }
    
    while (ck > 0 && xk >= s) {///x -> t; y -> p; first insertion and then match/mismatch
        --ck;
        op = ez.cigar.a[ck]>>14;
        if(op!=2) xk -= (ez.cigar.a[ck]&(0x3fff));
        if(op!=3) yk -= (ez.cigar.a[ck]&(0x3fff)); 
    }

    // char cm[4]; cm[0] = 'M'; cm[1] = 'S'; cm[2] = 'I'; cm[3] = 'D';  
    //some cigar will span s or e
    ii[0] = ii[1] = it[0] = it[1] = -1; res = cc = 0;
    while (ck < cn && xk < e) {//[s, e)
        ws = xk; wts = yk;
        op = ez.cigar.a[ck]>>14; ol = (ez.cigar.a[ck]&(0x3fff));
        ///op == 3: -> x; op == 2: -> y;
        if(op!=2) xk += ol;
        if(op!=3) yk += ol; 
        ck++; we = xk; wte = yk;

        // if(s == 10480) {
        //     fprintf(stderr, "[%ld, %ld)\t%c\n", ws, we, cm[op]);
        // }

        os = MAX(s, ws); oe = MIN(e, we);
        ovlp = ((oe>os)? (oe-os):0);

        if(s == e) {///insertion in comparsion with the reference
            if(op != 0 || ws >= s || we <= e || e != iwe || s != iws) continue;///must be a match
        } else {
            if(op != 2) {
                if(!ovlp) continue;
            } else {///ws == we
                if(ws < s || ws >= e) continue;
            }
        }
        
        
        if(ii[0] == -1) {
            ii[0] = os;
            if(op < 2) {
                it[0] = os - ws + wts;
            } else {///op == 2: more y; p == 3: more x
                it[0] = wts;
            } 
        }

        ii[1] = oe;
        if(op < 2) {
            it[1] = oe - ws + wts;
        } else {///op == 2: more y; p == 3: more x
            it[1] = wte;
        } 




        if(op != 2) ol = oe-os;
        cc += ol;
        // if(s == 11851 && e == 11853) {
        // if(!ol) fprintf(stderr, "%ld%c", ol, cm[op]);
        // }
        if(cc <= simp_vote_len) {
            for (cci = 0; cci < ol; cci++) {
                res <<= 2; res |= op;
            }
        }
    }

    while (ck < cn && xk <= e) {//[s, e)
        ws = xk; wts = yk;
        op = ez.cigar.a[ck]>>14; ol = (ez.cigar.a[ck]&(0x3fff));
        if(op != 2) break;
        yk += (ez.cigar.a[ck]&(0x3fff)); 
        ck++; we = xk; wte = yk;
        if(ws >= s && ws <= e) {
            
            if(ii[0] == -1) {
                ii[0] = ws; it[0] = wts;
            }
            ii[1] = we; it[1] = wte;
            
            cc += ol;
            // if(s == 11851 && e == 11853) {
            //     fprintf(stderr, "%ld%c", ol, cm[op]);
            // }
            if(cc <= simp_vote_len) {
                for (cci = 0; cci < ol; cci++) {
                    res <<= 2; res |= op;
                }
            }
        }
    }
    // if(s == 11851 && e == 11853) {
    //     fprintf(stderr, "\tx::[%ld, %ld)\ty::[%ld, %ld)\tcc::%ld\n", ii[0], ii[1], it[0], it[1], cc);
    // }
    if((cc <= simp_vote_len) 
            && (ii[1] >= ii[0]) && (ii[1] - ii[0] <= simp_vote_len) 
            && (it[1] >= it[0]) && (it[1] - it[0] <= simp_vote_len)) {
        // ii[0] = ii[0] - s; ii[1] = e - ii[1];
        if((ii[0] == iws) && (ii[1] == iwe)) {
            op = cc; op <<= 12; res |= op;

            char *ystr = NULL; res <<= 16; cc = it[1] - it[0]; op = 0;
            if(cc > 0) {
                UC_Read_resize(*tu, (it[1] - it[0])); ystr = tu->seq;
                recover_UC_Read_sub_region(ystr, it[0], (it[1] - it[0]), z->y_pos_strand, rref, z->y_id);
                
                for (cci = 0; cci < cc; cci++) {
                    op <<= 2; op |= seq_nt6_table[(uint32_t)(ystr[cci])];
                }
            } 
            res |= op;

            op = it[1] - it[0]; op <<= 12; res |= op;
        } else {
            res = (uint32_t)-1;
        }
    } else {
        res = (uint32_t)-1;
    }
    

    ovlp_cur_xoff(*p) = xk; ovlp_cur_yoff(*p) = yk; ovlp_cur_coff(*p) = ck; ovlp_cur_ylen(*p) = 0;
    
    return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x210, %rsp            # imm = 0x210
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 0x20(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x40(%rbp)
movq 0x20(%rbp), %rax
movl 0x4(%rax), %eax
movq %rax, -0x48(%rbp)
movq 0x20(%rbp), %rax
movl 0x10(%rax), %eax
movq %rax, -0x50(%rbp)
movq 0x20(%rbp), %rax
movl 0x8(%rax), %eax
movq %rax, -0x58(%rbp)
movq 0x20(%rbp), %rax
movl 0x18(%rax), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movl %eax, %eax
movq %rax, -0x150(%rbp)
movl $0xffffffff, -0x184(%rbp) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x40(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq (%rax), %rax
addq -0x150(%rbp), %rax
movq %rax, -0x158(%rbp)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x40(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq 0x4(%rax), %rax
addq $0x1, %rax
subq -0x150(%rbp), %rax
movq %rax, -0x160(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x158(%rbp), %rax
jge 0x24bd1e
movq -0x158(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x160(%rbp), %rax
jle 0x24bd36
movq -0x160(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jle 0x24bd4c
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x24c7c0
movq -0x28(%rbp), %rax
cmpq -0x158(%rbp), %rax
jl 0x24bd66
movq -0x28(%rbp), %rax
movq %rax, -0x1e0(%rbp)
jmp 0x24bd74
movq -0x158(%rbp), %rax
movq %rax, -0x1e0(%rbp)
movq -0x1e0(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x160(%rbp), %rax
jg 0x24bd99
movq -0x30(%rbp), %rax
movq %rax, -0x1e8(%rbp)
jmp 0x24bda7
movq -0x160(%rbp), %rax
movq %rax, -0x1e8(%rbp)
movq -0x1e8(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
cmpq -0x60(%rbp), %rax
jge 0x24bdc8
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x24c7c0
movq -0x158(%rbp), %rax
cmpq -0x38(%rbp), %rax
jl 0x24bddf
cmpq $0x0, -0x158(%rbp)
jne 0x24bdf9
movq -0x160(%rbp), %rax
cmpq 0x10(%rbp), %rax
jg 0x24be05
movq -0x160(%rbp), %rax
cmpq -0x18(%rbp), %rax
je 0x24be05
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x24c7c0
jmp 0x24be07
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x58(%rcx), %rcx
movq -0x40(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
movl 0x18(%rcx), %ecx
shlq %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x40(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x1c(%rax), %eax
movq %rax, -0x98(%rbp)
movq %rax, -0xa0(%rbp)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x40(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x12c(%rbp)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x40(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x4(%rax), %eax
movl %eax, -0x128(%rbp)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x40(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movl %eax, -0x138(%rbp)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x40(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0xc(%rax), %eax
movl %eax, -0x134(%rbp)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x40(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0x14(%rax), %eax
movl %eax, -0x11c(%rbp)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq -0x40(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movswl 0x14(%rax), %eax
movl %eax, -0x120(%rbp)
cmpq $0x0, -0xa0(%rbp)
jne 0x24bf15
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x24c7c0
movq -0xa0(%rbp), %rax
movq %rax, -0x190(%rbp)
movq $0x0, -0x1c8(%rbp)
cmpq $0x0, -0x58(%rbp)
jl 0x24bf42
movq -0x58(%rbp), %rax
cmpq -0x190(%rbp), %rax
jle 0x24bf60
movq $0x0, -0x58(%rbp)
movslq -0x12c(%rbp), %rax
movq %rax, -0x48(%rbp)
movslq -0x138(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x24bf62
xorl %eax, %eax
cmpq $0x0, -0x58(%rbp)
movb %al, -0x1e9(%rbp)
jle 0x24bf82
movq -0x48(%rbp), %rax
cmpq -0x28(%rbp), %rax
setge %al
movb %al, -0x1e9(%rbp)
movb -0x1e9(%rbp), %al
testb $0x1, %al
jne 0x24bf91
jmp 0x24c017
movq -0x58(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x58(%rbp)
movq -0x90(%rbp), %rax
movq -0x58(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
sarl $0xe, %eax
movw %ax, -0x192(%rbp)
movzwl -0x192(%rbp), %eax
cmpl $0x2, %eax
je 0x24bfe4
movq -0x90(%rbp), %rax
movq -0x58(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x3fff, %eax           # imm = 0x3FFF
movslq %eax, %rcx
movq -0x48(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x48(%rbp)
movzwl -0x192(%rbp), %eax
cmpl $0x3, %eax
je 0x24c012
movq -0x90(%rbp), %rax
movq -0x58(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x3fff, %eax           # imm = 0x3FFF
movslq %eax, %rcx
movq -0x50(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x50(%rbp)
jmp 0x24bf62
movq $-0x1, -0x178(%rbp)
movq $-0x1, -0x180(%rbp)
movq $-0x1, -0x168(%rbp)
movq $-0x1, -0x170(%rbp)
movq $0x0, -0x1c8(%rbp)
movl $0x0, -0x184(%rbp)
movq -0x58(%rbp), %rcx
xorl %eax, %eax
cmpq -0x190(%rbp), %rcx
movb %al, -0x1ea(%rbp)
jge 0x24c07e
movq -0x48(%rbp), %rax
cmpq -0x30(%rbp), %rax
setl %al
movb %al, -0x1ea(%rbp)
movb -0x1ea(%rbp), %al
testb $0x1, %al
jne 0x24c08d
jmp 0x24c362
movq -0x48(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq -0x90(%rbp), %rax
movq -0x58(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
sarl $0xe, %eax
movw %ax, -0x192(%rbp)
movq -0x90(%rbp), %rax
movq -0x58(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x3fff, %eax           # imm = 0x3FFF
cltq
movq %rax, -0x70(%rbp)
movzwl -0x192(%rbp), %eax
cmpl $0x2, %eax
je 0x24c0ee
movq -0x70(%rbp), %rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movzwl -0x192(%rbp), %eax
cmpl $0x3, %eax
je 0x24c106
movq -0x70(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x1b8(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x1a0(%rbp), %rax
jl 0x24c142
movq -0x28(%rbp), %rax
movq %rax, -0x1f8(%rbp)
jmp 0x24c150
movq -0x1a0(%rbp), %rax
movq %rax, -0x1f8(%rbp)
movq -0x1f8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x1a8(%rbp), %rax
jg 0x24c175
movq -0x30(%rbp), %rax
movq %rax, -0x200(%rbp)
jmp 0x24c183
movq -0x1a8(%rbp), %rax
movq %rax, -0x200(%rbp)
movq -0x200(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
cmpq -0x60(%rbp), %rax
jle 0x24c1a9
movq -0x68(%rbp), %rax
subq -0x60(%rbp), %rax
movq %rax, -0x208(%rbp)
jmp 0x24c1b4
xorl %eax, %eax
movq %rax, -0x208(%rbp)
jmp 0x24c1b4
movq -0x208(%rbp), %rax
movq %rax, -0x1c0(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jne 0x24c20d
movzwl -0x192(%rbp), %eax
cmpl $0x0, %eax
jne 0x24c206
movq -0x1a0(%rbp), %rax
cmpq -0x28(%rbp), %rax
jge 0x24c206
movq -0x1a8(%rbp), %rax
cmpq -0x30(%rbp), %rax
jle 0x24c206
movq -0x30(%rbp), %rax
cmpq 0x10(%rbp), %rax
jne 0x24c206
movq -0x28(%rbp), %rax
cmpq -0x38(%rbp), %rax
je 0x24c20b
jmp 0x24c058
jmp 0x24c24d
movzwl -0x192(%rbp), %eax
cmpl $0x2, %eax
je 0x24c22a
cmpq $0x0, -0x1c0(%rbp)
jne 0x24c228
jmp 0x24c058
jmp 0x24c24b
movq -0x1a0(%rbp), %rax
cmpq -0x28(%rbp), %rax
jl 0x24c244
movq -0x1a0(%rbp), %rax
cmpq -0x30(%rbp), %rax
jl 0x24c249
jmp 0x24c058
jmp 0x24c24b
jmp 0x24c24d
cmpq $-0x1, -0x170(%rbp)
jne 0x24c299
movq -0x60(%rbp), %rax
movq %rax, -0x170(%rbp)
movzwl -0x192(%rbp), %eax
cmpl $0x2, %eax
jge 0x24c289
movq -0x60(%rbp), %rax
subq -0x1a0(%rbp), %rax
addq -0x1b0(%rbp), %rax
movq %rax, -0x180(%rbp)
jmp 0x24c297
movq -0x1b0(%rbp), %rax
movq %rax, -0x180(%rbp)
jmp 0x24c299
movq -0x68(%rbp), %rax
movq %rax, -0x168(%rbp)
movzwl -0x192(%rbp), %eax
cmpl $0x2, %eax
jge 0x24c2cb
movq -0x68(%rbp), %rax
subq -0x1a0(%rbp), %rax
addq -0x1b0(%rbp), %rax
movq %rax, -0x178(%rbp)
jmp 0x24c2d9
movq -0x1b8(%rbp), %rax
movq %rax, -0x178(%rbp)
movzwl -0x192(%rbp), %eax
cmpl $0x2, %eax
je 0x24c2f1
movq -0x68(%rbp), %rax
subq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
addq -0x1c8(%rbp), %rax
movq %rax, -0x1c8(%rbp)
cmpq $0x6, -0x1c8(%rbp)
jg 0x24c35d
movq $0x0, -0x1d0(%rbp)
movq -0x1d0(%rbp), %rax
cmpq -0x70(%rbp), %rax
jge 0x24c35b
movl -0x184(%rbp), %eax
shll $0x2, %eax
movl %eax, -0x184(%rbp)
movzwl -0x192(%rbp), %eax
orl -0x184(%rbp), %eax
movl %eax, -0x184(%rbp)
movq -0x1d0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1d0(%rbp)
jmp 0x24c318
jmp 0x24c35d
jmp 0x24c058
jmp 0x24c364
movq -0x58(%rbp), %rcx
xorl %eax, %eax
cmpq -0x190(%rbp), %rcx
movb %al, -0x209(%rbp)
jge 0x24c38a
movq -0x48(%rbp), %rax
cmpq -0x30(%rbp), %rax
setle %al
movb %al, -0x209(%rbp)
movb -0x209(%rbp), %al
testb $0x1, %al
jne 0x24c399
jmp 0x24c50a
movq -0x48(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x1b0(%rbp)
movq -0x90(%rbp), %rax
movq -0x58(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
sarl $0xe, %eax
movw %ax, -0x192(%rbp)
movq -0x90(%rbp), %rax
movq -0x58(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x3fff, %eax           # imm = 0x3FFF
cltq
movq %rax, -0x70(%rbp)
movzwl -0x192(%rbp), %eax
cmpl $0x2, %eax
je 0x24c3f3
jmp 0x24c50a
movq -0x90(%rbp), %rax
movq -0x58(%rbp), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x3fff, %eax           # imm = 0x3FFF
cltq
addq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x1b8(%rbp)
movq -0x1a0(%rbp), %rax
cmpq -0x28(%rbp), %rax
jl 0x24c505
movq -0x1a0(%rbp), %rax
cmpq -0x30(%rbp), %rax
jg 0x24c505
cmpq $-0x1, -0x170(%rbp)
jne 0x24c47b
movq -0x1a0(%rbp), %rax
movq %rax, -0x170(%rbp)
movq -0x1b0(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0x1a8(%rbp), %rax
movq %rax, -0x168(%rbp)
movq -0x1b8(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0x70(%rbp), %rax
addq -0x1c8(%rbp), %rax
movq %rax, -0x1c8(%rbp)
cmpq $0x6, -0x1c8(%rbp)
jg 0x24c503
movq $0x0, -0x1d0(%rbp)
movq -0x1d0(%rbp), %rax
cmpq -0x70(%rbp), %rax
jge 0x24c501
movl -0x184(%rbp), %eax
shll $0x2, %eax
movl %eax, -0x184(%rbp)
movzwl -0x192(%rbp), %eax
orl -0x184(%rbp), %eax
movl %eax, -0x184(%rbp)
movq -0x1d0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1d0(%rbp)
jmp 0x24c4be
jmp 0x24c503
jmp 0x24c505
jmp 0x24c364
cmpq $0x6, -0x1c8(%rbp)
jg 0x24c77b
movq -0x168(%rbp), %rax
cmpq -0x170(%rbp), %rax
jl 0x24c77b
movq -0x168(%rbp), %rax
subq -0x170(%rbp), %rax
cmpq $0x6, %rax
jg 0x24c77b
movq -0x178(%rbp), %rax
cmpq -0x180(%rbp), %rax
jl 0x24c77b
movq -0x178(%rbp), %rax
subq -0x180(%rbp), %rax
cmpq $0x6, %rax
jg 0x24c77b
movq -0x170(%rbp), %rax
cmpq -0x38(%rbp), %rax
jne 0x24c76f
movq -0x168(%rbp), %rax
cmpq 0x10(%rbp), %rax
jne 0x24c76f
movq -0x1c8(%rbp), %rax
movw %ax, -0x192(%rbp)
movzwl -0x192(%rbp), %eax
shll $0xc, %eax
movw %ax, -0x192(%rbp)
movzwl -0x192(%rbp), %eax
orl -0x184(%rbp), %eax
movl %eax, -0x184(%rbp)
movq $0x0, -0x1d8(%rbp)
movl -0x184(%rbp), %eax
shll $0x10, %eax
movl %eax, -0x184(%rbp)
movq -0x178(%rbp), %rax
subq -0x180(%rbp), %rax
movq %rax, -0x1c8(%rbp)
movw $0x0, -0x192(%rbp)
cmpq $0x0, -0x1c8(%rbp)
jle 0x24c721
jmp 0x24c60c
movq 0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x178(%rbp), %rcx
subq -0x180(%rbp), %rcx
cmpq %rcx, %rax
jge 0x24c665
movq 0x18(%rbp), %rax
movq (%rax), %rdi
movq -0x178(%rbp), %rsi
subq -0x180(%rbp), %rsi
shlq $0x0, %rsi
callq 0x2360
movq %rax, %rcx
movq 0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x178(%rbp), %rcx
subq -0x180(%rbp), %rcx
movq 0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x24c667
movq 0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x1d8(%rbp)
movq -0x1d8(%rbp), %rdi
movq -0x180(%rbp), %rsi
movq -0x178(%rbp), %rdx
subq -0x180(%rbp), %rdx
movq -0x10(%rbp), %rax
movl 0x1c(%rax), %eax
movq -0x20(%rbp), %r8
movq -0x10(%rbp), %rcx
movl 0x10(%rcx), %ecx
movl %ecx, %r9d
movzbl %al, %ecx
callq 0x9a30
movq $0x0, -0x1d0(%rbp)
movq -0x1d0(%rbp), %rax
cmpq -0x1c8(%rbp), %rax
jge 0x24c71f
movzwl -0x192(%rbp), %eax
shll $0x2, %eax
movw %ax, -0x192(%rbp)
movq -0x1d8(%rbp), %rax
movq -0x1d0(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x177f59(%rip), %rax    # 0x3c4650
movzbl (%rax,%rcx), %ecx
movzwl -0x192(%rbp), %eax
orl %ecx, %eax
movw %ax, -0x192(%rbp)
movq -0x1d0(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1d0(%rbp)
jmp 0x24c6b9
jmp 0x24c721
movzwl -0x192(%rbp), %eax
orl -0x184(%rbp), %eax
movl %eax, -0x184(%rbp)
movq -0x178(%rbp), %rax
subq -0x180(%rbp), %rax
movw %ax, -0x192(%rbp)
movzwl -0x192(%rbp), %eax
shll $0xc, %eax
movw %ax, -0x192(%rbp)
movzwl -0x192(%rbp), %eax
orl -0x184(%rbp), %eax
movl %eax, -0x184(%rbp)
jmp 0x24c779
movl $0xffffffff, -0x184(%rbp) # imm = 0xFFFFFFFF
jmp 0x24c785
movl $0xffffffff, -0x184(%rbp) # imm = 0xFFFFFFFF
movq -0x48(%rbp), %rax
movl %eax, %ecx
movq 0x20(%rbp), %rax
movl %ecx, 0x4(%rax)
movq -0x50(%rbp), %rax
movl %eax, %ecx
movq 0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x58(%rbp), %rax
movl %eax, %ecx
movq 0x20(%rbp), %rax
movl %ecx, 0x8(%rax)
movq 0x20(%rbp), %rax
movl $0x0, 0x14(%rax)
movl -0x184(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x210, %rsp            # imm = 0x210
popq %rbp
retq
nopl (%rax)