// File: /workspace/github_cpp_makefile_star2_O3/WeichenZhou[P]PALMER/./scp/3_read_masker.cpp
// Function: ReadMasker(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int ReadMasker(string WD_dir, string mode){
    
    //std::ios::sync_with_stdio(false);
    //std::cin.tie(0);
    
    ifstream file1;
    //ifstream file2;
    ifstream file3;
    ofstream file5;
    ofstream file6;
    ofstream file7;
    
    string sys_regionsam = WD_dir+"region.sam";
    char *syst_regionsam = new char[sys_regionsam.length()+1];
    strcpy(syst_regionsam, sys_regionsam.c_str());
    
    file1.open(syst_regionsam);
    
    /*
    string sys_RMselec = WD_dir+"RM.selected";
    char *syst_RMselec = new char[sys_RMselec.length()+1];
    strcpy(syst_RMselec, sys_RMselec.c_str());
    
    file2.open(syst_RMselec);
    */
    
    string sys_cigar2 = WD_dir+"cigar.2";
    char *syst_cigar2 = new char[sys_cigar2.length()+1];
    strcpy(syst_cigar2, sys_cigar2.c_str());
    
    file5.open(syst_cigar2);
    
    string sys_SEQ = WD_dir+"SEQ.masked";
    char *syst_SEQ = new char[sys_SEQ.length()+1];
    strcpy(syst_SEQ, sys_SEQ.c_str());
    
    file6.open(syst_SEQ);
    
    string sys_selecinfo = WD_dir+"selected.reads.info";
    char *syst_selecinfo = new char[sys_selecinfo.length()+1];
    strcpy(syst_selecinfo, sys_selecinfo.c_str());
    
    file7.open(syst_selecinfo);
    
    if (!file1.is_open())
    {
        cout <<"CANNOT OPEN FILE, 'region.sam'"<< endl;
        //exit(1);
        return 0;
    }
    
    string input;
    int input_int;
    
    int line=0;
    
    for(int i=0;!file1.eof();++i){
        getline(file1,input);
        line=i;
    }
    file1.close();
    file1.clear();
    file1.open(syst_regionsam);

    string **sam_info;
    sam_info=new string*[line];
    for(int i=0;i!=line;++i) sam_info[i]=new string[6];
    
    int **sam_loc;
    sam_loc=new int*[line];
    for(int i=0;i!=line;++i) sam_loc[i]=new int[5];
    
    for(int i=0;i!=line;++i){
        file1>>sam_info[i][0];        //QNAME
        //getline(file1,sam_info[i][0],'\t'); //QNAME
        file1>>sam_loc[i][0];         //FLAG
        file1>>sam_info[i][1];        //RNAME
        file1>>sam_loc[i][1];         //POS
        file1>>sam_loc[i][2];         //MAPQ
        file1>>sam_info[i][2];        //CIGAR
        file1>>sam_info[i][3];        //RNEXT
        file1>>sam_loc[i][3];         //PNEXT
        file1>>sam_loc[i][4];         //TLEN
        file1>>sam_info[i][4];        //SEQ
        getline(file1,sam_info[i][5]);//QUAL
        
    }
    
    /*
    int line_rm;
    int **rm_loc;
    string **rm_info;
    
    if (!file2.is_open()){
        line_rm=1;
        
        rm_loc=new int*[line_rm];
        for(int i=0;i!=line_rm;++i) rm_loc[i]=new int[2];
        
        rm_info=new string*[line_rm];
        for(int i=0;i!=line_rm;++i) rm_info[i]=new string[4];
        
        rm_info[0][0]="null";           //chr
        rm_loc[0][0]=0;            //start
        rm_loc[0][1]=0;            //end
        rm_info[0][1]="null";           //class
        rm_info[0][2]="null";           //family
        rm_info[0][3]="null";          //name
        
    }
    else {
        line_rm=0;
        for(int i=0;!file2.eof();++i){
            getline(file2,input);
            line_rm=i;
        }
        file2.close();
        file2.clear();
        file2.open(syst_RMselec);
        
        rm_loc=new int*[line_rm];
        for(int i=0;i!=line_rm;++i) rm_loc[i]=new int[2];
        
        rm_info=new string*[line_rm];
        for(int i=0;i!=line_rm;++i) rm_info[i]=new string[4];
        
        for(int i=0;i!=line_rm;++i){
            file2>>rm_info[i][0];           //chr
            file2>>rm_loc[i][0];            //start
            file2>>rm_loc[i][1];            //end
            file2>>rm_info[i][1];           //class
            file2>>rm_info[i][2];           //family
            file2>>rm_info[i][3];           //name
        }
    }
     */
    
