// File: /workspace/github_cpp_makefile_star2_O1/Nallantli[P]Rossa/main/rossa/node_parser/node_parser.cpp
// Function: node_parser_t::parseCallNode(std::vector<node_scope_t, std::allocator<node_scope_t>>*, std::shared_ptr<Node> const&)
ptr_node_t node_parser_t::parseCallNode(std::vector<node_scope_t> *scopes, const ptr_node_t &a)
{
	auto marker = tokens.at(index - 2);
	nextToken();
	std::vector<ptr_node_t> args;
	int i = 0;
	while (currentToken.type != NULL_TOK && currentToken.type != ')')
	{
		if (i > 0)
		{
			if (currentToken.type != ',')
				return logErrorN(util::format(_EXPECTED_ERROR_, {","}), currentToken);
			nextToken();
		}
		i++;
		if (auto b = parseEquNode(scopes))
			args.push_back(b);
		else
			return logErrorN(_EXPECTED_FUNCTION_PARAM_, currentToken);
		if (currentToken.type == NULL_TOK)
			return logErrorN(util::format(_EXPECTED_ERROR_, {")"}), currentToken);
	}

	nextToken();

	ptr_node_t ret;
	if (a->getType() == Node::type_t::INS_NODE)
	{
		auto a_a = reinterpret_cast<InsNode *>(a.get())->getCallee();
		auto a_b = reinterpret_cast<InsNode *>(a.get())->getArg();
		if (a_b->getType() == Node::type_t::BID_NODE)
		{
			auto nkey = reinterpret_cast<BIDNode *>(a_b.get());
			std::string key = nkey->getKey();
			/*if (!args.empty())
				return logErrorN("Built in functions take a single argument", currentToken);*/

			if (key == KEYWORD_LENGTH)
			{
				ret = std::make_shared<CallBuiltNode>(*scopes, TOK_LENGTH, a_a, marker);
			}
			if (key == KEYWORD_ALLOC)
			{
				ret = std::make_shared<CallBuiltNode>(*scopes, TOK_ALLOC, a_a, marker);
			}
			if (key == KEYWORD_PARSE)
			{
				ret = std::make_shared<CallBuiltNode>(*scopes, TOK_PARSE, a_a, marker);
			}
			if (key == KEYWORD_CHAR_N)
			{
				ret = std::make_shared<CallBuiltNode>(*scopes, TOK_CHARN, a_a, marker);
			}
			if (key == KEYWORD_CHAR_S)
			{
				ret = std::make_shared<CallBuiltNode>(*scopes, TOK_CHARS, a_a, marker);
			}

			ret = parseTrailingNode(scopes, ret, true);
		}
		else
		{
			ret = std::make_shared<CallNode>(*scopes, std::make_shared<InsNode>(*scopes, a_a, a_b, currentToken), args, marker);
		}
		return parseTrailingNode(scopes, ret, true);
	}

	ret = std::make_shared<CallNode>(*scopes, a, args, marker);
	return parseTrailingNode(scopes, ret, true);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %rdx, %r15
movq %rdi, 0xa8(%rsp)
movl 0x50(%rsi), %ebp
addl $-0x2, %ebp
movq 0x10(%rsi), %r14
movq 0x18(%rsi), %rdx
subq %r14, %rdx
sarq $0x7, %rdx
cmpq %rbp, %rdx
jbe 0x28c29
movq %rcx, %r13
movq %rsi, %rbx
shlq $0x7, %rbp
leaq (%r14,%rbp), %r12
leaq 0xc8(%rsp), %rdi
movq %r12, %rsi
callq 0x1e698
leaq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x28(%r14,%rbp), %rsi
movq 0x30(%r14,%rbp), %rdx
addq %rsi, %rdx
callq 0x1e014
movups 0x48(%r12), %xmm0
leaq 0x120(%rsp), %rdi
movups %xmm0, -0x10(%rdi)
leaq 0x130(%rsp), %rax
movq %rax, -0x10(%rax)
movq 0x58(%r12), %rsi
movq 0x60(%r12), %rdx
addq %rsi, %rdx
callq 0x1e014
movl 0x78(%r12), %eax
movl %eax, 0x140(%rsp)
movq %rbx, %rdi
callq 0x2565a
xorps %xmm0, %xmm0
leaq 0xb0(%rsp), %rbp
movaps %xmm0, (%rbp)
movq $0x0, 0x10(%rbp)
xorl %r14d, %r14d
leaq 0x50(%rsp), %r12
movl 0xd0(%rbx), %eax
testl %eax, %eax
je 0x28629
cmpl $0x29, %eax
je 0x28629
subl $0x1, %r14d
jb 0x2855d
cmpl $0x2c, %eax
jne 0x28b9a
movq %rbx, %rdi
callq 0x2565a
movq %r12, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x296b0
cmpq $0x0, 0x50(%rsp)
je 0x28b68
movq %rbp, %rdi
movq %r12, %rsi
callq 0x3725c
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x28591
callq 0x1e6ee
cmpl $0x0, 0xd0(%rbx)
jne 0x2852f
leaq 0x60(%rsp), %r14
movq %r14, -0x10(%r14)
movabsq $0x6465746365707845, %rax # imm = 0x6465746365707845
movq %rax, (%r14)
movabsq $0x607d307b60206465, %rax # imm = 0x607D307B60206465
movq %rax, 0x6(%r14)
movq $0xe, -0x8(%r14)
movb $0x0, 0xe(%r14)
leaq 0x80(%rsp), %r15
movq %r15, -0x10(%r15)
movw $0x29, (%r15)
movq $0x1, -0x8(%r15)
leaq 0x90(%rsp), %rdi
leaq 0x70(%rsp), %rsi
leaq 0x10(%rsp), %rcx
movl $0x1, %edx
callq 0x20c5e
leaq 0x30(%rsp), %rdi
leaq 0x50(%rsp), %rsi
leaq 0x90(%rsp), %rdx
callq 0x48694
leaq 0x58(%rbx), %rcx
leaq 0x30(%rsp), %rdx
movq %rbx, %rsi
callq 0x29894
movq %rbx, %rdi
callq 0x2565a
xorps %xmm0, %xmm0
movaps %xmm0, 0x50(%rsp)
movq (%r13), %rdi
callq 0x59cd8
cmpl $0x5, %eax
jne 0x28971
movq (%r13), %rsi
leaq 0x70(%rsp), %rdi
callq 0x6285a
movq (%r13), %rsi
leaq 0x90(%rsp), %rdi
callq 0x6288c
movq 0x90(%rsp), %rdi
callq 0x59cd8
movq 0xa8(%rsp), %r14
leaq 0xc8(%rsp), %r12
cmpl $0x19, %eax
jne 0x28a00
movq 0x90(%rsp), %rsi
leaq 0x30(%rsp), %rdi
callq 0x5b238
leaq 0x5bc79(%rip), %rsi     # 0x84322
leaq 0x30(%rsp), %rdi
callq 0x10110
testl %eax, %eax
jne 0x2871b
leaq 0x2c(%rsp), %r8
movl $0xffffffe6, (%r8)      # imm = 0xFFFFFFE6
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %r12, (%rsp)
leaq 0x10(%rsp), %rsi
leaq 0xf(%rsp), %rdx
leaq 0x70(%rsp), %r9
movq %r15, %rcx
callq 0x38898
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x58(%rsp), %rdi
movaps %xmm0, 0x50(%rsp)
testq %rdi, %rdi
je 0x2870c
callq 0x1e6ee
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x2871b
callq 0x1e6ee
leaq 0x5be2a(%rip), %rsi     # 0x8454c
leaq 0x30(%rsp), %rdi
callq 0x10110
testl %eax, %eax
jne 0x28794
leaq 0x2c(%rsp), %r8
movl $0xffffffda, (%r8)      # imm = 0xFFFFFFDA
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %r12, (%rsp)
leaq 0x10(%rsp), %rsi
leaq 0xf(%rsp), %rdx
leaq 0x70(%rsp), %r9
movq %r15, %rcx
callq 0x38898
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x58(%rsp), %rdi
movaps %xmm0, 0x50(%rsp)
testq %rdi, %rdi
je 0x28785
callq 0x1e6ee
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x28794
callq 0x1e6ee
leaq 0x5be03(%rip), %rsi     # 0x8459e
leaq 0x30(%rsp), %rdi
callq 0x10110
testl %eax, %eax
jne 0x2880d
leaq 0x2c(%rsp), %r8
movl $0xffffffc7, (%r8)      # imm = 0xFFFFFFC7
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %r12, (%rsp)
leaq 0x10(%rsp), %rsi
leaq 0xf(%rsp), %rdx
leaq 0x70(%rsp), %r9
movq %r15, %rcx
callq 0x38898
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x58(%rsp), %rdi
movaps %xmm0, 0x50(%rsp)
testq %rdi, %rdi
je 0x287fe
callq 0x1e6ee
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x2880d
callq 0x1e6ee
leaq 0x5bd79(%rip), %rsi     # 0x8458d
leaq 0x30(%rsp), %rdi
callq 0x10110
testl %eax, %eax
jne 0x28886
leaq 0x2c(%rsp), %r8
movl $0xffffffcc, (%r8)      # imm = 0xFFFFFFCC
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %r12, (%rsp)
leaq 0x10(%rsp), %rsi
leaq 0xf(%rsp), %rdx
leaq 0x70(%rsp), %r9
movq %r15, %rcx
callq 0x38898
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x58(%rsp), %rdi
movaps %xmm0, 0x50(%rsp)
testq %rdi, %rdi
je 0x28877
callq 0x1e6ee
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x28886
callq 0x1e6ee
leaq 0x5bd06(%rip), %rsi     # 0x84593
leaq 0x30(%rsp), %rdi
callq 0x10110
testl %eax, %eax
jne 0x288ff
leaq 0x2c(%rsp), %r8
movl $0xffffffcb, (%r8)      # imm = 0xFFFFFFCB
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %r12, (%rsp)
leaq 0x10(%rsp), %rsi
leaq 0xf(%rsp), %rdx
leaq 0x70(%rsp), %r9
movq %r15, %rcx
callq 0x38898
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x58(%rsp), %rdi
movaps %xmm0, 0x50(%rsp)
testq %rdi, %rdi
je 0x288f0
callq 0x1e6ee
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x288ff
callq 0x1e6ee
leaq 0x2c(%rsp), %r8
movb $0x1, (%r8)
leaq 0x10(%rsp), %rdi
leaq 0x50(%rsp), %rcx
movq %rbx, %rsi
movq %r15, %rdx
callq 0x28276
movaps 0x10(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x10(%rsp)
movq 0x58(%rsp), %rdi
movaps %xmm0, 0x50(%rsp)
testq %rdi, %rdi
je 0x2893e
callq 0x1e6ee
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x2894d
callq 0x1e6ee
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x28aa3
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x28aa3
leaq 0x38(%rsp), %rdi
movq $0x0, -0x8(%rdi)
leaq 0xc8(%rsp), %rax
movq %rax, (%rsp)
leaq 0x30(%rsp), %rsi
leaq 0x70(%rsp), %rdx
leaq 0xb0(%rsp), %r9
movq %r15, %rcx
movq %r13, %r8
callq 0x38c9a
movaps 0x30(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x30(%rsp)
movq 0x58(%rsp), %rdi
movaps %xmm0, 0x50(%rsp)
testq %rdi, %rdi
movq 0xa8(%rsp), %r14
je 0x289d0
callq 0x1e6ee
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x289df
callq 0x1e6ee
leaq 0x30(%rsp), %r8
movb $0x1, (%r8)
leaq 0x50(%rsp), %rcx
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x28276
jmp 0x28ae0
leaq 0x58(%rbx), %rax
leaq 0x18(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %rax, (%rsp)
leaq 0x10(%rsp), %rsi
leaq 0x2c(%rsp), %rdx
leaq 0x70(%rsp), %r8
leaq 0x90(%rsp), %r9
movq %r15, %rcx
callq 0x3892a
leaq 0x38(%rsp), %rdi
movq $0x0, -0x8(%rdi)
movq %r12, (%rsp)
leaq 0x30(%rsp), %rsi
leaq 0x2c(%rsp), %rdx
leaq 0x10(%rsp), %r8
leaq 0xb0(%rsp), %r9
movq %r15, %rcx
callq 0x38aac
movaps 0x30(%rsp), %xmm0
xorps %xmm1, %xmm1
movaps %xmm1, 0x30(%rsp)
movq 0x58(%rsp), %rdi
movaps %xmm0, 0x50(%rsp)
testq %rdi, %rdi
je 0x28a85
callq 0x1e6ee
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x28a94
callq 0x1e6ee
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x28aa3
callq 0x1e6ee
leaq 0x30(%rsp), %r8
movb $0x1, (%r8)
leaq 0x50(%rsp), %rcx
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x28276
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x28ad1
callq 0x1e6ee
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x28ae0
callq 0x1e6ee
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x28aef
callq 0x1e6ee
leaq 0xb0(%rsp), %rdi
callq 0x37214
movq 0x120(%rsp), %rdi
leaq 0x130(%rsp), %rax
cmpq %rax, %rdi
je 0x28b21
movq 0x130(%rsp), %rsi
incq %rsi
callq 0x103d0
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0x28b46
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x103d0
leaq 0xc8(%rsp), %rdi
callq 0x1d736
movq %r14, %rax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x40(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x5bcfa(%rip), %rsi     # 0x84872
leaq 0x5bd0e(%rip), %rdx     # 0x8488d
leaq 0x30(%rsp), %rdi
callq 0x1e7ca
leaq 0x58(%rbx), %rcx
leaq 0x30(%rsp), %rdx
movq %rbx, %rsi
callq 0x29894
leaq 0x60(%rsp), %r14
movq %r14, -0x10(%r14)
movabsq $0x6465746365707845, %rax # imm = 0x6465746365707845
movq %rax, (%r14)
movabsq $0x607d307b60206465, %rax # imm = 0x607D307B60206465
movq %rax, 0x6(%r14)
movq $0xe, -0x8(%r14)
movb $0x0, 0xe(%r14)
leaq 0x80(%rsp), %r15
movq %r15, -0x10(%r15)
movw $0x2c, (%r15)
movq $0x1, -0x8(%r15)
leaq 0x90(%rsp), %rdi
leaq 0x70(%rsp), %rsi
leaq 0x10(%rsp), %rcx
movl $0x1, %edx
callq 0x20c5e
leaq 0x30(%rsp), %rdi
leaq 0x50(%rsp), %rsi
leaq 0x90(%rsp), %rdx
callq 0x48694
leaq 0x58(%rbx), %rcx
leaq 0x30(%rsp), %rdx
movq %rbx, %rsi
callq 0x29894
leaq 0x5be9e(%rip), %rdi     # 0x84ace
movq %rbp, %rsi
xorl %eax, %eax
callq 0x105d0
jmp 0x28c44
jmp 0x28c44
jmp 0x28c44
jmp 0x28c44
jmp 0x28c44
movq %rax, %rbx
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x28c81
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x28c81
movq %rax, %rbx
movq 0x18(%rsp), %rdi
testq %rdi, %rdi
je 0x28c81
callq 0x1e6ee
jmp 0x28c81
jmp 0x28c7e
jmp 0x28c7e
jmp 0x28c7e
movq %rax, %rbx
movq 0x98(%rsp), %rdi
testq %rdi, %rdi
je 0x28c9d
callq 0x1e6ee
jmp 0x28c9d
jmp 0x28da3
movq %rax, %rbx
movq 0x78(%rsp), %rdi
testq %rdi, %rdi
je 0x28da6
callq 0x1e6ee
jmp 0x28da6
jmp 0x28da3
jmp 0x28da3
jmp 0x28da3
jmp 0x28d9e
movq %rax, %rbx
jmp 0x28dc2
movq %rax, %rbx
movq 0xf0(%rsp), %rdi
leaq 0x100(%rsp), %rax
cmpq %rax, %rdi
je 0x28cfe
movq 0x100(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x28cfe
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x1d736
jmp 0x28dcf
jmp 0x28d14
jmp 0x28d34
movq %rax, %rbx
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x28d37
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x28d37
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x1dca2
jmp 0x28d69
jmp 0x28d66
movq %rax, %rbx
movq 0x30(%rsp), %rdi
cmpq %r14, %rdi
je 0x28da6
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x28da6
jmp 0x28da3
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0x28d83
movq 0x80(%rsp), %rsi
incq %rsi
callq 0x103d0
movq 0x50(%rsp), %rdi
cmpq %r14, %rdi
je 0x28db5
movq 0x60(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x28db5
jmp 0x28d9e
movq %rax, %rbx
jmp 0x28db5
movq %rax, %rbx
movq 0x58(%rsp), %rdi
testq %rdi, %rdi
je 0x28db5
callq 0x1e6ee
leaq 0xb0(%rsp), %rdi
callq 0x37214
leaq 0xc8(%rsp), %rdi
callq 0x211f6
movq %rbx, %rdi
callq 0x106f0
nop