// File: /workspace/github_cpp_makefile_star2_O1/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, %r14
movq %rdi, 0x30(%rsp)
movl $0xc, %esi
callq 0x810c
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq (%r14), %rbp
movq 0x8(%r14), %rbx
cmpq %rbx, %rbp
je 0x9ba7
leaq 0x10(%rsp), %r14
leaq 0x16a50(%rip), %r15     # 0x20590
leaq 0x16b31(%rip), %r12     # 0x20678
movq (%rbp), %rdi
testq %rdi, %rdi
je 0x9b62
movq %r15, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x53f0
movq %rax, %r13
jmp 0x9b65
xorl %r13d, %r13d
testq %r13, %r13
je 0x9cfe
leaq 0x8(%r13), %rdx
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x9b8c
movq (%rdx), %rax
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x9b94
movq %r14, %rdi
callq 0xa5f4
movq (%r13), %rax
movq %r13, %rdi
callq *0x8(%rax)
addq $0x8, %rbp
cmpq %rbx, %rbp
jne 0x9b47
movq 0x30(%rsp), %rdi
callq 0x8330
movq %rax, %r14
testq %rax, %rax
je 0x9bd6
leaq 0x169d0(%rip), %rsi     # 0x20590
leaq 0x17001(%rip), %rdx     # 0x20bc8
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x53f0
movq %rax, %rbx
jmp 0x9bd8
xorl %ebx, %ebx
testq %rbx, %rbx
jne 0x9c69
leaq 0x80(%rsp), %rsi
movq %r14, (%rsi)
leaq 0x50(%rsp), %rdi
leaq 0xf(%rsp), %rcx
movl $0x1, %edx
callq 0xa08e
movl $0x20, %edi
callq 0x5380
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0xa00e
leaq 0x16f15(%rip), %rax     # 0x20b38
addq $0x10, %rax
movq %rax, (%rbx)
movq %rbx, %rdi
addq $0x8, %rdi
leaq 0x38(%rsp), %rsi
callq 0xa00e
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x9c52
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x5390
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x9c69
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
callq 0x5390
movl $0x28, %edi
callq 0x5380
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)
movq $0x0, 0x20(%rsp)
leaq 0x16cbc(%rip), %rax     # 0x20960
addq $0x10, %rax
movq %rax, (%r15)
movq %r15, %rdi
addq $0x8, %rdi
callq 0xa23e
movq %rbx, 0x20(%r15)
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x9cd2
movq 0x78(%rsp), %rsi
subq %rdi, %rsi
callq 0x5390
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x9ce9
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x5390
movq %r15, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x48, %edi
callq 0x51b0
movq %rax, %rbx
movq (%rbp), %rdx
leaq 0xdb34(%rip), %rsi      # 0x1784a
movq %rax, %rdi
callq 0xabda
leaq 0x16853(%rip), %rsi     # 0x20578
leaq 0x2b2(%rip), %rdx       # 0x9fde
movq %rbx, %rdi
callq 0x55d0
movq %rax, %r14
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x9d53
movq 0x48(%rsp), %rsi
subq %rdi, %rsi
callq 0x5390
jmp 0x9d53
movq %rax, %r14
movl $0x20, %esi
movq %rbx, %rdi
callq 0x5390
jmp 0x9d65
movq %rax, %r14
movq 0x50(%rsp), %rdi
testq %rdi, %rdi
je 0x9db8
movq 0x60(%rsp), %rsi
subq %rdi, %rsi
jmp 0x9d9d
jmp 0x9da8
movq %rax, %r14
movq 0x68(%rsp), %rdi
testq %rdi, %rdi
je 0x9d95
movq 0x78(%rsp), %rsi
subq %rdi, %rsi
callq 0x5390
movl $0x28, %esi
movq %r15, %rdi
callq 0x5390
jmp 0x9db8
jmp 0x9da8
jmp 0x9da8
movq %rax, %r14
jmp 0x9db8
movq %rax, %r14
movq %rbx, %rdi
callq 0x5280
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x9dcf
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x5390
movq %r14, %rdi
callq 0x55e0
nop