//cout<<"region reading complete"<<endl;
    for(int i=0;i!=line;++i){
        //cout<<i<<endl;
        int number=0;
        int sc1, sc2, I, M, D, F, h1, h2, eq;
        sc1=sc2=I=M=D=F=h1=h2=eq=0;
        char cig;
        int read_s, read_e;
        read_s=sam_loc[i][1];
       
        string cigar1;
        cigar1=sam_info[i][2]+"0E";
        stringstream ss_cigar1;
        ss_cigar1.clear();
        ss_cigar1.str(cigar1);
        
//reads cigar&seq
        int le=sam_info[i][4].length();
        char *seq =new char[sam_info[i][4].length()+1];
        strcpy(seq,sam_info[i][4].c_str());
        
        /*
        int le=sam_info[i][4].length();
        char seq[le];
        char *cseq=sam_info[i][4].c_str();
        strcpy(seq,cseq);
        */
        ss_cigar1>>number;
        ss_cigar1>>cig;
        
        for(;!(cig=='E'&&number==0);){
            if(cig=='S'&&F==0) {sc1=sc1+number;F=1;}
            else if(cig=='H'&&F==0) h1=h1+number;
            else if (cig=='M') {M=M+number;F=1;}
            else if (cig=='='||cig=='X') {eq=eq+number;F=1;}
            else if (cig=='I') {I=I+number;F=1;}
            else if (cig=='D'||cig=='N') {D=D+number;F=1;}
            else if (cig=='S'&&F==1) sc2=sc2+number;
            else if (cig=='H'&&F==1) h2=h2+number;
            ss_cigar1>>number;
            ss_cigar1>>cig;
        }
        read_e=sam_loc[i][1]+M+D+eq-1;
        
        
        //if(sc1>=50||sc2>=50||I>=50){
            
//mask
            int start=0;
            int end=0;
            
            /*
            for(int j=0;j!=line_rm;++j){
                if(!((read_s>rm_loc[j][1])||(read_e<rm_loc[j][0]))){
                    
                    stringstream ss_cigar1;
                    ss_cigar1.clear();
                    ss_cigar1.str(cigar1);
                    
                    //file3.open(syst_cigar1);
                    if(read_s>rm_loc[j][0]) start=read_s;
                    else start= rm_loc[j][0];
                    if(read_e>rm_loc[j][1]) end=rm_loc[j][1];
                    else end=read_e;
                    
                    ss_cigar1>>number;
                    ss_cigar1>>cig;
                    int bit=read_s; //bit = reference location
                    int k=0;        //k = read seq location
                    
                    
                    for(;!(cig=='E'&&number==0);){
                        if(cig=='M'||cig=='='||cig=='X') {
                            bit=bit+number;
                            
                            if(bit>=start&&bit<=end&&(bit-number)>=start){
                                for(int x=0;x!=number;++x){
                                    seq[k+x]='N';
                                }
                            }
                            else if(bit>=start&&bit<=end&&(bit-number)<start){
                                for(int x=start-bit+number;x!=number;++x){
                                    seq[k+x]='N';
                                }
                            }
                            else if((bit-number)>=start&&(bit-number)<=end&&bit>end){
                                for(int x=0;x!=end-bit+number+1;++x){
                                    seq[k+x]='N';
                                }
                            }
                            else if((bit-number)<start&&bit>end){
                                for(int x=start-bit+number;x!=end-bit+number+1;++x){
                                    seq[k+x]='N';
                                }
                            }
                            k=k+number;
                        }
                        else if(cig=='D'||cig=='N') {bit=bit+number;
                        }
                        else if(cig=='S'||cig=='I') {k=k+number;
                        }
                        ss_cigar1>>number;
                        ss_cigar1>>cig;
                    }
                }
            }
            */
            
            stringstream ss_cigar2;
            ss_cigar2.clear();
            ss_cigar2.str(cigar1);
            
            //file3.open(syst_cigar1);
            start=read_s;
            end=read_e;
            
            ss_cigar2>>number;
            ss_cigar2>>cig;
            
            int bit_s=0;
            int k_s=0;
            for(;!(cig=='E'&&number==0);){
                /*if(cig=='S') {
                   
                    for(int x=0;x!=number;++x){
                        seq[k_s+x]='N';
                    }
                    
                    k_s=k_s+number;
                }
                
                ss_cigar1>>number;
                ss_cigar1>>cig;
                */
                
                if(cig=='M'||cig=='=') {
                    
                    for(int x=0;x!=number;++x){
                        seq[k_s+x]='N';
                    }
                    
                    bit_s=bit_s+number;
                    k_s=k_s+number;
                }
                else if(cig=='X') {
                    bit_s=bit_s+number;
                    k_s=k_s+number;
                }
                else if(cig=='D'||cig=='N') {bit_s=bit_s+number;
                }
                
                else if(cig=='I') {k_s=k_s+number;
                }
                
                else if(cig=='S'&&mode=="asm") {
                   
                    for(int x=0;x!=number;++x){
                        seq[k_s+x]='N';
                    }
                    
                    k_s=k_s+number;
                }
                
                else if(cig=='S'){
                    k_s=k_s+number;
                }
                
                ss_cigar2>>number;
                ss_cigar2>>cig;
                
            }
            
            
            
            
//output
            file5<<sam_info[i][2]<<"0E"<<'\t'<<i<<endl;
            file6<<">"<<sam_info[i][0]<<"_"<<sam_loc[i][1]<<"_"<<i<<endl;
            for(int x=0;x!=le;++x) file6<<seq[x];
            file6<<endl;
            file7<<sam_info[i][0]<<'\t'<<sam_info[i][1]<<'\t'<<sam_loc[i][1]<<'\t'<<le<<'\t'<<i<<endl;
        //}
        delete [] seq;
    }
    
    for(int i=0;i!=line;++i){
        delete [] sam_info[i];
        delete [] sam_loc[i];
    }
    delete [] sam_info;
    delete [] sam_loc;
    
    /*
    for(int i=0;i!=line_rm;++i){
        delete [] rm_info[i];
        delete [] rm_loc[i];
    }
    delete [] rm_info;
    delete [] rm_loc;
    */
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe48, %rsp            # imm = 0xE48
movq %rsi, 0x100(%rsp)
movq %rdi, %r15
leaq 0x128(%rsp), %rdi
callq 0x3270
leaq 0xc40(%rsp), %rdi
callq 0x3270
leaq 0x8b8(%rsp), %rdi
callq 0x33c0
leaq 0x330(%rsp), %rdi
callq 0x33c0
leaq 0x6b8(%rsp), %rdi
callq 0x33c0
leaq 0xe8(%rsp), %rax
movq %rax, -0x10(%rax)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq 0xd8(%rsp), %rdi
callq 0x4112c
leaq 0x3e3ac(%rip), %rsi     # 0x42083
leaq 0xd8(%rsp), %rdi
callq 0x3410
movq 0xe0(%rsp), %rdi
incq %rdi
callq 0x3030
movq %rax, %rbx
movq 0xd8(%rsp), %rsi
movq %rax, %rdi
callq 0x3220
leaq 0x128(%rsp), %rdi
movq %rbx, %rsi
movl $0x8, %edx
callq 0x3180
leaq 0xc8(%rsp), %rax
movq %rax, -0x10(%rax)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq 0xb8(%rsp), %rdi
callq 0x4112c
leaq 0x3e348(%rip), %rsi     # 0x4208e
leaq 0xb8(%rsp), %rdi
callq 0x3410
movq 0xc0(%rsp), %rdi
incq %rdi
callq 0x3030
movq %rax, %r14
movq 0xb8(%rsp), %rsi
movq %rax, %rdi
callq 0x3220
leaq 0x8b8(%rsp), %r13
movq %r13, %rdi
movq %r14, %rsi
movl $0x10, %edx
callq 0x3060
leaq 0xa8(%rsp), %rax
movq %rax, -0x10(%rax)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq 0x98(%rsp), %rdi
callq 0x4112c
leaq 0x3e2de(%rip), %rsi     # 0x42096
leaq 0x98(%rsp), %rdi
callq 0x3410
movq 0xa0(%rsp), %rdi
incq %rdi
callq 0x3030
movq %rax, %r14
movq 0x98(%rsp), %rsi
movq %rax, %rdi
callq 0x3220
leaq 0x330(%rsp), %rdi
movq %r14, %rsi
movl $0x10, %edx
callq 0x3060
leaq 0x88(%rsp), %rax
movq %rax, -0x10(%rax)
movq (%r15), %rsi
movq 0x8(%r15), %rdx
addq %rsi, %rdx
leaq 0x78(%rsp), %rdi
callq 0x4112c
leaq 0x3e27d(%rip), %rsi     # 0x420a1
leaq 0x78(%rsp), %rdi
callq 0x3410
movq 0x80(%rsp), %rdi
incq %rdi
callq 0x3030
movq %rax, %r14
movq 0x78(%rsp), %rsi
movq %rax, %rdi
callq 0x3220
leaq 0x6b8(%rsp), %rbp
movq %rbp, %rdi
movq %r14, %rsi
movl $0x10, %edx
callq 0x3060
leaq 0x1a0(%rsp), %rdi
callq 0x3090
testb %al, %al
je 0x46f3
leaq 0x118(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movq 0x128(%rsp), %rax
movq -0x18(%rax), %rax
xorl %r12d, %r12d
testb $0x2, 0x148(%rsp,%rax)
jne 0x3f04
leaq (%rsp,%rax), %rdi
addq $0x128, %rdi            # imm = 0x128
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
leaq 0x128(%rsp), %r14
leaq 0x108(%rsp), %r15
movl $0xa, %esi
callq 0x3240
movsbl %al, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x3400
movq 0x128(%rsp), %rax
movq -0x18(%rax), %rax
leaq (%rsp,%rax), %rdi
addq $0x128, %rdi            # imm = 0x128
incl %r12d
testb $0x2, 0x20(%rdi)
je 0x3ecc
leaq 0x128(%rsp), %r14
movq %r14, %rdi
callq 0x3080
movq 0x128(%rsp), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x33b0
leaq 0x128(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movl $0x8, %edx
callq 0x3180
movl %r12d, %eax
movq %rax, 0x28(%rsp)
leaq (,%rax,8), %rbx
movq %rbx, %rdi
callq 0x3030
movq %rax, 0x20(%rsp)
testl %r12d, %r12d
je 0x3fb7
xorl %r14d, %r14d
movl $0xc8, %edi
callq 0x3030
movq $0x6, (%rax)
movl $0x18, %ecx
leaq (%rax,%rcx), %rdx
movq %rdx, -0x10(%rax,%rcx)
movq $0x0, -0x8(%rax,%rcx)
movb $0x0, (%rax,%rcx)
addq $0x20, %rcx
cmpq $0xd8, %rcx
jne 0x3f7d
addq $0x8, %rax
movq 0x20(%rsp), %rcx
movq %rax, (%rcx,%r14,8)
incq %r14
cmpq 0x28(%rsp), %r14
jne 0x3f67
movq %rbx, %rdi
callq 0x3030
movq %rax, 0x18(%rsp)
testl %r12d, %r12d
je 0x46c3
xorl %ebx, %ebx
movl $0x14, %edi
callq 0x3030
movq 0x18(%rsp), %rcx
movq %rax, (%rcx,%rbx,8)
incq %rbx
cmpq %rbx, 0x28(%rsp)
jne 0x3fcf
testl %r12d, %r12d
je 0x46c3
movl %r12d, 0x34(%rsp)
xorl %r14d, %r14d
movq 0x20(%rsp), %rax
movq (%rax,%r14,8), %rbx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x32c0
movq 0x18(%rsp), %rax
movq (%rax,%r14,8), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x3170
leaq 0x20(%rbx), %rsi
movq %r15, %rdi
callq 0x32c0
leaq 0x4(%r12), %rsi
movq %r15, %rdi
callq 0x3170
leaq 0x8(%r12), %rsi
movq %r15, %rdi
callq 0x3170
leaq 0x40(%rbx), %rsi
movq %r15, %rdi
callq 0x32c0
leaq 0x60(%rbx), %rsi
movq %r15, %rdi
callq 0x32c0
leaq 0xc(%r12), %rsi
movq %r15, %rdi
callq 0x3170
addq $0x10, %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x3170
leaq 0x80(%rbx), %rsi
movq %r15, %rdi
callq 0x32c0
movq 0x128(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3240
addq $0xa0, %rbx
movsbl %al, %edx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x3400
incq %r14
cmpq %r14, 0x28(%rsp)
jne 0x3ffd
cmpl $0x0, 0x34(%rsp)
je 0x46c3
leaq 0x68(%rsp), %r13
leaq 0x540(%rsp), %r14
movl $0x80, %eax
leaq 0xab8(%rsp), %r12
leaq (%r12,%rax), %rcx
movq %rcx, 0x48(%rsp)
leaq 0x530(%rsp), %rbx
addq %rbx, %rax
movq %rax, 0x50(%rsp)
xorl %ecx, %ecx
leaq 0xb(%rsp), %rbp
movl $0x0, 0xc(%rsp)
movq %r13, 0x58(%rsp)
movq $0x0, 0x60(%rsp)
movb $0x0, 0x68(%rsp)
movq 0x20(%rsp), %rax
movq %rcx, 0x40(%rsp)
movq (%rax,%rcx,8), %rax
movq %r14, 0x530(%rsp)
movq 0x40(%rax), %rsi
movq %rax, 0x10(%rsp)
movq 0x48(%rax), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x4112c
movq %rbx, %rdi
leaq 0x3df72(%rip), %rsi     # 0x420d4
callq 0x3410
leaq 0x58(%rsp), %rdi
movq %rbx, %rsi
callq 0x32b0
movq 0x530(%rsp), %rdi
cmpq %r14, %rdi
je 0x4186
callq 0x3230
movq %rbx, %rdi
callq 0x31a0
movq 0x530(%rsp), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
xorl %esi, %esi
callq 0x33b0
leaq 0x548(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x3340
movq 0x10(%rsp), %rax
movq 0x88(%rax), %rcx
movq %rcx, 0x38(%rsp)
leaq 0x1(%rcx), %rdi
callq 0x3030
movq %rax, %r15
movq 0x10(%rsp), %rax
movq 0x80(%rax), %rsi
movq %r15, %rdi
callq 0x3220
movq %rbx, %rdi
leaq 0xc(%rsp), %rsi
callq 0x3170
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x32e0
xorl %eax, %eax
movzbl 0xb(%rsp), %ecx
cmpl $0x45, %ecx
jne 0x4212
cmpl $0x0, 0xc(%rsp)
je 0x4267
movl %ecx, %edx
xorl $0x53, %edx
movl $0x1, %r14d
orl %eax, %edx
je 0x4245
movl %ecx, %edx
xorl $0x48, %edx
xorl %r14d, %r14d
orl %eax, %edx
je 0x4245
addl $-0x3d, %ecx
cmpl $0x1b, %ecx
ja 0x4262
movl $0x8031081, %edx        # imm = 0x8031081
btl %ecx, %edx
movl $0x1, %r14d
jae 0x4262
movq %rbx, %rdi
leaq 0xc(%rsp), %rsi
callq 0x3170
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x32e0
movl %r14d, %eax
jmp 0x4201
movl %eax, %r14d
jmp 0x4245
movq %r12, %rdi
callq 0x31a0
movq 0xab8(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
xorl %esi, %esi
callq 0x33b0
leaq 0xad0(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x3340
movq %r12, %rdi
leaq 0xc(%rsp), %rsi
callq 0x3170
movq %r12, %rdi
movq %rbp, %rsi
callq 0x32e0
xorl %r13d, %r13d
movzbl 0xb(%rsp), %eax
movl %eax, %edx
xorl $0x45, %edx
movl 0xc(%rsp), %ecx
orl %ecx, %edx
je 0x4353
movl %ecx, %r14d
cmpl $0x4c, %eax
jle 0x42e1
cmpl $0x58, %eax
je 0x4330
cmpl $0x53, %eax
je 0x42ed
cmpl $0x4d, %eax
je 0x4318
jmp 0x4336
cmpl $0x3d, %eax
je 0x4318
cmpl $0x49, %eax
je 0x4330
jmp 0x4336
movq 0x100(%rsp), %rdi
leaq 0x3dddb(%rip), %rsi     # 0x420d7
callq 0x30b0
testl %eax, %eax
je 0x4313
cmpb $0x53, 0xb(%rsp)
jne 0x4336
addl 0xc(%rsp), %r13d
jmp 0x4336
movl 0xc(%rsp), %r14d
testq %r14, %r14
je 0x4330
movslq %r13d, %rdi
addq %r15, %rdi
movl $0x4e, %esi
movq %r14, %rdx
callq 0x3150
addl %r13d, %r14d
movl %r14d, %r13d
movq %r12, %rdi
leaq 0xc(%rsp), %rsi
callq 0x3170
movq %r12, %rdi
movq %rbp, %rsi
callq 0x32e0
jmp 0x42b2
movq 0x10(%rsp), %rax
movq 0x40(%rax), %rsi
movq 0x48(%rax), %rdx
leaq 0x8b8(%rsp), %rdi
callq 0x3280
movq 0x40(%rsp), %r13
movq %rax, %r14
movl $0x2, %edx
movq %rax, %rdi
leaq 0x3dd50(%rip), %rsi     # 0x420d4
callq 0x3280
movb $0x9, 0xa(%rsp)
movl $0x1, %edx
movq %r14, %rdi
leaq 0xa(%rsp), %rsi
callq 0x3280
movq %rax, %rdi
movl %r13d, %esi
callq 0x33d0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
movl $0x1, %edx
leaq 0x330(%rsp), %rdi
leaq 0x3f416(%rip), %rsi     # 0x437ff
callq 0x3280
movq 0x10(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
leaq 0x330(%rsp), %rdi
callq 0x3280
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x3dcc2(%rip), %rsi     # 0x420db
callq 0x3280
movq 0x18(%rsp), %rax
movq (%rax,%r13,8), %rax
movq %rax, 0xf8(%rsp)
movl 0x4(%rax), %esi
movq %r14, %rdi
callq 0x33d0
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0x3dc8f(%rip), %rsi     # 0x420db
callq 0x3280
movq %r14, %rdi
movl %r13d, %esi
callq 0x33d0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
cmpl $0x0, 0x38(%rsp)
je 0x44bc
movl 0x38(%rsp), %r14d
xorl %r13d, %r13d
movb (%r15,%r13), %al
movb %al, 0xa(%rsp)
movl $0x1, %edx
leaq 0x330(%rsp), %rdi
leaq 0xa(%rsp), %rsi
callq 0x3280
incq %r13
cmpq %r13, %r14
jne 0x4495
movq 0x330(%rsp), %rax
movq -0x18(%rax), %rdi
leaq 0x330(%rsp), %rax
addq %rax, %rdi
movl $0xa, %esi
callq 0x3240
movq 0x40(%rsp), %r14
movsbl %al, %esi
leaq 0x330(%rsp), %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
movq 0x10(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
leaq 0x6b8(%rsp), %rdi
callq 0x3280
movb $0x9, 0xa(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0xa(%rsp), %rsi
callq 0x3280
movq 0x10(%rsp), %rcx
movq 0x20(%rcx), %rsi
movq 0x28(%rcx), %rdx
movq %rax, %rdi
callq 0x3280
movb $0x9, 0xa(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0xa(%rsp), %rsi
callq 0x3280
movq 0xf8(%rsp), %rcx
movl 0x4(%rcx), %esi
movq %rax, %rdi
callq 0x33d0
movb $0x9, 0xa(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0xa(%rsp), %rsi
callq 0x3280
movq %rax, %rdi
movq 0x38(%rsp), %rsi
callq 0x33d0
movb $0x9, 0xa(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0xa(%rsp), %rsi
callq 0x3280
movq %rax, %rdi
movl %r14d, %esi
callq 0x33d0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq %r14, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3190
movq %r15, %rdi
callq 0x32d0
movq %r12, %rdi
movq 0x449cd(%rip), %r14     # 0x48fb8
movq %r14, %rsi
callq 0x31c0
movq 0x48(%rsp), %rdi
callq 0x30e0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x31c0
movq 0x50(%rsp), %rdi
callq 0x30e0
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %r13
cmpq %r13, %rdi
je 0x4626
callq 0x3230
movq 0x40(%rsp), %rcx
incq %rcx
cmpq 0x28(%rsp), %rcx
leaq 0x540(%rsp), %r14
jne 0x410f
cmpl $0x0, 0x34(%rsp)
leaq 0x8b8(%rsp), %r13
leaq 0x6b8(%rsp), %rbp
je 0x46c3
xorl %r14d, %r14d
movq 0x20(%rsp), %rax
movq (%rax,%r14,8), %rbx
testq %rbx, %rbx
je 0x46a6
movq -0x8(%rbx), %r15
testq %r15, %r15
je 0x469a
shlq $0x5, %r15
leaq (%rbx,%r15), %r12
addq $-0x10, %r12
negq %r15
movq -0x10(%r12), %rdi
cmpq %rdi, %r12
je 0x4690
callq 0x3230
addq $-0x20, %r12
addq $0x20, %r15
jne 0x4681
addq $-0x8, %rbx
movq %rbx, %rdi
callq 0x32d0
movq 0x18(%rsp), %rax
movq (%rax,%r14,8), %rdi
testq %rdi, %rdi
je 0x46b9
callq 0x32d0
incq %r14
cmpq 0x28(%rsp), %r14
jne 0x465b
movq 0x20(%rsp), %rdi
callq 0x32d0
movq 0x18(%rsp), %rdi
callq 0x32d0
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0x4739
callq 0x3230
jmp 0x4739
movq 0x448de(%rip), %rbx     # 0x48fd8
leaq 0x3d9b4(%rip), %rsi     # 0x420b5
movl $0x1e, %edx
movq %rbx, %rdi
callq 0x3280
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x3240
movsbl %al, %esi
movq 0x448ac(%rip), %rdi     # 0x48fd8
callq 0x3040
movq %rax, %rdi
callq 0x3190
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x4750
callq 0x3230
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x476a
callq 0x3230
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x4784
callq 0x3230
movq 0xd8(%rsp), %rdi
leaq 0xe8(%rsp), %rax
cmpq %rax, %rdi
je 0x479e
callq 0x3230
movq 0x4482b(%rip), %rax     # 0x48fd0
movq (%rax), %rbx
movq 0x18(%rax), %r14
leaq 0x6c0(%rsp), %rdi
movq %rbx, -0x8(%rdi)
movq -0x18(%rbx), %rax
movq %r14, 0x6b8(%rsp,%rax)
callq 0x31f0
movl $0xf8, %r15d
addq %r15, %rbp
movq %rbp, %rdi
callq 0x30e0
leaq 0x338(%rsp), %rdi
movq %rbx, -0x8(%rdi)
movq -0x18(%rbx), %rax
movq %r14, 0x330(%rsp,%rax)
callq 0x31f0
leaq 0x330(%rsp), %rdi
addq %r15, %rdi
callq 0x30e0
leaq 0x8c0(%rsp), %rdi
movq %rbx, -0x8(%rdi)
movq -0x18(%rbx), %rax
movq %r14, 0x8b8(%rsp,%rax)
callq 0x31f0
addq %r15, %r13
movq %r13, %rdi
callq 0x30e0
leaq 0xc40(%rsp), %rdi
callq 0x30a0
leaq 0x128(%rsp), %rdi
callq 0x30a0
xorl %eax, %eax
addq $0xe48, %rsp            # imm = 0xE48
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x48f3
jmp 0x48f3
jmp 0x48df
jmp 0x489f
jmp 0x489f
jmp 0x48a7
jmp 0x48a7
jmp 0x48af
jmp 0x48af
movq %rax, %rbx
jmp 0x49d3
movq %rax, %rbx
jmp 0x49e0
movq %rax, %rbx
jmp 0x49ed
movq %rax, %rbx
jmp 0x49fa
movq %rax, %rbx
jmp 0x4a07
jmp 0x48f3
movq %rax, %rbx
jmp 0x4985
movq %rax, %rbx
jmp 0x499f
movq %rax, %rbx
jmp 0x49b9
jmp 0x4924
movq %rax, %rbx
jmp 0x48d3
movq %rax, %rbx
movq 0x530(%rsp), %rdi
cmpq %r14, %rdi
je 0x48d3
callq 0x3230
leaq 0x68(%rsp), %r13
jmp 0x4945
movq %rax, %rbx
jmp 0x4945
movq %rax, %rbx
jmp 0x496e
jmp 0x4924
jmp 0x48f3
jmp 0x48f3
jmp 0x4924
jmp 0x48fc
jmp 0x48f3
movq %rax, %rbx
jmp 0x4954
jmp 0x48fc
jmp 0x48fc
movq %rax, %rbx
movq 0x446b2(%rip), %rsi     # 0x48fb8
leaq 0xab8(%rsp), %rdi
callq 0x31c0
movq 0x48(%rsp), %rdi
callq 0x30e0
leaq 0x68(%rsp), %r13
jmp 0x4927
movq %rax, %rbx
movq 0x4468a(%rip), %rsi     # 0x48fb8
leaq 0x530(%rsp), %rdi
callq 0x31c0
movq 0x50(%rsp), %rdi
callq 0x30e0
movq 0x58(%rsp), %rdi
cmpq %r13, %rdi
je 0x4954
callq 0x3230
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0x496e
callq 0x3230
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x4985
callq 0x3230
movq 0x98(%rsp), %rdi
leaq 0xa8(%rsp), %rax
cmpq %rax, %rdi
je 0x499f
callq 0x3230
movq 0xb8(%rsp), %rdi
leaq 0xc8(%rsp), %rax
cmpq %rax, %rdi
je 0x49b9
callq 0x3230
movq 0xd8(%rsp), %rdi
leaq 0xe8(%rsp), %rax
cmpq %rax, %rdi
je 0x49d3
callq 0x3230
leaq 0x6b8(%rsp), %rdi
callq 0x3330
leaq 0x330(%rsp), %rdi
callq 0x3330
leaq 0x8b8(%rsp), %rdi
callq 0x3330
leaq 0xc40(%rsp), %rdi
callq 0x30a0
leaq 0x128(%rsp), %rdi
callq 0x30a0
movq %rbx, %rdi
callq 0x33e0