// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/InputUtilSt.cpp
// Function: InputUtilSt::readTxt(char const*, task*)
bool InputUtilSt::readTxt(const char *fn, struct task *task) {
    FILE *fid = fopen(fn,"r");
    if( fid == NULL) {
        fprintf(stderr,"Could not read input file (%s).\n",fn);
        return false;
    }
    
    int number_columns = 0;
    max_line_length = 1024;
    char *col;
    NDAT co = 0;
    
    // count lines and check for number of columns
    line = (char *)malloc((size_t)max_line_length);// Malloc(char,max_line_length);
    
    // grab memory and read all data
    StripedArray<NPAR> *striped_dat_obs = new StripedArray<NPAR>();
    StripedArray<NCAT> *striped_dat_group = new StripedArray<NCAT>();
    StripedArray<NCAT> *striped_dat_skill = NULL;
    StripedArray<NCAT> *striped_dat_skill_stacked = NULL;
    StripedArray<NCAT> *striped_dat_skill_rcount  = NULL;
    StripedArray<NCAT> *striped_dat_skill_rix     = NULL;
    NDAT current_stacked = 0;
    if(task->multiskill==0)
        striped_dat_skill = new StripedArray<NCAT>();
    else {
//        task->dat_multiskill = new StripedArray< NCAT* >(true);
        striped_dat_skill_stacked = new StripedArray<NCAT>();
        striped_dat_skill_rcount  = new StripedArray<NCAT>();
        striped_dat_skill_rix     = new StripedArray<NCAT>();
    }
    StripedArray<NCAT> * striped_dat_item = new StripedArray<NCAT>();
    StripedArray<NPAR> *striped_dat_slice = NULL;
    if(task->sliced) {
        striped_dat_slice = new StripedArray<NPAR>();
    }
    task->map_group_fwd = new map<string,NCAT>();
    task->map_group_bwd = new map<NCAT,string>();
    task->map_skill_fwd = new map<string,NCAT>();
    task->map_skill_bwd = new map<NCAT,string>();
    task->map_step_fwd = new map<string,NCAT>();
    task->map_step_bwd = new map<NCAT,string>();
    string s_group, s_step, s_skill;
    NPAR slice = 0;
    map<string,NCAT>::iterator it;
    map<string,NCAT>::iterator it2;
    bool wrong_no_columns = false;
    task->N = 0;
    task->Nst = 0;
    NDAT Nst_alt = 0;
    task->N_null = 0;
    bool res = true;
    while( readline(fid)!=NULL && !wrong_no_columns) {
        //    while( NULL!=fgets(line,max_line_length,fid) && !wrong_no_columns) {
        number_columns = 0;
        // Observation
        col = strtok(line,"\t\n\r");
        if(col == NULL) {
            wrong_no_columns = true;
            break;
        }
        number_columns++;
        NPAR obs = (NPAR)(atoi( col )-1);
        if(obs==NPAR_MAX) {
            fprintf(stderr,"Number of observtions exceeds allowed maximum of %d.\n",NPAR_MAX);
            res=false;
            goto recycle;
        }
        striped_dat_obs->add(obs); // dat_obs[t] = (NPAR)obs;
        if( (obs >= 0) && ((task->nO-1) < obs) )
            task->nO = (NPAR)(obs + 1); // obs[t] + 1;

        // Group
        col = strtok(NULL,"\t\n\r");
        if(col == NULL) {
            wrong_no_columns = true;
            break;
        }
        number_columns++;
        s_group = string( col );
        it = task->map_group_fwd->find(s_group);
        if( it==task->map_group_fwd->end() ) { // not found
            if(task->map_group_fwd->size()==NCAT_MAX) {
                fprintf(stderr,"Number of unique groups exceeds allowed maximum of %d.\n",NCAT_MAX);
                res = false;
                goto recycle;
            }
            NCAT newg = (NCAT)task->map_group_fwd->size();
            striped_dat_group->add(newg); //[t] = task->map_group_fwd.size();
            task->map_group_fwd->insert(pair<string,NCAT>(s_group, newg));
            task->map_group_bwd->insert(pair<NCAT,string>(newg, s_group));
        }
        else
            striped_dat_group->add(it->second); // [t] = it->second;
        
        
        // Step
        col = strtok(NULL,"\t\n\r");
        if(col == NULL) {
            wrong_no_columns = true;
            break;
        }
        number_columns++;
        s_step = string( col );
        it2 = task->map_step_fwd->find(s_step);
        if( it2==task->map_step_fwd->end() ) { // not found
            if(task->map_step_fwd->size()==NCAT_MAX) {
                fprintf(stderr,"Number of unique steps exceeds allowed maximum of %d.\n",NCAT_MAX);
                res=false;
                goto recycle;
            }
            NCAT news = (NCAT)task->map_step_fwd->size();
            striped_dat_item->add(news); //[t] = task->map_group_fwd.size();
            task->map_step_fwd->insert(pair<string,NCAT>(s_step, news));
            task->map_step_bwd->insert(pair<NCAT,string>(news, s_step));
        }
        else
            striped_dat_item->add(it2->second);
        
        
        // Skill
        col = strtok(NULL,"\t\n\r");
        if(col == NULL) {
            wrong_no_columns = true;
            break;
        }
        number_columns++;
        s_skill = string( col );
        // process skills later
        
        // Slice
        if(task->sliced) {
            col = strtok(NULL,"\t\n\r");
            if(col == NULL) {
                wrong_no_columns = true;
                break;
            }
            number_columns++;
            slice = (NPAR) atoi( col );
            if( slice<0 ) {
                fprintf(stderr,"Slice cannot be negative (line %d).\n",task->N+1);
                res=false;
                goto recycle;
            }
            if( (slice >= 0) && ((task->nZ-1) < slice) ) // update slice count
                task->nZ = (NPAR)(slice + 1);
            striped_dat_slice->add(slice);
        } // time
        
        // back to skill processing
        if( (s_skill.empty() || ( s_skill.size()==1 && (s_skill[0]=='.' || s_skill[0]==' ') ) ) ) { // null skill
            task->N_null++;
            task->Nst++;    // increase stackd count too
            if(task->multiskill == 0) {
                striped_dat_skill->add(-1); // [t] = -1;
            }
            else {
//                NCAT* a_skills = Malloc(NCAT, 2);
//                a_skills[0] = 1; // count
//                a_skills[1] = -1; // value
//                task->dat_multiskill->add(a_skills);
                // add whole multi-skill row
                striped_dat_skill_rcount->add(1);
                striped_dat_skill_rix->add(current_stacked++); // first add pointer, then increase
                striped_dat_skill_stacked->add(-1);
            }
        } // empty skill
        else { // non-empty skill
            // multiskill
            if(task->multiskill != 0) {
                list<NCAT> a_skills;//
                char* a_kc;
                col = &s_skill[0];//. c_str();
                a_kc  = strtok(col, "~\n\r");
                string s_kc;
                // stacked
                NDAT skill_count = 0;
                striped_dat_skill_rix->add(current_stacked); // add stacked pointer once (but increase it with every next skill
                while(a_kc != NULL) {
                    s_kc = string(a_kc);
                    // stacked
                    skill_count++;
                    current_stacked++;
                    task->Nst++;    // increase line count
                    // adding vvvv
                    it = task->map_skill_fwd->find(s_kc);
                    if( it==task->map_skill_fwd->end() ) { // not found
                        if(task->map_skill_fwd->size()==NCAT_MAX) {
                            fprintf(stderr,"Number of unique skills exceeds allowed maximum of %d.\n",NCAT_MAX);
                            res = false;
                            goto recycle;
                        }
                        a_skills.insert(a_skills.end(), (NCAT)task->map_skill_fwd->size()); //dat_skill->add(task->map_skill_fwd->size());
                        task->map_skill_fwd->insert(pair<string,NCAT>(s_kc, (NCAT)task->map_skill_fwd->size()));
                        task->map_skill_bwd->insert(pair<NCAT,string>((NCAT)task->map_skill_bwd->size(),s_kc));
                        // add stacked skill
                        striped_dat_skill_stacked->add((NCAT)task->map_skill_fwd->size()-1); // -1 because after adding
                    }
                    else {
                        a_skills.insert(a_skills.end(), it->second); //dat_skill->add(it->second); //[t] = it->second;
                        // add stacked skill
                        striped_dat_skill_stacked->add(it->second);
                    }
                    // adding ^^^^
                    a_kc  = strtok(NULL,"~\n\r");
                }
//                NCAT *b_skills = Malloc(NCAT, a_skills.size()+1);
//                b_skills[0] = (NCAT)a_skills.size();
//                int count = 0;
//                for(list<NCAT>::iterator it=a_skills.begin(); it!=a_skills.end(); it++)
//                    b_skills[++count] = *it;
//                task->dat_multiskill->add(b_skills);
                // add stacked count
                striped_dat_skill_rcount->add(skill_count);
                Nst_alt+=skill_count;
                // multi skill
            } else {
                // single skill
                it = task->map_skill_fwd->find(s_skill);
                if( it==task->map_skill_fwd->end() ) { // not found
                    if(task->map_skill_fwd->size()==NCAT_MAX) {
                        fprintf(stderr,"Number of unique skills exceeds allowed maximum of %d.\n",NCAT_MAX);
                        res = false;
                        goto recycle;
                    }
                    striped_dat_skill->add((NCAT)task->map_skill_fwd->size()); //[t] = task->map_skill_fwd.size();
                    task->map_skill_fwd->insert(pair<string,NCAT>(s_skill, (NCAT)task->map_skill_fwd->size()));
                    task->map_skill_bwd->insert(pair<NCAT,string>((NCAT)task->map_skill_bwd->size(),s_skill));
                }
                else
                    striped_dat_skill->add(it->second); //[t] = it->second;
            } // single skill
        } // non empty skill
        
        // count lines
        task->N++;    // increase line count
    }// reading loop
    if(wrong_no_columns) {
        fprintf(stderr,"Wrong number of columns in line %u. Expected %d, found %d\n",task->N+1,COLUMNS+task->sliced, number_columns);
        res = false;
        goto recycle;
    }
    task->nG = (NCAT)task->map_group_fwd->size();
    task->nK = (NCAT)task->map_skill_fwd->size();
    task->nI = (NCAT)task->map_step_fwd->size();
    
    // copy striped to lined
    task->dat_obs = striped_dat_obs->toArray();
    task->dat_obs_stacked = init1D<NPAR>(task->Nst);
    task->dat_predict = initToValue2D<NUMBER>(task->N, task->nO, 0);

    task->dat_group = striped_dat_group->toArray();
    if(task->multiskill==0) {
        task->dat_skill = striped_dat_skill->toArray();
    } else {
        task->dat_skill_stacked = striped_dat_skill_stacked->toArray();
        task->dat_skill_rcount  = striped_dat_skill_rcount->toArray();
        task->dat_skill_rix     = striped_dat_skill_rix->toArray();
    }
    task->dat_item = striped_dat_item->toArray();
    if(task->sliced) {
        task->dat_slice = striped_dat_slice->toArray();
    }
    // build dat_obs_stacked
    co = 0;
    if(task->multiskill!=0) {
        for(NDAT t=0;t<task->N;t++) {
            for(NDAT tt=0; tt<task->dat_skill_rcount[t]; tt++) {
                task->dat_obs_stacked[co] = task->dat_obs[t];
                co++;
            }
        }
    } else {
        memcpy( task->dat_obs_stacked, task->dat_obs , sizeof(NPAR)*(size_t)task->N );
    }

    //
    // create connectivities: skill-skill, student-skill
    //
    createConnectivities(task);

    recycle: delete striped_dat_obs;
    delete striped_dat_group;
    if(striped_dat_skill!=NULL) delete striped_dat_skill;
    if(striped_dat_skill_stacked!=NULL) delete striped_dat_skill_stacked;
    if(striped_dat_skill_rcount!=NULL) delete striped_dat_skill_rcount;
    if(striped_dat_skill_rix!=NULL) delete striped_dat_skill_rix;
    if(striped_dat_item!=NULL) delete striped_dat_item;
    if(striped_dat_slice!=NULL) delete striped_dat_slice;
    
    if(fid!=NULL) fclose(fid);
    free(line);
    return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x9cec(%rip), %rsi      # 0x12038
callq 0x2230
testq %rax, %rax
je 0x9294
movq %rax, %r14
movl $0x400, 0x1095d(%rip)   # imm = 0x400
movl $0x400, %edi            # imm = 0x400
callq 0x22a0
movq %rax, 0x10950(%rip)     # 0x18cc8
movl $0x18, %edi
callq 0x21c0
movabsq $0x4e2000000000, %rbx   # imm = 0x4E2000000000
movq %rbx, (%rax)
xorps %xmm0, %xmm0
movq %rax, 0x98(%rsp)
movups %xmm0, 0x8(%rax)
movl $0x18, %edi
callq 0x21c0
movq %rbx, (%rax)
movq %rax, 0x90(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movb 0x920(%r12), %bpl
movl $0x18, %edi
callq 0x21c0
xorps %xmm0, %xmm0
movq %rbx, (%rax)
movups %xmm0, 0x8(%rax)
testb %bpl, %bpl
je 0x8420
movl $0x18, %edi
movq %rax, %r15
callq 0x21c0
movq %rbx, (%rax)
movq %rax, 0x60(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movl $0x18, %edi
callq 0x21c0
movq %rbx, (%rax)
movq %rax, 0x58(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movq %r15, 0x70(%rsp)
movq $0x0, 0x50(%rsp)
jmp 0x8440
movq %rax, 0x50(%rsp)
movq $0x0, 0x58(%rsp)
movq $0x0, 0x60(%rsp)
movq $0x0, 0x70(%rsp)
movl $0x18, %edi
callq 0x21c0
movq %rbx, (%rax)
movq %rax, 0x88(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
cmpb $0x0, 0x43(%r12)
je 0x8482
movl $0x18, %edi
callq 0x21c0
movq %rbx, (%rax)
xorps %xmm0, %xmm0
movq %rax, 0x80(%rsp)
movups %xmm0, 0x8(%rax)
jmp 0x848e
movq $0x0, 0x80(%rsp)
leaq 0x43(%r12), %rax
movq %rax, 0x130(%rsp)
movl $0x30, %edi
callq 0x21c0
leaq 0x8(%rax), %rcx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rax)
movaps %xmm0, (%rax)
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
xorl %ebx, %ebx
movq %rbx, 0x28(%rax)
movq %rax, 0x928(%r12)
movl $0x30, %edi
callq 0x21c0
leaq 0x8(%rax), %rcx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rax)
movaps %xmm0, (%rax)
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq %rbx, 0x28(%rax)
movq %rax, 0x930(%r12)
movl $0x30, %edi
callq 0x21c0
leaq 0x8(%rax), %rcx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rax)
movaps %xmm0, (%rax)
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq %rbx, 0x28(%rax)
movq %rax, 0x948(%r12)
movl $0x30, %edi
callq 0x21c0
leaq 0x8(%rax), %rcx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rax)
movaps %xmm0, (%rax)
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq %rbx, 0x28(%rax)
movq %rax, 0x950(%r12)
movl $0x30, %edi
callq 0x21c0
leaq 0x8(%rax), %rcx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rax)
movaps %xmm0, (%rax)
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq %rbx, 0x28(%rax)
movq %rax, 0x938(%r12)
movl $0x30, %edi
callq 0x21c0
leaq 0x8(%rax), %rcx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rax)
movaps %xmm0, (%rax)
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq %rbx, 0x28(%rax)
movq %rax, 0x940(%r12)
leaq 0x118(%rsp), %rax
movq %rax, -0x10(%rax)
movq %rbx, -0x8(%rax)
movb %bl, (%rax)
leaq 0xf8(%rsp), %rax
movq %rax, -0x10(%rax)
movq %rbx, -0x8(%rax)
movb %bl, (%rax)
leaq 0xd0(%rsp), %rax
movq %rax, -0x10(%rax)
movq %rbx, -0x8(%rax)
movb %bl, (%rax)
leaq 0x8f8(%r12), %rax
movq %rax, 0x68(%rsp)
movq %rbx, 0x8f8(%r12)
movl $0x0, 0x914(%r12)
movb $0x1, %al
movl %eax, 0x34(%rsp)
leaq 0x8(%rsp), %r13
xorl %ebp, %ebp
movq %r14, 0x128(%rsp)
movq 0x106b0(%rip), %rdi     # 0x18cc8
movl 0x106a6(%rip), %esi     # 0x18cc4
movq %r14, %rdx
callq 0x2330
testq %rax, %rax
je 0x8f50
movq 0x10692(%rip), %rbx     # 0x18cc8
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2200
testq %rax, %rax
jne 0x86aa
movq %rbx, %rdi
movl $0xd, %esi
callq 0x2200
testq %rax, %rax
jne 0x86aa
movslq 0x10663(%rip), %r15     # 0x18cc4
addq %r15, %r15
movl %r15d, 0x10659(%rip)    # 0x18cc4
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2350
movq %rax, %rbx
movq %rax, 0x10648(%rip)     # 0x18cc8
movq %rax, %rdi
callq 0x20e0
cltq
addq %rax, %rbx
subl %eax, %r15d
movq %rbx, %rdi
movl %r15d, %esi
movq %r14, %rdx
callq 0x2330
testq %rax, %rax
jne 0x862f
movq 0x1061e(%rip), %rbx     # 0x18cc8
testq %rbx, %rbx
je 0x8f50
movq %rbx, %rdi
leaq 0x9b51(%rip), %rsi      # 0x1220e
callq 0x2320
testq %rax, %rax
je 0x92b3
movq %rax, %rdi
callq 0x2310
movl %eax, %ebx
leal -0x1(%rbx), %r15d
cmpb $0x7f, %r15b
je 0x92b7
movsbl %r15b, %esi
movq 0x98(%rsp), %rdi
callq 0xa352
testb %r15b, %r15b
js 0x870b
cmpb %r15b, 0x901(%r12)
jg 0x870b
movb %bl, 0x901(%r12)
xorl %edi, %edi
leaq 0x9afa(%rip), %rsi      # 0x1220e
callq 0x2320
testq %rax, %rax
je 0x92be
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, 0x8(%rsp)
movq %rax, %rdi
callq 0x20e0
movq %rbx, %rdx
addq %rax, %rdx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x79e8
leaq 0x108(%rsp), %rdi
movq %r13, %rsi
callq 0x2260
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x876f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x928(%r12), %rdi
leaq 0x108(%rsp), %rsi
callq 0xa814
movq 0x928(%r12), %rcx
leaq 0x8(%rcx), %rdx
cmpq %rdx, %rax
je 0x87aa
movl 0x40(%rax), %esi
movq 0x90(%rsp), %rdi
callq 0xa3a8
jmp 0x887f
movq 0x28(%rcx), %r15
cmpq $0x7fffffff, %r15       # imm = 0x7FFFFFFF
je 0x9303
movq 0x90(%rsp), %rdi
movl %r15d, %esi
callq 0xa3a8
movq 0x928(%r12), %rbx
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x108(%rsp), %rsi
movq 0x110(%rsp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x78e6
movl %r15d, 0x28(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0xa90c
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x8824
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x930(%r12), %rbx
movl %r15d, 0x8(%rsp)
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x108(%rsp), %rsi
movq 0x110(%rsp), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0x78e6
movq %rbx, %rdi
movq %r13, %rsi
callq 0xaad6
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x887f
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21d0
xorl %edi, %edi
leaq 0x9986(%rip), %rsi      # 0x1220e
callq 0x2320
testq %rax, %rax
je 0x92c5
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, 0x8(%rsp)
movq %rax, %rdi
callq 0x20e0
movq %rbx, %rdx
addq %rax, %rdx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x79e8
leaq 0xe8(%rsp), %rdi
movq %r13, %rsi
callq 0x2260
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x88e3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x938(%r12), %rdi
leaq 0xe8(%rsp), %rsi
callq 0xa814
movq 0x938(%r12), %rcx
leaq 0x8(%rcx), %rdx
cmpq %rdx, %rax
je 0x891e
movl 0x40(%rax), %esi
movq 0x88(%rsp), %rdi
callq 0xa3a8
jmp 0x89f3
movq 0x28(%rcx), %r15
cmpq $0x7fffffff, %r15       # imm = 0x7FFFFFFF
je 0x930a
movq 0x88(%rsp), %rdi
movl %r15d, %esi
callq 0xa3a8
movq 0x938(%r12), %rbx
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0xe8(%rsp), %rsi
movq 0xf0(%rsp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x78e6
movl %r15d, 0x28(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0xa90c
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x8998
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x940(%r12), %rbx
movl %r15d, 0x8(%rsp)
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0xe8(%rsp), %rsi
movq 0xf0(%rsp), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0x78e6
movq %rbx, %rdi
movq %r13, %rsi
callq 0xaad6
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x89f3
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21d0
xorl %edi, %edi
leaq 0x9812(%rip), %rsi      # 0x1220e
callq 0x2320
testq %rax, %rax
je 0x92cc
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, 0x8(%rsp)
movq %rax, %rdi
callq 0x20e0
movq %rbx, %rdx
addq %rax, %rdx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x79e8
leaq 0xc0(%rsp), %rdi
movq %r13, %rsi
callq 0x2260
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x8a57
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x130(%rsp), %rax
cmpb $0x0, (%rax)
je 0x8ab2
xorl %edi, %edi
leaq 0x97a1(%rip), %rsi      # 0x1220e
callq 0x2320
testq %rax, %rax
je 0x92d3
movq %rax, %rdi
callq 0x2310
movsbl %al, %esi
testl %esi, %esi
js 0x92f7
movsbl 0x910(%r12), %ecx
cmpl %ecx, %esi
jl 0x8aa5
incb %al
movb %al, 0x910(%r12)
movq 0x80(%rsp), %rdi
callq 0xa352
movq 0xc8(%rsp), %rax
testq %rax, %rax
je 0x8ada
cmpq $0x1, %rax
jne 0x8b2a
movq 0xc0(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x2e, %eax
je 0x8ada
cmpl $0x20, %eax
jne 0x8b2a
incl 0x914(%r12)
incl 0x8fc(%r12)
cmpb $0x0, 0x920(%r12)
movq 0x60(%rsp), %rdi
je 0x8deb
movl $0x1, %esi
callq 0xa3a8
movq 0x58(%rsp), %rdi
movl %ebp, %esi
callq 0xa3a8
movq 0x70(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xa3a8
incl %ebp
jmp 0x8e25
cmpb $0x0, 0x920(%r12)
je 0x8df2
leaq 0x38(%rsp), %rax
movq %rax, 0x40(%rsp)
movq %rax, 0x38(%rsp)
xorl %r14d, %r14d
movq %r14, 0x48(%rsp)
movq 0xc0(%rsp), %rdi
leaq 0xa3fc(%rip), %rsi      # 0x12f5b
callq 0x2320
movq %rax, %rbx
leaq 0xb0(%rsp), %rax
movq %rax, 0xa0(%rsp)
movq %r14, 0xa8(%rsp)
movb $0x0, 0xb0(%rsp)
movq 0x58(%rsp), %rdi
movl %ebp, %esi
callq 0xa3a8
movl $0x0, 0x7c(%rsp)
xorl %esi, %esi
testq %rbx, %rbx
je 0x8d84
movl %esi, 0xe4(%rsp)
movl %ebp, %r14d
leaq 0x18(%rsp), %rbp
movq %rbp, 0x8(%rsp)
movq %rbx, %rdi
callq 0x20e0
leaq (%rax,%rbx), %rdx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x79e8
leaq 0xa0(%rsp), %rdi
movq %r13, %r15
movq %r13, %rsi
callq 0x2260
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x8bfb
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21d0
movq %r12, %r13
incl 0x8fc(%r12)
movq 0x948(%r12), %rdi
leaq 0xa0(%rsp), %rsi
callq 0xa814
movq %rax, %rbx
movl %r14d, %ebp
incl %ebp
movq 0x948(%r13), %rax
leaq 0x8(%rax), %rcx
cmpq %rcx, %rbx
movq %r15, %r13
je 0x8c60
movl $0x18, %edi
callq 0x21c0
movl 0x40(%rbx), %ecx
movl %ecx, 0x10(%rax)
movq %rax, %rdi
leaq 0x38(%rsp), %rsi
callq 0x2060
incq 0x48(%rsp)
movl 0x40(%rbx), %esi
jmp 0x8d57
movq 0x28(%rax), %rbx
cmpq $0x7fffffff, %rbx       # imm = 0x7FFFFFFF
je 0x8f21
movl $0x18, %edi
callq 0x21c0
movl %ebx, 0x10(%rax)
movq %rax, %rdi
leaq 0x38(%rsp), %rsi
callq 0x2060
incq 0x48(%rsp)
movq 0x948(%r12), %rbx
movq 0x28(%rbx), %r14
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x78e6
movl %r14d, 0x28(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0xa90c
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x8ced
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x950(%r12), %rbx
movl 0x28(%rbx), %eax
movl %eax, 0x8(%rsp)
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0x78e6
movq %rbx, %rdi
movq %r13, %rsi
callq 0xaad6
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x8d4a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x948(%r12), %rax
movl 0x28(%rax), %esi
decl %esi
movq 0x70(%rsp), %rdi
callq 0xa3a8
xorl %edi, %edi
leaq 0xa1f1(%rip), %rsi      # 0x12f5b
callq 0x2320
movq %rax, %rbx
movl 0xe4(%rsp), %esi
incl %esi
testq %rax, %rax
jne 0x8ba6
movb $0x1, %bl
movq 0x60(%rsp), %rdi
callq 0xa3a8
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x8db5
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x38(%rsp), %rdi
leaq 0x38(%rsp), %r15
cmpq %r15, %rdi
je 0x8dd9
movq (%rdi), %r14
movl $0x18, %esi
callq 0x21d0
movq %r14, %rdi
cmpq %r15, %r14
jne 0x8dc4
testb %bl, %bl
movq 0x128(%rsp), %r14
movl 0x7c(%rsp), %eax
jne 0x8e25
jmp 0x8e2e
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
jmp 0x8e1b
movq 0x948(%r12), %rdi
leaq 0xc0(%rsp), %rsi
callq 0xa814
movq 0x948(%r12), %rcx
leaq 0x8(%rcx), %rdx
cmpq %rdx, %rax
je 0x8e3b
movl 0x40(%rax), %esi
movq 0x50(%rsp), %rdi
callq 0xa3a8
movq 0x68(%rsp), %rax
incl (%rax)
xorl %eax, %eax
testl %eax, %eax
je 0x8611
jmp 0x8f3d
movq 0x28(%rcx), %rsi
cmpq $0x7fffffff, %rsi       # imm = 0x7FFFFFFF
je 0x9311
movq 0x50(%rsp), %rdi
callq 0xa3a8
movq 0x948(%r12), %rbx
movq 0x28(%rbx), %r14
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0xc0(%rsp), %rsi
movq 0xc8(%rsp), %rdx
addq %rsi, %rdx
movq %r13, %rdi
callq 0x78e6
movl %r14d, 0x28(%rsp)
movq %rbx, %rdi
movq %r13, %rsi
callq 0xa90c
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
movq 0x128(%rsp), %r14
je 0x8ebb
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x950(%r12), %rbx
movl 0x28(%rbx), %eax
movl %eax, 0x8(%rsp)
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0xc0(%rsp), %rsi
movq 0xc8(%rsp), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rdi
callq 0x78e6
movq %rbx, %rdi
movq %r13, %rsi
callq 0xaad6
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x8e25
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21d0
jmp 0x8e25
callq 0x2832
movl $0x4, 0x7c(%rsp)
xorl %ebx, %ebx
movl $0x0, 0x34(%rsp)
jmp 0x8d90
cmpl $0x3, %eax
je 0x8f50
cmpl $0x4, %eax
je 0x9100
jmp 0x920d
movq 0x928(%r12), %rax
movq 0x938(%r12), %rcx
movl 0x28(%rax), %eax
movl %eax, 0x904(%r12)
movq 0x948(%r12), %rax
movl 0x28(%rax), %eax
movl %eax, 0x908(%r12)
movl 0x28(%rcx), %eax
movl %eax, 0x90c(%r12)
movq 0x98(%rsp), %rdi
callq 0xa3fc
movq %rax, 0x880(%r12)
movslq 0x8fc(%r12), %rdi
movl $0x1, %esi
callq 0x2110
movq %rax, 0x888(%r12)
movl 0x8f8(%r12), %edi
movsbl 0x901(%r12), %esi
xorps %xmm0, %xmm0
callq 0xa47e
movq %rax, 0x8c8(%r12)
movq 0x90(%rsp), %rdi
callq 0xa5a0
movq %rax, 0x890(%r12)
cmpb $0x0, 0x920(%r12)
je 0x9029
movq 0x70(%rsp), %rdi
callq 0xa5a0
movq %rax, 0x8a0(%r12)
movq 0x60(%rsp), %rdi
callq 0xa5a0
movq %rax, 0x8a8(%r12)
movl $0x8b0, %ebx            # imm = 0x8B0
movq 0x58(%rsp), %rdi
jmp 0x9033
movl $0x898, %ebx            # imm = 0x898
movq 0x50(%rsp), %rdi
callq 0xa5a0
movq %rax, (%r12,%rbx)
movq 0x88(%rsp), %rdi
callq 0xa5a0
movq %rax, 0x8b8(%r12)
cmpb $0x0, 0x43(%r12)
je 0x906e
movq 0x80(%rsp), %rdi
callq 0xa3fc
movq %rax, 0x8c0(%r12)
cmpb $0x0, 0x920(%r12)
je 0x90db
movq 0x68(%rsp), %rax
movl (%rax), %esi
testl %esi, %esi
jle 0x90f8
movq 0x8a8(%r12), %rdx
xorl %eax, %eax
xorl %ecx, %ecx
cmpl $0x0, (%rdx,%rax,4)
jle 0x90ce
movslq %ecx, %rdi
xorl %esi, %esi
movq 0x880(%r12), %rdx
movb (%rdx,%rax), %dl
movq 0x888(%r12), %r8
addq %rdi, %r8
movb %dl, (%rsi,%r8)
movq 0x8a8(%r12), %rdx
incq %rsi
cmpl (%rdx,%rax,4), %esi
jl 0x909b
addl %esi, %ecx
movq 0x68(%rsp), %rsi
movl (%rsi), %esi
incq %rax
movslq %esi, %rdi
cmpq %rdi, %rax
jl 0x9090
jmp 0x90f8
movq 0x880(%r12), %rsi
movq 0x888(%r12), %rdi
movslq 0x8f8(%r12), %rdx
callq 0x2180
movq %r12, %rdi
callq 0x94a8
movq 0x98(%rsp), %rbx
movq %rbx, %rdi
callq 0xa634
movl $0x18, %esi
movq %rbx, %rdi
callq 0x21d0
movq 0x90(%rsp), %rbx
movq %rbx, %rdi
callq 0xa66e
movl $0x18, %esi
movq %rbx, %rdi
callq 0x21d0
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x9159
movq %rdi, %rbx
callq 0xa66e
movl $0x18, %esi
movq %rbx, %rdi
callq 0x21d0
movq 0x70(%rsp), %rbx
testq %rbx, %rbx
je 0x9178
movq %rbx, %rdi
callq 0xa66e
movl $0x18, %esi
movq %rbx, %rdi
callq 0x21d0
movq 0x60(%rsp), %rdi
testq %rdi, %rdi
je 0x9197
movq %rdi, %rbx
callq 0xa66e
movl $0x18, %esi
movq %rbx, %rdi
callq 0x21d0
movq 0x58(%rsp), %rbx
testq %rbx, %rbx
je 0x91b6
movq %rbx, %rdi
callq 0xa66e
movl $0x18, %esi
movq %rbx, %rdi
callq 0x21d0
movq 0x88(%rsp), %rbx
movq %rbx, %rdi
callq 0xa66e
movl $0x18, %esi
movq %rbx, %rdi
callq 0x21d0
movq 0x80(%rsp), %rbx
testq %rbx, %rbx
je 0x91f5
movq %rbx, %rdi
callq 0xa634
movl $0x18, %esi
movq %rbx, %rdi
callq 0x21d0
movq %r14, %rdi
callq 0x21b0
movq 0xfac4(%rip), %rdi      # 0x18cc8
callq 0x2240
movl 0x34(%rsp), %ebp
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x9232
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x9257
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0x927c
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x21d0
andb $0x1, %bpl
movl %ebp, %eax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xed3d(%rip), %rax      # 0x17fd8
movq (%rax), %rdi
leaq 0x9bcb(%rip), %rsi      # 0x12e70
xorl %ebp, %ebp
movq %rbx, %rdx
xorl %eax, %eax
callq 0x22b0
jmp 0x927c
xorl %edx, %edx
jmp 0x92d8
callq 0x28be
jmp 0x92ea
movl $0x1, %edx
jmp 0x92d8
movl $0x2, %edx
jmp 0x92d8
movl $0x3, %edx
jmp 0x92d8
movl $0x4, %edx
movq 0x68(%rsp), %rdi
movq 0x130(%rsp), %rsi
callq 0x28df
movl $0x0, 0x34(%rsp)
jmp 0x9100
movq 0x68(%rsp), %rdi
callq 0x280d
jmp 0x92ea
callq 0x289b
jmp 0x92ea
callq 0x2878
jmp 0x92ea
callq 0x2855
jmp 0x92ea
jmp 0x9343
jmp 0x93dc
jmp 0x9362
jmp 0x93dc
jmp 0x93dc
jmp 0x93dc
jmp 0x9343
jmp 0x93dc
jmp 0x9362
jmp 0x93dc
jmp 0x93dc
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x9431
movq 0x20(%rsp), %rsi
jmp 0x937d
jmp 0x93dc
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x9431
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21d0
jmp 0x9431
jmp 0x93dc
jmp 0x93dc
jmp 0x93e5
jmp 0x93dc
jmp 0x93dc
jmp 0x93dc
jmp 0x93dc
jmp 0x93dc
jmp 0x93e5
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x93e8
movq 0x18(%rsp), %rsi
jmp 0x93ce
jmp 0x93e5
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x93e8
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21d0
jmp 0x93e8
jmp 0x93e5
jmp 0x93e5
movq %rax, %rbx
jmp 0x9431
jmp 0x93e5
jmp 0x93e5
movq %rax, %rbx
leaq 0x38(%rsp), %r15
movq 0xa0(%rsp), %rdi
leaq 0xb0(%rsp), %rax
cmpq %rax, %rdi
je 0x9412
movq 0xb0(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x38(%rsp), %rdi
cmpq %r15, %rdi
je 0x9431
movq (%rdi), %r14
movl $0x18, %esi
callq 0x21d0
movq %r14, %rdi
cmpq %r15, %r14
jne 0x941c
movq 0xc0(%rsp), %rdi
leaq 0xd0(%rsp), %rax
cmpq %rax, %rdi
je 0x9456
movq 0xd0(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x947b
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0x94a0
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x21d0
movq %rbx, %rdi
callq 0x2370