// File: /workspace/github_cpp_makefile_star2_O3/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 0x9259
cmpl $0x1, %ebp
jle 0xab54
callq 0x942b
movq 0x6665(%rip), %rbx      # 0x10fd8
leaq 0x1aff(%rip), %rsi      # 0xc479
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, 0x68ba(%rip)      # 0x11270
jne 0xa9c6
leaq 0x13b5(%rip), %rax      # 0xbd74
movq %rax, 0x68aa(%rip)      # 0x11270
cmpq $0x0, 0x689a(%rip)      # 0x11268
je 0xaa20
cmpb $0x1, 0x68a2(%rip)      # 0x11279
jne 0xaa6a
movq 0x65f4(%rip), %r14      # 0x10fd8
leaq 0x1ada(%rip), %rsi      # 0xc4c5
movl $0x17, %edx
movq %r14, %rdi
callq 0x21f0
movq 0x6869(%rip), %r15      # 0x11268
testq %r15, %r15
je 0xaa3a
movq %r15, %rdi
callq 0x20c0
movq 0x65c5(%rip), %rdi      # 0x10fd8
movq %r15, %rsi
movq %rax, %rdx
callq 0x21f0
jmp 0xaa52
movl $0x42c, %edi            # imm = 0x42C
callq 0x21c0
movq %rax, %r14
movq %rax, %rdi
callq 0x4d28
jmp 0xaaca
movq (%r14), %rax
movq -0x18(%rax), %rax
leaq (%r14,%rax), %rdi
movl 0x20(%r14,%rax), %esi
orl $0x1, %esi
callq 0x2310
movq 0x657f(%rip), %rdi      # 0x10fd8
leaq 0x19e6(%rip), %rsi      # 0xc446
movl $0x4, %edx
callq 0x21f0
movl $0x42c, %edi            # imm = 0x42C
callq 0x21c0
movq %rax, %r14
movq 0x67ea(%rip), %rsi      # 0x11268
movq %rax, %rdi
callq 0x4dfe
cmpb $0x1, 0x67ec(%rip)      # 0x11279
jne 0xaaca
leaq 0x181c(%rip), %rsi      # 0xc2b2
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 0x9504
movq %r14, %rdi
callq 0xa60c
cmpb $0x1, 0x6797(%rip)      # 0x11278
jne 0xaaeb
movq %r14, %rdi
callq 0x99ad
callq 0xa7a1
testq %r14, %r14
je 0xaafd
movq %r14, %rdi
callq 0x4f2a
movl $0x42c, %esi            # imm = 0x42C
movq %r14, %rdi
callq 0x21d0
leaq 0x19e0(%rip), %rsi      # 0xc4f1
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 0x647d(%rip), %rdi      # 0x10fd8
leaq 0x18fe(%rip), %rsi      # 0xc460
callq 0x21b0
movq %rax, %rdi
callq 0x20d0
movq %rax, %rdi
callq 0x20d0
movq (%rbx), %rdi
callq 0x8454
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 0xabbc
movq %rdx, %r12
movq %rax, %r15
cmpl $0x1, %r12d
jne 0xab99
movq %r15, %rdi
callq 0x2230
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x8342
movq %r15, %rdi
callq 0x20b0
movq 0x63f2(%rip), %rdi      # 0x10fd8
leaq 0x18f0(%rip), %rsi      # 0xc4dd
movl $0x13, %edx
callq 0x21f0
movq 0x666a(%rip), %rsi      # 0x11268
movq 0x63d3(%rip), %rdi      # 0x10fd8
callq 0x21b0
movq %rax, %r14
leaq 0x16d6(%rip), %rsi      # 0xc2ea
movl $0x1, %edx
movq %rax, %rdi
callq 0x21f0
movq %r14, %rdi
callq 0x20d0
leaq 0x8(%rsp), %rdi
callq 0x835c
callq 0x2300
xorl %r14d, %r14d
jmp 0xaa86
movq %rax, %r15
leaq 0x8(%rsp), %rdi
callq 0x835c
callq 0x2300
jmp 0xab99
movq %rax, %rdi
callq 0x7088