// File: /workspace/github_cpp_makefile_star2_O2/andrakis[P]alisp/repl.cpp
// Function: ALisp::REPL::REPL(ALisp::Cell)
void REPL(Cell env) {
			State state;
			Eval::EvalType evaluator = Eval::Simple::eval;
			ListType history;
			last_env = env.env();

			check_linenoise();

			invokeCommand("help", state);
			while (state.exit == false) {
				const char *prompt = state.prompt.c_str();
				if (state.continuation)
					prompt = state.prompt_continuation.c_str();
				char *line_result = linenoise(prompt);
				if (line_result == NULL)
					break;

				StringType line(line_result);
				// No longer need string allocated
				free(line_result);

				if (state.continuation) {
					line = state.continued_line + line;
					state.continuation = false;
				}
				// Check if line is a repl command
				Command *cmd = getCommand(line);
				if (cmd != nullptr) {
					cmd->modifier(state);
					continue;
				}

				// Attempt to parse
				Cell read;
				try {
					read = Parser::read(line);
				} catch (ParserException const &pe) {
					state.continuation = true;
					state.continued_line = line;
					continue;
				}

				// Parsed successfully, save and execute
				linenoiseHistoryAdd(line.c_str());

				// Execute
				try {
					Cell result = evaluator(read, env);
					history.push_back(result);
					std::cout << result.repr() << std::endl;
				} catch (KeyNotFoundException &e) {
					std::cerr << "Key not found: " << e.what() << std::endl;
				} catch (Exception &e) {
					std::cerr << "Exception: " << e.what() << std::endl;
				}
			}

			last_env.reset();
		}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rdi, %rbx
