// File: /workspace/github_cpp_makefile_star2_O1/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 %r12
pushq %rbx
subq $0x20, %rsp
movq %rsi, %rbx
movl %edi, %ebp
callq 0x950d
cmpl $0x1, %ebp
jle 0xae27
callq 0x96a0
movq 0x7392(%rip), %rbx      # 0x11fd8
leaq 0x27d8(%rip), %rsi      # 0xd425
movl $0x4b, %edx
movq %rbx, %rdi
callq 0x21f0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2120
cmpq $0x0, 0x75e7(%rip)      # 0x12270
jne 0xac99
leaq 0x2082(%rip), %rax      # 0xcd14
movq %rax, 0x75d7(%rip)      # 0x12270
cmpq $0x0, 0x75c7(%rip)      # 0x12268
je 0xacf3
cmpb $0x1, 0x75cf(%rip)      # 0x12279
jne 0xad3d
movq 0x7321(%rip), %r14      # 0x11fd8
leaq 0x27b3(%rip), %rsi      # 0xd471
movl $0x17, %edx
movq %r14, %rdi
callq 0x21f0
movq 0x7596(%rip), %r15      # 0x12268
testq %r15, %r15
je 0xad0d
movq %r15, %rdi
callq 0x20c0
movq 0x72f2(%rip), %rdi      # 0x11fd8
movq %r15, %rsi
movq %rax, %rdx
callq 0x21f0
jmp 0xad25
movl $0x42c, %edi            # imm = 0x42C
callq 0x21c0
movq %rax, %r14
movq %rax, %rdi
callq 0x4cd2
jmp 0xad9d
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x2310
movq 0x72ac(%rip), %rdi      # 0x11fd8
leaq 0x26bf(%rip), %rsi      # 0xd3f2
movl $0x4, %edx
callq 0x21f0
movl $0x42c, %edi            # imm = 0x42C
callq 0x21c0
movq %rax, %r14
movq 0x7517(%rip), %rsi      # 0x12268
movq %rax, %rdi
callq 0x4da8
cmpb $0x1, 0x7519(%rip)      # 0x12279
jne 0xad9d
leaq 0x24f5(%rip), %rsi      # 0xd25e
movl $0x5, %edx
movq %rbx, %rdi
callq 0x21f0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2120
movq %r14, %rdi
callq 0x9779
movq %r14, %rdi
callq 0xa8df
cmpb $0x1, 0x74c4(%rip)      # 0x12278
jne 0xadbe
movq %r14, %rdi
callq 0x9c72
callq 0xaa74
testq %r14, %r14
je 0xaddd
movq %r14, %rdi
callq 0x4ed4
movl $0x42c, %esi            # imm = 0x42C
movq %r14, %rdi
callq 0x21d0
leaq 0x26b9(%rip), %rsi      # 0xd49d
movl $0xa, %edx
movq %rbx, %rdi
callq 0x21f0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2190
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2120
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x71aa(%rip), %rdi      # 0x11fd8
leaq 0x25d7(%rip), %rsi      # 0xd40c
callq 0x21b0
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x20d0
movq (%rbx), %rdi
callq 0x871c
movl $0x1, %edi
callq 0x2210
movq %rax, %r15
movl $0x42c, %esi            # imm = 0x42C
movq %r14, %rdi
callq 0x21d0
movq %r15, %rdi
callq 0x2350
movq %rdx, %r12
movq %rax, %r15
movl $0x42c, %esi            # imm = 0x42C
movq %r14, %rdi
callq 0x21d0
jmp 0xae8f
movq %rdx, %r12
movq %rax, %r15
cmpl $0x1, %r12d
jne 0xae6c
movq %r15, %rdi
callq 0x2230
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x860a
movq %r15, %rdi
callq 0x20b0
movq 0x711f(%rip), %rdi      # 0x11fd8
leaq 0x25c9(%rip), %rsi      # 0xd489
movl $0x13, %edx
callq 0x21f0
movq 0x7397(%rip), %rsi      # 0x12268
movq 0x7100(%rip), %rdi      # 0x11fd8
callq 0x21b0
movq %rax, %r14
leaq 0x23af(%rip), %rsi      # 0xd296
movl $0x1, %edx
movq %rax, %rdi
callq 0x21f0
movq %r14, %rdi
callq 0x20d0
leaq 0x8(%rsp), %rdi
callq 0x8624
callq 0x2300
xorl %r14d, %r14d
jmp 0xad59
movq %rax, %r15
leaq 0x8(%rsp), %rdi
callq 0x8624
callq 0x2300
jmp 0xae6c
movq %rax, %rdi
callq 0x7292