// File: /workspace/github_cpp_makefile_star2_O2/iamlouk[P]asbi/src/parser.cc
// Function: asbi::Parser::parse_lambda(std::vector<ast::Node*, std::allocator<ast::Node*>>)
ast::Lambda* Parser::parse_lambda(std::vector<ast::Node*> argnamenodes) {
	expect(tok::Arrow);

	std::vector<asbi::StringContainer*> argnames;
	for (auto const& node: argnamenodes) {
		ast::Variable* var = dynamic_cast<ast::Variable*>(node);
		if (var == nullptr)
			throw utils::parser_error("lambda-litteral args should only be identifiers", node);

		argnames.push_back(var->sc);
		delete var;
	}

	ast::Block* body;
	auto _body = parse_expr();
	if (body = dynamic_cast<ast::Block*>(_body); body == nullptr) {
		std::vector<ast::Node*> vec = { _body };
		body = new ast::Block(vec);
	}

	return new ast::Lambda(std::move(argnames), body);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %r15
pushq $0xc
popq %rsi
movq %rdi, 0x30(%rsp)
callq 0x796c
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %r14
movaps %xmm0, (%r14)
andq $0x0, 0x10(%r14)
movq (%r15), %rbp
movq 0x8(%r15), %rbx
leaq 0x165e4(%rip), %r15     # 0x1f588
leaq 0x166c5(%rip), %r12     # 0x1f670
cmpq %rbx, %rbp
je 0x8ff2
movq (%rbp), %rdi
testq %rdi, %rdi
je 0x90df
movq %r15, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x53e0
testq %rax, %rax
je 0x90df
movq %rax, %r13
leaq 0x8(%rax), %rsi
movq %r14, %rdi
callq 0x9448
movq (%r13), %rax
movq %r13, %rdi
callq *0x8(%rax)
addq $0x8, %rbp
jmp 0x8fab
movq 0x30(%rsp), %rdi
callq 0x7b36
movq %rax, %r14
testq %rax, %rax
je 0x9024
leaq 0x1657d(%rip), %rsi     # 0x1f588
leaq 0x16bae(%rip), %rdx     # 0x1fbc0
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x53e0
movq %rax, %rbx
testq %rax, %rax
jne 0x907c
leaq 0x80(%rsp), %rsi
movq %r14, (%rsi)
leaq 0x50(%rsp), %rdi
pushq $0x1
popq %rdx
leaq 0xf(%rsp), %rcx
callq 0x93e2
pushq $0x20
popq %rdi
callq 0x5390
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x9318
leaq 0x38(%rsp), %rsi
movq %rbx, %rdi
callq 0x9366
leaq 0x38(%rsp), %rdi
callq 0x9768
leaq 0x50(%rsp), %rdi
callq 0x9768
pushq $0x28
popq %rdi
callq 0x5390
movq %rax, %r15
movq 0x10(%rsp), %rax
leaq 0x68(%rsp), %rsi
movq %rax, (%rsi)
movups 0x18(%rsp), %xmm0
movups %xmm0, 0x8(%rsi)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
andq $0x0, 0x20(%rsp)
movq %r15, %rdi
movq %rbx, %rdx
callq 0x9466
leaq 0x68(%rsp), %rdi
callq 0x96d2
leaq 0x10(%rsp), %rdi
callq 0x96d2
movq %r15, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x48
popq %rdi
callq 0x51b0
movq %rax, %rbx
movq (%rbp), %rdx
leaq 0xb765(%rip), %rsi      # 0x1485a
movq %rax, %rdi
callq 0x9f2e
leaq 0x1646c(%rip), %rsi     # 0x1f570
leaq 0x1ed(%rip), %rdx       # 0x92f8
movq %rbx, %rdi
callq 0x55f0
movq %rax, %r14
leaq 0x38(%rsp), %rdi
callq 0x9768
jmp 0x9125
movq %rax, %r14
pushq $0x20
popq %rsi
movq %rbx, %rdi
callq 0x53a0
jmp 0x9135
movq %rax, %r14
leaq 0x50(%rsp), %rdi
callq 0x9768
jmp 0x9171
jmp 0x9161
movq %rax, %r14
leaq 0x68(%rsp), %rdi
callq 0x96d2
pushq $0x28
popq %rsi
movq %r15, %rdi
callq 0x53a0
jmp 0x9171
jmp 0x9161
jmp 0x9161
movq %rax, %r14
jmp 0x9171
movq %rax, %r14
movq %rbx, %rdi
callq 0x5290
leaq 0x10(%rsp), %rdi
callq 0x96d2
movq %r14, %rdi
callq 0x5600
nop