leaq 0x60(%rsp), %rdi
callq 0x1680c
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rsp)
andq $0x0, 0x50(%rsp)
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
callq 0x90d0
leaq 0x15737(%rip), %rdi     # 0x2bb80
leaq 0x20(%rsp), %rsi
callq 0x169cc
leaq 0x28(%rsp), %rdi
callq 0x9680
callq 0x163b9
leaq 0x5e61(%rip), %rsi      # 0x1c2ca
leaq 0xe8(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x7150
leaq 0xe8(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x1619e
leaq 0xe8(%rsp), %rdi
callq 0x7688
cmpb $0x0, 0x60(%rsp)
je 0x164d3
leaq 0x156d8(%rip), %rdi     # 0x2bb80
callq 0x168a8
leaq 0x40(%rsp), %rdi
callq 0x944e
leaq 0x60(%rsp), %rdi
callq 0x168cc
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x20(%rsp), %r15
leaq 0xc8(%rsp), %r12
leaq 0x108(%rsp), %r13
leaq 0x18(%rsp), %rbp
movzbl 0x61(%rsp), %eax
shll $0x5, %eax
movq 0x68(%rsp,%rax), %rdi
callq 0x10dab
movq %rax, %r14
testq %rax, %rax
je 0x164a1
movq %r15, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x7150
movq %r14, %rdi
callq 0x73c0
cmpb $0x1, 0x61(%rsp)
jne 0x1654f
movq %r12, %rdi
leaq 0xa8(%rsp), %rsi
movq %r15, %rdx
callq 0x16870
movq %r15, %rdi
movq %r12, %rsi
callq 0x73e0
movq %r12, %rdi
callq 0x7688
movb $0x0, 0x61(%rsp)
movq %r13, %rdi
movq %r15, %rsi
callq 0x7490
movq %r13, %rdi
callq 0x16167
movq %rax, %r14
movq %r13, %rdi
callq 0x7688
testq %r14, %r14
je 0x16580
leaq 0x60(%rsp), %rdi
callq *0x20(%r14)
jmp 0x1663b
andq $0x0, 0x10(%rsp)
movq %r12, %rdi
movq %r15, %rsi
callq 0x1549c
movq 0xc8(%rsp), %rax
andq $0x0, 0xc8(%rsp)
movq 0x10(%rsp), %rdi
movq %rax, 0x10(%rsp)
testq %rdi, %rdi
je 0x165ca
movq (%rdi), %rax
callq *0x10(%rax)
movq 0xc8(%rsp), %rdi
testq %rdi, %rdi
je 0x165ca
movq (%rdi), %rax
callq *0x10(%rax)
movq 0x20(%rsp), %rdi
callq 0x10b24
movq %rbp, %rdi
leaq 0x10(%rsp), %rsi
movq %rbx, %rdx
callq 0x12cd0
leaq 0x40(%rsp), %rdi
movq %rbp, %rsi
callq 0xbae0
movq %r12, %rdi
movq %rbp, %rsi
callq 0xb5fe
movq 0x149c5(%rip), %rdi     # 0x2afc8
movq %r12, %rsi
callq 0x72b0
movq %rax, %rdi
callq 0x71a0
movq %r12, %rdi
callq 0x7688
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x1662b
movq (%rdi), %rax
callq *0x10(%rax)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1663b
movq (%rdi), %rax
callq *0x10(%rax)
movq %r15, %rdi
callq 0x7688
cmpb $0x0, 0x60(%rsp)
je 0x164ed
jmp 0x164a1
jmp 0x16655
movq %rdx, 0x8(%rsp)
movq %rax, %r14
jmp 0x166a9
movq %rdx, 0x8(%rsp)
movq %rax, %r14
jmp 0x166b9
movq %rax, %r14
cmpl $0x1, %edx
jne 0x167a3
movq %r14, %rdi
callq 0x7160
movb $0x1, 0x61(%rsp)
leaq 0xa8(%rsp), %rdi
movq %r15, %rsi
callq 0x71e0
callq 0x75b0
jmp 0x1662b
movq %rdx, 0x8(%rsp)
movq %rax, %r14
movq %r12, %rdi
callq 0x7688
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x166b9
movq (%rdi), %rax
callq *0x10(%rax)
cmpl $0x3, 0x8(%rsp)
jne 0x1670b
movq %r14, %rdi
callq 0x7160
movq %rax, %r14
movq 0x1491e(%rip), %rdi     # 0x2aff0
leaq 0x7309(%rip), %rsi      # 0x1d9e2
callq 0x72d0
movq %rax, 0x8(%rsp)
movq (%r14), %rax
movq %r14, %rdi
callq *0x10(%rax)
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x72d0
movq %rax, %rdi
callq 0x71a0
callq 0x75b0
jmp 0x1662b
cmpl $0x2, 0x8(%rsp)
jne 0x167a3
movq %r14, %rdi
callq 0x7160
movq %rax, %r14
movq 0x148c8(%rip), %rdi     # 0x2aff0
leaq 0x5b79(%rip), %rsi      # 0x1c2a8
callq 0x72d0
movq %rax, 0x8(%rsp)
movq (%r14), %rax
movq %r14, %rdi
callq *0x10(%rax)
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x72d0
movq %rax, %rdi
callq 0x71a0
callq 0x75b0
jmp 0x1662b
jmp 0x167a0
movq %rax, %r14
callq 0x75b0
jmp 0x167a3
jmp 0x167a0
movq %rax, %r14
callq 0x75b0
jmp 0x167a3
jmp 0x167a0
movq %rax, %r14
callq 0x75b0
jmp 0x167a3
movq %rax, %rdi
callq 0x9442
movq %rax, %r14
leaq 0xe8(%rsp), %rdi
jmp 0x167c6
jmp 0x167b9
jmp 0x167b9
jmp 0x167b9
movq %rax, %r14
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x167c1
movq (%rdi), %rax
callq *0x10(%rax)
jmp 0x167c1
jmp 0x167be
jmp 0x167b9
movq %rax, %r14
jmp 0x167cb
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0x7688
leaq 0x40(%rsp), %rdi
callq 0x944e
leaq 0x60(%rsp), %rdi
callq 0x168cc
movq %r14, %rdi
callq 0x7600
nop