// File: /workspace/github_cpp_makefile_star2_O1/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 $0x128, %rsp            # imm = 0x128
movq %rsi, %r15
movq %rdi, %r14
leaq 0x8d68(%rip), %rsi      # 0x11038
callq 0x2230
testq %rax, %rax
je 0x9335
movq %rax, %rbx
movl $0x400, 0xf9d9(%rip)    # imm = 0x400
movl $0x400, %edi            # imm = 0x400
callq 0x22a0
movq %rax, 0xf9cc(%rip)      # 0x17cc8
movl $0x18, %edi
callq 0x21c0
movabsq $0x4e2000000000, %r14   # imm = 0x4E2000000000
movq %r14, (%rax)
xorps %xmm0, %xmm0
movq %rax, 0x88(%rsp)
movups %xmm0, 0x8(%rax)
movl $0x18, %edi
callq 0x21c0
movq %r14, (%rax)
movq %rax, 0x78(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movb 0x920(%r15), %bpl
movl $0x18, %edi
callq 0x21c0
xorps %xmm0, %xmm0
movq %r14, (%rax)
movups %xmm0, 0x8(%rax)
testb %bpl, %bpl
je 0x83a0
movl $0x18, %edi
movq %rax, %r12
callq 0x21c0
movq %r14, (%rax)
movq %rax, 0x50(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movl $0x18, %edi
callq 0x21c0
movq %r14, (%rax)
movq %rax, 0x58(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
movq %r12, 0x60(%rsp)
movq $0x0, 0x48(%rsp)
jmp 0x83c0
movq %rax, 0x48(%rsp)
movq $0x0, 0x58(%rsp)
movq $0x0, 0x50(%rsp)
movq $0x0, 0x60(%rsp)
movl $0x18, %edi
callq 0x21c0
movq %r14, (%rax)
movq %rax, 0x70(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rax)
cmpb $0x0, 0x43(%r15)
je 0x83fb
movl $0x18, %edi
callq 0x21c0
movq %r14, (%rax)
xorps %xmm0, %xmm0
movq %rax, 0x68(%rsp)
movups %xmm0, 0x8(%rax)
jmp 0x8404
movq $0x0, 0x68(%rsp)
movl $0x30, %edi
callq 0x21c0
leaq 0x8(%rax), %rcx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rax)
movaps %xmm0, 0x20(%rax)
movaps %xmm0, (%rax)
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
xorl %r14d, %r14d
movq %r14, 0x28(%rax)
movq %rax, 0x928(%r15)
movl $0x30, %edi
callq 0x21c0
leaq 0x8(%rax), %rcx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rax)
movaps %xmm0, 0x20(%rax)
movaps %xmm0, (%rax)
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq %r14, 0x28(%rax)
movq %rax, 0x930(%r15)
movl $0x30, %edi
callq 0x21c0
leaq 0x8(%rax), %rcx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rax)
movaps %xmm0, 0x20(%rax)
movaps %xmm0, (%rax)
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq %r14, 0x28(%rax)
movq %rax, 0x948(%r15)
movl $0x30, %edi
callq 0x21c0
leaq 0x8(%rax), %rcx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rax)
movaps %xmm0, 0x20(%rax)
movaps %xmm0, (%rax)
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq %r14, 0x28(%rax)
movq %rax, 0x950(%r15)
movl $0x30, %edi
callq 0x21c0
leaq 0x8(%rax), %rcx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rax)
movaps %xmm0, 0x20(%rax)
movaps %xmm0, (%rax)
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq %r14, 0x28(%rax)
movq %rax, 0x938(%r15)
movl $0x30, %edi
callq 0x21c0
leaq 0x8(%rax), %rcx
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rax)
movaps %xmm0, 0x20(%rax)
movaps %xmm0, (%rax)
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq %r14, 0x28(%rax)
movq %rax, 0x940(%r15)
leaq 0x118(%rsp), %rax
movq %rax, -0x10(%rax)
movq %r14, -0x8(%rax)
movb %r14b, (%rax)
leaq 0xf8(%rsp), %rax
movq %rax, -0x10(%rax)
movq %r14, -0x8(%rax)
movb %r14b, (%rax)
leaq 0xd8(%rsp), %rax
movq %rax, -0x10(%rax)
movq %r14, -0x8(%rax)
movb %r14b, (%rax)
leaq 0x8f8(%r15), %rax
movq %rax, 0x80(%rsp)
movq %r14, 0x8f8(%r15)
movl $0x0, 0x914(%r15)
movb $0x1, %al
movl %eax, 0x38(%rsp)
leaq 0x8c86(%rip), %r14      # 0x1120e
movq $0x0, 0x40(%rsp)
movl $0x0, 0x3c(%rsp)
movl $0x0, 0x8(%rsp)
movq 0xf720(%rip), %rdi      # 0x17cc8
movl 0xf716(%rip), %esi      # 0x17cc4
movq %rbx, %rdx
callq 0x2330
movb $0x1, %cl
testq %rax, %rax
je 0x8639
movq 0xf704(%rip), %r12      # 0x17cc8
movq %r12, %rdi
movl $0xa, %esi
callq 0x2200
testq %rax, %rax
jne 0x862e
movq %r12, %rdi
movl $0xd, %esi
callq 0x2200
testq %rax, %rax
jne 0x862e
movslq 0xf6d5(%rip), %rbp      # 0x17cc4
addq %rbp, %rbp
movl %ebp, 0xf6cc(%rip)      # 0x17cc4
movq %r12, %rdi
movq %rbp, %rsi
callq 0x2350
movq %rax, %r12
movq %rax, 0xf6bb(%rip)      # 0x17cc8
movq %rax, %rdi
callq 0x20e0
cltq
addq %rax, %r12
subl %eax, %ebp
movq %r12, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x2330
testq %rax, %rax
jne 0x85bd
cmpq $0x0, 0xf692(%rip)      # 0x17cc8
sete %cl
testb %cl, %cl
jne 0x9015
testb $0x1, 0x40(%rsp)
jne 0x9015
movq 0xf675(%rip), %rdi      # 0x17cc8
movq %r14, %rsi
callq 0x2320
testq %rax, %rax
je 0x9006
movq %rax, %rdi
callq 0x2310
movl %eax, %r12d
leal -0x1(%r12), %ebp
cmpb $0x7f, %bpl
je 0x8d8d
movsbl %bpl, %esi
movq 0x88(%rsp), %rdi
callq 0xa414
testb %bpl, %bpl
js 0x86a4
cmpb %bpl, 0x901(%r15)
jg 0x86a4
movb %r12b, 0x901(%r15)
xorl %edi, %edi
movq %r14, %rsi
callq 0x2320
movl $0x3, %r13d
testq %rax, %rax
je 0x874b
movq %rax, %r12
leaq 0x20(%rsp), %rbp
movq %rbp, 0x10(%rsp)
movq %rax, %rdi
callq 0x20e0
movq %r12, %rdx
addq %rax, %rdx
leaq 0x10(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x7956
leaq 0x108(%rsp), %rdi
movq %r13, %rsi
callq 0x2260
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x870f
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x928(%r15), %rdi
leaq 0x108(%rsp), %rsi
callq 0xa82a
movl $0x3, %r13d
movq 0x928(%r15), %rcx
leaq 0x8(%rcx), %rdx
cmpq %rdx, %rax
je 0x8758
movl 0x40(%rax), %esi
movq 0x78(%rsp), %rdi
callq 0xa466
jmp 0x8835
movl $0x1, 0x8(%rsp)
jmp 0x88df
movq 0x28(%rcx), %r12
cmpq $0x7fffffff, %r12       # imm = 0x7FFFFFFF
je 0x8e74
movq 0x78(%rsp), %rdi
movl %r12d, %esi
callq 0xa466
movq 0x928(%r15), %rbp
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x108(%rsp), %rsi
movq 0x110(%rsp), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %r13
movq %r13, %rdi
callq 0x7858
movl %r12d, 0x30(%rsp)
movq %rbp, %rdi
movq %r13, %rsi
callq 0xa922
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
movl $0x3, %r13d
je 0x87d9
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x930(%r15), %rbp
movl %r12d, 0x10(%rsp)
leaq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x108(%rsp), %rsi
movq 0x110(%rsp), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %rdi
callq 0x7858
movq %rbp, %rdi
leaq 0x10(%rsp), %rsi
callq 0xaaec
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x8835
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x21d0
xorl %edi, %edi
movq %r14, %rsi
callq 0x2320
testq %rax, %rax
je 0x88d7
movq %rax, %r12
leaq 0x20(%rsp), %r14
movq %r14, 0x10(%rsp)
movq %rax, %rdi
callq 0x20e0
movq %r12, %rdx
addq %rax, %rdx
leaq 0x10(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x7956
leaq 0xe8(%rsp), %rdi
movq %r13, %rsi
callq 0x2260
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x889a
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x938(%r15), %rdi
leaq 0xe8(%rsp), %rsi
callq 0xa82a
movq 0x938(%r15), %rcx
leaq 0x8(%rcx), %rdx
cmpq %rdx, %rax
je 0x88f4
movl 0x40(%rax), %esi
movq 0x70(%rsp), %rdi
callq 0xa466
leaq 0x893c(%rip), %r14      # 0x1120e
jmp 0x89c8
movl $0x2, 0x8(%rsp)
movb $0x1, %al
movq %rax, 0x40(%rsp)
testl %r13d, %r13d
je 0x85a1
jmp 0x8ff1
movq 0x28(%rcx), %r12
cmpq $0x7fffffff, %r12       # imm = 0x7FFFFFFF
je 0x8f82
movq 0x70(%rsp), %rdi
movl %r12d, %esi
callq 0xa466
movq 0x938(%r15), %rbp
movq %r14, 0x10(%rsp)
movq 0xe8(%rsp), %rsi
movq 0xf0(%rsp), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %r13
movq %r13, %rdi
callq 0x7858
movl %r12d, 0x30(%rsp)
movq %rbp, %rdi
movq %r13, %rsi
callq 0xa922
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x8965
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x940(%r15), %rbp
movl %r12d, 0x10(%rsp)
leaq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0xe8(%rsp), %rsi
movq 0xf0(%rsp), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %rdi
callq 0x7858
leaq 0x886f(%rip), %r14      # 0x1120e
movq %rbp, %rdi
leaq 0x10(%rsp), %rsi
callq 0xaaec
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x89c8
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x21d0
xorl %edi, %edi
movq %r14, %rsi
callq 0x2320
movl $0x3, %r13d
testq %rax, %rax
je 0x8a8f
movq %rax, %r12
leaq 0x20(%rsp), %rbp
movq %rbp, 0x10(%rsp)
movq %rax, %rdi
callq 0x20e0
movq %r12, %rdx
addq %rax, %rdx
leaq 0x10(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x7956
leaq 0xc8(%rsp), %rdi
movq %r13, %rsi
callq 0x2260
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x8a33
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21d0
cmpb $0x0, 0x43(%r15)
movl $0x3, %r13d
je 0x8aa3
xorl %edi, %edi
movq %r14, %rsi
callq 0x2320
testq %rax, %rax
je 0x8dad
movq %rax, %rdi
callq 0x2310
movsbl %al, %esi
testl %esi, %esi
js 0x8fa9
movsbl 0x910(%r15), %ecx
cmpl %ecx, %esi
jl 0x8a7b
incb %al
movb %al, 0x910(%r15)
movl $0x5, 0x8(%rsp)
movq 0x68(%rsp), %rdi
callq 0xa414
jmp 0x8aab
movb $0x1, %al
movq %rax, 0x40(%rsp)
movl $0x3, 0x8(%rsp)
jmp 0x88e6
movl $0x4, 0x8(%rsp)
movq 0xd0(%rsp), %rax
testq %rax, %rax
je 0x8ad3
cmpq $0x1, %rax
jne 0x8b24
movq 0xc8(%rsp), %rax
movzbl (%rax), %eax
cmpl $0x2e, %eax
je 0x8ad3
cmpl $0x20, %eax
jne 0x8b24
incl 0x914(%r15)
incl 0x8fc(%r15)
cmpb $0x0, 0x920(%r15)
je 0x8dba
movq 0x50(%rsp), %rdi
movl $0x1, %esi
callq 0xa466
movq 0x58(%rsp), %rdi
movl 0x3c(%rsp), %esi
callq 0xa466
movq 0x60(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xa466
incl 0x3c(%rsp)
jmp 0x8f70
cmpb $0x0, 0x920(%r15)
je 0x8dc1
leaq 0xb0(%rsp), %rax
movq %rax, 0xb8(%rsp)
movq %rax, 0xb0(%rsp)
xorl %r14d, %r14d
movq %r14, 0xc0(%rsp)
movq 0xc8(%rsp), %rdi
leaq 0x9337(%rip), %rsi      # 0x11e9b
callq 0x2320
movq %rax, %rbp
leaq 0xa0(%rsp), %rax
movq %rax, 0x90(%rsp)
movq %r14, 0x98(%rsp)
movb $0x0, 0xa0(%rsp)
movq 0x58(%rsp), %rdi
movl 0x3c(%rsp), %esi
callq 0xa466
testq %rbp, %rbp
sete 0xf(%rsp)
je 0x8dfb
xorl %r12d, %r12d
movq %rbx, %r13
leaq 0x20(%rsp), %r14
movq %r14, 0x10(%rsp)
movq %rbp, %rdi
callq 0x20e0
leaq (%rax,%rbp), %rdx
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x7956
leaq 0x90(%rsp), %rdi
movq %rbx, %rsi
callq 0x2260
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
je 0x8bfb
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21d0
incl 0x8fc(%r15)
movq 0x948(%r15), %rdi
leaq 0x90(%rsp), %rsi
callq 0xa82a
movq %rax, %rbp
movq %r13, %rbx
incl 0x3c(%rsp)
movq 0x948(%r15), %rax
leaq 0x8(%rax), %rcx
cmpq %rcx, %rbp
leaq 0x10(%rsp), %r14
je 0x8c65
movl $0x18, %edi
callq 0x21c0
movl 0x40(%rbp), %ecx
movl %ecx, 0x10(%rax)
movq %rax, %rdi
leaq 0xb0(%rsp), %rsi
callq 0x2060
incq 0xc0(%rsp)
movl 0x40(%rbp), %esi
jmp 0x8d5f
movq 0x28(%rax), %rbp
cmpq $0x7fffffff, %rbp       # imm = 0x7FFFFFFF
je 0x8fc9
movl $0x18, %edi
callq 0x21c0
movl %ebp, 0x10(%rax)
movq %rax, %rdi
leaq 0xb0(%rsp), %rsi
callq 0x2060
incq 0xc0(%rsp)
movq 0x948(%r15), %rbp
movq 0x28(%rbp), %r13
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x7858
movl %r13d, 0x30(%rsp)
movq %rbp, %rdi
movq %r14, %rsi
callq 0xa922
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x8cf7
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x950(%r15), %rbp
movl 0x28(%rbp), %eax
movl %eax, 0x10(%rsp)
leaq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %rdi
callq 0x7858
movq %rbp, %rdi
movq %r14, %rsi
callq 0xaaec
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x8d53
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x948(%r15), %rax
movl 0x28(%rax), %esi
decl %esi
movq 0x60(%rsp), %rdi
callq 0xa466
xorl %edi, %edi
leaq 0x9129(%rip), %rsi      # 0x11e9b
callq 0x2320
movq %rax, %rbp
incl %r12d
testq %rax, %rax
sete 0xf(%rsp)
jne 0x8bab
jmp 0x8dfe
callq 0x289e
movl $0x4, %r13d
movl $0x1, 0x8(%rsp)
movl $0x0, 0x38(%rsp)
jmp 0x88e6
movl $0x4, 0x8(%rsp)
jmp 0x88df
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
jmp 0x8dec
movq 0x948(%r15), %rdi
leaq 0xc8(%rsp), %rsi
callq 0xa82a
movq 0x948(%r15), %rcx
leaq 0x8(%rcx), %rdx
cmpq %rdx, %rax
je 0x8e8c
movl 0x40(%rax), %esi
movq 0x48(%rsp), %rdi
callq 0xa466
jmp 0x8f70
xorl %r12d, %r12d
movq 0x50(%rsp), %rdi
movl %r12d, %esi
callq 0xa466
xorl %r13d, %r13d
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
leaq 0x83e6(%rip), %r14      # 0x1120e
je 0x8e3a
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0xb0(%rsp), %rdi
leaq 0xb0(%rsp), %rbp
cmpq %rbp, %rdi
je 0x8e64
movq (%rdi), %r12
movl $0x18, %esi
callq 0x21d0
movq %r12, %rdi
cmpq %rbp, %r12
jne 0x8e4f
testb $0x1, 0xf(%rsp)
je 0x88e6
jmp 0x8f70
callq 0x287b
movl $0x4, %r13d
movl $0x2, 0x8(%rsp)
jmp 0x8da0
movq 0x28(%rcx), %rsi
cmpq $0x7fffffff, %rsi       # imm = 0x7FFFFFFF
je 0x8fe1
movq 0x48(%rsp), %rdi
callq 0xa466
movq 0x948(%r15), %r12
movq 0x28(%r12), %r14
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0xc8(%rsp), %rsi
movq 0xd0(%rsp), %rdx
addq %rsi, %rdx
leaq 0x10(%rsp), %rbp
movq %rbp, %rdi
callq 0x7858
movl %r14d, 0x30(%rsp)
movq %r12, %rdi
movq %rbp, %rsi
callq 0xa922
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
leaq 0x830d(%rip), %r14      # 0x1120e
je 0x8f10
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x950(%r15), %r12
movl 0x28(%r12), %eax
movl %eax, 0x10(%rsp)
leaq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0xc8(%rsp), %rsi
movq 0xd0(%rsp), %rdx
addq %rsi, %rdx
leaq 0x18(%rsp), %rdi
callq 0x7858
movq %r12, %rdi
leaq 0x10(%rsp), %rsi
callq 0xaaec
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x8f70
movq 0x28(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x80(%rsp), %rax
incl (%rax)
xorl %r13d, %r13d
jmp 0x88e6
callq 0x2858
movl $0x4, %r13d
movl $0x3, 0x8(%rsp)
movl $0x0, 0x38(%rsp)
leaq 0x826a(%rip), %r14      # 0x1120e
jmp 0x88e6
movq 0x80(%rsp), %rdi
callq 0x27ed
movl $0x4, %r13d
movl $0x5, 0x8(%rsp)
jmp 0x8da0
callq 0x2812
movl $0x4, %r13d
movl $0x0, 0x38(%rsp)
jmp 0x8e0e
callq 0x2835
movl $0x4, %r13d
jmp 0x8da0
cmpl $0x4, %r13d
je 0x91ab
cmpl $0x3, %r13d
je 0x9015
jmp 0x92af
movl $0x0, 0x8(%rsp)
movb $0x1, %al
movq %rax, 0x40(%rsp)
testb $0x1, 0x40(%rsp)
jne 0x9354
movq 0x928(%r15), %rax
movq 0x938(%r15), %rcx
movl 0x28(%rax), %eax
movl %eax, 0x904(%r15)
movq 0x948(%r15), %rax
movl 0x28(%rax), %eax
movl %eax, 0x908(%r15)
movl 0x28(%rcx), %eax
movl %eax, 0x90c(%r15)
movq 0x88(%rsp), %rdi
callq 0xa4b6
movq %rax, 0x880(%r15)
movslq 0x8fc(%r15), %rdi
movl $0x1, %esi
callq 0x2110
movq %rax, 0x888(%r15)
movl 0x8f8(%r15), %edi
movsbl 0x901(%r15), %esi
xorps %xmm0, %xmm0
callq 0xa538
movq %rax, 0x8c8(%r15)
movq 0x78(%rsp), %rdi
callq 0xa5b6
movq %rax, 0x890(%r15)
cmpb $0x0, 0x920(%r15)
je 0x90e7
movq 0x60(%rsp), %rdi
callq 0xa5b6
movq %rax, 0x8a0(%r15)
movq 0x50(%rsp), %rdi
callq 0xa5b6
movq %rax, 0x8a8(%r15)
movl $0x8b0, %r14d           # imm = 0x8B0
movq 0x58(%rsp), %rdi
jmp 0x90f2
movl $0x898, %r14d           # imm = 0x898
movq 0x48(%rsp), %rdi
callq 0xa5b6
movq %rax, (%r15,%r14)
movq 0x70(%rsp), %rdi
callq 0xa5b6
movq %rax, 0x8b8(%r15)
cmpb $0x0, 0x43(%r15)
je 0x9124
movq 0x68(%rsp), %rdi
callq 0xa4b6
movq %rax, 0x8c0(%r15)
cmpb $0x0, 0x920(%r15)
movq 0x80(%rsp), %r9
je 0x9189
cmpl $0x0, (%r9)
jle 0x91a3
xorl %eax, %eax
xorl %ecx, %ecx
movq 0x8a8(%r15), %rdx
cmpl $0x0, (%rdx,%rax,4)
jle 0x917c
movslq %ecx, %rsi
xorl %edx, %edx
movq 0x880(%r15), %rdi
movb (%rdi,%rax), %dil
movq 0x888(%r15), %r8
addq %rsi, %r8
movb %dil, (%rdx,%r8)
movq 0x8a8(%r15), %rdi
incq %rdx
cmpl (%rdi,%rax,4), %edx
jl 0x9152
addl %edx, %ecx
incq %rax
movslq (%r9), %rdx
cmpq %rdx, %rax
jl 0x9140
jmp 0x91a3
movq 0x880(%r15), %rsi
movq 0x888(%r15), %rdi
movslq 0x8f8(%r15), %rdx
callq 0x2180
movq %r15, %rdi
callq 0x9544
movq 0x88(%rsp), %r14
movq %r14, %rdi
callq 0xa64a
movl $0x18, %esi
movq %r14, %rdi
callq 0x21d0
movq 0x78(%rsp), %r14
movq %r14, %rdi
callq 0xa684
movl $0x18, %esi
movq %r14, %rdi
callq 0x21d0
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x9201
movq %rdi, %r14
callq 0xa684
movl $0x18, %esi
movq %r14, %rdi
callq 0x21d0
movq 0x60(%rsp), %r14
testq %r14, %r14
je 0x9220
movq %r14, %rdi
callq 0xa684
movl $0x18, %esi
movq %r14, %rdi
callq 0x21d0
movq 0x50(%rsp), %r14
testq %r14, %r14
je 0x923f
movq %r14, %rdi
callq 0xa684
movl $0x18, %esi
movq %r14, %rdi
callq 0x21d0
movq 0x58(%rsp), %r14
testq %r14, %r14
je 0x925e
movq %r14, %rdi
callq 0xa684
movl $0x18, %esi
movq %r14, %rdi
callq 0x21d0
movq 0x70(%rsp), %r14
movq %r14, %rdi
callq 0xa684
movl $0x18, %esi
movq %r14, %rdi
callq 0x21d0
movq 0x68(%rsp), %r14
testq %r14, %r14
je 0x9297
movq %r14, %rdi
callq 0xa64a
movl $0x18, %esi
movq %r14, %rdi
callq 0x21d0
movq %rbx, %rdi
callq 0x21b0
movq 0xea22(%rip), %rdi      # 0x17cc8
callq 0x2240
movl 0x38(%rsp), %ebx
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x92d4
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x92f9
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0x931e
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x21d0
andb $0x1, %bl
movl %ebx, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xdc9c(%rip), %rax      # 0x16fd8
movq (%rax), %rdi
leaq 0x8a6a(%rip), %rsi      # 0x11db0
xorl %ebx, %ebx
movq %r14, %rdx
xorl %eax, %eax
callq 0x22b0
jmp 0x931e
movq 0xdc7d(%rip), %rax      # 0x16fd8
movq (%rax), %rdi
movl 0x8f8(%r15), %edx
incl %edx
movsbl 0x43(%r15), %ecx
addl $0x4, %ecx
leaq 0x8b61(%rip), %rsi      # 0x11ed7
movl $0x0, 0x38(%rsp)
movl 0x8(%rsp), %r8d
xorl %eax, %eax
callq 0x22b0
jmp 0x91ab
jmp 0x93cf
jmp 0x94ca
jmp 0x93f1
jmp 0x94ca
jmp 0x94ca
jmp 0x94ca
jmp 0x9476
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r14, %rdi
jne 0x9407
jmp 0x94cd
jmp 0x94ca
jmp 0x94ca
jmp 0x93cf
jmp 0x94ca
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x94cd
movq 0x28(%rsp), %rsi
jmp 0x940c
jmp 0x94ca
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x94cd
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21d0
jmp 0x94cd
jmp 0x94ca
jmp 0x94ca
jmp 0x94ca
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x9479
movq 0x28(%rsp), %rsi
jmp 0x945a
jmp 0x9476
movq %rax, %rbx
movq 0x10(%rsp), %rdi
leaq 0x20(%rsp), %rax
cmpq %rax, %rdi
je 0x9479
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x21d0
jmp 0x9479
jmp 0x9476
jmp 0x9476
jmp 0x94ca
jmp 0x94ca
jmp 0x9476
jmp 0x94ca
jmp 0x94ca
jmp 0x9476
jmp 0x9476
movq %rax, %rbx
movq 0x90(%rsp), %rdi
leaq 0xa0(%rsp), %rax
cmpq %rax, %rdi
je 0x949e
movq 0xa0(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0xb0(%rsp), %rdi
leaq 0xb0(%rsp), %r15
cmpq %r15, %rdi
je 0x94cd
movq (%rdi), %r14
movl $0x18, %esi
callq 0x21d0
movq %r14, %rdi
cmpq %r15, %r14
jne 0x94b3
jmp 0x94cd
movq %rax, %rbx
movq 0xc8(%rsp), %rdi
leaq 0xd8(%rsp), %rax
cmpq %rax, %rdi
je 0x94f2
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0xe8(%rsp), %rdi
leaq 0xf8(%rsp), %rax
cmpq %rax, %rdi
je 0x9517
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0x21d0
movq 0x108(%rsp), %rdi
leaq 0x118(%rsp), %rax
cmpq %rax, %rdi
je 0x953c
movq 0x118(%rsp), %rsi
incq %rsi
callq 0x21d0
movq %rbx, %rdi
callq 0x2370