// File: andrakis[P]alisp/repl.cpp
// Function: ALisp::REPL::completion_hook(char const*, linenoiseCompletions*)
void completion_hook(char const *prefix, linenoiseCompletions *lc) {
			size_t len = strlen(prefix);
			
			// Add builtins
			for(size_t i = 0; builtins[i] != NULL; ++i) {
				if (!strncmp(builtins[i], prefix, len))
					linenoiseAddCompletion(lc, builtins[i]);
			}

			// Add REPL commands
			for (auto it = &replCommands[0]; it->valid(); ++it) {
				if (!strncmp(it->command.c_str(), prefix, len))
					linenoiseAddCompletion(lc, it->command.c_str());
			}

			// Add environment atoms.
			// These require a reference to the current environment
			if (auto env = last_env.lock()) {
				auto e = env;
				for (;;) {
					for (auto it = e->cbegin(); it != e->cend(); ++it) {
						Cell atom = Atoms::Get(it->first);
						if (!strncmp(atom.str().c_str(), prefix, len)) {
							// Got a partial match
							linenoiseAddCompletion(lc, atom.str().c_str());
						}
					}
					if (!e->has_parent())
						break;
					e = e->get_parent();
				}
			}
		}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x8210
movq %rax, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x20(%rbp), %rcx
leaq 0x2759d(%rip), %rax     # 0x577f0
cmpq $0x0, (%rax,%rcx,8)
je 0x302a3
movq -0x20(%rbp), %rcx
leaq 0x2758b(%rip), %rax     # 0x577f0
movq (%rax,%rcx,8), %rdi
movq -0x8(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x8230
cmpl $0x0, %eax
jne 0x30293
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rcx
leaq 0x27566(%rip), %rax     # 0x577f0
movq (%rax,%rcx,8), %rsi
callq 0x22bf0
jmp 0x30295
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x30248
leaq 0x27916(%rip), %rax     # 0x57bc0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x30ca0
testb $0x1, %al
jne 0x302bd
jmp 0x3030e
movq -0x28(%rbp), %rdi
callq 0x81e0
movq %rax, %rdi
movq -0x8(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x8230
cmpl $0x0, %eax
jne 0x302fe
movq -0x10(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x28(%rbp), %rdi
callq 0x81e0
movq -0xc8(%rbp), %rdi
movq %rax, %rsi
callq 0x22bf0
jmp 0x30300
movq -0x28(%rbp), %rax
addq $0x28, %rax
movq %rax, -0x28(%rbp)
jmp 0x302ae
leaq -0x38(%rbp), %rdi
leaq 0x27997(%rip), %rsi     # 0x57cb0
callq 0x30db0
leaq -0x38(%rbp), %rdi
callq 0x178a0
testb $0x1, %al
jne 0x30330
jmp 0x3052f
leaq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0xf830
leaq -0x48(%rbp), %rdi
callq 0xba80
movq %rax, %rdi
callq 0x30de0
movq %rax, -0xd0(%rbp)
jmp 0x30357
movq -0xd0(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq -0x48(%rbp), %rdi
callq 0xba80
movq %rax, %rdi
callq 0x28a30
movq %rax, -0xd8(%rbp)
jmp 0x3037c
movq -0xd8(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0x28a00
testb $0x1, %al
jne 0x3039d
jmp 0x304ae
leaq -0x50(%rbp), %rdi
callq 0x28a60
movq (%rax), %rsi
leaq -0x70(%rbp), %rdi
callq 0x17bb0
jmp 0x303b4
leaq -0x90(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0xd4b0
jmp 0x303c6
leaq -0x90(%rbp), %rdi
callq 0x81e0
movq %rax, %rdi
movq -0x8(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x8230
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
movb %al, -0xd9(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x8878
movb -0xd9(%rbp), %al
testb $0x1, %al
jne 0x3040b
jmp 0x3048c
movq -0x10(%rbp), %rax
movq %rax, -0xe8(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0xd4b0
jmp 0x30428
leaq -0xb0(%rbp), %rdi
callq 0x81e0
movq -0xe8(%rbp), %rdi
movq %rax, %rsi
callq 0x22bf0
jmp 0x30445
leaq -0xb0(%rbp), %rdi
callq 0x8878
jmp 0x3048c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x3051b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x304a3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x8878
jmp 0x304a3
leaq -0x70(%rbp), %rdi
callq 0xb9d0
leaq -0x50(%rbp), %rdi
callq 0x30e10
jmp 0x30362
leaq -0x70(%rbp), %rdi
callq 0xb9d0
jmp 0x3051b
leaq -0x48(%rbp), %rdi
callq 0xba80
movq %rax, %rdi
callq 0x17840
movb %al, -0xe9(%rbp)
jmp 0x304c7
movb -0xe9(%rbp), %al
testb $0x1, %al
jne 0x304d5
jmp 0x304d3
jmp 0x30510
leaq -0x48(%rbp), %rdi
callq 0xba80
movq %rax, %rsi
leaq -0xc0(%rbp), %rdi
callq 0x30e40
jmp 0x304ef
leaq -0x48(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x30e70
leaq -0xc0(%rbp), %rdi
callq 0xb8e0
jmp 0x3033d
leaq -0x48(%rbp), %rdi
callq 0xb8e0
jmp 0x3052f
leaq -0x48(%rbp), %rdi
callq 0xb8e0
leaq -0x38(%rbp), %rdi
callq 0xb8e0
jmp 0x30541
leaq -0x38(%rbp), %rdi
callq 0xb8e0
addq $0xf0, %rsp
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x87b0
nopw (%rax,%rax)