// File: /workspace/github_cpp_makefile_star2_O1/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 $0x6d8, %rsp            # imm = 0x6D8
movq %rsi, 0x30(%rsp)
movl %edi, 0xc(%rsp)
cmpl $0x1, %edi
jle 0x62a3
leaq 0x170(%rsp), %rbx
movq %rbx, %rdi
callq 0x10e06
movq 0x4f8(%rbx), %r14
movq 0x548(%rbx), %r15
movl $0x68, %edi
callq 0x5380
movq %rax, %rbx
leaq 0x170(%rsp), %rsi
movq %rax, %rdi
callq 0xf2dc
movq %r14, %rdi
movq %r15, %rsi
movl $0x6, %edx
movq %rbx, %rcx
callq 0x10c8e
leaq 0x20(%rsp), %rbp
movl $0x1, %ebx
leaq 0x10(%rsp), %r15
leaq 0x70(%rsp), %r13
movslq %ebx, %rax
movq 0x30(%rsp), %r12
movq (%r12,%rax,8), %r14
movq %r14, %rdi
leaq 0x1135d(%rip), %rsi     # 0x17004
callq 0x54c0
testl %eax, %eax
je 0x5f10
movq %r14, %rdi
leaq 0x1134d(%rip), %rsi     # 0x1700b
callq 0x54c0
testl %eax, %eax
jne 0x5d8d
leal 0x1(%rbx), %r12d
cmpl 0xc(%rsp), %r12d
jge 0x5d8d
movslq %r12d, %rax
movq 0x30(%rsp), %rcx
movq (%rcx,%rax,8), %rsi
movq %r13, %rdi
movq %r15, %rdx
callq 0x646e
leaq 0x170(%rsp), %rdi
movq %r13, %rsi
callq 0x112ba
movl %eax, 0x40(%rsp)
movq %rdx, 0x48(%rsp)
movq %r15, %rdi
leaq 0x40(%rsp), %rsi
movl $0x1, %edx
callq 0xfa82
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x1b293(%rip), %rdi     # 0x20fc0
callq 0x5400
movb $0xa, 0x50(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0x50(%rsp), %rsi
callq 0x5400
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x5d60
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5390
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x5d82
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x5390
movb $0x1, %r14b
movl %r12d, %ebx
jmp 0x6262
movq %r14, %rdi
leaq 0x1127b(%rip), %rsi     # 0x17012
callq 0x54c0
testl %eax, %eax
je 0x6248
movq %r14, %rdi
leaq 0x1126b(%rip), %rsi     # 0x17019
callq 0x54c0
testl %eax, %eax
je 0x625a
cmpb $0x2d, (%r14)
je 0x6294
leaq 0x80(%rsp), %rax
movq %rax, 0x70(%rsp)
movq %r14, %rdi
callq 0x5180
leaq (%rax,%r14), %rdx
movq %r13, %rdi
movq %r14, %rsi
callq 0x6684
movq %r15, %rdi
movq %r13, %rsi
callq 0xae9d
movq %r13, %rdi
movq %r15, %rsi
callq 0x5450
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x5e16
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5390
leal 0x1(%rbx), %ecx
leaq 0x170(%rsp), %rdi
movl 0xc(%rsp), %esi
movq 0x30(%rsp), %rdx
callq 0x137a4
movq 0x668(%rsp), %r14
movq 0x6a8(%rsp), %r12
movq 0x70(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0xf626
movq %rdx, %rcx
movq %r14, %rdi
movq %r12, %rsi
movl %eax, %edx
callq 0x10c8e
movq 0x668(%rsp), %r14
movq 0x6b0(%rsp), %r12
movq 0x70(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0xf626
movq %rdx, %rcx
movq %r14, %rdi
movq %r12, %rsi
movl %eax, %edx
callq 0x10c8e
movq %rbp, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
movb $0x0, 0x20(%rsp)
movq %r13, %rdi
movq %r15, %rsi
callq 0xaf2e
leaq 0x170(%rsp), %rdi
movq %r15, %rsi
callq 0x112ba
leaq 0x488(%rsp), %rdi
callq 0x14bbc
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x5ee5
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5390
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x6243
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x5390
jmp 0x6243
leal 0x1(%rbx), %ecx
leaq 0x170(%rsp), %rdi
movl 0xc(%rsp), %esi
movq %r12, %rdx
callq 0x137a4
leaq 0x11206(%rip), %rdi     # 0x17134
leaq 0x170(%rsp), %rsi
callq 0xf626
movl %eax, %r14d
movq %rdx, %r12
movq 0x668(%rsp), %rdi
movq 0x6a8(%rsp), %rsi
movl %eax, %edx
movq %r12, %rcx
callq 0x10c8e
movq 0x668(%rsp), %rdi
movq 0x6b0(%rsp), %rsi
movl %r14d, %edx
movq %r12, %rcx
callq 0x10c8e
leaq 0x170(%rsp), %rax
movq %rax, 0x70(%rsp)
movq $0x0, 0x40(%rsp)
leaq 0x48(%rsp), %rdi
leaq 0x40(%rsp), %rsi
movq %r15, %rdx
movq %r13, %rcx
leaq 0x668(%rsp), %r8
callq 0x64b6
xorl %edi, %edi
xorl %esi, %esi
callq 0x51d0
movq %rax, %r14
movl $0xff, %esi
movq %r13, %rdi
leaq 0x111c4(%rip), %rdx     # 0x17188
leaq 0x111ea(%rip), %rcx     # 0x171b5
movq %rax, %r8
xorl %eax, %eax
callq 0x5560
movq %r14, %rdi
callq 0x5420
movq %r13, %rdi
callq 0x5330
movq %rax, %r14
testq %rax, %rax
je 0x6234
cmpb $0x0, (%r14)
je 0x6114
movq %rbp, 0x10(%rsp)
movq %r14, %rdi
callq 0x5180
movq %r14, %rdx
addq %rax, %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x6684
movq 0x40(%rsp), %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x60(%rsp)
movq %rax, 0x68(%rsp)
testq %rax, %rax
je 0x6047
movq 0x1af7f(%rip), %rcx     # 0x20fb8
cmpb $0x0, (%rcx)
je 0x6043
incl 0x8(%rax)
jmp 0x6047
lock
incl 0x8(%rax)
leaq 0x170(%rsp), %rdi
movq %r15, %rsi
leaq 0x60(%rsp), %rdx
callq 0x11342
movl %eax, 0x50(%rsp)
movq %rdx, 0x58(%rsp)
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x6074
callq 0x6614
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x608b
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5390
movl $0xe, %edx
movq 0x1af29(%rip), %rdi     # 0x20fc0
leaq 0x11098(%rip), %rsi     # 0x17136
callq 0x5400
movq %r15, %rdi
leaq 0x50(%rsp), %rsi
movl $0x1, %edx
callq 0xfa82
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rdx
movq 0x1aefa(%rip), %rdi     # 0x20fc0
callq 0x5400
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x5360
movsbl %al, %esi
movq %r12, %rdi
callq 0x5030
movq %rax, %rdi
callq 0x5240
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x610c
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5390
movq %r14, %rdi
callq 0x5480
movq %r14, %rdi
callq 0x5420
jmp 0x5fa9
jmp 0x615f
movq %rax, %r12
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
movq %rdx, 0x38(%rsp)
je 0x613f
callq 0x6614
movq 0x38(%rsp), %rdx
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x618e
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5390
movq 0x38(%rsp), %rdx
jmp 0x618e
jmp 0x615f
movq %rax, %r12
jmp 0x618e
movq %rax, %r12
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x618e
movq 0x20(%rsp), %rsi
incq %rsi
movq %r12, 0x38(%rsp)
movq %rdx, %r12
callq 0x5390
movq %r12, %rdx
movq 0x38(%rsp), %r12
cmpl $0x1, %edx
jne 0x633e
movq %r12, %rdi
callq 0x5460
movq %r15, %rdi
movq %rax, %rsi
callq 0x5170
movq %r12, %rdi
callq 0x5160
movl $0x12, %edx
movq 0x1ae2a(%rip), %r12     # 0x20fe8
movq %r12, %rdi
leaq 0x10f7d(%rip), %rsi     # 0x17145
callq 0x5400
movq %r15, %rdi
callq 0x54b0
movq %r12, %rdi
movq %rax, %rsi
callq 0x5370
movb $0x20, 0x50(%rsp)
movl $0x1, %edx
movq %rax, %rdi
leaq 0x50(%rsp), %rsi
callq 0x5400
movl $0x2f, %edx
movq %r12, %rdi
leaq 0x10f52(%rip), %rsi     # 0x17158
callq 0x5400
movb $0xa, 0x50(%rsp)
movl $0x1, %edx
movq %r12, %rdi
leaq 0x50(%rsp), %rsi
callq 0x5400
movq %r15, %rdi
callq 0x5658
callq 0x5590
jmp 0x6114
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x6243
callq 0x6614
xorl %r14d, %r14d
jmp 0x6262
movq 0x30(%rsp), %rax
movq (%rax), %rdi
movb $0x1, %r14b
callq 0x6362
jmp 0x6262
movb $0x1, %r14b
callq 0x161dc
testb %r14b, %r14b
je 0x6273
incl %ebx
cmpl 0xc(%rsp), %ebx
jl 0x5c91
leaq 0x170(%rsp), %rdi
callq 0x110bc
xorl %eax, %eax
addq $0x6d8, %rsp            # imm = 0x6D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x30(%rsp), %rax
movq (%rax), %rdi
callq 0x6362
jmp 0x62b0
movq 0x30(%rsp), %rax
movq (%rax), %rdi
callq 0x6362
movl $0x1, %edi
callq 0x5430
jmp 0x633b
movq %rax, %r12
leaq 0x10(%rsp), %rdi
callq 0x5658
callq 0x5590
jmp 0x633e
movq %rax, %rdi
callq 0x64ab
movq %rax, %r12
movl $0x68, %esi
movq %rbx, %rdi
jmp 0x632f
jmp 0x6336
jmp 0x6336
jmp 0x6336
jmp 0x6336
jmp 0x630f
jmp 0x62f3
jmp 0x630f
movq %rax, %r12
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x6312
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x5390
jmp 0x6312
movq %rax, %r12
movq 0x70(%rsp), %rdi
leaq 0x80(%rsp), %rax
cmpq %rax, %rdi
je 0x634d
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x5390
jmp 0x634d
movq %rax, %r12
jmp 0x634d
movq %rax, %r12
movq 0x48(%rsp), %rdi
testq %rdi, %rdi
je 0x634d
callq 0x6614
leaq 0x170(%rsp), %rdi
callq 0x110bc
movq %r12, %rdi
callq 0x55e0