// File: myudelson[P]hmm-scalable/HMMProblemPiAGK.cpp
// Function: HMMProblemPiAGK::init(param*)
void HMMProblemPiAGK::init(struct param *param) {
	this->p = param;
    NPAR nS = this->p->nS, nO = this->p->nO; NCAT nK = this->p->nK, nG = this->p->nG;
	this->non01constraints = true;
    this->null_obs_ratio = Calloc(NUMBER, (size_t)this->p->nO);
    this->neg_log_lik = 0;
    this->null_skill_obs = 0;
    this->null_skill_obs_prob = 0;
    
    // skill
    NUMBER *a_PI, ** a_A, ** a_B;
    init3Params(a_PI, a_A, a_B, nS, nO);
    // student
//    NUMBER *a_PIg, ** a_Ag;
//    a_PIg = init1D<NUMBER>((NDAT)nS);
//    a_Ag  = init2D<NUMBER>((NDAT)nS, (NDAT)nS);
    
    //
    // setup params
    //
	NPAR i, j, idx, offset;
	NUMBER sumPI = 0;
	NUMBER sumA[nS];
	NUMBER sumB[nS];
	for(i=0; i<nS; i++) {
		sumA[i] = 0;
		sumB[i] = 0;
	}
    
    // write default parameters first
	// populate PI
	for(i=0; i<((nS)-1); i++) {
		a_PI[i] = this->p->init_params[i];
		sumPI  += this->p->init_params[i];
	}
	a_PI[nS-1] = 1 - sumPI;
	// populate A
	offset = (NPAR)(nS-1);
	for(i=0; i<nS; i++) {
		for(j=0; j<((nS)-1); j++) {
			idx = (NPAR)(offset + i*((nS)-1) + j);
			a_A[i][j] = this->p->init_params[idx];
			sumA[i]  += this->p->init_params[idx];
		}
		a_A[i][((nS)-1)]  = 1 - sumA[i];
	}
	// polupale B
	offset = (NPAR)((nS-1) + nS*(nS-1));
	for(i=0; i<nS; i++) {
		for(j=0; j<((nO)-1); j++) {
			idx = (NPAR)(offset + i*((nO)-1) + j);
			a_B[i][j] = this->p->init_params[idx];
			sumB[i] += this->p->init_params[idx];
		}
		a_B[i][((nO)-1)]  = 1 - sumB[i];
	}
    
//    if(this->p->init_params_n==( nS - 1 + (nS-1) * nS + (nO-1) * nS ) ) {
//        for(i=0; i<((nS)-1); i++) {
//            a_PIg[i] = (NUMBER)1/nS;
//            for(j=0; j<((nS)-1); j++) a_Ag[i][j] = (NUMBER)1/nS;
//        }
//    } else if(this->p->init_params_n==( (nS - 1 + (nS-1) * nS)*2 + (nO-1) * nS )) { // ... if they were specified, read them from the init_params
//        sumPI = 0;
//        for(i=0; i<nS; i++) {
//            sumA[i] = 0;
//        }
//        // populate PI
//        offset = (NPAR)( (nS-1) + nS*(nS-1) + nS*(nO-1) );
//        for(i=0; i<((nS)-1); i++) {
//            idx = (NPAR)(offset + i);
//            a_PIg[i] = this->p->init_params[idx];
//            sumPI  += this->p->init_params[idx];
//        }
//        a_PI[nS-1] = 1 - sumPI;
//        // populate A
//        offset = (NPAR)( (nS-1) + nS*(nS-1) + nS*(nO-1) + (nS-1) );
//        for(i=0; i<nS; i++) {
//            for(j=0; j<((nS)-1); j++) {
//                idx = (NPAR)(offset + i*((nS)-1) + j);
//                a_Ag[i][j] = this->p->init_params[idx];
//                sumA[i]  += this->p->init_params[idx];
//            }
//            a_A[i][((nS)-1)]  = 1 - sumA[i];
//        }
//    } else { // ... the n is wrong
//        fprintf(stderr,"The number of initial parameters is expected to be %i or %i, but it is %i.\n",
//                ( nS - 1 + (nS-1) * nS + (nO-1) * nS ), ( (nS - 1 + (nS-1) * nS)*2 + (nO-1) * nS ), this->p->init_params_n);
//        exit(1);
//    }
    
    
    
    // mass produce PI's/PIg's, A's, B's
    if( this->p->do_not_check_constraints==0 && !checkPIABConstraints(a_PI, a_A, a_B)) {
        fprintf(stderr,"params do not meet constraints.\n");
        exit(1);
    }
    this->pi  = init2D<NUMBER>(nK, nS);
    this->A   = init3D<NUMBER>(nK, nS, nS);
    this->B   = init3D<NUMBER>(nK, nS, nO);
    this->PIg = init2D<NUMBER>(nG, nS);
    this->Ag  = init3D<NUMBER>(nG, nS, nS);
    NCAT x;
    for(x=0; x<nK; x++) {
        cpy1D<NUMBER>(a_PI, this->pi[x], nS);
        cpy2D<NUMBER>(a_A,  this->A[x],  nS, nS);
        cpy2D<NUMBER>(a_B,  this->B[x],  nS, nO);
    }
//    // PIg start with "no-effect" params,PI[i] = 1/nS, A[i][j] = 1/nS __IF__ they were not specified
//    for(x=0; x<nG; x++) {
//        cpy1D<NUMBER>(a_PIg, this->PIg[x], nS);
//        cpy2D<NUMBER>(a_Ag,  this->Ag[x],  nS, nS);
//    }
    // PIg start with "no-effect" params,PI[i] = 1/nS
    for(x=0; x<nG; x++) {
        for(i=0; i<nS; i++) {
            this->PIg[x][i] = (NUMBER)1/nS;
            for(j=0; j<nS; j++)
                this->Ag[x][i][j] = (NUMBER)1/nS;
        }
    }
    // destroy setup params
	free(a_PI);
	free2D<NUMBER>(a_A, nS);
	free2D<NUMBER>(a_B, nS);
//    free(a_PIg);
//    free2D<NUMBER>(a_Ag, nS);

    // if needs be -- read in init params from a file
    if(param->initfile[0]!=0)
        this->readModel(param->initfile, false /* read and upload but not overwrite*/);
    
    // populate boundaries
	// populate lb*/ub*
	// *PI
    init3Params(this->lbPI, this->lbA, this->lbB, nS, nO);
    init3Params(this->ubPI, this->ubA, this->ubB, nS, nO);
	for(i=0; i<nS; i++) {
		lbPI[i] = this->p->param_lo[i];
		ubPI[i] = this->p->param_hi[i];
	}
	// *A
	offset = nS;
	for(i=0; i<nS; i++)
		for(j=0; j<nS; j++) {
			idx = (NPAR)(offset + i*nS + j);
			lbA[i][j] = this->p->param_lo[idx];
			ubA[i][j] = this->p->param_hi[idx];
		}
	// *B
	offset = (NPAR)(nS + nS*nS);
	for(i=0; i<nS; i++)
		for(j=0; j<nO; j++) {
			idx = (NPAR)(offset + i*nS + j);
			lbB[i][j] = this->p->param_lo[idx];
			ubB[i][j] = this->p->param_hi[idx];
		}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x10(%rbp), %rcx
movq %rcx, 0x88(%rax)
movq 0x88(%rax), %rcx
movb 0x8b8(%rcx), %cl
movb %cl, -0x11(%rbp)
movq 0x88(%rax), %rcx
movb 0x8b9(%rcx), %cl
movb %cl, -0x12(%rbp)
movq 0x88(%rax), %rcx
movl 0x8c0(%rcx), %ecx
movl %ecx, -0x18(%rbp)
movq 0x88(%rax), %rcx
movl 0x8bc(%rcx), %ecx
movl %ecx, -0x1c(%rbp)
movb $0x1, 0x80(%rax)
movq 0x88(%rax), %rax
movsbq 0x8b9(%rax), %rdi
movl $0x8, %esi
callq 0x5180
movq -0x80(%rbp), %rdi
movq %rax, 0x18(%rdi)
movq $0x0, 0x20(%rdi)
movq $0x0, 0x28(%rdi)
movq $0x0, 0x30(%rdi)
movsbl -0x11(%rbp), %r8d
movsbl -0x12(%rbp), %r9d
leaq -0x28(%rbp), %rsi
leaq -0x30(%rbp), %rdx
leaq -0x38(%rbp), %rcx
callq 0x19de0
movq $0x0, -0x48(%rbp)
movzbl -0x11(%rbp), %edx
movl %edx, %eax
movq %rsp, %rcx
movq %rcx, -0x50(%rbp)
movl %edx, %ecx
leal 0xf(,%rcx,8), %ecx
andl $-0x10, %ecx
movl %ecx, %edx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x78(%rbp)
movq %rcx, %rsp
movq %rax, -0x58(%rbp)
movzbl -0x11(%rbp), %edx
movl %edx, %eax
movl %edx, %ecx
leal 0xf(,%rcx,8), %ecx
andl $-0x10, %ecx
movl %ecx, %edx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x70(%rbp)
movq %rcx, %rsp
movq %rax, -0x60(%rbp)
movb $0x0, -0x39(%rbp)
movsbl -0x39(%rbp), %eax
movsbl -0x11(%rbp), %ecx
cmpl %ecx, %eax
jge 0x30fa6
movq -0x70(%rbp), %rax
movq -0x78(%rbp), %rcx
movsbq -0x39(%rbp), %rdx
xorps %xmm0, %xmm0
movsd %xmm0, (%rcx,%rdx,8)
movsbq -0x39(%rbp), %rcx
xorps %xmm0, %xmm0
movsd %xmm0, (%rax,%rcx,8)
movb -0x39(%rbp), %al
addb $0x1, %al
movb %al, -0x39(%rbp)
jmp 0x30f6e
movb $0x0, -0x39(%rbp)
movsbl -0x39(%rbp), %eax
movsbl -0x11(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x31009
movq -0x80(%rbp), %rax
movq 0x88(%rax), %rcx
movq 0x8(%rcx), %rcx
movsbq -0x39(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movq -0x28(%rbp), %rcx
movsbq -0x39(%rbp), %rdx
movsd %xmm0, (%rcx,%rdx,8)
movq 0x88(%rax), %rax
movq 0x8(%rax), %rax
movsbq -0x39(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
addsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x48(%rbp)
movb -0x39(%rbp), %al
addb $0x1, %al
movb %al, -0x39(%rbp)
jmp 0x30faa
movsd 0x1e9f7(%rip), %xmm0    # 0x4fa08
subsd -0x48(%rbp), %xmm0
movq -0x28(%rbp), %rax
movsbl -0x11(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movsbl -0x11(%rbp), %eax
subl $0x1, %eax
movb %al, -0x3c(%rbp)
movb $0x0, -0x39(%rbp)
movsbl -0x39(%rbp), %eax
movsbl -0x11(%rbp), %ecx
cmpl %ecx, %eax
jge 0x3111f
movb $0x0, -0x3a(%rbp)
movsbl -0x3a(%rbp), %eax
movsbl -0x11(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x310e0
movq -0x78(%rbp), %rax
movq -0x80(%rbp), %rcx
movsbl -0x3c(%rbp), %edx
movsbl -0x39(%rbp), %esi
movsbl -0x11(%rbp), %edi
subl $0x1, %edi
imull %edi, %esi
addl %esi, %edx
movsbl -0x3a(%rbp), %esi
addl %esi, %edx
movb %dl, -0x3b(%rbp)
movq 0x88(%rcx), %rdx
movq 0x8(%rdx), %rdx
movsbq -0x3b(%rbp), %rsi
movsd (%rdx,%rsi,8), %xmm0
movq -0x30(%rbp), %rdx
movsbq -0x39(%rbp), %rsi
movq (%rdx,%rsi,8), %rdx
movsbq -0x3a(%rbp), %rsi
movsd %xmm0, (%rdx,%rsi,8)
movq 0x88(%rcx), %rcx
movq 0x8(%rcx), %rcx
movsbq -0x3b(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movsbq -0x39(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movb -0x3a(%rbp), %al
addb $0x1, %al
movb %al, -0x3a(%rbp)
jmp 0x3104b
movq -0x78(%rbp), %rax
movsbq -0x39(%rbp), %rcx
movsd 0x1e917(%rip), %xmm0    # 0x4fa08
subsd (%rax,%rcx,8), %xmm0
movq -0x30(%rbp), %rax
movsbq -0x39(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl -0x11(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movb -0x39(%rbp), %al
addb $0x1, %al
movb %al, -0x39(%rbp)
jmp 0x31037
movsbl -0x11(%rbp), %eax
subl $0x1, %eax
movsbl -0x11(%rbp), %ecx
movsbl -0x11(%rbp), %edx
subl $0x1, %edx
imull %edx, %ecx
addl %ecx, %eax
movb %al, -0x3c(%rbp)
movb $0x0, -0x39(%rbp)
movsbl -0x39(%rbp), %eax
movsbl -0x11(%rbp), %ecx
cmpl %ecx, %eax
jge 0x31225
movb $0x0, -0x3a(%rbp)
movsbl -0x3a(%rbp), %eax
movsbl -0x12(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0x311e6
movq -0x70(%rbp), %rax
movq -0x80(%rbp), %rcx
movsbl -0x3c(%rbp), %edx
movsbl -0x39(%rbp), %esi
movsbl -0x12(%rbp), %edi
subl $0x1, %edi
imull %edi, %esi
addl %esi, %edx
movsbl -0x3a(%rbp), %esi
addl %esi, %edx
movb %dl, -0x3b(%rbp)
movq 0x88(%rcx), %rdx
movq 0x8(%rdx), %rdx
movsbq -0x3b(%rbp), %rsi
movsd (%rdx,%rsi,8), %xmm0
movq -0x38(%rbp), %rdx
movsbq -0x39(%rbp), %rsi
movq (%rdx,%rsi,8), %rdx
movsbq -0x3a(%rbp), %rsi
movsd %xmm0, (%rdx,%rsi,8)
movq 0x88(%rcx), %rcx
movq 0x8(%rcx), %rcx
movsbq -0x3b(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movsbq -0x39(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movb -0x3a(%rbp), %al
addb $0x1, %al
movb %al, -0x3a(%rbp)
jmp 0x31151
movq -0x70(%rbp), %rax
movsbq -0x39(%rbp), %rcx
movsd 0x1e811(%rip), %xmm0    # 0x4fa08
subsd (%rax,%rcx,8), %xmm0
movq -0x38(%rbp), %rax
movsbq -0x39(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl -0x12(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movb -0x39(%rbp), %al
addb $0x1, %al
movb %al, -0x39(%rbp)
jmp 0x3113d
movq -0x80(%rbp), %rax
movq 0x88(%rax), %rax
movsbl 0x32(%rax), %eax
cmpl $0x0, %eax
jne 0x31274
movq -0x80(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x38(%rbp), %rcx
callq 0x19e80
testb $0x1, %al
jne 0x31274
movq 0x29d7f(%rip), %rax     # 0x5afd8
movq (%rax), %rdi
leaq 0x1f20c(%rip), %rsi     # 0x5046f
movb $0x0, %al
callq 0x5440
movl $0x1, %edi
callq 0x5390
movl -0x18(%rbp), %edi
movsbl -0x11(%rbp), %esi
callq 0xf580
movq %rax, %rcx
movq -0x80(%rbp), %rax
movq %rcx, 0x38(%rax)
movl -0x18(%rbp), %edi
movsbl -0x11(%rbp), %esi
movsbl -0x11(%rbp), %edx
callq 0x11310
movq %rax, %rcx
movq -0x80(%rbp), %rax
movq %rcx, 0x40(%rax)
movl -0x18(%rbp), %edi
movsbl -0x11(%rbp), %esi
movsbl -0x12(%rbp), %edx
callq 0x11310
movq %rax, %rcx
movq -0x80(%rbp), %rax
movq %rcx, 0x48(%rax)
movl -0x1c(%rbp), %edi
movsbl -0x11(%rbp), %esi
callq 0xf580
movq %rax, %rcx
movq -0x80(%rbp), %rax
movq %rcx, 0x90(%rax)
movl -0x1c(%rbp), %edi
movsbl -0x11(%rbp), %esi
movsbl -0x11(%rbp), %edx
callq 0x11310
movq %rax, %rcx
movq -0x80(%rbp), %rax
movq %rcx, 0x98(%rax)
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x18(%rbp), %eax
jge 0x31372
movq -0x80(%rbp), %rax
movq -0x28(%rbp), %rdi
movq 0x38(%rax), %rax
movslq -0x64(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movsbl -0x11(%rbp), %edx
callq 0xc440
movq -0x80(%rbp), %rax
movq -0x30(%rbp), %rdi
movq 0x40(%rax), %rax
movslq -0x64(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movsbl -0x11(%rbp), %edx
movsbl -0x11(%rbp), %ecx
callq 0xf650
movq -0x80(%rbp), %rax
movq -0x38(%rbp), %rdi
movq 0x48(%rax), %rax
movslq -0x64(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movsbl -0x11(%rbp), %edx
movsbl -0x12(%rbp), %ecx
callq 0xf650
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x31300
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x3143d
movb $0x0, -0x39(%rbp)
movsbl -0x39(%rbp), %eax
movsbl -0x11(%rbp), %ecx
cmpl %ecx, %eax
jge 0x3142d
movq -0x80(%rbp), %rax
movsbl -0x11(%rbp), %ecx
cvtsi2sd %ecx, %xmm1
movsd 0x1e65b(%rip), %xmm0    # 0x4fa08
divsd %xmm1, %xmm0
movq 0x90(%rax), %rax
movslq -0x64(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x39(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movb $0x0, -0x3a(%rbp)
movsbl -0x3a(%rbp), %eax
movsbl -0x11(%rbp), %ecx
cmpl %ecx, %eax
jge 0x3141e
movq -0x80(%rbp), %rax
movsbl -0x11(%rbp), %ecx
cvtsi2sd %ecx, %xmm1
movsd 0x1e61a(%rip), %xmm0    # 0x4fa08
divsd %xmm1, %xmm0
movq 0x98(%rax), %rax
movslq -0x64(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x39(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x3a(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movb -0x3a(%rbp), %al
addb $0x1, %al
movb %al, -0x3a(%rbp)
jmp 0x313ce
jmp 0x31420
movb -0x39(%rbp), %al
addb $0x1, %al
movb %al, -0x39(%rbp)
jmp 0x31389
jmp 0x3142f
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x31379
movq -0x28(%rbp), %rdi
callq 0x5380
movq -0x30(%rbp), %rdi
movsbl -0x11(%rbp), %esi
callq 0xc7f0
movq -0x38(%rbp), %rdi
movsbl -0x11(%rbp), %esi
callq 0xc7f0
movq -0x10(%rbp), %rax
movsbl 0x6c(%rax), %eax
cmpl $0x0, %eax
je 0x31480
movq -0x80(%rbp), %rdi
movq -0x10(%rbp), %rsi
addq $0x6c, %rsi
xorl %edx, %edx
callq 0x1a1f0
movq -0x80(%rbp), %rdi
movq %rdi, %rsi
addq $0x50, %rsi
movq %rdi, %rdx
addq $0x58, %rdx
movq %rdi, %rcx
addq $0x60, %rcx
movb -0x11(%rbp), %al
movsbl %al, %r8d
movsbl -0x12(%rbp), %r9d
callq 0x19de0
movq -0x80(%rbp), %rdi
movq %rdi, %rsi
addq $0x68, %rsi
movq %rdi, %rdx
addq $0x70, %rdx
movq %rdi, %rcx
addq $0x78, %rcx
movb -0x11(%rbp), %al
movsbl %al, %r8d
movsbl -0x12(%rbp), %r9d
callq 0x19de0
movb $0x0, -0x39(%rbp)
movsbl -0x39(%rbp), %eax
movsbl -0x11(%rbp), %ecx
cmpl %ecx, %eax
jge 0x31538
movq -0x80(%rbp), %rax
movq 0x88(%rax), %rcx
movq 0x18(%rcx), %rcx
movsbq -0x39(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movq 0x50(%rax), %rcx
movsbq -0x39(%rbp), %rdx
movsd %xmm0, (%rcx,%rdx,8)
movq 0x88(%rax), %rcx
movq 0x20(%rcx), %rcx
movsbq -0x39(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movq 0x68(%rax), %rax
movsbq -0x39(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movb -0x39(%rbp), %al
addb $0x1, %al
movb %al, -0x39(%rbp)
jmp 0x314d8
movb -0x11(%rbp), %al
movb %al, -0x3c(%rbp)
movb $0x0, -0x39(%rbp)
movsbl -0x39(%rbp), %eax
movsbl -0x11(%rbp), %ecx
cmpl %ecx, %eax
jge 0x315f8
movb $0x0, -0x3a(%rbp)
movsbl -0x3a(%rbp), %eax
movsbl -0x11(%rbp), %ecx
cmpl %ecx, %eax
jge 0x315e9
movq -0x80(%rbp), %rax
movsbl -0x3c(%rbp), %ecx
movsbl -0x39(%rbp), %edx
movsbl -0x11(%rbp), %esi
imull %esi, %edx
addl %edx, %ecx
movsbl -0x3a(%rbp), %edx
addl %edx, %ecx
movb %cl, -0x3b(%rbp)
movq 0x88(%rax), %rcx
movq 0x18(%rcx), %rcx
movsbq -0x3b(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movq 0x58(%rax), %rcx
movsbq -0x39(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movsbq -0x3a(%rbp), %rdx
movsd %xmm0, (%rcx,%rdx,8)
movq 0x88(%rax), %rcx
movq 0x20(%rcx), %rcx
movsbq -0x3b(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movq 0x70(%rax), %rax
movsbq -0x39(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x3a(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movb -0x3a(%rbp), %al
addb $0x1, %al
movb %al, -0x3a(%rbp)
jmp 0x31556
jmp 0x315eb
movb -0x39(%rbp), %al
addb $0x1, %al
movb %al, -0x39(%rbp)
jmp 0x31542
movsbl -0x11(%rbp), %eax
movsbl -0x11(%rbp), %ecx
movsbl -0x11(%rbp), %edx
imull %edx, %ecx
addl %ecx, %eax
movb %al, -0x3c(%rbp)
movb $0x0, -0x39(%rbp)
movsbl -0x39(%rbp), %eax
movsbl -0x11(%rbp), %ecx
cmpl %ecx, %eax
jge 0x316c6
movb $0x0, -0x3a(%rbp)
movsbl -0x3a(%rbp), %eax
movsbl -0x12(%rbp), %ecx
cmpl %ecx, %eax
jge 0x316b7
movq -0x80(%rbp), %rax
movsbl -0x3c(%rbp), %ecx
movsbl -0x39(%rbp), %edx
movsbl -0x11(%rbp), %esi
imull %esi, %edx
addl %edx, %ecx
movsbl -0x3a(%rbp), %edx
addl %edx, %ecx
movb %cl, -0x3b(%rbp)
movq 0x88(%rax), %rcx
movq 0x18(%rcx), %rcx
movsbq -0x3b(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movq 0x60(%rax), %rcx
movsbq -0x39(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movsbq -0x3a(%rbp), %rdx
movsd %xmm0, (%rcx,%rdx,8)
movq 0x88(%rax), %rcx
movq 0x20(%rcx), %rcx
movsbq -0x3b(%rbp), %rdx
movsd (%rcx,%rdx,8), %xmm0
movq 0x78(%rax), %rax
movsbq -0x39(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbq -0x3a(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movb -0x3a(%rbp), %al
addb $0x1, %al
movb %al, -0x3a(%rbp)
jmp 0x31624
jmp 0x316b9
movb -0x39(%rbp), %al
addb $0x1, %al
movb %al, -0x39(%rbp)
jmp 0x31610
movq -0x50(%rbp), %rax
movq %rax, %rsp
movq %rbp, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)