// File: /workspace/github_cpp_makefile_star2_O1/cjlin1[P]liblinear/train.c
// Function: parse_command_line(int, char**, char*, char*)
void parse_command_line(int argc, char **argv, char *input_file_name, char *model_file_name)
{
	int i;
	void (*print_func)(const char*) = NULL;  // default printing to stdout

	// default values
	param.solver_type = L2R_L2LOSS_SVC_DUAL;
	param.C = 1;
	param.p = 0.1;
	param.nu = 0.5;
	param.eps = INF; // see setting below
	param.nr_weight = 0;
	param.regularize_bias = 1;
	param.weight_label = NULL;
	param.weight = NULL;
	param.init_sol = NULL;
	param.w_recalc = false;
	flag_cross_validation = 0;
	flag_C_specified = 0;
	flag_p_specified = 0;
	flag_solver_specified = 0;
	flag_find_parameters = 0;
	bias = -1;

	// parse options
	for(i=1;i<argc;i++)
	{
		if(argv[i][0] != '-') break;
		if(++i>=argc)
			exit_with_help();
		switch(argv[i-1][1])
		{
			case 's':
				param.solver_type = atoi(argv[i]);
				flag_solver_specified = 1;
				break;

			case 'c':
				param.C = atof(argv[i]);
				flag_C_specified = 1;
				break;

			case 'p':
				flag_p_specified = 1;
				param.p = atof(argv[i]);
				break;

			case 'n':
				param.nu = atof(argv[i]);
				break;

			case 'e':
				param.eps = atof(argv[i]);
				break;

			case 'B':
				bias = atof(argv[i]);
				break;

			case 'w':
				++param.nr_weight;
				param.weight_label = (int *) realloc(param.weight_label,sizeof(int)*param.nr_weight);
				param.weight = (double *) realloc(param.weight,sizeof(double)*param.nr_weight);
				param.weight_label[param.nr_weight-1] = atoi(&argv[i-1][2]);
				param.weight[param.nr_weight-1] = atof(argv[i]);
				break;

			case 'v':
				flag_cross_validation = 1;
				nr_fold = atoi(argv[i]);
				if(nr_fold < 2)
				{
					fprintf(stderr,"n-fold cross validation: n must >= 2\n");
					exit_with_help();
				}
				break;

			case 'q':
				print_func = &print_null;
				i--;
				break;

			case 'C':
				flag_find_parameters = 1;
				i--;
				break;

			case 'R':
				param.regularize_bias = 0;
				i--;
				break;

			default:
				fprintf(stderr,"unknown option: -%c\n", argv[i-1][1]);
				exit_with_help();
				break;
		}
	}

	set_print_string_function(print_func);

	// determine filenames
	if(i>=argc)
		exit_with_help();

	strcpy(input_file_name, argv[i]);

	if(i<argc-1)
		strcpy(model_file_name,argv[i+1]);
	else
	{
		char *p = strrchr(argv[i],'/');
		if(p==NULL)
			p = argv[i];
		else
			++p;
		sprintf(model_file_name,"%s.model",p);
	}

	// default solver for parameter selection is L2R_L2LOSS_SVC
	if(flag_find_parameters)
	{
		if(!flag_cross_validation)
			nr_fold = 5;
		if(!flag_solver_specified)
		{
			fprintf(stderr, "Solver not specified. Using -s 2\n");
			param.solver_type = L2R_L2LOSS_SVC;
		}
		else if(param.solver_type != L2R_LR && param.solver_type != L2R_L2LOSS_SVC && param.solver_type != L2R_L2LOSS_SVR)
		{
			fprintf(stderr, "Warm-start parameter search only available for -s 0, -s 2 and -s 11\n");
			exit_with_help();
		}
	}

	if(param.eps == INF)
	{
		switch(param.solver_type)
		{
			case L2R_LR:
			case L2R_L2LOSS_SVC:
				param.eps = 0.01;
				break;
			case L2R_L2LOSS_SVR:
				param.eps = 0.0001;
				break;
			case L2R_L2LOSS_SVC_DUAL:
			case L2R_L1LOSS_SVC_DUAL:
			case MCSVM_CS:
			case L2R_LR_DUAL:
				param.eps = 0.1;
				break;
			case L1R_L2LOSS_SVC:
			case L1R_LR:
				param.eps = 0.01;
				break;
			case L2R_L1LOSS_SVR_DUAL:
			case L2R_L2LOSS_SVR_DUAL:
				param.eps = 0.1;
				break;
			case ONECLASS_SVM:
				param.eps = 0.01;
				break;
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edi, %ebp
movl $0x1, %r12d
movl %r12d, 0xf6e7(%rip)     # 0x121b8
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0xf6e6(%rip)      # 0x121c8
movabsq $0x3fb999999999999a, %rax # imm = 0x3FB999999999999A
movq %rax, 0xf6f5(%rip)      # 0x121e8
movabsq $0x3fe0000000000000, %rax # imm = 0x3FE0000000000000
movq %rax, 0xf6ec(%rip)      # 0x121f0
movabsq $0x7ff0000000000000, %rax # imm = 0x7FF0000000000000
movq %rax, 0xf6ab(%rip)      # 0x121c0
xorl %edi, %edi
movl %edi, 0xf6b3(%rip)      # 0x121d0
movl %r12d, 0xf6dc(%rip)     # 0x12200
movq $0x0, 0xf6c9(%rip) # 0x121f8
movb $0x0, 0xf6ce(%rip)      # 0x12204
xorps %xmm0, %xmm0
movups %xmm0, 0xf698(%rip)     # 0x121d8
movl %edi, 0xf6ea(%rip)      # 0x12230
movl %edi, 0xf6ec(%rip)      # 0x12238
movl %edi, 0xf6ea(%rip)      # 0x1223c
movl %edi, 0xf6e8(%rip)      # 0x12240
movl %edi, 0xf6d6(%rip)      # 0x12234
movabsq $-0x4010000000000000, %rax # imm = 0xBFF0000000000000
movq %rax, 0xf6d9(%rip)      # 0x12248
cmpl $0x2, %ebp
setge %r13b
jl 0x2e9e
movq %rsi, %r14
movq %rcx, 0x8(%rsp)
movq 0x8(%rsi), %rax
cmpb $0x2d, (%rax)
movq %rdx, 0x10(%rsp)
jne 0x2da7
leaq 0x8(%r14), %rbx
movl $0x1, %r12d
xorl %r15d, %r15d
leal 0x1(%r12), %r13d
cmpl %ebp, %r13d
jge 0x2ea3
movzbl 0x1(%rax), %eax
cmpl $0x62, %eax
jle 0x2bf2
leal -0x6e(%rax), %ecx
cmpl $0x9, %ecx
ja 0x2c3c
leaq 0xa45f(%rip), %rdx      # 0xd028
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
leaq -0x24b(%rip), %rdi      # 0x298c
jmpq *%rcx
movslq %r13d, %rax
movq (%r14,%rax,8), %rdi
callq 0x21c0
movsd %xmm0, 0xf603(%rip)     # 0x121f0
jmp 0x2d79
cmpl $0x42, %eax
je 0x2c14
cmpl $0x43, %eax
je 0x2c2d
cmpl $0x52, %eax
jne 0x2eb9
movl $0x0, 0xf5f1(%rip)      # 0x12200
jmp 0x2d7c
movslq %r13d, %rax
movq (%r14,%rax,8), %rdi
callq 0x21c0
movsd %xmm0, 0xf620(%rip)     # 0x12248
jmp 0x2d79
movl $0x1, 0xf5fd(%rip)      # 0x12234
jmp 0x2d7c
cmpl $0x63, %eax
je 0x2d5b
cmpl $0x65, %eax
jne 0x2eb9
movslq %r13d, %rax
movq (%r14,%rax,8), %rdi
callq 0x21c0
movsd %xmm0, 0xf55e(%rip)     # 0x121c0
jmp 0x2d79
movslq 0xf562(%rip), %rax      # 0x121d0
leaq 0x1(%rax), %rcx
movl %ecx, 0xf558(%rip)      # 0x121d0
movq 0xf559(%rip), %rdi      # 0x121d8
leaq 0x4(,%rax,4), %rsi
callq 0x2270
movq %rax, 0xf545(%rip)      # 0x121d8
movq 0xf546(%rip), %rdi      # 0x121e0
movslq 0xf52f(%rip), %rsi      # 0x121d0
shlq $0x3, %rsi
callq 0x2270
movq %rax, %r12
movq %rax, 0xf52c(%rip)      # 0x121e0
movq (%rbx), %rdi
addq $0x2, %rdi
callq 0x2240
movq 0xf511(%rip), %rcx      # 0x121d8
movslq 0xf502(%rip), %rdx      # 0x121d0
movl %eax, -0x4(%rcx,%rdx,4)
movslq %r13d, %rax
movq (%r14,%rax,8), %rdi
callq 0x21c0
movslq 0xf4eb(%rip), %rax      # 0x121d0
movsd %xmm0, -0x8(%r12,%rax,8)
jmp 0x2d79
movl $0x1, 0xf535(%rip)      # 0x12230
movslq %r13d, %rax
movq (%r14,%rax,8), %rdi
callq 0x2240
movl %eax, 0xf537(%rip)      # 0x12244
movl %r13d, %r12d
movq %r15, %rdi
cmpl $0x1, %eax
jg 0x2d7f
jmp 0x2ec0
movslq %r13d, %rax
movq (%r14,%rax,8), %rdi
callq 0x2240
movl %eax, 0xf489(%rip)      # 0x121b8
movl $0x1, 0xf507(%rip)      # 0x12240
jmp 0x2d79
movl $0x1, 0xf4f7(%rip)      # 0x1223c
movslq %r13d, %rax
movq (%r14,%rax,8), %rdi
callq 0x21c0
movsd %xmm0, 0xf48f(%rip)     # 0x121e8
jmp 0x2d79
movslq %r13d, %rax
movq (%r14,%rax,8), %rdi
callq 0x21c0
movsd %xmm0, 0xf459(%rip)     # 0x121c8
movl $0x1, 0xf4bf(%rip)      # 0x12238
movl %r13d, %r12d
movq %r15, %rdi
incl %r12d
cmpl %ebp, %r12d
setl %r13b
jge 0x2e9e
movslq %r12d, %rax
leaq (%r14,%rax,8), %rbx
movq (%rbx), %rax
cmpb $0x2d, (%rax)
movq %rdi, %r15
je 0x2ba3
jmp 0x2da9
xorl %edi, %edi
callq 0xb219
testb %r13b, %r13b
je 0x2ea3
movslq %r12d, %rbx
movq (%r14,%rbx,8), %rsi
movq 0x10(%rsp), %rdi
callq 0x2130
decl %ebp
cmpl %ebp, %ebx
jge 0x2ddf
movq 0x8(%r14,%rbx,8), %rsi
movq 0x8(%rsp), %rdi
callq 0x2130
jmp 0x2e0e
movq (%r14,%rbx,8), %r14
movq %r14, %rdi
movl $0x2f, %esi
callq 0x2160
leaq 0x1(%rax), %rdx
testq %rax, %rax
cmoveq %r14, %rdx
leaq 0xa481(%rip), %rsi      # 0xd283
movq 0x8(%rsp), %rdi
xorl %eax, %eax
callq 0x2080
cmpl $0x0, 0xf41f(%rip)      # 0x12234
je 0x2e4c
cmpl $0x0, 0xf412(%rip)      # 0x12230
jne 0x2e2a
movl $0x5, 0xf41a(%rip)      # 0x12244
cmpl $0x0, 0xf40f(%rip)      # 0x12240
je 0x2e97
movl 0xf37f(%rip), %eax      # 0x121b8
cmpl $0xb, %eax
ja 0x2ec5
movl $0x805, %ecx            # imm = 0x805
btl %eax, %ecx
jae 0x2ec5
movsd 0xf36c(%rip), %xmm0     # 0x121c0
ucomisd 0xa1ac(%rip), %xmm0     # 0xd008
jb 0x2e88
movl 0xf354(%rip), %eax      # 0x121b8
cmpq $0x15, %rax
ja 0x2e88
movl $0x2038ff, %ecx         # imm = 0x2038FF
btl %eax, %ecx
jae 0x2e88
leaq 0xa1d5(%rip), %rcx      # 0xd050
movsd (%rcx,%rax,8), %xmm0
movsd %xmm0, 0xf338(%rip)     # 0x121c0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x23ba
jmp 0x2e4c
callq 0xb219
leaq 0xa46e(%rip), %rdi      # 0xd318
callq 0x2230
movl $0x1, %edi
callq 0x21b0
movl %eax, %edi
callq 0x23e6
callq 0x2358
callq 0x2389