// File: myudelson[P]hmm-scalable/trainhmm.cpp
// Function: parse_arguments_step2(int, char**, _IO_FILE*)
void parse_arguments_step2(int argc, char **argv, FILE *fid_console) {
	// parse command line options, starting from 1 (0 is path to executable)
	// go in pairs, looking at whether first in pair starts with '-', if not, stop parsing arguments
    
    // at this time we do know nO (the number of observations)
	int i;
    int n, expected_n;
    char *ch;
	for(i=1;i<argc;i++)
	{
		if(argv[i][0] != '-') break; // end of options stop parsing
		if(++i>=argc)
			exit_with_help();
		switch(argv[i-1][1])
		{
			case '0': // init_params
				int len;
				len = (int)strlen( argv[i] );
				// count delimiters
				n = 1; // start with 1
				for(int j=0;j<len;j++) {
					n += (argv[i][j]==',')?1:0;
                    if( (argv[i][j] >= 'a' && argv[i][j] <= 'z') || (argv[i][j] >= 'A' && argv[i][j] <= 'Z') ) {
                        strcpy(param.initfile, argv[i]);
                        break;
                    }
                }
                // init parameters
                if(param.init_params!=NULL) free(param.init_params);
                param.init_params = Calloc(NUMBER, (size_t)n);
                param.init_params_n = (NPAR)n;
                // read params and write to params
                param.init_params[0] = atof( strtok(argv[i],",\t\n\r") );
                for(int j=1; j<n; j++) {
                    param.init_params[j] = atof( strtok(NULL,",\t\n\r") );
                }
				break;
			case 'l': // lower boundaries
				len = (int)strlen( argv[i] );
				// count delimiters
				n = 1; // start with 1
				for(int j=0;j<len;j++)
					n += (NPAR)((argv[i][j]==',')?1:0);
				// init params
				if(param.param_lo!=NULL) free(param.param_lo);
				param.param_lo = Calloc(NUMBER, (size_t)n);
				// read params and write to params
				param.param_lo[0] = atof( strtok(argv[i],",\t\n\r") );
                for(int j=1; j<n; j++) {
					param.param_lo[j] = atof( strtok(NULL,",\t\n\r") );
//                    if(param.param_lo[j] >0) {
//                        int a = 0;
//                    }
                }
                // check if the number of lower boundaries corresponds
                expected_n = param.nS +
                    ((param.sliced==1 && (param.structure==STRUCTURE_SKAslc || param.structure==STRUCTURE_SKABslc) )?param.nZ:1)*param.nS*param.nS +
                    ((param.sliced==1 && param.structure==STRUCTURE_SKABslc )?param.nZ:1)*param.nS*param.nO;
                if( n != expected_n ) {
//                    fprintf(stderr,"Structure=%d, nS=%d, nO=%d, nZ=%d, The expected n=%d specified=%d\n",param.structure,param.nS,param.nO,param.nZ,expected_n,n);
                    fprintf(stderr,"The expected number of lower parameter boundaries is %d and it is %d\n",expected_n,n);
                    exit_with_help();
                }
                param.lo_lims_specd = true;
				break;
			case 'u': // upper boundaries
				len = (int)strlen( argv[i] );
				// count delimiters
				n = 1; // start with 1
				for(int j=0;j<len;j++)
					n += (argv[i][j]==',')?1:0;
				// init params
				if(param.param_hi!=NULL) free(param.param_hi);
				param.param_hi = Calloc(NUMBER, (size_t)n);
				// read params and write to params
				param.param_hi[0] = atof( strtok(argv[i],",\t\n\r") );
                for(int j=1; j<n; j++) {
					param.param_hi[j] = atof( strtok(NULL,",\t\n\r") );
//                    if(param.param_hi[j] < 1) {
//                        int a = 0;
//                    }
                }
                // check if the number of upper boundaries corresponds
                expected_n = param.nS +
                    ((param.sliced==1 && (param.structure==STRUCTURE_SKAslc || param.structure==STRUCTURE_SKABslc) )?param.nZ:1)*param.nS*param.nS +
                    ((param.sliced==1 && param.structure==STRUCTURE_SKABslc )?param.nZ:1)*param.nS*param.nO;
                if( n != expected_n ) {
                    fprintf(stderr,"The expected number of upper parameter boundaries is %d and it is %d\n",expected_n,n);
                    exit_with_help();
                }
                param.hi_lims_specd = true;
				break;
			case 'B': // block fitting
                // first
				param.block_fitting[0] = (NPAR)atoi( strtok(argv[i],",\t\n\r") );
                if(param.block_fitting[0]!=0 && param.block_fitting[0]!=1) {
                    fprintf(stderr,"Values of blocking the fitting flags shuld only be 0 or 1.\n");
                    if(param.duplicate_console==1) fprintf(fid_console,"Values of blocking the fitting flags shuld only be 0 or 1.\n");
                    exit_with_help();
                }
                // second
                ch = strtok(NULL,",\t\n\r"); // could be NULL (default GD solver)
                if(ch != NULL) {
                    param.block_fitting[1] = (NPAR)atoi(ch);
                    if(param.block_fitting[1]!=0 && param.block_fitting[1]!=1) {
                        fprintf(stderr,"Values of blocking the fitting flags shuld only be 0 or 1.\n");
                        if(param.duplicate_console==1) fprintf(fid_console,"Values of blocking the fitting flags shuld only be 0 or 1.\n");
                        exit_with_help();
                    }
                }
                else {
                    fprintf(stderr,"There should be 3 blockig the fitting flags specified.\n");
                    if(param.duplicate_console==1) fprintf(fid_console,"There should be 3 blockig the fitting flags specified.\n");
                    exit_with_help();
                }
                // third
                ch = strtok(NULL,",\t\n\r"); // could be NULL (default GD solver)
                if(ch != NULL) {
                    param.block_fitting[2] = (NPAR)atoi(ch);
                    if(param.block_fitting[2]!=0 && param.block_fitting[2]!=1) {
                        fprintf(stderr,"Values of blocking the fitting flags shuld only be 0 or 1.\n");
                        if(param.duplicate_console==1) fprintf(fid_console,"Values of blocking the fitting flags shuld only be 0 or 1.\n");
                        exit_with_help();
                    }
                }
                else {
                    fprintf(stderr,"There should be 3 blockig the fitting flags specified.\n");
                    if(param.duplicate_console==1) fprintf(fid_console,"There should be 3 blockig the fitting flags specified.\n");
                    exit_with_help();
                }
				break;
			case 'c': {
                    // this version with per-parameter center of gravity in Pi, A, and B
                    NPAR nS = param.nS;
                    NPAR nO = param.nO;
                    int nPerSlice = 1 + nS + nS*nS + nS*nO; // parameters per slice
                    int nCenters = nS + nS*nS + nS*nO; // centers per slice
                    StripedArray<NUMBER> * tmp_array = new StripedArray<NUMBER>();
                    ch = strtok(argv[i],",\t\n\r");
                    while( ch != NULL ) {
                        tmp_array->add( atof(ch) );
                        ch = strtok(NULL,",\t\n\r");
                    }
                    if( (tmp_array->getSize() % nPerSlice) != 0 ) {
                        fprintf(stderr,"The number of regularization parameters should be a multiple of %d and it is %d\n",nPerSlice,tmp_array->getSize());
                        exit_with_help();
                    }
                    param.Cslices = (NPAR) ( tmp_array->getSize() / nPerSlice );
                    param.Cw = Calloc(NUMBER, (size_t)param.Cslices);
                    param.Ccenters = Calloc(NUMBER, (size_t)(param.Cslices * nCenters) );
                    int c1 = 0/*counter for weights*/, c2 = 0/*counter for centers*/, i = 0/*counter for tmp_array*/;
                    for(int l=0; l<(int)tmp_array->getSize() / nPerSlice; l++) {
                        param.Cw[c1++] = tmp_array->get((NDAT)i++);
                        for(int j=0; j<nCenters; j++)
                            param.Ccenters[c2++] = tmp_array->get((NDAT)i++);
                    }
                    delete tmp_array;
                }
                break;
                
        } // end switch
    }// end for
    // post parse actions
    
    if(!param.lo_lims_specd && (param.nS!=2 || param.nO!=2) ) { // if not specified, and it's not 2-state 2-obs case, set to 0
        if(param.param_lo!=NULL) free(param.param_lo);
        param.param_lo = Calloc(NUMBER, (size_t)( param.nS*(1+param.nS+param.nO) ) );
    }
 
    if(!param.hi_lims_specd && (param.nS!=2 || param.nO!=2) ) {  // if not specified, and it's not 2-state 2-obs case, set to 1
        if(param.param_hi!=NULL) free(param.param_hi);  // if not specified, set to 1
        param.param_hi = Calloc(NUMBER, (size_t)( param.nS*(1+param.nS+param.nO) ) );
        for(int j=0; j<( param.nS*(1+param.nS+param.nO) ); j++)
            param.param_hi[j] = (NUMBER)1.0;
    }
    
    // post-argument checks
    if( param.cv_target_obs>(param.nO-1)) {
        fprintf(stderr,"target observation to be cross-validated against cannot be '%d'\n",param.cv_target_obs+1);
        if(param.duplicate_console==1) fprintf(fid_console,"target observation to be cross-validated against cannot be '%d'\n",param.cv_target_obs+1);
        exit_with_help();
    }
    if(param.metrics_target_obs>(param.nO-1)) {
        fprintf(stderr,"target observation to compute metrics against cannot be '%d'\n",param.metrics_target_obs+1);
        if(param.duplicate_console==1) fprintf(fid_console,"target observation to compute metrics against cannot be '%d'\n",param.metrics_target_obs+1);
        exit_with_help();
    }
    
    // upper and lower bounds
    if( (param.sliced==1) && (param.structure == STRUCTURE_SKABslc || param.structure == STRUCTURE_SKAslc) &&
       !(param.lo_lims_specd && param.hi_lims_specd)) {
        fprintf(stderr,"Error! when parameter slicing is enabled, lower and upper boundaries for all parameters have to be set explicitly.\n");
        exit_with_help();
    }

    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl $0x1, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x91b5
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x8732
jmp 0x91b5
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
cmpl -0x4(%rbp), %eax
jl 0x8745
callq 0xb500
movq -0x10(%rbp), %rax
movl -0x1c(%rbp), %ecx
decl %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %eax
movl %eax, -0x88(%rbp)
subl $0x30, %eax
je 0x87ad
jmp 0x8766
movl -0x88(%rbp), %eax
subl $0x42, %eax
je 0x8d2b
jmp 0x8777
movl -0x88(%rbp), %eax
subl $0x63, %eax
je 0x8f1d
jmp 0x8788
movl -0x88(%rbp), %eax
subl $0x6c, %eax
je 0x8936
jmp 0x8799
movl -0x88(%rbp), %eax
subl $0x75, %eax
je 0x8b32
jmp 0x91a5
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x5140
movl %eax, -0x34(%rbp)
movl $0x1, -0x20(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x8890
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x2c, %edx
cmovel %ecx, %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x61, %eax
jl 0x8834
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x7a, %eax
jle 0x8866
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x41, %eax
jl 0x8880
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x38(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x5a, %eax
jg 0x8880
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x58b4b(%rip), %rdi     # 0x613c4
callq 0x52b0
jmp 0x8890
jmp 0x8882
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x87cf
cmpq $0x0, 0x58ac8(%rip)     # 0x61360
je 0x88a6
movq 0x58abf(%rip), %rdi     # 0x61360
callq 0x53b0
movslq -0x20(%rbp), %rdi
movl $0x8, %esi
callq 0x5190
movq %rax, 0x58aa5(%rip)     # 0x61360
movl -0x20(%rbp), %eax
movb %al, 0x58aa4(%rip)      # 0x61368
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x4cc35(%rip), %rsi     # 0x5550c
callq 0x54d0
movq %rax, %rdi
callq 0x53f0
movq 0x58a75(%rip), %rax     # 0x61360
movsd %xmm0, (%rax)
movl $0x1, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x8931
xorl %eax, %eax
movl %eax, %edi
leaq 0x4cc03(%rip), %rsi     # 0x5550c
callq 0x54d0
movq %rax, %rdi
callq 0x53f0
movq 0x58a43(%rip), %rax     # 0x61360
movslq -0x3c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x88f6
jmp 0x91a5
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x5140
movl %eax, -0x34(%rbp)
movl $0x1, -0x20(%rbp)
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x8995
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x40(%rbp), %rcx
movsbl (%rax,%rcx), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x2c, %edx
cmovel %ecx, %eax
movsbl %al, %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x8958
cmpq $0x0, 0x589d3(%rip)     # 0x61370
je 0x89ab
movq 0x589ca(%rip), %rdi     # 0x61370
callq 0x53b0
movslq -0x20(%rbp), %rdi
movl $0x8, %esi
callq 0x5190
movq %rax, 0x589b0(%rip)     # 0x61370
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x4cb39(%rip), %rsi     # 0x5550c
callq 0x54d0
movq %rax, %rdi
callq 0x53f0
movq 0x58989(%rip), %rax     # 0x61370
movsd %xmm0, (%rax)
movl $0x1, -0x44(%rbp)
movl -0x44(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x8a2d
xorl %eax, %eax
movl %eax, %edi
leaq 0x4cb07(%rip), %rsi     # 0x5550c
callq 0x54d0
movq %rax, %rdi
callq 0x53f0
movq 0x58957(%rip), %rax     # 0x61370
movslq -0x44(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x89f2
movsbl 0x591dc(%rip), %eax     # 0x61c10
movl %eax, -0x8c(%rbp)
movsbl 0x5894a(%rip), %eax     # 0x6138b
cmpl $0x1, %eax
jne 0x8a6d
movsbl 0x58949(%rip), %eax     # 0x61396
cmpl $0xc, %eax
je 0x8a5e
movsbl 0x5893d(%rip), %eax     # 0x61396
cmpl $0xb, %eax
jne 0x8a6d
movsbl 0x591bb(%rip), %eax     # 0x61c20
movl %eax, -0x90(%rbp)
jmp 0x8a7a
movl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0x8a7a
movl -0x8c(%rbp), %eax
movl -0x90(%rbp), %ecx
movsbl 0x59183(%rip), %edx     # 0x61c10
imull %edx, %ecx
movsbl 0x59179(%rip), %edx     # 0x61c10
imull %edx, %ecx
addl %ecx, %eax
movl %eax, -0x94(%rbp)
movsbl 0x588e2(%rip), %eax     # 0x6138b
cmpl $0x1, %eax
jne 0x8ac9
movsbl 0x588e1(%rip), %eax     # 0x61396
cmpl $0xb, %eax
jne 0x8ac9
movsbl 0x5915f(%rip), %eax     # 0x61c20
movl %eax, -0x98(%rbp)
jmp 0x8ad6
movl $0x1, %eax
movl %eax, -0x98(%rbp)
jmp 0x8ad6
movl -0x94(%rbp), %eax
movl -0x98(%rbp), %ecx
movsbl 0x59127(%rip), %edx     # 0x61c10
imull %edx, %ecx
movsbl 0x5911e(%rip), %edx     # 0x61c11
imull %edx, %ecx
addl %ecx, %eax
movl %eax, -0x24(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x24(%rbp), %eax
je 0x8b26
movq 0x584ce(%rip), %rax     # 0x60fd8
movq (%rax), %rdi
movl -0x24(%rbp), %edx
movl -0x20(%rbp), %ecx
leaq 0x4d154(%rip), %rsi     # 0x55c6e
movb $0x0, %al
callq 0x5470
callq 0xb500
movb $0x1, 0x59145(%rip)     # 0x61c72
jmp 0x91a5
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x5140
movl %eax, -0x34(%rbp)
movl $0x1, -0x20(%rbp)
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x8b8e
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x48(%rbp), %rcx
movsbl (%rax,%rcx), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x2c, %edx
cmovel %ecx, %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x8b54
cmpq $0x0, 0x587e2(%rip)     # 0x61378
je 0x8ba4
movq 0x587d9(%rip), %rdi     # 0x61378
callq 0x53b0
movslq -0x20(%rbp), %rdi
movl $0x8, %esi
callq 0x5190
movq %rax, 0x587bf(%rip)     # 0x61378
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x4c940(%rip), %rsi     # 0x5550c
callq 0x54d0
movq %rax, %rdi
callq 0x53f0
movq 0x58798(%rip), %rax     # 0x61378
movsd %xmm0, (%rax)
movl $0x1, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jge 0x8c26
xorl %eax, %eax
movl %eax, %edi
leaq 0x4c90e(%rip), %rsi     # 0x5550c
callq 0x54d0
movq %rax, %rdi
callq 0x53f0
movq 0x58766(%rip), %rax     # 0x61378
movslq -0x4c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x8beb
movsbl 0x58fe3(%rip), %eax     # 0x61c10
movl %eax, -0x9c(%rbp)
movsbl 0x58751(%rip), %eax     # 0x6138b
cmpl $0x1, %eax
jne 0x8c66
movsbl 0x58750(%rip), %eax     # 0x61396
cmpl $0xc, %eax
je 0x8c57
movsbl 0x58744(%rip), %eax     # 0x61396
cmpl $0xb, %eax
jne 0x8c66
movsbl 0x58fc2(%rip), %eax     # 0x61c20
movl %eax, -0xa0(%rbp)
jmp 0x8c73
movl $0x1, %eax
movl %eax, -0xa0(%rbp)
jmp 0x8c73
movl -0x9c(%rbp), %eax
movl -0xa0(%rbp), %ecx
movsbl 0x58f8a(%rip), %edx     # 0x61c10
imull %edx, %ecx
movsbl 0x58f80(%rip), %edx     # 0x61c10
imull %edx, %ecx
addl %ecx, %eax
movl %eax, -0xa4(%rbp)
movsbl 0x586e9(%rip), %eax     # 0x6138b
cmpl $0x1, %eax
jne 0x8cc2
movsbl 0x586e8(%rip), %eax     # 0x61396
cmpl $0xb, %eax
jne 0x8cc2
movsbl 0x58f66(%rip), %eax     # 0x61c20
movl %eax, -0xa8(%rbp)
jmp 0x8ccf
movl $0x1, %eax
movl %eax, -0xa8(%rbp)
jmp 0x8ccf
movl -0xa4(%rbp), %eax
movl -0xa8(%rbp), %ecx
movsbl 0x58f2e(%rip), %edx     # 0x61c10
imull %edx, %ecx
movsbl 0x58f25(%rip), %edx     # 0x61c11
imull %edx, %ecx
addl %ecx, %eax
movl %eax, -0x24(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x24(%rbp), %eax
je 0x8d1f
movq 0x582d5(%rip), %rax     # 0x60fd8
movq (%rax), %rdi
movl -0x24(%rbp), %edx
movl -0x20(%rbp), %ecx
leaq 0x4cfa1(%rip), %rsi     # 0x55cb4
movb $0x0, %al
callq 0x5470
callq 0xb500
movb $0x1, 0x58f4d(%rip)     # 0x61c73
jmp 0x91a5
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x4c7ce(%rip), %rsi     # 0x5550c
callq 0x54d0
movq %rax, %rdi
callq 0x54c0
movb %al, 0x58f88(%rip)      # 0x61cd9
movsbl 0x58f81(%rip), %eax     # 0x61cd9
cmpl $0x0, %eax
je 0x8da4
movsbl 0x58f75(%rip), %eax     # 0x61cd9
cmpl $0x1, %eax
je 0x8da4
movq 0x58268(%rip), %rax     # 0x60fd8
movq (%rax), %rdi
leaq 0x4cf80(%rip), %rsi     # 0x55cfa
movb $0x0, %al
callq 0x5470
movsbl 0x58604(%rip), %eax     # 0x6138c
cmpl $0x1, %eax
jne 0x8d9f
movq -0x18(%rbp), %rdi
leaq 0x4cf62(%rip), %rsi     # 0x55cfa
movb $0x0, %al
callq 0x5470
callq 0xb500
xorl %eax, %eax
movl %eax, %edi
leaq 0x4c75d(%rip), %rsi     # 0x5550c
callq 0x54d0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x8e23
movq -0x30(%rbp), %rdi
callq 0x54c0
movb %al, 0x58f0c(%rip)      # 0x61cda
movsbl 0x58f05(%rip), %eax     # 0x61cda
cmpl $0x0, %eax
je 0x8e21
movsbl 0x58ef9(%rip), %eax     # 0x61cda
cmpl $0x1, %eax
je 0x8e21
movq 0x581eb(%rip), %rax     # 0x60fd8
movq (%rax), %rdi
leaq 0x4cf03(%rip), %rsi     # 0x55cfa
movb $0x0, %al
callq 0x5470
movsbl 0x58587(%rip), %eax     # 0x6138c
cmpl $0x1, %eax
jne 0x8e1c
movq -0x18(%rbp), %rdi
leaq 0x4cee5(%rip), %rsi     # 0x55cfa
movb $0x0, %al
callq 0x5470
callq 0xb500
jmp 0x8e5e
movq 0x581ae(%rip), %rax     # 0x60fd8
movq (%rax), %rdi
leaq 0x4cf02(%rip), %rsi     # 0x55d36
movb $0x0, %al
callq 0x5470
movsbl 0x5854a(%rip), %eax     # 0x6138c
cmpl $0x1, %eax
jne 0x8e59
movq -0x18(%rbp), %rdi
leaq 0x4cee4(%rip), %rsi     # 0x55d36
movb $0x0, %al
callq 0x5470
callq 0xb500
xorl %eax, %eax
movl %eax, %edi
leaq 0x4c6a3(%rip), %rsi     # 0x5550c
callq 0x54d0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x8edd
movq -0x30(%rbp), %rdi
callq 0x54c0
movb %al, 0x58e53(%rip)      # 0x61cdb
movsbl 0x58e4c(%rip), %eax     # 0x61cdb
cmpl $0x0, %eax
je 0x8edb
movsbl 0x58e40(%rip), %eax     # 0x61cdb
cmpl $0x1, %eax
je 0x8edb
movq 0x58131(%rip), %rax     # 0x60fd8
movq (%rax), %rdi
leaq 0x4ce49(%rip), %rsi     # 0x55cfa
movb $0x0, %al
callq 0x5470
movsbl 0x584cd(%rip), %eax     # 0x6138c
cmpl $0x1, %eax
jne 0x8ed6
movq -0x18(%rbp), %rdi
leaq 0x4ce2b(%rip), %rsi     # 0x55cfa
movb $0x0, %al
callq 0x5470
callq 0xb500
jmp 0x8f18
movq 0x580f4(%rip), %rax     # 0x60fd8
movq (%rax), %rdi
leaq 0x4ce48(%rip), %rsi     # 0x55d36
movb $0x0, %al
callq 0x5470
movsbl 0x58490(%rip), %eax     # 0x6138c
cmpl $0x1, %eax
jne 0x8f13
movq -0x18(%rbp), %rdi
leaq 0x4ce2a(%rip), %rsi     # 0x55d36
movb $0x0, %al
callq 0x5470
callq 0xb500
jmp 0x91a5
movb 0x58ced(%rip), %al      # 0x61c10
movb %al, -0x4d(%rbp)
movb 0x58ce5(%rip), %al      # 0x61c11
movb %al, -0x4e(%rbp)
movsbl -0x4d(%rbp), %ecx
movl %ecx, %eax
imull %eax, %eax
movl %ecx, %edx
addl %eax, %edx
movsbl -0x4e(%rbp), %eax
imull %eax, %ecx
movl %ecx, %eax
movl %edx, %ecx
leal 0x1(%rax,%rcx), %eax
movl %eax, -0x54(%rbp)
movsbl -0x4d(%rbp), %ecx
movl %ecx, %edx
imull %edx, %edx
movl %ecx, %eax
addl %edx, %eax
movsbl -0x4e(%rbp), %edx
imull %edx, %ecx
addl %ecx, %eax
movl %eax, -0x58(%rbp)
movl $0x18, %edi
callq 0x5300
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xb0(%rbp)
callq 0xb620
jmp 0x8f85
movq -0xb0(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x4c569(%rip), %rsi     # 0x5550c
callq 0x54d0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x900b
movq -0x60(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x30(%rbp), %rdi
callq 0x53f0
movq -0xb8(%rbp), %rdi
callq 0xb660
xorl %eax, %eax
movl %eax, %edi
leaq 0x4c52e(%rip), %rsi     # 0x5550c
callq 0x54d0
movq %rax, -0x30(%rbp)
jmp 0x8fac
movq -0xb0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
movl $0x18, %esi
callq 0x5310
jmp 0x9410
movq -0x60(%rbp), %rdi
callq 0xb700
cltd
idivl -0x54(%rbp)
cmpl $0x0, %edx
je 0x9062
movq 0x57fb4(%rip), %rax     # 0x60fd8
movq (%rax), %rax
movq %rax, -0xc8(%rbp)
movl -0x54(%rbp), %eax
movl %eax, -0xbc(%rbp)
movq -0x60(%rbp), %rdi
callq 0xb700
movq -0xc8(%rbp), %rdi
movl -0xbc(%rbp), %edx
movl %eax, %ecx
leaq 0x4cd18(%rip), %rsi     # 0x55d6e
movb $0x0, %al
callq 0x5470
callq 0xb500
movq -0x60(%rbp), %rdi
callq 0xb700
cltd
idivl -0x54(%rbp)
movb %al, 0x58325(%rip)      # 0x6139a
movsbq 0x5831d(%rip), %rdi     # 0x6139a
movl $0x8, %esi
callq 0x5190
movq %rax, 0x58312(%rip)     # 0x613a0
movsbl 0x58305(%rip), %eax     # 0x6139a
imull -0x58(%rbp), %eax
movslq %eax, %rdi
movl $0x8, %esi
callq 0x5190
movq %rax, 0x582fb(%rip)     # 0x613a8
movl $0x0, -0x70(%rbp)
movl $0x0, -0x74(%rbp)
movl $0x0, -0x78(%rbp)
movl $0x0, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movl %eax, -0xcc(%rbp)
movq -0x60(%rbp), %rdi
callq 0xb700
cltd
idivl -0x54(%rbp)
movl %eax, %ecx
movl -0xcc(%rbp), %eax
cmpl %ecx, %eax
jge 0x9175
movq -0x60(%rbp), %rdi
movl -0x78(%rbp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
callq 0xb710
movq 0x58296(%rip), %rax     # 0x613a0
movl -0x70(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x70(%rbp)
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl $0x0, -0x80(%rbp)
movl -0x80(%rbp), %eax
cmpl -0x58(%rbp), %eax
jge 0x9165
movq -0x60(%rbp), %rdi
movl -0x78(%rbp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
callq 0xb710
movq 0x58261(%rip), %rax     # 0x613a8
movl -0x74(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x74(%rbp)
movslq %ecx, %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x80(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x80(%rbp)
jmp 0x9124
jmp 0x9167
movl -0x7c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
jmp 0x90c9
movq -0x60(%rbp), %rax
movq %rax, -0xd8(%rbp)
cmpq $0x0, %rax
je 0x91a3
movq -0xd8(%rbp), %rdi
callq 0xb7a0
movq -0xd8(%rbp), %rdi
movl $0x18, %esi
callq 0x5310
jmp 0x91a5
jmp 0x91a7
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x870d
testb $0x1, 0x58ab6(%rip)     # 0x61c72
jne 0x921d
movsbl 0x58a4b(%rip), %eax     # 0x61c10
cmpl $0x2, %eax
jne 0x91d6
movsbl 0x58a40(%rip), %eax     # 0x61c11
cmpl $0x2, %eax
je 0x921d
cmpq $0x0, 0x58192(%rip)     # 0x61370
je 0x91ec
movq 0x58189(%rip), %rdi     # 0x61370
callq 0x53b0
movsbl 0x58a1d(%rip), %eax     # 0x61c10
movsbl 0x58a16(%rip), %ecx     # 0x61c10
addl $0x1, %ecx
movsbl 0x58a0d(%rip), %edx     # 0x61c11
addl %edx, %ecx
imull %ecx, %eax
movslq %eax, %rdi
movl $0x8, %esi
callq 0x5190
movq %rax, 0x58153(%rip)     # 0x61370
testb $0x1, 0x58a4f(%rip)     # 0x61c73
jne 0x92ec
movsbl 0x589df(%rip), %eax     # 0x61c10
cmpl $0x2, %eax
jne 0x9246
movsbl 0x589d4(%rip), %eax     # 0x61c11
cmpl $0x2, %eax
je 0x92ec
cmpq $0x0, 0x5812a(%rip)     # 0x61378
je 0x925c
movq 0x58121(%rip), %rdi     # 0x61378
callq 0x53b0
movsbl 0x589ad(%rip), %eax     # 0x61c10
movsbl 0x589a6(%rip), %ecx     # 0x61c10
addl $0x1, %ecx
movsbl 0x5899d(%rip), %edx     # 0x61c11
addl %edx, %ecx
imull %ecx, %eax
movslq %eax, %rdi
movl $0x8, %esi
callq 0x5190
movq %rax, 0x580eb(%rip)     # 0x61378
movl $0x0, -0x84(%rbp)
movl -0x84(%rbp), %eax
movsbl 0x5896c(%rip), %ecx     # 0x61c10
movsbl 0x58965(%rip), %edx     # 0x61c10
addl $0x1, %edx
movsbl 0x5895c(%rip), %esi     # 0x61c11
addl %esi, %edx
imull %edx, %ecx
cmpl %ecx, %eax
jge 0x92ea
movq 0x580b3(%rip), %rax     # 0x61378
movslq -0x84(%rbp), %rcx
movsd 0x4ad4c(%rip), %xmm0    # 0x54020
movsd %xmm0, (%rax,%rcx,8)
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x9297
jmp 0x92ec
movsbl 0x584d3(%rip), %eax     # 0x617c6
movsbl 0x58917(%rip), %ecx     # 0x61c11
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0x9350
movq 0x57cd0(%rip), %rax     # 0x60fd8
movq (%rax), %rdi
movsbl 0x584b4(%rip), %edx     # 0x617c6
addl $0x1, %edx
leaq 0x4c5e6(%rip), %rsi     # 0x55902
movb $0x0, %al
callq 0x5470
movsbl 0x58062(%rip), %eax     # 0x6138c
cmpl $0x1, %eax
jne 0x934b
movq -0x18(%rbp), %rdi
movsbl 0x5848c(%rip), %edx     # 0x617c6
addl $0x1, %edx
leaq 0x4c5be(%rip), %rsi     # 0x55902
movb $0x0, %al
callq 0x5470
callq 0xb500
movsbl 0x5805d(%rip), %eax     # 0x613b4
movsbl 0x588b3(%rip), %ecx     # 0x61c11
subl $0x1, %ecx
cmpl %ecx, %eax
jle 0x93b4
movq 0x57c6c(%rip), %rax     # 0x60fd8
movq (%rax), %rdi
movsbl 0x5803e(%rip), %edx     # 0x613b4
addl $0x1, %edx
leaq 0x4c48b(%rip), %rsi     # 0x5580b
movb $0x0, %al
callq 0x5470
movsbl 0x57ffe(%rip), %eax     # 0x6138c
cmpl $0x1, %eax
jne 0x93af
movq -0x18(%rbp), %rdi
movsbl 0x58016(%rip), %edx     # 0x613b4
addl $0x1, %edx
leaq 0x4c463(%rip), %rsi     # 0x5580b
movb $0x0, %al
callq 0x5470
callq 0xb500
movsbl 0x57fd0(%rip), %eax     # 0x6138b
cmpl $0x1, %eax
jne 0x9407
movsbl 0x57fcf(%rip), %eax     # 0x61396
cmpl $0xb, %eax
je 0x93d8
movsbl 0x57fc3(%rip), %eax     # 0x61396
cmpl $0xc, %eax
jne 0x9407
testb $0x1, 0x58893(%rip)     # 0x61c72
je 0x93ea
testb $0x1, 0x5888b(%rip)     # 0x61c73
jne 0x9407
movq 0x57be7(%rip), %rax     # 0x60fd8
movq (%rax), %rdi
leaq 0x4c9c4(%rip), %rsi     # 0x55dbf
movb $0x0, %al
callq 0x5470
callq 0xb500
addq $0xe0, %rsp
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x5570
nopl (%rax)