// File: /workspace/github_cpp_makefile_star2_O2/Nallantli[P]Rossa/main/rossa/node_parser/node_parser.cpp
// Function: node_parser_t::parseEachNode(std::vector<node_scope_t, std::allocator<node_scope_t>>*)
ptr_node_t node_parser_t::parseEachNode(std::vector<node_scope_t> *scopes)
{
	auto marker = currentToken;
	scopes->push_back({ROSSA_HASH("<EACH@" + std::to_string(scope_i++) + ">")});
	nextToken();
	auto id = ROSSA_HASH(currentToken.valueString);
	nextToken();
	if (currentToken.type != TOK_IN)
		return logErrorN(util::format(_EXPECTED_ERROR_, {KEYWORD_IN}), currentToken);
	nextToken();
	auto eachs = parseEquNode(scopes);
	ptr_node_t wheres = nullptr;
	ptr_node_t body = nullptr;

	if (currentToken.type == TOK_WHERE)
	{
		nextToken();
		if (currentToken.type == '{')
		{
			nextToken();
			std::vector<ptr_node_t> where_body;
			while (currentToken.type != NULL_TOK)
			{
				if (currentToken.type == '}')
					break;

				if (auto e = parseExprNode(scopes))
					where_body.push_back(e);
				else
					return logErrorN(_FAILURE_PARSE_CODE_, currentToken);
			}
			if (currentToken.type != '}')
				return logErrorN(util::format(_EXPECTED_ERROR_, {"}"}), currentToken);
			nextToken();
			wheres = std::make_shared<VectorNode>(*scopes, where_body, true, marker);
		}
		else
		{
			wheres = parseEquNode(scopes);
			if (!wheres)
				return logErrorN(_FAILURE_PARSE_CODE_, currentToken);
		}
	}

	if (currentToken.type == TOK_DO)
	{
		nextToken();
		if (currentToken.type == '{')
		{
			nextToken();
			std::vector<ptr_node_t> body_body;
			while (currentToken.type != NULL_TOK)
			{
				if (currentToken.type == '}')
					break;

				if (auto e = parseExprNode(scopes))
					body_body.push_back(e);
				else
					return logErrorN(_FAILURE_PARSE_CODE_, currentToken);
			}
			if (currentToken.type != '}')
				return logErrorN(util::format(_EXPECTED_ERROR_, {"}"}), currentToken);
			nextToken();
			body = std::make_shared<VectorNode>(*scopes, body_body, true, marker);
		}
		else
		{
			body = parseEquNode(scopes);
			if (!body)
				return logErrorN(_FAILURE_PARSE_CODE_, currentToken);
		}
	}

	scopes->pop_back();
	return std::make_shared<EachNode>(*scopes, id, eachs, wheres, body, marker);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x178, %rsp            # imm = 0x178
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %r15
leaq 0x58(%rsi), %rbp
leaq 0xf8(%rsp), %rbx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x1f71a
movq (%r14), %rsi
leaq 0x1(%rsi), %rax
movq %rax, (%r14)
leaq 0x60(%rsp), %rdi
callq 0x2ecd6
leaq 0x4b7b3(%rip), %rsi     # 0x76a91
leaq 0x80(%rsp), %rdi
leaq 0x60(%rsp), %rdx
callq 0x1ca9c
leaq 0x4b077(%rip), %rdx     # 0x7636e
leaq 0x40(%rsp), %rdi
leaq 0x80(%rsp), %rsi
callq 0x1ca7d
leaq 0x8b5f8(%rip), %rdi     # 0xb6908
leaq 0x40(%rsp), %rsi
callq 0x1efb0
leaq 0x18(%rsp), %r13
movq %rax, -0x8(%r13)
xorps %xmm0, %xmm0
movups %xmm0, (%r13)
andq $0x0, 0x10(%r13)
leaq 0x10(%rsp), %rsi
movq %r12, %rdi
callq 0x1fe52
movq %r13, %rdi
callq 0x1f5c4
leaq 0x40(%rsp), %rdi
callq 0x101d0
leaq 0x80(%rsp), %rdi
callq 0x101d0
leaq 0x60(%rsp), %rdi
callq 0x101d0
movq %r14, %rdi
callq 0x22e24
leaq 0xb0(%r14), %rsi
leaq 0x8b58c(%rip), %rdi     # 0xb6908
callq 0x1efb0
movq %rax, 0xf0(%rsp)
movq %r14, %rdi
callq 0x22e24
cmpl $-0x8, 0xd0(%r14)
jne 0x2b845
movq %r14, %rdi
callq 0x22e24
leaq 0xc8(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x25798
xorps %xmm0, %xmm0
movaps %xmm0, 0xa0(%rsp)
movaps %xmm0, 0xb0(%rsp)
movl 0xd0(%r14), %eax
cmpl $-0x3f, %eax
jne 0x2b526
movq %r14, %rdi
callq 0x22e24
cmpl $0x7b, 0xd0(%r14)
jne 0x2b45d
movq %r14, %rdi
callq 0x22e24
movq %rbp, 0x38(%rsp)
leaq 0x60(%rsp), %rbx
andq $0x0, 0x10(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rbx)
leaq 0x48(%rsp), %rbp
leaq 0x40(%rsp), %r13
movl 0xd0(%r14), %eax
cmpl $0x7d, %eax
je 0x2b4c2
testl %eax, %eax
je 0x2b705
movq %r13, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x23390
cmpq $0x0, 0x40(%rsp)
je 0x2b77a
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2e880
movq %rbp, %rdi
callq 0x1d786
jmp 0x2b416
movq %rbx, %r13
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x25798
leaq 0xa0(%rsp), %rbx
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x30b82
leaq 0x18(%rsp), %rdi
callq 0x1d786
cmpq $0x0, (%rbx)
movq %r13, %rbx
jne 0x2b51f
leaq 0x4b497(%rip), %rsi     # 0x7693a
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x1c814
leaq 0x10(%rsp), %rdx
movq %r14, %rsi
movq %rbp, %rcx
callq 0x25932
movq %r14, %rdi
callq 0x22e24
leaq 0x40(%rsp), %rcx
movb $0x1, (%rcx)
leaq 0x10(%rsp), %rdi
leaq 0x60(%rsp), %rdx
leaq 0xf8(%rsp), %r8
movq %r12, %rsi
callq 0x2e811
movq 0x38(%rsp), %rbp
leaq 0xf8(%rsp), %rbx
leaq 0xa0(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x34dfc
leaq 0x18(%rsp), %rdi
callq 0x1d786
leaq 0x60(%rsp), %rdi
callq 0x2e838
movl 0xd0(%r14), %eax
cmpl $-0xa, %eax
jne 0x2b668
movq %r14, %rdi
callq 0x22e24
cmpl $0x7b, 0xd0(%r14)
jne 0x2b5af
movq %r14, %rdi
callq 0x22e24
movq %rbp, 0x38(%rsp)
leaq 0x60(%rsp), %rbx
andq $0x0, 0x10(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rbx)
leaq 0x48(%rsp), %rbp
leaq 0x40(%rsp), %r13
movl 0xd0(%r14), %eax
cmpl $0x7d, %eax
je 0x2b610
testl %eax, %eax
je 0x2b7a5
movq %r13, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x23390
cmpq $0x0, 0x40(%rsp)
je 0x2b81a
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2e880
movq %rbp, %rdi
callq 0x1d786
jmp 0x2b568
movq %rbx, %r13
leaq 0x10(%rsp), %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x25798
leaq 0xb0(%rsp), %rbx
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x30b82
leaq 0x18(%rsp), %rdi
callq 0x1d786
cmpq $0x0, (%rbx)
movq %r13, %rbx
jne 0x2b668
leaq 0x4b349(%rip), %rsi     # 0x7693a
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rdx
callq 0x1c814
leaq 0x10(%rsp), %rdx
movq %r14, %rsi
movq %rbp, %rcx
callq 0x25932
movq %r14, %rdi
callq 0x22e24
leaq 0x40(%rsp), %rcx
movb $0x1, (%rcx)
leaq 0x10(%rsp), %rdi
leaq 0x60(%rsp), %rdx
leaq 0xf8(%rsp), %r8
movq %r12, %rsi
callq 0x2e811
leaq 0xf8(%rsp), %rbx
leaq 0xb0(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x34dfc
leaq 0x18(%rsp), %rdi
callq 0x1d786
leaq 0x60(%rsp), %rdi
callq 0x2e838
movq %r12, %rdi
callq 0x2eb8e
movq %rbx, (%rsp)
leaq 0x10(%rsp), %rdi
leaq 0xf0(%rsp), %rdx
leaq 0xc8(%rsp), %rcx
leaq 0xa0(%rsp), %r8
leaq 0xb0(%rsp), %r9
movq %r12, %rsi
callq 0x2f1a8
leaq 0x18(%rsp), %rdi
movaps -0x8(%rdi), %xmm0
andq $0x0, (%rdi)
movups %xmm0, (%r15)
andq $0x0, -0x8(%rdi)
callq 0x1d786
leaq 0xb8(%rsp), %rdi
callq 0x1d786
leaq 0xa8(%rsp), %rdi
callq 0x1d786
leaq 0xd0(%rsp), %rdi
callq 0x1d786
leaq 0xf8(%rsp), %rdi
callq 0x1df38
movq %r15, %rax
addq $0x178, %rsp            # imm = 0x178
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4b198(%rip), %rsi     # 0x768a4
leaq 0x40(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x1c814
leaq 0x4f19f(%rip), %rsi     # 0x7a8c1
leaq 0x80(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x1c814
leaq 0xd8(%rsp), %rdi
leaq 0x80(%rsp), %rsi
pushq $0x1
popq %rdx
leaq 0xd(%rsp), %rcx
callq 0x1f298
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
callq 0x3f724
leaq 0x10(%rsp), %rdx
movq %r14, %rsi
movq 0x38(%rsp), %rcx
callq 0x25932
leaq 0x4b1b9(%rip), %rsi     # 0x7693a
leaq 0x10(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0x1c814
leaq 0x10(%rsp), %rdx
movq %r14, %rsi
movq 0x38(%rsp), %rcx
callq 0x25932
leaq 0x4b0f8(%rip), %rsi     # 0x768a4
leaq 0x40(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x1c814
leaq 0x4f0ff(%rip), %rsi     # 0x7a8c1
leaq 0x80(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x1c814
leaq 0xd8(%rsp), %rdi
leaq 0x80(%rsp), %rsi
pushq $0x1
popq %rdx
leaq 0xd(%rsp), %rcx
callq 0x1f298
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rsi
leaq 0xd8(%rsp), %rdx
callq 0x3f724
leaq 0x10(%rsp), %rdx
movq %r14, %rsi
movq 0x38(%rsp), %rcx
callq 0x25932
leaq 0x4b119(%rip), %rsi     # 0x7693a
leaq 0x10(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0x1c814
leaq 0x10(%rsp), %rdx
movq %r14, %rsi
movq 0x38(%rsp), %rcx
callq 0x25932
leaq 0x4b058(%rip), %rsi     # 0x768a4
leaq 0x40(%rsp), %rdi
leaq 0xd8(%rsp), %rdx
callq 0x1c814
leaq 0x4acbc(%rip), %rsi     # 0x76521
leaq 0x80(%rsp), %rdi
leaq 0xc8(%rsp), %rdx
callq 0x1c814
leaq 0x60(%rsp), %rdi
leaq 0x80(%rsp), %rsi
pushq $0x1
popq %rdx
leaq 0xa0(%rsp), %rcx
callq 0x1f298
leaq 0x10(%rsp), %rdi
leaq 0x40(%rsp), %rsi
leaq 0x60(%rsp), %rdx
callq 0x3f724
leaq 0x10(%rsp), %rdx
movq %r14, %rsi
movq %rbp, %rcx
callq 0x25932
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x101d0
jmp 0x2b8cd
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x1cea0
jmp 0x2b8fa
jmp 0x2b8e0
jmp 0x2b9b1
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x101d0
jmp 0x2ba03
jmp 0x2b9b1
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x101d0
jmp 0x2b92a
jmp 0x2b9f6
jmp 0x2b9f6
jmp 0x2b9f6
jmp 0x2b9f6
jmp 0x2b9b1
jmp 0x2b9b1
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
jmp 0x2b9a8
jmp 0x2b935
jmp 0x2b944
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x101d0
jmp 0x2b947
movq %rax, %rbx
leaq 0xd8(%rsp), %rdi
callq 0x1cea0
jmp 0x2b95d
jmp 0x2b9c7
jmp 0x2b95a
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x101d0
jmp 0x2b9bb
jmp 0x2b9b1
jmp 0x2b9c7
jmp 0x2b9c7
movq %rax, %rbx
movq %r13, %rdi
callq 0x1f5c4
jmp 0x2b982
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x101d0
jmp 0x2b991
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x101d0
jmp 0x2b9a3
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x101d0
jmp 0x2ba2a
jmp 0x2b9c7
movq %rax, %rbx
jmp 0x2ba03
jmp 0x2b9b8
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x101d0
jmp 0x2b9f9
movq %rax, %rbx
jmp 0x2ba2a
jmp 0x2b9d2
jmp 0x2b9e9
jmp 0x2b9f6
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x101d0
jmp 0x2b9ec
jmp 0x2b9e9
jmp 0x2b9f6
jmp 0x2b9e9
jmp 0x2b9f6
movq %rax, %rbx
movq %rbp, %rdi
callq 0x1d786
jmp 0x2b9f9
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x2e838
leaq 0xb8(%rsp), %rdi
callq 0x1d786
leaq 0xa8(%rsp), %rdi
callq 0x1d786
leaq 0xd0(%rsp), %rdi
callq 0x1d786
leaq 0xf8(%rsp), %rdi
callq 0x1df38
movq %rbx, %rdi
callq 0x106f0
nop