// File: /workspace/github_cpp_makefile_star2_O2/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 %rbx
subq $0x288, %rsp            # imm = 0x288
movq %rsi, %rbx
movl %edi, %r14d
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
andq $0x0, -0x40(%rbp)
movq 0xa5eb(%rip), %rdi      # 0xdff0
callq 0x2130
cmpl $0x1, %r14d
jne 0x3a7b
movq 0xa5d9(%rip), %rdi      # 0xdff0
leaq 0x55e6(%rip), %rsi      # 0x9004
callq 0x21c0
movq %rax, %rdi
callq 0x2130
movq 0xa5be(%rip), %rdi      # 0xdff0
leaq 0x55f2(%rip), %rsi      # 0x902b
callq 0x21c0
movq %rax, %rdi
callq 0x2130
movq 0xa5a3(%rip), %rdi      # 0xdff0
leaq 0x55b0(%rip), %rsi      # 0x9004
callq 0x21c0
movq %rax, %rdi
callq 0x2130
movq %rax, %rdi
callq 0x2130
movq 0xa568(%rip), %rdi      # 0xdfd8
leaq -0x50(%rbp), %rsi
callq 0x3f91
jmp 0x3ae7
movq 0x8(%rbx), %rsi
leaq -0x38(%rbp), %rdi
leaq -0x298(%rbp), %rdx
callq 0x20f0
leaq -0x298(%rbp), %rdi
leaq -0x38(%rbp), %rsi
pushq $0x8
popq %rdx
callq 0x2300
leaq -0x220(%rbp), %rdi
callq 0x2090
testb %al, %al
je 0x3cde
leaq -0x298(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x3f91
leaq -0x298(%rbp), %rdi
callq 0x2080
leaq -0x298(%rbp), %rdi
callq 0x20b0
leaq -0x38(%rbp), %rdi
callq 0x2120
movq 0xa502(%rip), %rdi      # 0xdff0
callq 0x2130
leaq 0x556d(%rip), %rsi      # 0x9067
movq %rax, %rdi
callq 0x21c0
movq %rax, %rdi
callq 0x2130
leaq -0x28(%rbp), %rax
andq $0x0, -0x8(%rax)
movq %rax, -0x10(%rax)
movb $0x0, (%rax)
cmpl $0x1, %r14d
jne 0x3b48
movq 0xa4c9(%rip), %rdi      # 0xdff0
leaq 0x5557(%rip), %rsi      # 0x9085
callq 0x21c0
movq 0xa49e(%rip), %rdi      # 0xdfd8
leaq -0x38(%rbp), %rsi
callq 0x2250
jmp 0x3c17
movq 0x8(%rbx), %rsi
leaq -0x90(%rbp), %rdi
leaq -0x70(%rbp), %rdx
callq 0x20f0
leaq -0x298(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x3d75
leaq -0x38(%rbp), %rdi
leaq -0x298(%rbp), %r15
movq %r15, %rsi
callq 0x2240
movq %r15, %rdi
callq 0x2120
leaq -0x90(%rbp), %rdi
callq 0x2120
cmpl $0x3, %r14d
jne 0x3c17
movq 0x10(%rbx), %rsi
leaq -0x298(%rbp), %rdi
leaq -0x70(%rbp), %rdx
callq 0x20f0
movq -0x298(%rbp), %rax
movq -0x290(%rbp), %rcx
cmpb $0x23, -0x1(%rax,%rcx)
jne 0x3bfe
leaq -0x298(%rbp), %rbx
movq %rbx, %rdi
callq 0x2230
leaq -0x70(%rbp), %rdi
leaq -0x38(%rbp), %rdx
movq %rbx, %rsi
callq 0x3e1f
leaq -0x38(%rbp), %rdi
leaq -0x70(%rbp), %rbx
movq %rbx, %rsi
callq 0x2240
movq %rbx, %rdi
callq 0x2120
jmp 0x3c0b
movq 0x10(%rbx), %rsi
leaq -0x38(%rbp), %rdi
callq 0x2350
leaq -0x298(%rbp), %rdi
callq 0x2120
leaq -0x298(%rbp), %rdi
leaq -0x38(%rbp), %rsi
pushq $0x4
popq %rdx
callq 0x2360
leaq -0x228(%rbp), %rdi
callq 0x2090
testb %al, %al
je 0x3cb3
leaq -0x298(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x46cc
leaq -0x298(%rbp), %rdi
callq 0x2290
movq 0xa393(%rip), %rdi      # 0xdff0
leaq 0x5464(%rip), %rsi      # 0x90c8
callq 0x21c0
leaq -0x38(%rbp), %rsi
movq %rax, %rdi
callq 0x21a0
movq %rax, %rdi
callq 0x2130
movq %rax, %rdi
callq 0x2130
leaq -0x298(%rbp), %rdi
callq 0x22c0
leaq -0x38(%rbp), %rdi
callq 0x2120
leaq -0x50(%rbp), %rdi
callq 0x3e58
xorl %eax, %eax
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0xa336(%rip), %rdi      # 0xdff0
leaq 0x53e7(%rip), %rsi      # 0x90a8
callq 0x21c0
movq %rax, %rdi
callq 0x2130
movq %rax, %rdi
callq 0x2130
pushq $0x5
popq %rdi
callq 0x2220
movq 0xa30b(%rip), %rdi      # 0xdff0
leaq 0x5366(%rip), %rsi      # 0x9052
callq 0x21c0
movq %rax, %rdi
callq 0x2130
movq %rax, %rdi
callq 0x2130
xorl %edi, %edi
callq 0x2220
jmp 0x3d0a
movq %rax, %rbx
leaq -0x298(%rbp), %rdi
jmp 0x3d22
jmp 0x3d31
movq %rax, %rbx
leaq -0x90(%rbp), %rdi
callq 0x2120
jmp 0x3d56
jmp 0x3d31
jmp 0x3d31
jmp 0x3d61
jmp 0x3d31
movq %rax, %rbx
jmp 0x3d56
movq %rax, %rbx
leaq -0x298(%rbp), %rdi
callq 0x20b0
jmp 0x3d56
movq %rax, %rbx
leaq -0x298(%rbp), %rdi
callq 0x22c0
leaq -0x38(%rbp), %rdi
callq 0x2120
jmp 0x3d64
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x3e58
movq %rbx, %rdi
callq 0x2330