// File: /workspace/github_cpp_makefile_star2_O2/Nallantli[P]Rossa/main/rossa/node_parser/node_parser.cpp
// Function: node_parser_t::parseIfElseNode(std::vector<node_scope_t, std::allocator<node_scope_t>>*)
ptr_node_t node_parser_t::parseIfElseNode(std::vector<node_scope_t> *scopes)
{
	scopes->push_back({ROSSA_HASH("<IFS@" + std::to_string(scope_i++) + ">")});
	nextToken();
	auto ifs = parseEquNode(scopes);
	if (!ifs)
		return nullptr;
	if (currentToken.type != TOK_THEN)
		return logErrorN(util::format(_EXPECTED_ERROR_, {KEYWORD_THEN}), currentToken);

	auto marker = currentToken;

	nextToken();
	if (currentToken.type != '{')
		return logErrorN(util::format(_EXPECTED_ERROR_, {"{"}), currentToken);
	nextToken();
	std::vector<ptr_node_t> body;
	while (currentToken.type != NULL_TOK)
	{
		if (currentToken.type == '}')
			break;

		if (auto e = parseExprNode(scopes))
			body.push_back(e);
		else
			return logErrorN(_FAILURE_PARSE_CODE_, currentToken);
	}
	if (currentToken.type != '}')
		return logErrorN(util::format(_EXPECTED_ERROR_, {"}"}), currentToken);
	nextToken();

	std::shared_ptr<IfElseNode> ret;

	if (body.size() != 1)
		ret = std::make_shared<IfElseNode>(*scopes, ifs, std::make_shared<VectorNode>(*scopes, body, true, currentToken), marker);
	else
		ret = std::make_shared<IfElseNode>(*scopes, ifs, (body[0]), marker);

	if (currentToken.type == NULL_TOK)
	{
		scopes->pop_back();
		return ret;
	}

	switch (currentToken.type)
	{
	case TOK_ELSE:
	{
		nextToken();
		if (currentToken.type != '{')
			return logErrorN(util::format(_EXPECTED_ERROR_, {"{"}), currentToken);
		nextToken();
		std::vector<ptr_node_t> elses;
		while (currentToken.type != NULL_TOK)
		{
			if (currentToken.type == '}')
				break;

			if (auto e = parseExprNode(scopes))
				elses.push_back(e);
			else
				return logErrorN(_FAILURE_PARSE_CODE_, currentToken);
		}
		if (currentToken.type != '}')
			return logErrorN(util::format(_EXPECTED_ERROR_, {"}"}), currentToken);
		nextToken();
		if (elses.size() != 1)
			ret->setElse(std::make_shared<VectorNode>(*scopes, elses, true, currentToken));
		else
			ret->setElse(elses[0]);
		scopes->pop_back();
		return ret;
	}
	case TOK_ELSEIF:
	{
		ret->setElse(parseIfElseNode(scopes));
		scopes->pop_back();
		return ret;
	}
	default:
		scopes->pop_back();
		return ret;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r15
movq (%rsi), %rsi
leaq 0x1(%rsi), %rax
movq %rax, (%rbx)
leaq 0x80(%rsp), %r14
movq %r14, %rdi
callq 0x2ecd6
leaq 0x4ac02(%rip), %rsi     # 0x76a5f
leaq 0x60(%rsp), %rdi
movq %r14, %rdx
callq 0x1ca9c
leaq 0x4a4fd(%rip), %rdx     # 0x7636e
leaq 0x30(%rsp), %rdi
leaq 0x60(%rsp), %rsi
callq 0x1ca7d
leaq 0x8aa81(%rip), %rdi     # 0xb6908
leaq 0x30(%rsp), %rsi
callq 0x1efb0
leaq 0x110(%rsp), %r14
movq %rax, -0x8(%r14)
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
andq $0x0, 0x10(%r14)
leaq 0x108(%rsp), %rsi
movq %r12, %rdi
callq 0x1fe52
movq %r14, %rdi
callq 0x1f5c4
leaq 0x30(%rsp), %rdi
callq 0x101d0
leaq 0x60(%rsp), %rdi
callq 0x101d0
leaq 0x80(%rsp), %rdi
callq 0x101d0
movq %rbx, %rdi
callq 0x22e24
leaq 0xe0(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x25798
cmpq $0x0, (%r14)
je 0x2c00b
leaq 0x58(%rbx), %rsi
cmpl $-0xc, 0xd0(%rbx)
movq %rsi, 0x28(%rsp)
jne 0x2c3a7
leaq 0x108(%rsp), %rdi
callq 0x1f71a
movq %rbx, %rdi
callq 0x22e24
cmpl $0x7b, 0xd0(%rbx)
jne 0x2c425
movq %rbx, %rdi
callq 0x22e24
leaq 0xc0(%rsp), %rbp
andq $0x0, 0x10(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rbp)
leaq 0x68(%rsp), %r13
leaq 0x60(%rsp), %r14
movl 0xd0(%rbx), %eax
cmpl $0x7d, %eax
je 0x2bfaa
testl %eax, %eax
je 0x2c264
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x23390
cmpq $0x0, 0x60(%rsp)
je 0x2c2dc
movq %rbp, %rdi
movq %r14, %rsi
callq 0x2e880
movq %r13, %rdi
callq 0x1d786
jmp 0x2bf68
movq %rbx, %rdi
callq 0x22e24
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq 0xc0(%rsp), %rcx
movq 0xc8(%rsp), %rax
subq %rcx, %rax
cmpq $0x10, %rax
movq 0x28(%rsp), %r8
jne 0x2c017
leaq 0x30(%rsp), %rdi
leaq 0xe0(%rsp), %rdx
leaq 0x108(%rsp), %r8
movq %r12, %rsi
callq 0x2f0fe
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x34692
leaq 0x38(%rsp), %rdi
jmp 0x2c077
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
jmp 0x2c242
leaq 0x80(%rsp), %rcx
movb $0x1, (%rcx)
leaq 0x60(%rsp), %rdi
leaq 0xc0(%rsp), %rdx
movq %r12, %rsi
callq 0x2e811
leaq 0x30(%rsp), %rdi
leaq 0xe0(%rsp), %rdx
leaq 0x60(%rsp), %rcx
leaq 0x108(%rsp), %r8
movq %r12, %rsi
callq 0x2f0d7
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x34692
leaq 0x38(%rsp), %rdi
callq 0x1d786
leaq 0x68(%rsp), %rdi
callq 0x1d786
movl 0xd0(%rbx), %eax
cmpl $-0x7, %eax
je 0x2c118
cmpl $-0x6, %eax
je 0x2c097
testl %eax, %eax
jmp 0x2c144
movq %rbx, %rdi
callq 0x22e24
cmpl $0x7b, 0xd0(%rbx)
jne 0x2c4a0
movq %rbx, %rdi
callq 0x22e24
leaq 0xa0(%rsp), %rbp
andq $0x0, 0x10(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rbp)
leaq 0x68(%rsp), %r13
leaq 0x60(%rsp), %r14
movl 0xd0(%rbx), %eax
cmpl $0x7d, %eax
je 0x2c166
testl %eax, %eax
je 0x2c307
movq %r14, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x23390
cmpq $0x0, 0x60(%rsp)
je 0x2c37c
movq %rbp, %rdi
movq %r14, %rsi
callq 0x2e880
movq %r13, %rdi
callq 0x1d786
jmp 0x2c0d2
movq 0x10(%rsp), %r14
leaq 0x30(%rsp), %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x2be22
leaq 0x30(%rsp), %rsi
movq %r14, %rdi
callq 0x557b4
leaq 0x38(%rsp), %rdi
callq 0x1d786
movq %r12, %rdi
callq 0x2eb8e
movaps 0x10(%rsp), %xmm0
andq $0x0, 0x18(%rsp)
movups %xmm0, (%r15)
andq $0x0, 0x10(%rsp)
jmp 0x2c21e
movq %rbx, %rdi
callq 0x22e24
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rax
subq %rsi, %rax
movq 0x10(%rsp), %rbx
cmpq $0x10, %rax
movq 0x28(%rsp), %r8
jne 0x2c19b
movq %rbx, %rdi
callq 0x557b4
jmp 0x2c1f4
leaq 0x80(%rsp), %rcx
movb $0x1, (%rcx)
leaq 0x60(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
movq %r12, %rsi
callq 0x2e811
leaq 0x38(%rsp), %r13
leaq 0x68(%rsp), %r14
movaps -0x8(%r14), %xmm0
movaps %xmm0, -0x8(%r13)
xorps %xmm0, %xmm0
movaps %xmm0, -0x8(%r14)
leaq 0x30(%rsp), %rsi
movq %rbx, %rdi
callq 0x557b4
movq %r13, %rdi
callq 0x1d786
movq %r14, %rdi
callq 0x1d786
movq %r12, %rdi
callq 0x2eb8e
movaps 0x10(%rsp), %xmm0
andq $0x0, 0x18(%rsp)
movups %xmm0, (%r15)
andq $0x0, 0x10(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0x2e838
leaq 0x18(%rsp), %rdi
callq 0x1d786
leaq 0xc0(%rsp), %rdi
callq 0x2e838
leaq 0x108(%rsp), %rdi
callq 0x1df38
leaq 0xe8(%rsp), %rdi
callq 0x1d786
movq %r15, %rax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4a639(%rip), %rsi     # 0x768a4
leaq 0x60(%rsp), %rdi
leaq 0xf0(%rsp), %rdx
callq 0x1c814
leaq 0x4e63d(%rip), %rsi     # 0x7a8c1
leaq 0x80(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x1c814
leaq 0xa0(%rsp), %rdi
leaq 0x80(%rsp), %rsi
pushq $0x1
popq %rdx
leaq 0xe(%rsp), %rcx
callq 0x1f298
leaq 0x30(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
callq 0x3f724
leaq 0x30(%rsp), %rdx
movq %rbx, %rsi
movq 0x28(%rsp), %rcx
callq 0x25932
leaq 0x4a657(%rip), %rsi     # 0x7693a
leaq 0x30(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0x1c814
leaq 0x30(%rsp), %rdx
movq %rbx, %rsi
movq 0x28(%rsp), %rcx
callq 0x25932
leaq 0x4a596(%rip), %rsi     # 0x768a4
leaq 0x60(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x1c814
leaq 0x4e59d(%rip), %rsi     # 0x7a8c1
leaq 0x80(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x1c814
leaq 0xf0(%rsp), %rdi
leaq 0x80(%rsp), %rsi
pushq $0x1
popq %rdx
leaq 0x5f(%rsp), %rcx
callq 0x1f298
leaq 0x30(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0xf0(%rsp), %rdx
callq 0x3f724
leaq 0x30(%rsp), %rdx
movq %rbx, %rsi
movq 0x28(%rsp), %rcx
callq 0x25932
leaq 0x4a5b7(%rip), %rsi     # 0x7693a
leaq 0x30(%rsp), %rdi
leaq 0x80(%rsp), %rdx
callq 0x1c814
leaq 0x30(%rsp), %rdx
movq %rbx, %rsi
movq 0x28(%rsp), %rcx
callq 0x25932
leaq 0x4a4f6(%rip), %rsi     # 0x768a4
leaq 0x30(%rsp), %rdi
leaq 0xc0(%rsp), %rdx
callq 0x1c814
leaq 0x4a14d(%rip), %rsi     # 0x76514
leaq 0x60(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
callq 0x1c814
leaq 0x80(%rsp), %rdi
leaq 0x60(%rsp), %rsi
pushq $0x1
popq %rdx
leaq 0xf0(%rsp), %rcx
callq 0x1f298
leaq 0x108(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0x80(%rsp), %rdx
callq 0x3f724
leaq 0x108(%rsp), %rdx
movq %rbx, %rsi
movq 0x28(%rsp), %rcx
callq 0x25932
leaq 0x4a478(%rip), %rsi     # 0x768a4
leaq 0x60(%rsp), %rdi
leaq 0xa0(%rsp), %rdx
callq 0x1c814
leaq 0x4a610(%rip), %rsi     # 0x76a55
leaq 0x80(%rsp), %rdi
leaq 0xf0(%rsp), %rdx
callq 0x1c814
leaq 0xc0(%rsp), %rdi
leaq 0x80(%rsp), %rsi
pushq $0x1
popq %rdx
leaq 0x10(%rsp), %rcx
callq 0x1f298
leaq 0x30(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
callq 0x3f724
leaq 0x30(%rsp), %rdx
movq %rbx, %rsi
movq 0x28(%rsp), %rcx
callq 0x25932
leaq 0x4a3fd(%rip), %rsi     # 0x768a4
leaq 0x60(%rsp), %rdi
leaq 0xf0(%rsp), %rdx
callq 0x1c814
leaq 0x4a595(%rip), %rsi     # 0x76a55
leaq 0x80(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x1c814
leaq 0xa0(%rsp), %rdi
leaq 0x80(%rsp), %rsi
pushq $0x1
popq %rdx
leaq 0xf(%rsp), %rcx
callq 0x1f298
leaq 0x30(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0xa0(%rsp), %rdx
callq 0x3f724
leaq 0x30(%rsp), %rdx
movq %rbx, %rsi
movq 0x28(%rsp), %rcx
callq 0x25932
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x101d0
jmp 0x2c52a
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x1cea0
jmp 0x2c53c
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x101d0
jmp 0x2c54e
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x101d0
jmp 0x2c734
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x101d0
jmp 0x2c56f
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x1cea0
jmp 0x2c5c2
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
callq 0x101d0
jmp 0x2c593
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x1cea0
jmp 0x2c5d4
movq %rax, %rbx
movq %r13, %rdi
callq 0x1d786
movq %r14, %rdi
jmp 0x2c71d
jmp 0x2c724
jmp 0x2c64c
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x101d0
jmp 0x2c5ef
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x101d0
jmp 0x2c601
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
jmp 0x2c640
jmp 0x2c64c
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x101d0
jmp 0x2c77a
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x101d0
jmp 0x2c787
jmp 0x2c724
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x101d0
jmp 0x2c627
movq %rax, %rbx
leaq 0xf0(%rsp), %rdi
callq 0x1cea0
jmp 0x2c65e
jmp 0x2c64c
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x1d786
jmp 0x2c734
jmp 0x2c64c
movq %rax, %rbx
jmp 0x2c734
jmp 0x2c6ea
jmp 0x2c672
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x101d0
jmp 0x2c6bd
jmp 0x2c76a
movq %rax, %rbx
jmp 0x2c787
movq %rax, %rbx
movq %r14, %rdi
callq 0x1f5c4
jmp 0x2c68a
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x101d0
jmp 0x2c699
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x101d0
jmp 0x2c6a8
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x101d0
jmp 0x2c794
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x101d0
jmp 0x2c727
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x101d0
jmp 0x2c6db
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x1cea0
jmp 0x2c708
movq %rax, %rbx
jmp 0x2c77a
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x101d0
jmp 0x2c71a
jmp 0x2c717
jmp 0x2c724
movq %rax, %rbx
leaq 0x80(%rsp), %rdi
callq 0x101d0
jmp 0x2c73e
movq %rax, %rbx
movq %r13, %rdi
callq 0x1d786
jmp 0x2c727
movq %rax, %rbx
leaq 0xa0(%rsp), %rdi
callq 0x2e838
leaq 0x18(%rsp), %rdi
jmp 0x2c763
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x101d0
jmp 0x2c76d
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x101d0
jmp 0x2c760
jmp 0x2c75d
jmp 0x2c76a
movq %rax, %rbx
movq %r13, %rdi
callq 0x1d786
jmp 0x2c76d
movq %rax, %rbx
leaq 0xc0(%rsp), %rdi
callq 0x2e838
leaq 0x108(%rsp), %rdi
callq 0x1df38
leaq 0xe8(%rsp), %rdi
callq 0x1d786
movq %rbx, %rdi
callq 0x106f0