// File: /workspace/github_cpp_makefile_star2_O3/myudelson[P]hmm-scalable/trainhmmst.cpp
// Function: parse_arguments_step1(int, char**, char*, char*, char*, char*)
void parse_arguments_step1(int argc, char **argv, char *input_file_name, char *output_file_name, char *predict_file_name, char *console_file_name) {
	// 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 not know nO (the number of observations) yet
	int i;
    int n;
    char *ch, *ch2;
	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 'e':
				task.tol = atof( strtok(argv[i],",\t\n\r") );
                ch = strtok(NULL,",\t\n\r"); // could be NULL
                if(ch != NULL)
                    task.tol_mode = ch[0];
				if(task.tol<0) {
					fprintf(stderr,"ERROR! Fitting tolerance cannot be negative\n");
					exit_with_help();
				}
                if(task.tol>10) {
                    fprintf(stderr,"ERROR! Fitting tolerance cannot be >10\n");
                    exit_with_help();
                }
                if(task.tol_mode!='p' && task.tol_mode!='l') {
                    fprintf(stderr,"ERROR! Tolerance mode '%c' is not allowed\n",task.tol_mode);
                    exit_with_help();
                }
				break;
			case 't':
				task.sliced = (NPAR)atoi(argv[i]);
				if(task.sliced!=0 && task.sliced!=1) {
					fprintf(stderr,"ERROR! Time parameter should be either 0 (off) or 1(on)\n");
					exit_with_help();
				}
				break;
			case 'i':
				task.maxiter = atoi(argv[i]);
				if(task.maxiter<10) {
					fprintf(stderr,"ERROR! Maximum iterations should be at least 10\n");
					exit_with_help();
				}
				break;
			case 'q':
				task.quiet = (NPAR)atoi(argv[i]);
				if(task.quiet!=0 && task.quiet!=1) {
					fprintf(stderr,"ERROR! Quiet param should be 0 or 1\n");
					exit_with_help();
				}
				break;
			case 'n':
				task.nS = (NPAR)atoi(argv[i]);
				if(task.nS<2) {
					fprintf(stderr,"ERROR! Number of hidden states should be at least 2\n");
					exit_with_help();
				}
                if(task.nS != 2) {
                    task.stat_specd_gt2 = true;
                }
				break;
			case 'S':
				task.is_scaled = (NPAR)atoi(argv[i]);
				if(task.is_scaled < 0 || task.is_scaled > 1) {
					fprintf(stderr,"ERROR! Scaling flag should be either 0 (off) or 1 (in)\n");
					exit_with_help();
				}
				break;
			case 's':
				task.structure = (NPAR)atoi( strtok(argv[i],".\t\n\r") );
                ch = strtok(NULL,".\t\n\r"); // could be NULL (default GD solver)
                if(ch != NULL)
                    task.solver = (NPAR)atoi(ch);
                ch = strtok(NULL,"\t\n\r"); // could be NULL (default GD solver)
                if(ch != NULL)
                    task.solver_setting = (NPAR)atoi(ch);
                if( task.structure != STRUCTURE_SKILL && // task.structure != STRUCTURE_GROUP &&
                   task.structure != STRUCTURE_PIg   && task.structure != STRUCTURE_PIgk  &&
                   task.structure != STRUCTURE_PIAgk && task.structure != STRUCTURE_Agk &&
                   task.structure != STRUCTURE_PIABgk && task.structure != STRUCTURE_Agki &&
                   task.structure != STRUCTURE_PIgkww && task.structure != STRUCTURE_SKABslc &&
                   task.structure != STRUCTURE_SKAslc && task.structure != STRUCTURE_COMP &&
                   task.structure != STRUCTURE_ELO ) {
                    fprintf(stderr, "Model Structure specified (%d) is out of range of allowed values\n",task.structure);
					exit_with_help();
                }
                if( task.solver != METHOD_BW  && task.solver != METHOD_GD &&
                   task.solver != METHOD_CGD && task.solver != METHOD_GDL &&
                   task.solver != METHOD_GBB) {
                    fprintf(stderr, "Method specified (%d) is out of range of allowed values\n",task.solver);
					exit_with_help();
                }
//                if( (task.structure == STRUCTURE_SKABslc || task.structure == STRUCTURE_SKAslc) && task.solver == METHOD_BW) {
//                    fprintf(stderr, "Method specified (%d) is not defined for this structure (%d) \n",task.solver,task.structure);
//                    exit_with_help();
//                }
                if( task.structure == STRUCTURE_COMP && task.solver == METHOD_BW) {
                    fprintf(stderr, "Method specified (%d) is not defined for this structure (%d) \n",task.solver,task.structure);
                    exit_with_help();
                }
//                if( task.structure == STRUCTURE_ELO && !(task.solver == METHOD_GD || task.solver == METHOD_CGD) ) {
//                    fprintf(stderr, "Method specified (%d) is not defined for this structure (%d) \n",task.solver,task.structure);
//                    exit_with_help();
//                }
                if( task.solver == METHOD_BW && ( task.solver != STRUCTURE_SKILL /*&& task.solver != STRUCTURE_GROUP*/ ) ) {
                    fprintf(stderr, "Baum-Welch solver does not support model structure specified (%d)\n",task.solver);
					exit_with_help();
                }
                if( task.solver == METHOD_CGD  &&
                   ( task.solver_setting != 1 && task.solver_setting != 2 &&
                    task.solver_setting != 3 && task.solver_setting !=4 )
                   ) {
                    fprintf(stderr, "Conjugate Gradient Descent setting specified (%d) is out of range of allowed values\n",task.solver_setting);
					exit_with_help();
                }
				break;
            case 'f':
                task.single_skill = (NPAR)atoi(argv[i]);
                break;
			case 'm':
                task.metrics = atoi( strtok(argv[i],",\t\n\r"));
                ch = strtok(NULL, "\t\n\r");
                if(ch!=NULL) {
                    task.metrics_target_obs = (NPAR)(atoi(ch)-1);
                }
				if(task.metrics<0 || task.metrics>1) {
					fprintf(stderr,"value for -m should be either 0 or 1.\n");
					exit_with_help();
				}
				if(task.metrics_target_obs<0) {// || task.metrics_target_obs>(task.nO-1)) {
					fprintf(stderr,"target observation to compute metrics against cannot be '%d'\n",task.metrics_target_obs+1);
					exit_with_help();
				}
                break;
			case 'b':
                task.binaryinput = atoi( strtok(argv[i],"\t\n\r"));
                break;
			case 'v':
				task.cv_folds   = (NPAR)atoi( strtok(argv[i],",\t\n\r"));
                ch2 = strtok(NULL, ",\t\n\r");
                if(ch2!=NULL)
                    task.cv_strat = ch2[0];
                ch = strtok(NULL, ",\t\n\r");
                if(ch!=NULL)
                    task.cv_target_obs = (NPAR)(atoi(ch)-1);
                ch = strtok(NULL, ",\t\n\r");
                if(ch!=NULL)
                    strcpy(task.cv_folds_file, ch);
                ch = strtok(NULL, ",\t\n\r");
                if(ch!=NULL)
                    task.cv_inout_flag = ch[0];
                
				if(task.cv_folds<2) {
					fprintf(stderr,"number of cross-validation folds should be at least 2\n");

					exit_with_help();
				}
				if(task.cv_folds>10) {
					fprintf(stderr,"please keep number of cross-validation folds less than or equal to 10\n");
					exit_with_help();
				}
                if(task.cv_strat != CV_GROUP && task.cv_strat != CV_ITEM && task.cv_strat != CV_NSTR){
					fprintf(stderr,"cross-validation stratification parameter '%c' is illegal\n",task.cv_strat);
					exit_with_help();
                }
				if(task.cv_target_obs<0) {// || task.cv_target_obs>(task.nO-1)) {
					fprintf(stderr,"target observation to be cross-validated against cannot be '%d'\n",task.cv_target_obs+1);
					exit_with_help();
				}
                if( task.cv_inout_flag!='i' && task.cv_inout_flag!='o') {
					fprintf(stderr,"cross-validation folds input/output flag should be ither 'o' (out) or 'i' (in), while it is '%c'\n",task.cv_inout_flag);
					exit_with_help();
                }
                
				break;
            case  'p':
                task.predictions = atoi(argv[i]);
                if(task.predictions<0 || task.predictions>3) {
                    fprintf(stderr,"a flag of whether to report predictions for training data (-p) should be 0, 1, 2, or 3\n");
                    exit_with_help();
                }
                break;
            case  'U':
                task.update_known = *strtok(argv[i],",\t\n\r");
                ch = strtok(NULL, ",\t\n\r");
                task.update_unknown = ch[0];
                
                if( (task.update_known!='r' && task.update_known!='g') ||
                   (task.update_unknown!='t' && task.update_unknown!='g') ) {
                    fprintf(stderr,"specification of how probabilities of states should be updated (-U) is incorrect, it sould be r|g[,t|g] \n");
                    exit_with_help();
                }
                break;
            case  'd':
				task.multiskill = argv[i][0]; // just grab first character (later, maybe several)
                break;
            case  'P':
				n = atoi(argv[i]);
                if(n!=0 && n!=1 && n!=2) {
					fprintf(stderr,"parallel processing flag (-P) should be 0 or 1\n");
					exit_with_help();
                }
                task.parallel = (NPAR)n;
                break;
            case 'r': // coordinate descend parameters
                // if two first_iteration_qualify,iterations_to_qualify
                // if one iterations_to_qualify (first_iteration_qualify==0)
                n = atoi( strtok(argv[i],",\t\n\r") );
                ch = strtok(NULL,",\t\n\r"); // could be NULL (default GD solver)
                if(ch==NULL) {// one parameter
                    task.first_iteration_qualify = 0;
                    task.iterations_to_qualify   = (NPAR)n;
                } else {
                    task.first_iteration_qualify = (NPAR)n;
                    task.iterations_to_qualify   = (NPAR)atoi(ch);
                }
                break;
            case 'R': // coordinate descend parameter for hard iterations limit of skill/group/other fitting
                n = atoi(argv[i]);
                if(n<=0) {
                    fprintf(stderr,"skill/group gradient descent iteration limit (-R) should be an integer >0\n");
                    exit_with_help();
                }
                if(n<=0) {
                    fprintf(stderr,"skill/group gradient descent iteration limit (-R) should be an integer >0\n");
                    exit_with_help();
                }
                task.iterations_limit = (NPAR)n;
                break;
            /*
            case 'c': {
                    // this version is with single center of gravity per Pi, A, and B
                    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() % 4) != 0 ) {
                        fprintf(stderr,"The number of regularization parameters should be a multiple of 4 and it is %d\n",tmp_array->getSize());
                        exit_with_help();
                    }
                    task.Cslices = (NPAR) tmp_array->getSize() / 4;
                    task.Cw = Calloc(NUMBER, (size_t)task.Cslices);
                    task.Ccenters = Calloc(NUMBER, (size_t)(task.Cslices * 3) );
                    int c1 = 0, c2 = 0, i = 0;
                    for(int l=0; l<(int)tmp_array->getSize() / 4; l++) {
                        task.Cw[c1++] = tmp_array->get((NDAT)i++);
                        for(int j=0; j<3; j++)
                            task.Ccenters[c2++] = tmp_array->get((NDAT)i++);
                    }
                    delete tmp_array;
                }
                break;
                */
            case 'c': // just to keep it a valid option
                break;
            case 'o':
                task.duplicate_console = 1;
                strcpy(console_file_name,argv[i]);
                break;
            case '0':
                task.init_reset = true;
                break;
            case 'l': // just to keep it a valid option
                break;
            case 'u': // just to keep it a valid option
                break;
            case 'B': // just to keep it a valid option
                break;
            case 'k': // just to keep it a valid option
                break;
			default:
				fprintf(stderr,"unknown option: -%c\n", argv[i-1][1]);
				exit_with_help();
				break;
		}
	}
    // post-process checks
    // -v and -m collision
    if(task.cv_folds>0 && task.metrics>0) { // correct for 0-start coding
        fprintf(stderr,"values for -v and -m cannot be both non-zeros\n");
        exit_with_help();
    }
    // scaling
    if(task.is_scaled == 1 && task.solver != METHOD_BW) {
        task.is_scaled = 0;
        printf("Scaling can only be enabled for Baum-Welch method. Setting it to off\n");
    }
    // specifying >2 states via -n and mandatory specification of -0 (initial parameters)
    if(task.nS > 2 && !task.init_reset) {
        fprintf(stderr,"when >2 latent states specified via '-n', initial values of parameters have to be explicitly set via '-0'!\n");
        exit_with_help();
    }
    // STRUCTURE_SKABslc solver and -t 1 should be set together
    if( (task.sliced==1) != (task.structure == STRUCTURE_SKABslc || task.structure == STRUCTURE_SKAslc) ) {
        fprintf(stderr,"Error! sliced parameter ('-t 1') and STRUCTURE_SKABslc or STRUCTURE_SKAslc structure should be either both set on or off.\n");
        exit_with_help();
    }
    
	// next argument should be input file name
	if(i>=argc) // if not
		exit_with_help(); // leave
	
	strcpy(input_file_name, argv[i++]); // copy and advance
	
	if(i>=argc) { // no output file name specified
		strcpy(output_file_name,"output.hmm");
		strcpy(predict_file_name,"predict_hmm.txt"); // the predict file too
	}
	else {
		strcpy(output_file_name,argv[i++]); // copy and advance
		if(i>=argc) // no prediction file name specified
			strcpy(predict_file_name,"predict_hmm.txt"); // the predict file too
		else
			strcpy(predict_file_name,argv[i]);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, 0x18(%rsp)
movq %r8, %r15
movq %rcx, %r13
movq %rdx, 0x20(%rsp)
movq %rsi, %r14
movl %edi, %ebp
cmpl $0x2, %edi
jl 0x5647
movq %r13, 0x8(%rsp)
movq %r15, 0x10(%rsp)
movl $0x1, %r12d
movl $0x2, %r15d
leaq 0xfed2(%rip), %r13      # 0x15020
movq -0x8(%r14,%r15,8), %rax
cmpb $0x2d, (%rax)
jne 0x5651
cmpl %ebp, %r15d
jge 0x5755
movzbl 0x1(%rax), %edi
leal -0x42(%rdi), %eax
cmpl $0x34, %eax
ja 0x518d
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
addl $0x2, %r12d
addq $0x2, %r15
cmpl %ebp, %r12d
jl 0x514e
jmp 0x5655
cmpl $0x30, %edi
jne 0x577a
movb $0x1, 0x189dc(%rip)     # 0x1db79
jmp 0x517b
movq (%r14,%r15,8), %rdi
leaq 0x1028c(%rip), %rbx     # 0x15436
movq %rbx, %rsi
callq 0x3350
movq %rax, %rdi
callq 0x3340
movb %al, 0x180e6(%rip)      # 0x1d2a6
xorl %edi, %edi
movq %rbx, %rsi
callq 0x3350
testq %rax, %rax
je 0x51dd
movq %rax, %rdi
callq 0x3340
movb %al, 0x180ca(%rip)      # 0x1d2a7
xorl %edi, %edi
leaq 0x100d0(%rip), %rsi     # 0x152b6
callq 0x3350
testq %rax, %rax
je 0x51fe
movq %rax, %rdi
callq 0x3340
movb %al, 0x180aa(%rip)      # 0x1d2a8
movzbl 0x180a1(%rip), %eax     # 0x1d2a6
cmpl $0xe, %eax
ja 0x5802
movl $0x7efa, %ecx           # imm = 0x7EFA
btl %eax, %ecx
jae 0x5802
movb 0x18085(%rip), %cl      # 0x1d2a7
leal -0x6(%rcx), %edx
cmpb $-0x6, %dl
jbe 0x57a3
xorb $0xd, %al
movl %ecx, %edx
xorb $0x1, %dl
orb %al, %dl
je 0x579e
cmpb $0x3, %cl
sete %cl
movb 0x1805f(%rip), %al      # 0x1d2a8
leal -0x5(%rax), %edx
cmpb $-0x4, %dl
setb %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x517b
jmp 0x5796
movq (%r14,%r15,8), %rdi
leaq 0x10048(%rip), %rsi     # 0x152b5
callq 0x3350
movq %rax, %rdi
callq 0x3340
movl %eax, %ebx
xorl %edi, %edi
leaq 0x10030(%rip), %rsi     # 0x152b5
callq 0x3350
testq %rax, %rax
je 0x5635
movb %bl, 0x1893f(%rip)      # 0x1dbd8
movq %rax, %rdi
callq 0x3340
movb %al, 0x18932(%rip)      # 0x1dbd9
jmp 0x517b
movq (%r14,%r15,8), %rdi
callq 0x3340
movb %al, 0x17fea(%rip)      # 0x1d2a5
jmp 0x517b
movq (%r14,%r15,8), %rdi
callq 0x3340
movl %eax, 0x17fd1(%rip)     # 0x1d2a0
cmpl $0x9, %eax
jg 0x517b
jmp 0x57c7
movq (%r14,%r15,8), %rdi
callq 0x3340
movl %eax, 0x17fdc(%rip)     # 0x1d2c8
cmpl $0x4, %eax
jb 0x517b
jmp 0x57b0
movq (%r14,%r15,8), %rdi
callq 0x3340
testl %eax, %eax
jle 0x57e0
movsbl %al, %eax
movl %eax, 0x188c8(%rip)     # 0x1dbdc
jmp 0x517b
movq (%r14,%r15,8), %rdi
callq 0x3340
movb %al, 0x17f73(%rip)      # 0x1d29b
testb $-0x2, %al
je 0x517b
jmp 0x5791
movq (%r14,%r15,8), %rdi
leaq 0xff75(%rip), %rsi      # 0x152b5
callq 0x3350
movq %rax, %rdi
callq 0x3340
movl %eax, 0x17f6d(%rip)     # 0x1d2c0
xorl %edi, %edi
leaq 0xff5a(%rip), %rsi      # 0x152b6
callq 0x3350
testq %rax, %rax
je 0x5376
movq %rax, %rdi
callq 0x3340
decb %al
movb %al, 0x17f4e(%rip)      # 0x1d2c4
cmpl $0x2, 0x17f43(%rip)     # 0x1d2c0
jae 0x57c2
movb 0x17f3b(%rip), %al      # 0x1d2c4
testb %al, %al
jns 0x517b
jmp 0x57ba
movb $0x1, 0x17eff(%rip)     # 0x1d29c
movq (%r14,%r15,8), %rsi
movq 0x18(%rsp), %rdi
callq 0x31c0
jmp 0x517b
movq (%r14,%r15,8), %rdi
callq 0x3340
movb %al, 0x18799(%rip)      # 0x1db58
cmpb $0x1, %al
jle 0x57b5
cmpb $0x2, %al
je 0x517b
movb $0x1, 0x187a6(%rip)     # 0x1db7c
jmp 0x517b
movq (%r14,%r15,8), %rdi
callq 0x3340
cmpl $0x3, %eax
jae 0x57e5
movb %al, 0x17eb6(%rip)      # 0x1d2a9
jmp 0x517b
movq (%r14,%r15,8), %rdi
leaq 0xfeb2(%rip), %rbx      # 0x152b5
movq %rbx, %rsi
callq 0x3350
movb (%rax), %al
movb %al, 0x17eb9(%rip)      # 0x1d2cc
xorl %edi, %edi
movq %rbx, %rsi
callq 0x3350
movzbl (%rax), %eax
movb %al, 0x17ea7(%rip)      # 0x1d2cd
movzbl 0x17e9f(%rip), %ecx     # 0x1d2cc
cmpl $0x72, %ecx
je 0x543b
cmpl $0x67, %ecx
jne 0x57d6
cmpl $0x67, %eax
je 0x517b
cmpl $0x74, %eax
je 0x517b
jmp 0x57d6
movq (%r14,%r15,8), %rdi
leaq 0xfe59(%rip), %rsi      # 0x152b6
callq 0x3350
movq %rax, %rdi
callq 0x3340
movl %eax, 0x17e60(%rip)     # 0x1d2d0
jmp 0x517b
movq (%r14,%r15,8), %rdi
callq 0x3340
movb %al, 0x17e15(%rip)      # 0x1d299
testb $-0x2, %al
je 0x517b
jmp 0x57db
movq (%r14,%r15,8), %rdi
callq 0x3340
movb %al, 0x17e04(%rip)      # 0x1d2a4
testb $-0x2, %al
je 0x517b
jmp 0x57ab
movq (%r14,%r15,8), %rdi
leaq 0xfdfd(%rip), %rbx      # 0x152b5
movq %rbx, %rsi
callq 0x3350
movq %rax, %rdi
callq 0x32a0
movsd %xmm0, 0x17dc0(%rip)    # 0x1d290
xorl %edi, %edi
movq %rbx, %rsi
callq 0x3350
testq %rax, %rax
je 0x54e7
movb (%rax), %al
movb %al, 0x17db1(%rip)      # 0x1d298
movsd 0x17da1(%rip), %xmm0    # 0x1d290
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
ja 0x57d1
ucomisd 0xfb0b(%rip), %xmm0     # 0x15010
ja 0x57cc
movzbl 0x17d86(%rip), %eax     # 0x1d298
cmpl $0x6c, %eax
je 0x517b
cmpl $0x70, %eax
je 0x517b
jmp 0x57f2
movq (%r14,%r15,8), %rax
movb (%rax), %al
movb %al, 0x18643(%rip)      # 0x1db78
jmp 0x517b
movq (%r14,%r15,8), %rdi
leaq 0xfd70(%rip), %rbx      # 0x152b5
movq %rbx, %rsi
callq 0x3350
movq %rax, %rdi
callq 0x3340
movb %al, 0x18179(%rip)      # 0x1d6d4
xorl %edi, %edi
movq %rbx, %rsi
callq 0x3350
testq %rax, %rax
je 0x5572
movb (%rax), %al
movb %al, 0x18163(%rip)      # 0x1d6d5
xorl %edi, %edi
leaq 0xfd3a(%rip), %rsi      # 0x152b5
callq 0x3350
testq %rax, %rax
je 0x5595
movq %rax, %rdi
callq 0x3340
decb %al
movb %al, 0x18141(%rip)      # 0x1d6d6
xorl %edi, %edi
leaq 0xfd17(%rip), %rsi      # 0x152b5
callq 0x3350
testq %rax, %rax
je 0x55b7
leaq 0x18128(%rip), %rdi     # 0x1d6d7
movq %rax, %rsi
callq 0x31c0
xorl %edi, %edi
leaq 0xfcf5(%rip), %rsi      # 0x152b5
callq 0x3350
testq %rax, %rax
je 0x55d2
movb (%rax), %al
movb %al, 0x18505(%rip)      # 0x1dad7
movb 0x180fc(%rip), %al      # 0x1d6d4
cmpb $0x1, %al
jle 0x578c
cmpb $0xb, %al
jae 0x5787
movzbl 0x180e6(%rip), %eax     # 0x1d6d5
leal -0x67(%rax), %ecx
cmpl $0x7, %ecx
ja 0x57fa
movl $0x85, %edx
btl %ecx, %edx
jae 0x57fa
movb 0x180c7(%rip), %al      # 0x1d6d6
testb %al, %al
js 0x577f
movzbl 0x184b9(%rip), %eax     # 0x1dad7
cmpl $0x69, %eax
je 0x517b
cmpl $0x6f, %eax
je 0x517b
jmp 0x57ea
movb $0x0, 0x1859c(%rip)     # 0x1dbd8
movb %bl, 0x18597(%rip)      # 0x1dbd9
jmp 0x517b
movl $0x1, %r12d
xorl %ebx, %ebx
jmp 0x5661
movb $0x1, %bl
jmp 0x5657
xorl %ebx, %ebx
movq 0x10(%rsp), %r15
movq 0x8(%rsp), %r13
cmpb $0x0, 0x1806c(%rip)     # 0x1d6d4
jle 0x5677
cmpl $0x0, 0x17c4f(%rip)     # 0x1d2c0
jg 0x576b
cmpb $0x1, 0x17c1b(%rip)     # 0x1d299
jne 0x569c
cmpb $0x1, 0x17c20(%rip)     # 0x1d2a7
je 0x569c
movb $0x0, 0x17c09(%rip)     # 0x1d299
leaq 0x1071b(%rip), %rdi     # 0x15db2
callq 0x3320
cmpb $0x3, 0x184b5(%rip)     # 0x1db58
jl 0x56b2
cmpb $0x0, 0x184cd(%rip)     # 0x1db79
je 0x5775
cmpb $0x1, 0x17be2(%rip)     # 0x1d29b
sete %al
movb 0x17be4(%rip), %cl      # 0x1d2a6
addb $-0xd, %cl
cmpb $-0x2, %cl
setb %cl
xorb %al, %cl
je 0x5770
testb %bl, %bl
je 0x5755
leal 0x1(%r12), %ebx
movl %r12d, %eax
movq (%r14,%rax,8), %rsi
movq 0x20(%rsp), %rdi
callq 0x31c0
cmpl %ebp, %ebx
jge 0x5725
addl $0x2, %r12d
movl %ebx, %eax
movq (%r14,%rax,8), %rsi
movq %r13, %rdi
callq 0x31c0
cmpl %ebp, %r12d
jge 0x573b
movl %r12d, %eax
movq (%r14,%rax,8), %rsi
movq %r15, %rdi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31c0
movabsq $0x682e74757074756f, %rax # imm = 0x682E74757074756F
movq %rax, (%r13)
movl $0x6d6d68, 0x7(%r13)    # imm = 0x6D6D68
movups 0x1023c(%rip), %xmm0    # 0x1597e
movups %xmm0, (%r15)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x106db(%rip), %rdi     # 0x15e37
callq 0x3320
movl $0x1, %edi
callq 0x3280
callq 0x388a
callq 0x3859
callq 0x3828
callq 0x394e
movzbl %al, %edi
callq 0x353a
callq 0x35a2
callq 0x35d3
callq 0x37f7
movzbl %al, %edi
callq 0x366c
callq 0x369d
movzbl %cl, %edi
callq 0x36d1
callq 0x3795
callq 0x34d8
callq 0x3764
movzbl %al, %edi
callq 0x3604
callq 0x363b
callq 0x37c6
callq 0x38ec
callq 0x391d
callq 0x34a7
callq 0x3733
callq 0x3445
callq 0x3476
movzbl %al, %edi
callq 0x3509
movzbl %al, %edi
callq 0x38bb
movzbl %al, %edi
callq 0x3571
movzbl %al, %edi
callq 0x3702