// File: /workspace/github_c_makefile_star2_O0/qpfiffer[P]lair/src/eval.c
// Function: reevaluate_until_break
static void _reevaluate_until_break(struct _lair_runtime *r,
		struct _lair_env *env,
		struct _lair_ast *current_node) {
	/* This function will take an AST node and re-evaluate it in it's new context.
	 * We don't know until runtime if we're calling or defining a function,
	 * so the idea here is to turn LR_FUNCTION_ARG nodes into things that
	 * they actually are.
	 */
	struct _lair_ast *n = current_node;
	while (n &&
			n->atom.type != LR_DEDENT &&
			n->atom.type != LR_EOF) {
		struct _lair_ast *prev = n->prev;
		struct _lair_ast *next = n->next;
		if (n->next && n->next->prev == NULL) {
			n->next->prev = n;
		}

		if (prev && (prev->atom.type == LR_CALL || prev->atom.type == LR_INDENT)) {
			if (_is_callable_runtime(env, n)) {
				n->atom.type = LR_FUNCTION_CALL;
			}
		} else if (prev && prev->atom.type == LR_FUNCTION_CALL) {
			/* We need to parse this into something more useful, like a string or a number. */
			struct _lair_token token = {
				.token_str = n->atom.value.str,
				.token_type = LR_ERR,
				.indent_level = n->indent_level,
				.next = NULL,
				.prev = NULL,
			};
			_intuit_token_type(r, &token, n->atom.value.str);
			n->atom = _lair_atomize_token(&token);
		} else if (prev && (prev->atom.type == LR_FUNCTION_ARG || prev->atom.type == LR_FUNCTION_DEF)) {
			n->atom.type = LR_FUNCTION_ARG;
		} else {
			struct _lair_token token = {
				.token_str = n->atom.value.str,
				.token_type = LR_ERR,
				.indent_level = n->indent_level,
				.next = NULL,
				.prev = NULL,
			};
			_intuit_token_type(r, &token, n->atom.value.str);
			n->atom = _lair_atomize_token(&token);
		}

		n = next;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x20(%rbp)
movb %al, -0x91(%rbp)
je 0x3601
movq -0x20(%rbp), %rcx
xorl %eax, %eax
cmpl $0x8, 0x28(%rcx)
movb %al, -0x91(%rbp)
je 0x3601
movq -0x20(%rbp), %rax
cmpl $0x9, 0x28(%rax)
setne %al
movb %al, -0x91(%rbp)
movb -0x91(%rbp), %al
testb $0x1, %al
jne 0x3610
jmp 0x37da
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x364f
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
cmpq $0x0, (%rax)
jne 0x364f
movq -0x20(%rbp), %rcx
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rcx, (%rax)
cmpq $0x0, -0x28(%rbp)
je 0x368c
movq -0x28(%rbp), %rax
cmpl $0xb, 0x28(%rax)
je 0x366a
movq -0x28(%rbp), %rax
cmpl $0x7, 0x28(%rax)
jne 0x368c
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x37f0
cmpl $0x0, %eax
je 0x3687
movq -0x20(%rbp), %rax
movl $0x2, 0x28(%rax)
jmp 0x37cd
cmpq $0x0, -0x28(%rbp)
je 0x371c
movq -0x28(%rbp), %rax
cmpl $0x2, 0x28(%rax)
jne 0x371c
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x50(%rbp)
movl $0x0, -0x48(%rbp)
movq -0x20(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x44(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rdx
leaq -0x50(%rbp), %rsi
callq 0x3fa0
movq -0x20(%rbp), %rax
movq %rax, -0xa0(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x4ba0
movl %eax, %ecx
movq -0xa0(%rbp), %rax
movl %ecx, -0x60(%rbp)
movq %rdx, -0x58(%rbp)
movq -0x60(%rbp), %rcx
movq %rcx, 0x28(%rax)
movq -0x58(%rbp), %rcx
movq %rcx, 0x30(%rax)
jmp 0x37cb
cmpq $0x0, -0x28(%rbp)
je 0x3747
movq -0x28(%rbp), %rax
cmpl $0x5, 0x28(%rax)
je 0x3737
movq -0x28(%rbp), %rax
cmpl $0x1, 0x28(%rax)
jne 0x3747
movq -0x20(%rbp), %rax
movl $0x5, 0x28(%rax)
jmp 0x37c9
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x80(%rbp)
movl $0x0, -0x78(%rbp)
movq -0x20(%rbp), %rax
movl 0x20(%rax), %eax
movl %eax, -0x74(%rbp)
movq $0x0, -0x70(%rbp)
movq $0x0, -0x68(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rdx
leaq -0x80(%rbp), %rsi
callq 0x3fa0
movq -0x20(%rbp), %rax
movq %rax, -0xa8(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x4ba0
movl %eax, %ecx
movq -0xa8(%rbp), %rax
movl %ecx, -0x90(%rbp)
movq %rdx, -0x88(%rbp)
movq -0x90(%rbp), %rcx
movq %rcx, 0x28(%rax)
movq -0x88(%rbp), %rcx
movq %rcx, 0x30(%rax)
jmp 0x37cb
jmp 0x37cd
movq -0x30(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x35cf
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)