// File: /workspace/github_cpp_makefile_star2_O2/Nallantli[P]Rossa/main/rossa/node_parser/node_parser.cpp
// Function: node_parser_t::parseSigNode(std::vector<node_scope_t, std::allocator<node_scope_t>>*)
std::pair<signature_t, std::vector<std::pair<bool, hash_ull>>> node_parser_t::parseSigNode(std::vector<node_scope_t> *scopes)
{
	if (currentToken.type != '(')
		return logErrorSN(util::format(_EXPECTED_ERROR_, {"("}), currentToken);
	nextToken();

	if (currentToken.type == TOK_VAR_ARGS)
	{
		nextToken();
		if (currentToken.type != ')')
			return logErrorSN(util::format(_EXPECTED_ERROR_, {")"}), currentToken);
		nextToken();
		return {signature_t(), {{true, static_cast<hash_ull>(0)}}};
	}

	std::vector<std::pair<bool, hash_ull>> args;
	std::vector<parameter_t> types;

	int i = 0;
	while (currentToken.type != NULL_TOK && currentToken.type != ')')
	{
		if (i > 0)
		{
			if (currentToken.type != ',')
				return logErrorSN(util::format(_EXPECTED_ERROR_, {","}), currentToken);
			nextToken();
		}
		i++;

		int type = currentToken.type == TOK_REF;
		if (type)
		{
			nextToken();
		}
		std::string arg;

		if (currentToken.type == TOK_IDF)
			arg = currentToken.valueString;
		else
			return logErrorSN("Expected variable identifier", currentToken);
		nextToken();

		parameter_t pt({}, {value_type_enum::ANY});
		if (currentToken.type == ':')
		{
			aug_type_t ftype = {value_type_enum::ANY};
			nextToken();
			switch (currentToken.type)
			{
			case TOK_BOOLEAN:
				ftype = {value_type_enum::BOOLEAN_D};
				nextToken();
				break;
			case TOK_NUMBER:
				ftype = {value_type_enum::NUMBER};
				nextToken();
				break;
			case TOK_ARRAY:
				ftype = {value_type_enum::ARRAY};
				nextToken();
				break;
			case TOK_STRING:
				ftype = {value_type_enum::STRING};
				nextToken();
				break;
			case TOK_DICTIONARY:
				ftype = {value_type_enum::DICTIONARY};
				nextToken();
				break;
			case TOK_OBJECT:
				ftype = {value_type_enum::OBJECT};
				nextToken();
				break;
			case TOK_FUNCTION:
				ftype = {value_type_enum::FUNCTION};
				nextToken();
				break;
			case TOK_POINTER:
				ftype = {value_type_enum::POINTER};
				nextToken();
				break;
			case TOK_ANY:
				nextToken();
				break;
			case TOK_TYPE_NAME:
				ftype = {value_type_enum::TYPE_NAME};
				nextToken();
				break;
			case TOK_IDF:
			{
				ftype = {};
				while (currentToken.type == TOK_IDF)
				{
					ftype.push_back(ROSSA_HASH(currentToken.valueString));
					nextToken();
					if (currentToken.type != TOK_INNER)
						break;
					nextToken();
				}
				break;
			}
			default:
				return logErrorSN(_EXPECTED_BASE_TYPE_, currentToken);
			}
			if (currentToken.valueString == "<")
			{
				pt = parseParamTypeNode(scopes, ftype);
			}
			else
			{
				pt = parameter_t({}, ftype);
			}
		}

		args.push_back({type, ROSSA_HASH(arg)});
		types.push_back(pt);

		scopes->back().var_ids.push_back(ROSSA_HASH(arg));

		if (currentToken.type == NULL_TOK)
			return logErrorSN(util::format(_EXPECTED_ERROR_, {")"}), currentToken);
	}
	nextToken();

	return {types, args};
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movq %rdx, 0xd0(%rsp)
leaq 0x58(%rsi), %rbx
cmpl $0x28, 0xd0(%rsi)
movq %rsi, 0x10(%rsp)
jne 0x26dae
movq %rsi, %r14
movq %rdi, %r15
movq %rsi, %rdi
callq 0x22e24
movl 0xd0(%r14), %ebp
cmpl $-0x3d, %ebp
jne 0x267db
movq %r14, %rdi
callq 0x22e24
cmpl $0x29, 0xd0(%r14)
jne 0x26e2c
movq %r14, %rdi
callq 0x22e24
leaq 0xd8(%rsp), %rdi
callq 0x380a8
leaq 0x70(%rsp), %rsi
movb $0x1, (%rsi)
andq $0x0, 0x8(%rsi)
leaq 0x20(%rsp), %rdi
pushq $0x1
popq %rdx
leaq 0x90(%rsp), %rcx
callq 0x2ea62
leaq 0xd8(%rsp), %rsi
leaq 0x20(%rsp), %rdx
movq %r15, %rdi
callq 0x2ea9c
leaq 0x20(%rsp), %rdi
callq 0x1dfbc
leaq 0xd8(%rsp), %rdi
callq 0x2eb6c
jmp 0x26c6f
movq %r15, 0x158(%rsp)
movq %rbx, 0x68(%rsp)
xorps %xmm0, %xmm0
leaq 0x140(%rsp), %rax
andq $0x0, 0x10(%rax)
leaq 0x120(%rsp), %rcx
andq $0x0, 0x10(%rcx)
movaps %xmm0, (%rax)
movaps %xmm0, (%rcx)
leaq 0xb0(%r14), %rbx
xorl %r15d, %r15d
leaq 0x90(%rsp), %r13
testl %ebp, %ebp
je 0x26c2d
cmpl $0x29, %ebp
je 0x26c2d
testl %r15d, %r15d
je 0x2684b
cmpl $0x2c, %ebp
jne 0x26d31
movq %r14, %rdi
callq 0x22e24
movl 0xd0(%r14), %ebp
movl %ebp, %eax
cmpl $-0x28, %ebp
jne 0x26861
movq %r14, %rdi
callq 0x22e24
movl 0xd0(%r14), %eax
leaq 0x80(%rsp), %rcx
movq %rcx, 0x70(%rsp)
andq $0x0, 0x78(%rsp)
movb $0x0, 0x80(%rsp)
cmpl $-0x2, %eax
jne 0x26c84
leaq 0x70(%rsp), %rdi
movq %rbx, %rsi
callq 0x10220
movq %r14, %rdi
callq 0x22e24
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
andq $0x0, 0x30(%rsp)
movq $-0xb, 0xb0(%rsp)
movq %r13, %rdi
leaq 0xb0(%rsp), %rsi
pushq $0x1
popq %rdx
leaq 0x160(%rsp), %rcx
callq 0x2e9c0
leaq 0xd8(%rsp), %rdi
leaq 0x20(%rsp), %r12
movq %r12, %rsi
movq %r13, %rdx
callq 0x36e60
movq %r13, %rdi
callq 0x2fa2a
movq %r12, %rdi
callq 0x2e99e
cmpl $0x3a, 0xd0(%r14)
jne 0x26b81
movq $-0xb, 0x20(%rsp)
movq %r13, %rdi
leaq 0x20(%rsp), %rsi
pushq $0x1
popq %rdx
leaq 0xb0(%rsp), %rcx
callq 0x2e9c0
movq %r14, %rdi
callq 0x22e24
movl 0xd0(%r14), %eax
leal 0x23(%rax), %ecx
cmpl $0xe, %ecx
ja 0x2696d
leaq 0x4fdb8(%rip), %rdx     # 0x766fc
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movq $-0x6, 0x20(%rsp)
movq %r13, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x3152c
jmp 0x26ac9
cmpl $-0x2e, %eax
je 0x26aae
cmpl $-0x2, %eax
jne 0x26eaa
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3152c
cmpl $-0x2, 0xd0(%r14)
jne 0x26ad1
leaq 0x8ff68(%rip), %rdi     # 0xb6908
movq %rbx, %rsi
callq 0x1efb0
movq %rax, 0x20(%rsp)
movq %r13, %rdi
leaq 0x20(%rsp), %rsi
callq 0x31648
movq %r14, %rdi
callq 0x22e24
cmpl $-0x27, 0xd0(%r14)
jne 0x26ad1
movq %r14, %rdi
callq 0x22e24
jmp 0x2698b
movq $-0x7, 0x20(%rsp)
movq %r13, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x3152c
jmp 0x26ac9
movq $-0x2, 0x20(%rsp)
movq %r13, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x3152c
jmp 0x26ac9
movq $-0x8, 0x20(%rsp)
movq %r13, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x3152c
jmp 0x26ac9
movq $-0x4, 0x20(%rsp)
movq %r13, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x3152c
jmp 0x26ac9
movq $-0x3, 0x20(%rsp)
movq %r13, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x3152c
jmp 0x26ac9
movq $-0x9, 0x20(%rsp)
movq %r13, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x3152c
jmp 0x26ac9
movq $-0x5, 0x20(%rsp)
movq %r13, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x3152c
jmp 0x26ac9
movq $-0xa, 0x20(%rsp)
movq %r13, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x28(%rsp), %rdx
callq 0x3152c
movq %r14, %rdi
callq 0x22e24
movq %rbx, %rdi
leaq 0x4f8ca(%rip), %rsi     # 0x763a5
callq 0x1c7a0
testb %al, %al
je 0x26b19
leaq 0x20(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq 0xd0(%rsp), %rdx
movq %r13, %rcx
callq 0x26278
leaq 0xd8(%rsp), %rdi
movq %r12, %rsi
callq 0x2ead2
movq %r12, %rdi
callq 0x2e9f6
jmp 0x26b79
movq %r15, %r12
movq %r13, %rdx
movq %rbx, %r15
xorps %xmm0, %xmm0
movaps %xmm0, 0xb0(%rsp)
andq $0x0, 0xc0(%rsp)
leaq 0x20(%rsp), %r14
movq %r14, %rdi
leaq 0xb0(%rsp), %rbx
movq %rbx, %rsi
callq 0x36e60
leaq 0xd8(%rsp), %rdi
movq %r14, %rsi
callq 0x2ead2
movq %r14, %rdi
callq 0x2e9f6
movq %rbx, %rdi
callq 0x2e99e
movq %r15, %rbx
movq %r12, %r15
movq 0x10(%rsp), %r14
movq %r13, %rdi
callq 0x2fa2a
leaq 0x8fd80(%rip), %rdi     # 0xb6908
leaq 0x70(%rsp), %rsi
callq 0x1efb0
cmpl $-0x28, %ebp
sete 0x20(%rsp)
movq %rax, 0x28(%rsp)
leaq 0x140(%rsp), %rdi
leaq 0x20(%rsp), %rsi
callq 0x31802
leaq 0x120(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x2eb0a
movq 0xd0(%rsp), %rax
movq 0x8(%rax), %rbp
leaq 0x8fd2f(%rip), %rdi     # 0xb6908
leaq 0x70(%rsp), %rsi
callq 0x1efb0
addq $-0x18, %rbp
movq %rax, 0x20(%rsp)
movq %rbp, %rdi
leaq 0x20(%rsp), %rsi
callq 0x31afa
cmpl $0x0, 0xd0(%r14)
je 0x26cb4
incl %r15d
leaq 0xd8(%rsp), %rdi
callq 0x2e9f6
leaq 0x70(%rsp), %rdi
callq 0x101d0
movl 0xd0(%r14), %ebp
jmp 0x2681d
movq %r14, %rdi
callq 0x22e24
movq 0x158(%rsp), %r15
leaq 0x120(%rsp), %rsi
leaq 0x140(%rsp), %rdx
movq %r15, %rdi
callq 0x2eb36
leaq 0x120(%rsp), %rdi
callq 0x2eb6c
leaq 0x140(%rsp), %rdi
callq 0x1dfbc
movq %r15, %rax
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4fc7b(%rip), %rsi     # 0x76906
leaq 0xd8(%rsp), %rdi
leaq 0x20(%rsp), %rdx
callq 0x1c814
leaq 0xd8(%rsp), %rdx
movq 0x10(%rsp), %rsi
movq 0x68(%rsp), %rcx
callq 0x270d2
leaq 0x4fbe9(%rip), %rsi     # 0x768a4
leaq 0x90(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x1c814
leaq 0x5165d(%rip), %rsi     # 0x78331
leaq 0xb0(%rsp), %rdi
leaq 0x1f(%rsp), %rdx
callq 0x1c814
leaq 0x160(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
pushq $0x1
popq %rdx
leaq 0x1e(%rsp), %rcx
callq 0x1f298
leaq 0x20(%rsp), %rdi
leaq 0x90(%rsp), %rsi
leaq 0x160(%rsp), %rdx
callq 0x3f724
leaq 0x20(%rsp), %rdx
movq 0x10(%rsp), %rsi
movq 0x68(%rsp), %rcx
callq 0x270d2
leaq 0x4fb6c(%rip), %rsi     # 0x768a4
leaq 0x20(%rsp), %rdi
leaq 0xb0(%rsp), %rdx
callq 0x1c814
leaq 0x4fdb3(%rip), %rsi     # 0x76b04
leaq 0x70(%rsp), %rdi
leaq 0x160(%rsp), %rdx
callq 0x1c814
leaq 0x90(%rsp), %rdi
leaq 0x70(%rsp), %rsi
pushq $0x1
popq %rdx
leaq 0xf(%rsp), %rcx
callq 0x1f298
leaq 0xd8(%rsp), %rdi
leaq 0x20(%rsp), %rsi
leaq 0x90(%rsp), %rdx
callq 0x3f724
leaq 0xd8(%rsp), %rdx
movq 0x10(%rsp), %rsi
movq 0x68(%rsp), %rcx
callq 0x270d2
leaq 0x4faef(%rip), %rsi     # 0x768a4
leaq 0x20(%rsp), %rdi
leaq 0xb0(%rsp), %rdx
callq 0x1c814
leaq 0x4f3dc(%rip), %rsi     # 0x761aa
leaq 0x70(%rsp), %rdi
leaq 0x140(%rsp), %rdx
callq 0x1c814
leaq 0x90(%rsp), %rdi
leaq 0x70(%rsp), %rsi
pushq $0x1
popq %rdx
leaq 0x120(%rsp), %rcx
callq 0x1f298
leaq 0xd8(%rsp), %rdi
leaq 0x20(%rsp), %rsi
leaq 0x90(%rsp), %rdx
callq 0x3f724
leaq 0xd8(%rsp), %rdx
movq 0x10(%rsp), %rsi
movq %rbx, %rcx
callq 0x270d2
leaq 0x4fa71(%rip), %rsi     # 0x768a4
leaq 0x20(%rsp), %rdi
leaq 0xb0(%rsp), %rdx
callq 0x1c814
leaq 0x514e5(%rip), %rsi     # 0x78331
leaq 0x70(%rsp), %rdi
leaq 0x140(%rsp), %rdx
callq 0x1c814
leaq 0x90(%rsp), %rdi
leaq 0x70(%rsp), %rsi
pushq $0x1
popq %rdx
leaq 0x120(%rsp), %rcx
callq 0x1f298
leaq 0xd8(%rsp), %rdi
leaq 0x20(%rsp), %rsi
leaq 0x90(%rsp), %rdx
callq 0x3f724
leaq 0xd8(%rsp), %rdx
movq 0x10(%rsp), %rsi
movq %rbx, %rcx
callq 0x270d2
leaq 0x4fa1e(%rip), %rsi     # 0x768cf
leaq 0x20(%rsp), %rdi
leaq 0xb0(%rsp), %rdx
callq 0x1c814
leaq 0x20(%rsp), %rdx
movq 0x10(%rsp), %rsi
movq 0x68(%rsp), %rcx
callq 0x270d2
jmp 0x26edd
jmp 0x26eef
jmp 0x26f03
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x101d0
jmp 0x26ef2
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x1cea0
jmp 0x26f06
jmp 0x26f2e
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x101d0
jmp 0x26f31
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x101d0
jmp 0x2707f
jmp 0x2707c
jmp 0x26fd6
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x101d0
jmp 0x270c4
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x101d0
jmp 0x26f55
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x1cea0
jmp 0x26fe1
jmp 0x2707c
jmp 0x2707c
jmp 0x2707c
jmp 0x2707c
jmp 0x2707c
jmp 0x2707c
jmp 0x2707c
jmp 0x2707c
jmp 0x2707c
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x101d0
jmp 0x26fa3
movq %rax, %rbx
leaq 0x160(%rsp), %rdi
callq 0x1cea0
jmp 0x26ff0
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x1dfbc
jmp 0x26fc4
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x2eb6c
jmp 0x270c4
movq %rax, %rbx
jmp 0x270c4
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x101d0
jmp 0x27004
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x101d0
jmp 0x27025
jmp 0x27050
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
jmp 0x270a5
jmp 0x2707c
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x2e99e
jmp 0x2707f
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x101d0
jmp 0x27093
jmp 0x27050
jmp 0x27090
jmp 0x27090
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x101d0
jmp 0x270a0
jmp 0x270cc
jmp 0x27050
movq %rax, %rbx
jmp 0x270aa
jmp 0x2707c
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x2fa2a
jmp 0x2706e
jmp 0x27090
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x2e99e
jmp 0x270a0
jmp 0x2707c
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x2fa2a
jmp 0x27093
jmp 0x27090
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x2e9f6
leaq 0x70(%rsp), %rdi
callq 0x101d0
leaq 0x120(%rsp), %rdi
callq 0x2eb6c
leaq 0x140(%rsp), %rdi
callq 0x1dfbc
movq %rbx, %rdi
callq 0x106f0
movq %rax, %rbx
jmp 0x270a0
nop