// File: /workspace/github_cpp_makefile_star2_O2/ticky[P]ps2iconsys/src/iconsys_builder.cpp
// Function: main
int main(int argc, char* argv[])
{
	ParseCommandLine(argc, argv);

	if(argc < 2) {
		std::cout << "No parameters specified." << std::endl << std::endl;
		PrintHelp(argv[0]);
		exit(1);
	}

	CheckParameters();

	std::cout << "PS2 Icon.Sys Builder  V-1.0\n by Ghulbus Inc.  (http://www.ghulbus-inc.de/)\n" << std::endl;

	if(!output_file) {
		output_file = "icon.sys";
	}

	IconSys* icon_sys = NULL;

	if(input_file) {
		if(verbose_output)
			std::cout << " * Reading input file \"" << input_file << "\"...";
		try {
			icon_sys = new IconSys(input_file);
		} catch(Ghulbus::gbException e) {
			std::cout << "\nFile read error: \"" << input_file << "\"" << std::endl;
		}
		if(verbose_output)
			std::cout << "done." << std::endl;
	} else {
		icon_sys = new IconSys();
	}

	ProcessParameters(icon_sys);

	WriteOutput(icon_sys);

	if(list_file) {
		ListFile(icon_sys);
	}

	Cleanup();	
	delete icon_sys;

	std::cout << "Success :)" << std::endl;

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movl %edi, %ebp
callq 0x816e
cmpl $0x1, %ebp
jle 0x9585
callq 0x82fc
movq 0x6b82(%rip), %rdi      # 0xffd8
leaq 0x200c(%rip), %rsi      # 0xb469
callq 0x2190
movq %rax, %rdi
callq 0x20d0
cmpq $0x0, 0x6de6(%rip)      # 0x10258
jne 0x9482
leaq 0x18e9(%rip), %rax      # 0xad64
movq %rax, 0x6dd6(%rip)      # 0x10258
cmpq $0x0, 0x6dc6(%rip)      # 0x10250
je 0x9508
cmpb $0x1, 0x6dce(%rip)      # 0x10261
jne 0x94c6
movq 0x6b3c(%rip), %rdi      # 0xffd8
leaq 0x2012(%rip), %rsi      # 0xb4b5
callq 0x2190
movq 0x6da1(%rip), %rsi      # 0x10250
movq %rax, %rdi
callq 0x2190
leaq 0x1f78(%rip), %rsi      # 0xb436
movq %rax, %rdi
callq 0x2190
movl $0x42c, %edi            # imm = 0x42C
callq 0x21a0
movq %rax, %rbx
movq 0x6d76(%rip), %rsi      # 0x10250
movq %rax, %rdi
callq 0x4482
cmpb $0x1, 0x6d78(%rip)      # 0x10261
jne 0x951d
movq 0x6ae6(%rip), %rdi      # 0xffd8
leaq 0x1da9(%rip), %rsi      # 0xb2a2
callq 0x2190
movq %rax, %rdi
callq 0x20d0
jmp 0x951d
movl $0x42c, %edi            # imm = 0x42C
callq 0x21a0
movq %rax, %rbx
movq %rax, %rdi
callq 0x43ac
movq %rbx, %rdi
callq 0x83d3
movq %rbx, %rdi
callq 0x91a4
cmpb $0x1, 0x6d2c(%rip)      # 0x10260
jne 0x953e
movq %rbx, %rdi
callq 0x887f
callq 0x92b3
testq %rbx, %rbx
je 0x9550
movq %rbx, %rdi
callq 0x45a6
movl $0x42c, %esi            # imm = 0x42C
movq %rbx, %rdi
callq 0x21b0
movq 0x6a74(%rip), %rdi      # 0xffd8
leaq 0x1f76(%rip), %rsi      # 0xb4e1
callq 0x2190
movq %rax, %rdi
callq 0x20d0
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x6a4c(%rip), %rdi      # 0xffd8
leaq 0x1ebd(%rip), %rsi      # 0xb450
callq 0x2190
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x20d0
movq (%rbx), %rdi
callq 0x7718
pushq $0x1
popq %rdi
callq 0x21f0
movq %rax, %r14
movl $0x42c, %esi            # imm = 0x42C
movq %rbx, %rdi
callq 0x21b0
movq %r14, %rdi
callq 0x2330
movq %rdx, %r15
movq %rax, %r14
movl $0x42c, %esi            # imm = 0x42C
movq %rbx, %rdi
callq 0x21b0
jmp 0x95eb
movq %rdx, %r15
movq %rax, %r14
cmpl $0x1, %r15d
jne 0x95c8
movq %r14, %rdi
callq 0x2210
movq %rsp, %rdi
movq %rax, %rsi
callq 0x764a
movq %r14, %rdi
callq 0x20a0
movq 0x69c5(%rip), %rdi      # 0xffd8
leaq 0x1eb3(%rip), %rsi      # 0xb4cd
callq 0x2190
movq 0x6c2a(%rip), %rsi      # 0x10250
movq %rax, %rdi
callq 0x2190
leaq 0x1ca5(%rip), %rsi      # 0xb2da
movq %rax, %rdi
callq 0x2190
movq %rax, %rdi
callq 0x20d0
movq %rsp, %rdi
callq 0x7664
callq 0x22f0
xorl %ebx, %ebx
jmp 0x94e2
movq %rax, %r14
movq %rsp, %rdi
callq 0x7664
callq 0x22f0
jmp 0x95c8
movq %rax, %rdi
callq 0x399a