// File: ticky[P]ps2iconsys/src/obj_to_ps2icon.cpp
// Function: ParseCommandLine(int, char**)
void ParseCommandLine(int argc, char* argv[])
{
	for(int i=1; i<argc; i++) {
		//Flag parameters:
		if( (strcmp( argv[i], "-h" ) == 0) || (strcmp( argv[i], "--help" ) == 0) ) {
			PrintHelp(argv[0]);
			exit(0);
		} else if( (strcmp( argv[i], "-l" ) == 0) || (strcmp( argv[i], "--list-obj-file" ) == 0) ) {
			list_obj_file = true;
		} else if( (strcmp( argv[i], "-v" ) == 0) || (strcmp( argv[i], "--verbose" ) == 0) ) {
			verbose_output = true;
		} else if(i < argc-1) {
		//Parameters with 1 argument
			if( (strcmp( argv[i], "-f" ) == 0) || (strcmp( argv[i], "--input-file" ) == 0) ) {
				obj_input_file = argv[++i];
			} else if( (strcmp( argv[i], "-t" ) == 0) || (strcmp( argv[i], "--input-texture" ) == 0) ) {
				texture_input_file = argv[++i];
			} else if( (strcmp( argv[i], "-o" ) == 0) || (strcmp( argv[i], "--output-file" ) == 0) ) {
				ps2_output_file = argv[++i];
			} else if( (strcmp( argv[i], "-m" ) == 0) || (strcmp( argv[i], "--mesh-index" ) == 0) ) {
				obj_mesh_index = atoi(argv[++i]);
			} else if( (strcmp( argv[i], "-s" ) == 0) || (strcmp( argv[i], "--scale-factor" ) == 0) ) {
				obj_scale_factor = static_cast<float>(atof(argv[++i]));
			} else {
				std::cout << "Invalid argument." << std::endl << std::endl;
				PrintHelp(argv[0]);
				exit(1);
			}
		} else {
			std::cout << "Invalid argument." << std::endl << std::endl;
			PrintHelp(argv[0]);
			exit(1);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x1, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0xfa97
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x2403(%rip), %rsi      # 0x11b48
callq 0x22b0
cmpl $0x0, %eax
je 0xf76c
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x23e9(%rip), %rsi      # 0x11b4b
callq 0x22b0
cmpl $0x0, %eax
jne 0xf77f
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0xf360
xorl %edi, %edi
callq 0x2220
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x2375(%rip), %rsi      # 0x11b07
callq 0x22b0
cmpl $0x0, %eax
je 0xf7b9
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x23a3(%rip), %rsi      # 0x11b52
callq 0x22b0
cmpl $0x0, %eax
jne 0xf7c5
movb $0x1, 0x8ad9(%rip)      # 0x18299
jmp 0xfa85
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x238a(%rip), %rsi      # 0x11b62
callq 0x22b0
cmpl $0x0, %eax
je 0xf7ff
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x2370(%rip), %rsi      # 0x11b65
callq 0x22b0
cmpl $0x0, %eax
jne 0xf80b
movb $0x1, 0x8a92(%rip)      # 0x18298
jmp 0xfa83
movl -0x14(%rbp), %eax
movl -0x4(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0xfa3a
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x2340(%rip), %rsi      # 0x11b6f
callq 0x22b0
cmpl $0x0, %eax
je 0xf856
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x2326(%rip), %rsi      # 0x11b72
callq 0x22b0
cmpl $0x0, %eax
jne 0xf876
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x8a07(%rip)      # 0x18278
jmp 0xfa38
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x22f6(%rip), %rsi      # 0x11b7f
callq 0x22b0
cmpl $0x0, %eax
je 0xf8b0
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x22dc(%rip), %rsi      # 0x11b82
callq 0x22b0
cmpl $0x0, %eax
jne 0xf8d0
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x89c5(%rip)      # 0x18290
jmp 0xfa36
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x22af(%rip), %rsi      # 0x11b92
callq 0x22b0
cmpl $0x0, %eax
je 0xf90a
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x2295(%rip), %rsi      # 0x11b95
callq 0x22b0
cmpl $0x0, %eax
jne 0xf92a
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x8963(%rip)      # 0x18288
jmp 0xfa34
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x2266(%rip), %rsi      # 0x11ba3
callq 0x22b0
cmpl $0x0, %eax
je 0xf964
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x224c(%rip), %rsi      # 0x11ba6
callq 0x22b0
cmpl $0x0, %eax
jne 0xf988
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2310
movl %eax, 0x88fd(%rip)      # 0x18280
jmp 0xfa32
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x2218(%rip), %rsi      # 0x11bb3
callq 0x22b0
cmpl $0x0, %eax
je 0xf9c2
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x21fe(%rip), %rsi      # 0x11bb6
callq 0x22b0
cmpl $0x0, %eax
jne 0xf9e9
movq -0x10(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x14(%rbp)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2230
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x88b5(%rip)     # 0x1829c
jmp 0xfa30
movq 0x85e8(%rip), %rdi      # 0x17fd8
leaq 0x21ce(%rip), %rsi      # 0x11bc5
callq 0x21c0
movq %rax, %rdi
movq 0x85ba(%rip), %rsi      # 0x17fc0
callq 0x21f0
movq %rax, %rdi
movq 0x85ab(%rip), %rsi      # 0x17fc0
callq 0x21f0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0xf360
movl $0x1, %edi
callq 0x2220
jmp 0xfa32
jmp 0xfa34
jmp 0xfa36
jmp 0xfa38
jmp 0xfa81
movq 0x8597(%rip), %rdi      # 0x17fd8
leaq 0x217d(%rip), %rsi      # 0x11bc5
callq 0x21c0
movq %rax, %rdi
movq 0x8569(%rip), %rsi      # 0x17fc0
callq 0x21f0
movq %rax, %rdi
movq 0x855a(%rip), %rsi      # 0x17fc0
callq 0x21f0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0xf360
movl $0x1, %edi
callq 0x2220
jmp 0xfa83
jmp 0xfa85
jmp 0xfa87
jmp 0xfa89
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xf726
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)