// File: /workspace/github_cpp_makefile_star2_O1/olly-larkin[P]mips-parser/src/main.cpp
// Function: main
int main(int argc, char* argv[]) {

	std::vector< std::vector<std::string> > commVector;
	std::cerr << std::endl;

	if (argc == 1) {
		std::cerr << "------------------------------------- " << std::endl;
		std::cerr << "*********** CONSOLE INPUT *********** " << std::endl;
		std::cerr << "------------------------------------- " << std::endl << std::endl;
		vecParser(std::cin, commVector);
	} else {
		std::string inFileName = argv[1];
		std::ifstream inFile(inFileName);
		if (!inFile.is_open()) {
			std::cerr << "Unable to open file." << std::endl << std::endl;
			std::exit(0);
		}
		vecParser(inFile, commVector);
		inFile.close();
	}

	std::cerr << std::endl << "Commands passed successfully." << std::endl;

	std::string outFileName;
	
	if (argc == 1) {
		std::cerr << "Please enter an output file name: ";
		std::cin >> outFileName;
	} else {
		outFileName = formatName(argv[1]);
		if (argc == 3) {
			std::string str = argv[2];
			if (str.back() == '#') {
				str.pop_back();
				outFileName = str + outFileName;
			} else
				outFileName = argv[2];
		}
	}

	std::ofstream outFile(outFileName, std::ios::binary);
	if (!outFile.is_open()) {
		std::cerr << "Unable to generate output file." << std::endl << std::endl;
		std::exit(5);
	}
	binGen(outFile, commVector);
	outFile.close();

	std::cerr << "Output file generated: " << outFileName << std::endl << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movq %rsi, %rbx
movl %edi, %r14d
xorps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbp)
movq $0x0, -0x50(%rbp)
movq 0xb6d4(%rip), %rdi      # 0xeff0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq 0xb6b9(%rip), %r15      # 0xeff0
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2160
cmpl $0x1, %r14d
jne 0x3a62
movq 0xb698(%rip), %r12      # 0xeff0
leaq 0x76a5(%rip), %rsi      # 0xb004
movl $0x26, %edx
movq %r12, %rdi
callq 0x2250
movq (%r12), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq 0xb665(%rip), %rdi      # 0xeff0
callq 0x2030
movq %rax, %rdi
callq 0x2160
movq 0xb651(%rip), %r12      # 0xeff0
leaq 0x7685(%rip), %rsi      # 0xb02b
movl $0x26, %edx
movq %r12, %rdi
callq 0x2250
movq (%r12), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq 0xb61e(%rip), %rdi      # 0xeff0
callq 0x2030
movq %rax, %rdi
callq 0x2160
movq 0xb60a(%rip), %r12      # 0xeff0
leaq 0x7617(%rip), %rsi      # 0xb004
movl $0x26, %edx
movq %r12, %rdi
callq 0x2250
movq (%r12), %rax
addq -0x18(%rax), %r12
movq %r12, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq 0xb5d7(%rip), %rdi      # 0xeff0
callq 0x2030
movq %rax, %rdi
callq 0x2160
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2160
movq 0xb581(%rip), %rdi      # 0xefd8
leaq -0x60(%rbp), %rsi
callq 0x41fa
jmp 0x3ad9
movq 0x8(%rbx), %rsi
leaq -0x48(%rbp), %rdi
leaq -0x2a8(%rbp), %rdx
callq 0x2100
leaq -0x2a8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
movl $0x8, %edx
callq 0x2340
leaq -0x230(%rbp), %rdi
callq 0x2090
testb %al, %al
je 0x3df8
leaq -0x2a8(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x41fa
leaq -0x2a8(%rbp), %rdi
callq 0x2080
leaq -0x2a8(%rbp), %rdi
callq 0x20a0
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3ad9
callq 0x21f0
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq 0xb4f9(%rip), %rdi      # 0xeff0
callq 0x2030
movq %rax, %rdi
callq 0x2160
movq %rax, %r15
leaq 0x7559(%rip), %rsi      # 0xb067
movl $0x1d, %edx
movq %rax, %rdi
callq 0x2250
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2160
leaq -0x38(%rbp), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
cmpl $0x1, %r14d
jne 0x3b8c
movq 0xb48a(%rip), %rdi      # 0xeff0
leaq 0x7518(%rip), %rsi      # 0xb085
movl $0x22, %edx
callq 0x2250
movq 0xb45a(%rip), %rdi      # 0xefd8
leaq -0x48(%rbp), %rsi
callq 0x22a0
jmp 0x3c9c
movq 0x8(%rbx), %rsi
leaq -0xa0(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0x2100
leaq -0x2a8(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x3ebb
leaq -0x48(%rbp), %rdi
leaq -0x2a8(%rbp), %r15
movq %r15, %rsi
callq 0x2290
movq (%r15), %rdi
leaq -0x298(%rbp), %r13
cmpq %r13, %rdi
je 0x3bda
callq 0x21f0
leaq -0x90(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3bef
callq 0x21f0
cmpl $0x3, %r14d
jne 0x3c9c
movq 0x10(%rbx), %rsi
leaq -0x2a8(%rbp), %rdi
leaq -0x80(%rbp), %rdx
callq 0x2100
movq -0x2a8(%rbp), %rax
movq -0x2a0(%rbp), %rcx
cmpb $0x23, -0x1(%rax,%rcx)
jne 0x3c64
leaq -0x2a8(%rbp), %rbx
movq %rbx, %rdi
callq 0x2280
leaq -0x80(%rbp), %rdi
leaq -0x48(%rbp), %rdx
movq %rbx, %rsi
callq 0x3fc9
leaq -0x48(%rbp), %rdi
leaq -0x80(%rbp), %rbx
movq %rbx, %rsi
callq 0x2290
movq (%rbx), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x3c8b
callq 0x21f0
jmp 0x3c8b
movq 0x10(%rbx), %rbx
leaq -0x48(%rbp), %r14
movq 0x8(%r14), %r15
movq %rbx, %rdi
callq 0x2120
movq %r14, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %rbx, %rcx
movq %rax, %r8
callq 0x2320
movq -0x2a8(%rbp), %rdi
cmpq %r13, %rdi
je 0x3c9c
callq 0x21f0
leaq -0x2a8(%rbp), %rdi
leaq -0x48(%rbp), %rsi
movl $0x4, %edx
callq 0x23c0
leaq -0x238(%rbp), %rdi
callq 0x2090
testb %al, %al
je 0x3dc2
leaq -0x2a8(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x4cf5
leaq -0x2a8(%rbp), %rdi
callq 0x22d0
movq 0xb308(%rip), %rdi      # 0xeff0
leaq 0x73d9(%rip), %rsi      # 0xb0c8
movl $0x17, %edx
callq 0x2250
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq 0xb2e8(%rip), %rdi      # 0xeff0
callq 0x2250
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2160
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2200
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2160
movq 0xb260(%rip), %rax      # 0xefc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x2a0(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x2a8(%rbp,%rcx)
callq 0x21b0
leaq -0x1b0(%rbp), %rdi
callq 0x20e0
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x3da5
callq 0x21f0
leaq -0x60(%rbp), %rdi
callq 0x4028
xorl %eax, %eax
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xb227(%rip), %rdi      # 0xeff0
leaq 0x72d8(%rip), %rsi      # 0xb0a8
movl $0x1f, %edx
callq 0x2250
movq 0xb20f(%rip), %rdi      # 0xeff0
callq 0x2130
movq %rax, %rdi
callq 0x2130
movl $0x5, %edi
callq 0x2270
movq 0xb1f1(%rip), %rdi      # 0xeff0
leaq 0x724c(%rip), %rsi      # 0xb052
movl $0x14, %edx
callq 0x2250
movq 0xb1d9(%rip), %rdi      # 0xeff0
callq 0x2130
movq %rax, %rdi
callq 0x2130
xorl %edi, %edi
callq 0x2270
jmp 0x3e2d
movq %rax, %rbx
movq -0x2a8(%rbp), %rdi
cmpq %r13, %rdi
jne 0x3e53
jmp 0x3e97
jmp 0x3e65
movq %rax, %rbx
leaq -0x90(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3e97
callq 0x21f0
jmp 0x3e97
jmp 0x3e65
movq %rax, %rbx
jmp 0x3e79
jmp 0x3ea7
jmp 0x3e65
movq %rax, %rbx
jmp 0x3e97
movq %rax, %rbx
leaq -0x2a8(%rbp), %rdi
callq 0x20a0
leaq -0x38(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x3ea0
jmp 0x3eaa
movq %rax, %rbx
leaq -0x2a8(%rbp), %rdi
callq 0x2300
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x3eaa
callq 0x21f0
jmp 0x3eaa
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x4028
movq %rbx, %rdi
callq 0x2370