// File: qmmlib[P]QmmLibrary/predict.c
// Function: main
int main(int argc, char **argv)
{
	FILE *input, *output;
	int i;

	// parse options
	for(i=1;i<argc;i++)
	{
		if(argv[i][0] != '-') break;
		++i;
		switch(argv[i-1][1])
		{
			case 'b':
				flag_predict_probability = atoi(argv[i]);
				break;

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

	input = fopen(argv[i],"r");
	if(input == NULL)
	{
		fprintf(stderr,"can't open input file %s\n",argv[i]);
		exit(1);
	}

	output = fopen(argv[i+2],"w");
	if(output == NULL)
	{
		fprintf(stderr,"can't open output file %s\n",argv[i+2]);
		exit(1);
	}

	if((model_=load_model(argv[i+1]))==0)
	{
		fprintf(stderr,"can't open model file %s\n",argv[i+1]);
		exit(1);
	}

	x = (struct feature_node *) malloc(max_nr_attr*sizeof(struct feature_node));
	do_predict(input, output);
	free_and_destroy_model(&model_);
	free(line);
	free(x);
	fclose(input);
	fclose(output);
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x1, -0x24(%rbp)
movl -0x24(%rbp), %eax
cmpl -0x8(%rbp), %eax
jge 0x3fab
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x3f2f
jmp 0x3fab
movl -0x24(%rbp), %eax
incl %eax
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
decl %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movb 0x1(%rax), %al
subb $0x62, %al
jne 0x3f69
jmp 0x3f50
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x33f0
movl %eax, 0x23529(%rip)     # 0x27490
jmp 0x3f9b
movq 0x23068(%rip), %rax     # 0x26fd8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movsbl 0x1(%rax), %edx
leaq 0x1e22e(%rip), %rsi     # 0x221bd
movb $0x0, %al
callq 0x33c0
callq 0x3ed0
jmp 0x3f9d
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x3f0d
movl -0x24(%rbp), %eax
cmpl -0x8(%rbp), %eax
jl 0x3fb8
callq 0x3ed0
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x1e207(%rip), %rsi     # 0x221d2
callq 0x3320
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x4009
movq 0x22ff6(%rip), %rax     # 0x26fd8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x1e1dc(%rip), %rsi     # 0x221d4
movb $0x0, %al
callq 0x33c0
movl $0x1, %edi
callq 0x3340
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x1e1cd(%rip), %rsi     # 0x221ee
callq 0x3320
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x4064
movq 0x22fa0(%rip), %rax     # 0x26fd8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x1e19d(%rip), %rsi     # 0x221f0
movb $0x0, %al
callq 0x33c0
movl $0x1, %edi
callq 0x3340
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0xd6e0
movq %rax, 0x23407(%rip)     # 0x27488
cmpq $0x0, %rax
jne 0x40ba
movq 0x22f4a(%rip), %rax     # 0x26fd8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x1e162(%rip), %rsi     # 0x2220b
movb $0x0, %al
callq 0x33c0
movl $0x1, %edi
callq 0x3340
movslq 0x231cf(%rip), %rdi     # 0x27290
shlq $0x4, %rdi
callq 0x3390
movq %rax, 0x233af(%rip)     # 0x27480
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x3670
leaq 0x233a3(%rip), %rdi     # 0x27488
callq 0xcd00
movq 0x233a7(%rip), %rdi     # 0x27498
callq 0x3330
movq 0x23383(%rip), %rdi     # 0x27480
callq 0x3330
movq -0x18(%rbp), %rdi
callq 0x3270
movq -0x20(%rbp), %rdi
callq 0x3270
xorl %eax, %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)