// File: /workspace/github_cpp_makefile_star2_O2/pranavmodx[P]modlang/main.cpp
// Function: main
int main(int argc, char *argv[])
{
	if (argc < 2) {
		std::cout << "error: file name not specified" << std::endl;
		exit(1);
	}

	std::string filename(argv[1]);
	std::string input = readFile(filename);

	if (input.empty())
		return 0;

	Lexer lexer;
	Parser parser;
	Evaluator evaluator;

	Environment *env = new Environment();

	lexer.New(input);
	parser.New(lexer);

	Program *program = parser.ParseProgram();

	if (!parser.Errors().empty())
	{
		std::cout << "error: " << std::endl;

		for (auto error : parser.Errors())
			std::cout << error << std::endl;

		return 0;
	}

	Object *obj = evaluator.Eval(program, env);
	if (obj->type() != NULL_OBJ)
		std::cout << obj->inspect() << std::endl;

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x220, %rsp            # imm = 0x220
cmpl $0x1, %edi
jle 0x9edc
movq 0x8(%rsi), %rsi
leaq 0x90(%rsp), %rbx
leaq 0xb0(%rsp), %rdx
movq %rbx, %rdi
callq 0x9f7c
leaq 0x40(%rsp), %rdi
movq %rbx, %rsi
callq 0x9b9c
cmpq $0x0, 0x48(%rsp)
je 0x9eb3
leaq 0x70(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0xb0(%rsp), %rdi
callq 0xe0e8
pushq $0x40
popq %rdi
callq 0x51e0
movq %rax, %rbx
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rax)
movaps %xmm0, 0x30(%rax)
addq $0x30, %rax
movq %rax, (%rbx)
movq $0x1, 0x8(%rbx)
movups %xmm0, 0x10(%rbx)
movl $0x3f800000, 0x20(%rbx) # imm = 0x3F800000
movups %xmm0, 0x28(%rbx)
leaq 0x60(%rsp), %rdi
leaq 0x40(%rsp), %rsi
callq 0xae5e
leaq 0xb0(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0xe484
leaq 0xb0(%rsp), %rdi
callq 0xfca6
movq %rax, %r14
leaq 0x8(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x10406
leaq 0x8(%rsp), %rdi
movq (%rdi), %r15
movq 0x8(%rdi), %r12
callq 0xa00a
cmpq %r12, %r15
je 0x9e28
movq 0x21219(%rip), %rdi     # 0x2afc8
leaq 0x1336e(%rip), %rsi     # 0x1d124
callq 0x51d0
movq %rax, %rdi
callq 0x5110
leaq 0x28(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x10406
movq 0x28(%rsp), %rbx
movq 0x30(%rsp), %r12
leaq 0x8(%rsp), %r14
movq 0x211dd(%rip), %r15     # 0x2afc8
cmpq %r12, %rbx
je 0x9e1c
movq %r14, %rdi
movq %rbx, %rsi
callq 0x52a0
movq %r15, %rdi
movq %r14, %rsi
callq 0x51c0
movq %rax, %rdi
callq 0x5110
movq %r14, %rdi
callq 0x53e8
addq $0x20, %rbx
jmp 0x9deb
leaq 0x28(%rsp), %rdi
callq 0xa00a
jmp 0x9e9c
leaq 0x7(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x15dc4
movq %rax, %rbx
movq (%rax), %rax
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq *(%rax)
leaq 0x21ab9(%rip), %rsi     # 0x2b908
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xa02b
movl %eax, %ebp
movq %r14, %rdi
callq 0x53e8
testb %bpl, %bpl
je 0x9e9c
movq (%rbx), %rax
leaq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq *0x8(%rax)
movq 0x21148(%rip), %rdi     # 0x2afc8
leaq 0x8(%rsp), %rsi
callq 0x51c0
movq %rax, %rdi
callq 0x5110
leaq 0x8(%rsp), %rdi
callq 0x53e8
leaq 0xb0(%rsp), %rdi
callq 0xa036
leaq 0x60(%rsp), %rdi
callq 0x53e8
leaq 0x40(%rsp), %rdi
callq 0x53e8
leaq 0x90(%rsp), %rdi
callq 0x53e8
xorl %eax, %eax
addq $0x220, %rsp            # imm = 0x220
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x210e5(%rip), %rdi     # 0x2afc8
leaq 0x1321b(%rip), %rsi     # 0x1d105
callq 0x51d0
movq %rax, %rdi
callq 0x5110
pushq $0x1
popq %rdi
callq 0x5220
jmp 0x9f24
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x53e8
jmp 0x9f45
jmp 0x9f24
jmp 0x9f24
jmp 0x9f24
jmp 0x9f24
movq %rax, %rbx
jmp 0x9f52
movq %rax, %rbx
jmp 0x9f66
jmp 0x9f24
movq %rax, %rbx
jmp 0x9f45
movq %rax, %rbx
jmp 0x9f3b
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x53e8
leaq 0x28(%rsp), %rdi
callq 0xa00a
leaq 0xb0(%rsp), %rdi
callq 0xa036
leaq 0x60(%rsp), %rdi
callq 0x53e8
leaq 0x40(%rsp), %rdi
callq 0x53e8
leaq 0x90(%rsp), %rdi
callq 0x53e8
movq %rbx, %rdi
callq 0x5380
nop