// File: ticky[P]ps2iconsys/src/ps2icon_to_obj.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], "-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) ) {
				ps2_input_file = argv[++i];
			} else if( (strcmp( argv[i], "-o" ) == 0) || (strcmp( argv[i], "--output-file" ) == 0) ) {
				obj_output_file = argv[++i];
			} else if( (strcmp( argv[i], "-ot" ) == 0) || (strcmp( argv[i], "--output-texture" ) == 0) ) {
				texture_output_file = argv[++i];
			} else {
				std::cout << "Invalid argument.\n" << std::endl;
				PrintHelp(argv[0]);
				exit(1);
			}
		} else {
			std::cout << "Invalid argument.\n" << 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 0xf85b
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x23aa(%rip), %rsi      # 0x119df
callq 0x2290
cmpl $0x0, %eax
je 0xf65c
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x2390(%rip), %rsi      # 0x119e2
callq 0x2290
cmpl $0x0, %eax
jne 0xf66f
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0xf330
xorl %edi, %edi
callq 0x2210
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x2367(%rip), %rsi      # 0x119e9
callq 0x2290
cmpl $0x0, %eax
je 0xf6a9
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x234d(%rip), %rsi      # 0x119ec
callq 0x2290
cmpl $0x0, %eax
jne 0xf6b5
movb $0x1, 0x8bd0(%rip)      # 0x18280
jmp 0xf849
movl -0x14(%rbp), %eax
movl -0x4(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jge 0xf80f
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x231d(%rip), %rsi      # 0x119f6
callq 0x2290
cmpl $0x0, %eax
je 0xf700
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x2303(%rip), %rsi      # 0x119f9
callq 0x2290
cmpl $0x0, %eax
jne 0xf720
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, 0x8b4d(%rip)      # 0x18268
jmp 0xf80d
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x22d3(%rip), %rsi      # 0x11a06
callq 0x2290
cmpl $0x0, %eax
je 0xf75a
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x22b9(%rip), %rsi      # 0x11a09
callq 0x2290
cmpl $0x0, %eax
jne 0xf77a
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, 0x8afb(%rip)      # 0x18270
jmp 0xf80b
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x228a(%rip), %rsi      # 0x11a17
callq 0x2290
cmpl $0x0, %eax
je 0xf7b4
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x2271(%rip), %rsi      # 0x11a1b
callq 0x2290
cmpl $0x0, %eax
jne 0xf7d1
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, 0x8aa9(%rip)      # 0x18278
jmp 0xf809
movq 0x8800(%rip), %rdi      # 0x17fd8
leaq 0x224d(%rip), %rsi      # 0x11a2c
callq 0x21b0
movq %rax, %rdi
movq 0x87d2(%rip), %rsi      # 0x17fc0
callq 0x21e0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0xf330
movl $0x1, %edi
callq 0x2210
jmp 0xf80b
jmp 0xf80d
jmp 0xf847
movq 0x87c2(%rip), %rdi      # 0x17fd8
leaq 0x220f(%rip), %rsi      # 0x11a2c
callq 0x21b0
movq %rax, %rdi
movq 0x8794(%rip), %rsi      # 0x17fc0
callq 0x21e0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0xf330
movl $0x1, %edi
callq 0x2210
jmp 0xf849
jmp 0xf84b
jmp 0xf84d
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xf616
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)