// File: /workspace/github_cpp_makefile_star2_O2/iamlouk[P]asbi/src/main.cc
// Function: main
int main(int argc, const char *argv[]) {
	if (argc <= 1) {
		usage(argv[0]);
		exit(EXIT_FAILURE);
	}

	Context ctx;
	ctx.global_env->decl(ctx.names.__imports, Value::map(new MapContainer(&ctx)));

	for (int i = 1; i < argc; i++) {
		auto arg = argv[i];
		if (strcmp(arg, "--repl") == 0) {
			load_procenv(&ctx, argc, argv, i + 1);
			repl(ctx);
			break;
		} else if (strcmp(arg, "--eval") == 0 && i + 1 < argc) {
			std::string str = argv[++i];
			std::cout << ctx.run(str).to_string(true) << '\n';
		} else if (strcmp(arg, "--help") == 0) {
			usage(argv[0]);
#ifndef NDEBUG
		} else if (strcmp(arg, "--test") == 0) {
			tests::run();
#endif
		} else if (arg[0] != '-') {
			auto filepath = std::string(arg);
			filepath = utils::normalize(filepath);

			load_procenv(&ctx, argc, argv, i + 1);
			ctx.global_env->decl(ctx.names.__file, Value::string(filepath.c_str(), &ctx));
			ctx.global_env->decl(ctx.names.__main, Value::string(filepath.c_str(), &ctx));

			std::string content;
			utils::readfile(filepath, content);
			ctx.run(content);
			ctx.evtloop.start();
			break;
		} else {
			usage(argv[0]);
			exit(EXIT_FAILURE);
		}
	}

	return EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x6c8, %rsp            # imm = 0x6C8
movq %rsi, %rbx
cmpl $0x1, %edi
jle 0x5fa9
movl %edi, %ebp
leaq 0x160(%rsp), %r14
movq %r14, %rdi
callq 0xee50
movq 0x4f8(%r14), %r15
movq 0x548(%r14), %r12
pushq $0x68
popq %rdi
callq 0x5390
movq %rax, %r14
leaq 0x160(%rsp), %rsi
movq %rax, %rdi
callq 0xd80c
pushq $0x6
popq %rdx
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rcx
callq 0xed22
pushq $0x1
popq %rax
leaq 0xe4d5(%rip), %r12      # 0x14004
movl %eax, %r15d
cmpl %ebp, %r15d
jge 0x5f88
movslq %r15d, %rax
movq (%rbx,%rax,8), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x54e0
testl %eax, %eax
je 0x5c26
movq %r14, %rdi
leaq 0xe4ac(%rip), %rsi      # 0x1400b
callq 0x54e0
testl %eax, %eax
jne 0x5be5
leal 0x1(%r15), %r13d
cmpl %ebp, %r13d
jge 0x5be5
movslq %r13d, %rax
movq (%rbx,%rax,8), %rsi
leaq 0x60(%rsp), %r14
movq %r14, %rdi
leaq 0x20(%rsp), %r15
movq %r15, %rdx
callq 0x60ee
leaq 0x160(%rsp), %rdi
movq %r14, %rsi
callq 0xf1f6
movl %eax, 0x10(%rsp)
movq %rdx, 0x18(%rsp)
movq %r15, %rdi
leaq 0x10(%rsp), %rsi
pushq $0x1
popq %rdx
callq 0xde68
movq 0x1a3fb(%rip), %rdi     # 0x1ffb8
movq %r15, %rsi
callq 0x5320
movq %rax, %rdi
pushq $0xa
popq %rsi
callq 0x5400
movq %r15, %rdi
callq 0x5170
movq %r14, %rdi
callq 0x5170
movl %r13d, %r15d
jmp 0x5c1e
movq %r14, %rdi
leaq 0xe423(%rip), %rsi      # 0x14012
callq 0x54e0
testl %eax, %eax
je 0x5c16
movq %r14, %rdi
leaq 0xe417(%rip), %rsi      # 0x14019
callq 0x54e0
testl %eax, %eax
jne 0x5e78
callq 0x138db
jmp 0x5c1e
movq (%rbx), %rdi
callq 0x604b
incl %r15d
jmp 0x5b32
incl %r15d
leaq 0x160(%rsp), %rdi
movl %ebp, %esi
movq %rbx, %rdx
movl %r15d, %ecx
callq 0x112bc
leaq 0xe4ef(%rip), %rdi      # 0x14134
leaq 0x160(%rsp), %rbx
movq %rbx, %rsi
callq 0xdae0
movl %eax, %ebp
movq %rdx, %r14
movq 0x658(%rsp), %rdi
movq 0x698(%rsp), %rsi
movl %eax, %edx
movq %r14, %rcx
callq 0xed22
movq 0x658(%rsp), %rdi
movq 0x6a0(%rsp), %rsi
movl %ebp, %edx
movq %r14, %rcx
callq 0xed22
leaq 0x60(%rsp), %rsi
movq %rbx, (%rsi)
leaq 0x10(%rsp), %rdi
leaq 0x658(%rsp), %rdx
callq 0x6129
leaq 0xe506(%rip), %r15      # 0x141b5
leaq 0x60(%rsp), %r12
leaq 0x20(%rsp), %r13
leaq 0x40(%rsp), %rbx
xorl %edi, %edi
xorl %esi, %esi
callq 0x51d0
movq %rax, %r14
movl $0xff, %esi
movq %r12, %rdi
leaq 0xe4af(%rip), %rdx      # 0x14188
movq %r15, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x5590
movq %r14, %rdi
callq 0x5410
movq %r12, %rdi
callq 0x5340
movq %rax, %rbp
testq %rax, %rax
je 0x5e69
cmpb $0x0, (%rbp)
je 0x5da0
movq %r13, %rdi
movq %rbp, %rsi
leaq 0xf(%rsp), %rdx
callq 0x60ee
movq %rbx, %rdi
leaq 0x10(%rsp), %rsi
callq 0x6356
leaq 0x160(%rsp), %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0xf262
movl %eax, 0x50(%rsp)
movq %rdx, 0x58(%rsp)
leaq 0x48(%rsp), %rdi
callq 0x638a
movq %r13, %rdi
callq 0x5170
movq 0x1a25a(%rip), %rdi     # 0x1ffb8
leaq 0xe3d1(%rip), %rsi      # 0x14136
callq 0x5380
movq %rax, %r14
movq %r13, %rdi
leaq 0x50(%rsp), %rsi
pushq $0x1
popq %rdx
callq 0xde68
movq %r14, %rdi
movq %r13, %rsi
callq 0x5320
movq %rax, %rdi
callq 0x51a0
movq %r13, %rdi
callq 0x5170
movq %rbp, %rdi
callq 0x5490
movq %rbp, %rdi
callq 0x5410
jmp 0x5cbe
jmp 0x5dd5
movq %rdx, %r14
movq %rax, (%rsp)
leaq 0x48(%rsp), %rdi
callq 0x638a
jmp 0x5dcb
jmp 0x5dd5
movq %rdx, %r14
movq %rax, (%rsp)
movq %r13, %rdi
callq 0x5170
jmp 0x5ddc
movq %rdx, %r14
movq %rax, (%rsp)
cmpl $0x1, %r14d
jne 0x602b
movq (%rsp), %r14
movq %r14, %rdi
callq 0x5460
movq %r13, %rdi
movq %rax, %rsi
callq 0x5140
movq %r14, %rdi
callq 0x5130
movq 0x1a1dc(%rip), %rdi     # 0x1ffe8
leaq 0xe332(%rip), %rsi      # 0x14145
callq 0x5380
movq %rax, %r14
movq %r13, %rdi
callq 0x54c0
movq %r14, %rdi
movq %rax, %rsi
callq 0x5380
movq %rax, %rdi
pushq $0x20
popq %rsi
callq 0x5400
movq 0x1a1a8(%rip), %rdi     # 0x1ffe8
leaq 0xe311(%rip), %rsi      # 0x14158
callq 0x5380
movq %rax, %rdi
pushq $0xa
popq %rsi
callq 0x5400
movq %r13, %rdi
callq 0x5688
callq 0x55c0
jmp 0x5da0
leaq 0x18(%rsp), %rdi
callq 0x638a
jmp 0x5f88
cmpb $0x2d, (%r14)
je 0x5fb9
leaq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %rdx
movq %r14, %rsi
callq 0x60ee
leaq 0x20(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0xa179
leaq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %r14
movq %r14, %rsi
callq 0x5440
movq %r14, %rdi
callq 0x5170
incl %r15d
leaq 0x160(%rsp), %rdi
movl %ebp, %esi
movq %rbx, %rdx
movl %r15d, %ecx
callq 0x112bc
leaq 0x160(%rsp), %rsi
movq 0x4f8(%rsi), %rbx
movq 0x538(%rsi), %r14
movq 0x60(%rsp), %rdi
callq 0xdae0
movq %rdx, %rcx
movq %rbx, %rdi
movq %r14, %rsi
movl %eax, %edx
callq 0xed22
leaq 0x160(%rsp), %rsi
movq 0x4f8(%rsi), %rbx
movq 0x540(%rsi), %r14
movq 0x60(%rsp), %rdi
callq 0xdae0
movq %rdx, %rcx
movq %rbx, %rdi
movq %r14, %rsi
movl %eax, %edx
callq 0xed22
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0xa1fb
leaq 0x160(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0xf1f6
leaq 0x478(%rsp), %rdi
callq 0x12270
leaq 0x20(%rsp), %rdi
callq 0x5170
leaq 0x60(%rsp), %rdi
callq 0x5170
leaq 0x160(%rsp), %rdi
callq 0xf048
xorl %eax, %eax
addq $0x6c8, %rsp            # imm = 0x6C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rdi
callq 0x604b
pushq $0x1
popq %rdi
callq 0x5420
movq (%rbx), %rdi
callq 0x604b
jmp 0x5fb1
jmp 0x6027
movq %rax, (%rsp)
leaq 0x20(%rsp), %rdi
callq 0x5688
callq 0x55c0
jmp 0x602b
movq %rax, %rdi
callq 0x614a
jmp 0x6011
jmp 0x6021
jmp 0x6001
jmp 0x6011
movq %rax, (%rsp)
pushq $0x68
popq %rsi
movq %r14, %rdi
callq 0x53a0
jmp 0x6035
jmp 0x6021
jmp 0x6021
jmp 0x6021
movq %rax, (%rsp)
leaq 0x20(%rsp), %rdi
callq 0x5170
jmp 0x6015
movq %rax, (%rsp)
leaq 0x60(%rsp), %rdi
callq 0x5170
jmp 0x6035
movq %rax, (%rsp)
jmp 0x6035
movq %rax, (%rsp)
leaq 0x18(%rsp), %rdi
callq 0x638a
leaq 0x160(%rsp), %rdi
callq 0xf048
movq (%rsp), %rdi
callq 0x5600