// File: /workspace/github_cpp_makefile_star2_O3/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 0x6270
movl %edi, %ebp
leaq 0x160(%rsp), %r14
movq %r14, %rdi
callq 0x10cba
movq 0x4f8(%r14), %r15
movq 0x548(%r14), %r12
movl $0x68, %edi
callq 0x5380
movq %rax, %r14
leaq 0x160(%rsp), %rsi
movq %rax, %rdi
callq 0xf274
movq %r15, %rdi
movq %r12, %rsi
movl $0x6, %edx
movq %r14, %rcx
callq 0x10b4e
movl $0x1, %r14d
leaq 0x60(%rsp), %r15
movslq %r14d, %rax
movq (%rbx,%rax,8), %r13
movq %r13, %rdi
leaq 0x1136f(%rip), %rsi     # 0x17004
callq 0x54c0
testl %eax, %eax
je 0x5dc1
movq %r13, %rdi
leaq 0x1135f(%rip), %rsi     # 0x1700b
callq 0x54c0
testl %eax, %eax
jne 0x5d6e
leal 0x1(%r14), %r12d
cmpl %ebp, %r12d
jge 0x5d6e
movslq %r12d, %rax
movq (%rbx,%rax,8), %rsi
movq %r15, %rdi
leaq 0x8(%rsp), %rdx
callq 0x643e
leaq 0x160(%rsp), %rdi
movq %r15, %rsi
callq 0x11166
movl %eax, 0x40(%rsp)
movq %rdx, 0x48(%rsp)
leaq 0x8(%rsp), %rdi
leaq 0x40(%rsp), %rsi
movl $0x1, %edx
callq 0xfa02
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq 0x1b2a8(%rip), %rdi     # 0x20fc0
callq 0x5400
movb $0xa, 0x30(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0x30(%rsp), %rsi
callq 0x5400
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5d50
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5390
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x5dad
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x5390
jmp 0x5dad
movq %r13, %rdi
leaq 0x1129a(%rip), %rsi     # 0x17012
callq 0x54c0
testl %eax, %eax
je 0x5da2
movq %r13, %rdi
leaq 0x1128e(%rip), %rsi     # 0x17019
callq 0x54c0
testl %eax, %eax
jne 0x60f3
callq 0x15fc4
movl %r14d, %r12d
jmp 0x5dad
movq (%rbx), %rdi
callq 0x6333
movl %r14d, %r12d
incl %r12d
movl %r12d, %r14d
cmpl %ebp, %r12d
jl 0x5c84
jmp 0x624f
incl %r14d
leaq 0x160(%rsp), %rdi
movl %ebp, %esi
movq %rbx, %rdx
movl %r14d, %ecx
callq 0x13614
leaq 0x11354(%rip), %rdi     # 0x17134
leaq 0x160(%rsp), %rbx
movq %rbx, %rsi
callq 0xf5b6
movl %eax, %ebp
movq %rdx, %r14
movq 0x658(%rsp), %rdi
movq 0x698(%rsp), %rsi
movl %eax, %edx
movq %r14, %rcx
callq 0x10b4e
movq 0x658(%rsp), %rdi
movq 0x6a0(%rsp), %rsi
movl %ebp, %edx
movq %r14, %rcx
callq 0x10b4e
leaq 0x60(%rsp), %rcx
movq %rbx, (%rcx)
leaq 0x48(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0x40(%rsp), %rsi
leaq 0x8(%rsp), %rdx
leaq 0x658(%rsp), %r8
callq 0x6486
leaq 0x11359(%rip), %r14     # 0x171b5
leaq 0x60(%rsp), %r15
leaq 0x8(%rsp), %r12
movq 0x1b153(%rip), %r13     # 0x20fc0
xorl %edi, %edi
xorl %esi, %esi
callq 0x51d0
movq %rax, %rbx
movl $0xff, %esi
movq %r15, %rdi
leaq 0x11300(%rip), %rdx     # 0x17188
movq %r14, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x5560
movq %rbx, %rdi
callq 0x5420
movq %r15, %rdi
callq 0x5330
movq %rax, %rbp
testq %rax, %rax
je 0x60db
cmpb $0x0, (%rbp)
je 0x5fdb
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rsp)
movq %rbp, %rdi
callq 0x5180
movq %rbp, %rdx
addq %rax, %rdx
movq %r12, %rdi
movq %rbp, %rsi
callq 0x6646
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x50(%rsp)
movq %rax, 0x58(%rsp)
testq %rax, %rax
je 0x5f0c
movq 0x1b0ba(%rip), %rcx     # 0x20fb8
cmpb $0x0, (%rcx)
je 0x5f08
incl 0x8(%rax)
jmp 0x5f0c
lock
incl 0x8(%rax)
leaq 0x160(%rsp), %rdi
movq %r12, %rsi
leaq 0x50(%rsp), %rdx
callq 0x111ee
movl %eax, 0x30(%rsp)
movq %rdx, 0x38(%rsp)
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x5f39
callq 0x65d6
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5f55
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5390
movl $0xe, %edx
movq %r13, %rdi
leaq 0x111d2(%rip), %rsi     # 0x17136
callq 0x5400
movq %r12, %rdi
leaq 0x30(%rsp), %rsi
movl $0x1, %edx
callq 0xfa02
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r13, %rdi
callq 0x5400
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x5360
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5240
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x5fd3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5390
movq %rbp, %rdi
callq 0x5480
movq %rbp, %rdi
callq 0x5420
jmp 0x5e6d
jmp 0x6005
movq %rdx, 0x28(%rsp)
movq %rax, %rbx
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x6017
callq 0x65d6
jmp 0x6017
jmp 0x6005
movq %rdx, 0x28(%rsp)
movq %rax, %rbx
jmp 0x6033
movq %rdx, 0x28(%rsp)
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x6033
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5390
cmpl $0x1, 0x28(%rsp)
jne 0x630f
movq %rbx, %rdi
callq 0x5460
movq %r12, %rdi
movq %rax, %rsi
callq 0x5170
movq %rbx, %rdi
callq 0x5160
movl $0x12, %edx
movq 0x1af83(%rip), %rbx     # 0x20fe8
movq %rbx, %rdi
leaq 0x110d6(%rip), %rsi     # 0x17145
callq 0x5400
movq %r12, %rdi
callq 0x54b0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x5370
movb $0x20, 0x30(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0x30(%rsp), %rsi
callq 0x5400
movl $0x2f, %edx
movq %rbx, %rdi
leaq 0x110ab(%rip), %rsi     # 0x17158
callq 0x5400
movb $0xa, 0x30(%rsp)
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x30(%rsp), %rsi
callq 0x5400
movq %r12, %rdi
callq 0x5658
callq 0x5590
jmp 0x5fdb
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x624f
callq 0x65d6
jmp 0x624f
cmpb $0x2d, (%r13)
je 0x6282
leaq 0x60(%rsp), %r15
leaq 0x70(%rsp), %rax
movq %rax, (%r15)
movq %r13, %rdi
callq 0x5180
leaq (%rax,%r13), %rdx
movq %r15, %rdi
movq %r13, %rsi
callq 0x6646
leaq 0x8(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0xad3d
leaq 0x60(%rsp), %rdi
leaq 0x8(%rsp), %r15
movq %r15, %rsi
callq 0x5450
movq (%r15), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x615d
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5390
incl %r14d
leaq 0x160(%rsp), %rdi
movl %ebp, %esi
movq %rbx, %rdx
movl %r14d, %ecx
callq 0x13614
leaq 0x160(%rsp), %rsi
movq 0x4f8(%rsi), %rbx
movq 0x538(%rsi), %r14
movq 0x60(%rsp), %rdi
callq 0xf5b6
movq %rdx, %rcx
movq %rbx, %rdi
movq %r14, %rsi
movl %eax, %edx
callq 0x10b4e
leaq 0x160(%rsp), %rsi
movq 0x4f8(%rsi), %rbx
movq 0x540(%rsi), %r14
movq 0x60(%rsp), %rdi
callq 0xf5b6
movq %rdx, %rcx
movq %rbx, %rdi
movq %r14, %rsi
movl %eax, %edx
callq 0x10b4e
leaq 0x8(%rsp), %rsi
leaq 0x18(%rsp), %rax
movq %rax, (%rsi)
movq $0x0, 0x8(%rsi)
movb $0x0, 0x10(%rsi)
leaq 0x60(%rsp), %rdi
callq 0xadce
leaq 0x160(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x11166
leaq 0x478(%rsp), %rdi
callq 0x149a8
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x6233
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5390
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x624f
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x5390
leaq 0x160(%rsp), %rdi
callq 0x10f66
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 0x6333
movl $0x1, %edi
callq 0x5430
movq (%rbx), %rdi
callq 0x6333
jmp 0x6278
jmp 0x630c
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x5658
callq 0x5590
jmp 0x630f
movq %rax, %rdi
callq 0x647b
jmp 0x62e6
jmp 0x6307
jmp 0x62c5
movq %rax, %rbx
movl $0x68, %esi
movq %r14, %rdi
jmp 0x6300
jmp 0x62e6
jmp 0x6307
jmp 0x6307
jmp 0x6307
movq %rax, %rbx
movq 0x8(%rsp), %rdi
leaq 0x18(%rsp), %rax
cmpq %rax, %rdi
je 0x62e9
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5390
jmp 0x62e9
movq %rax, %rbx
movq 0x60(%rsp), %rdi
leaq 0x70(%rsp), %rax
cmpq %rax, %rdi
je 0x631e
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x5390
jmp 0x631e
movq %rax, %rbx
jmp 0x631e
movq %rax, %rbx
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x631e
callq 0x65d6
leaq 0x160(%rsp), %rdi
callq 0x10f66
movq %rbx, %rdi
callq 0x55e0