// File: /workspace/github_cpp_makefile_star2_O1/iamlouk[P]asbi/src/parser.cc
// Function: asbi::Parser::parse_factor()
ast::Node* Parser::parse_factor() {
	auto node = parse_final();
	auto t = tokenizer.peek().type;
	while (t == tok::LeftBracket || t == tok::Dot || t == tok::Colon || t == tok::DoubleColon) {
		tokenizer.next();
		if (t == tok::LeftBracket) {
			std::vector<ast::Node*> args;
			parse_arglist(args);
			node = new ast::Call(node, args);
		} else if (t == tok::Colon) {
			auto token = tokenizer.next();
			if (token.type != tok::Identifier)
				throw utils::parser_error("expected identifier/symbol after ':'", token);

			node = new ast::Access(node, new ast::Symbol(ctx->new_stringconstant(*token.str)));
			delete token.str;
		} else if (t == tok::DoubleColon) {
			/*auto token = tokenizer.next();
			if (token.type != tok::Identifier)
				throw utils::parser_error("expected identifier/symbol after '::'", token);

			auto acs = new ast::Access(node, new ast::Symbol(token.str));
			expect(tok::LeftBracket);
			std::vector<ast::Node*> args;
			parse_arglist(args);
			node = new ast::OOCall(acs, args);*/
			throw std::runtime_error("unimplemented");
		} else {
			node = new ast::Access(node, parse_final());
		}
		t = tokenizer.peek().type;
	}
	return node;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
callq 0x9220
movq %rax, %r13
movq %rbx, %rdi
callq 0x6a1a
movq %rax, %rbp
leaq 0x10(%rsp), %r14
leaq 0x40(%rsp), %r15
leaq 0x17b87(%rip), %rax     # 0x20b08
addq $0x10, %rax
movq %rax, 0x38(%rsp)
leaq 0x17987(%rip), %rax     # 0x20918
addq $0x10, %rax
movq %rax, 0x30(%rsp)
leaq 0x176ef(%rip), %rax     # 0x20690
addq $0x10, %rax
movq %rax, 0x8(%rsp)
leal -0x1f(%rbp), %eax
cmpl $0x3, %eax
jb 0x8fbb
cmpl $0x17, %ebp
jne 0x912a
movq %rbx, %rdi
callq 0x6a44
cmpl $0x17, %ebp
je 0x9098
cmpl $0x1f, %ebp
je 0x9007
cmpl $0x21, %ebp
je 0x913c
movl $0x18, %edi
callq 0x5380
movq %rax, %r12
movq %rbx, %rdi
callq 0x9220
movq 0x8(%rsp), %rcx
movq %rcx, (%r12)
movq %r13, 0x8(%r12)
movq %rax, 0x10(%r12)
jmp 0x9117
movq %rbx, %rdi
movq %r14, %r15
callq 0x6a44
movq %rax, %r12
movq %rdx, %rbp
testl %r12d, %r12d
jne 0x9168
movl $0x18, %edi
callq 0x5380
movq %rax, %r12
movl $0x10, %edi
callq 0x5380
movq %rax, %r14
movq 0x30(%rbx), %rdi
movq %rbp, %rsi
callq 0x10b4c
movq 0x30(%rsp), %rcx
movq %rcx, (%r14)
movq %rax, 0x8(%r14)
movq 0x8(%rsp), %rax
movq %rax, (%r12)
movq %r13, 0x8(%r12)
movq %r14, 0x10(%r12)
movq (%rbp), %rdi
movq %rbp, %rax
addq $0x10, %rax
cmpq %rax, %rdi
je 0x9081
movq (%rax), %rsi
incq %rsi
callq 0x5390
movl $0x20, %esi
movq %rbp, %rdi
callq 0x5390
movq %r15, %r14
leaq 0x40(%rsp), %r15
jmp 0x9117
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9a24
movl $0x28, %edi
callq 0x5380
movq %rax, %r12
movq %r15, %rdi
movq %r14, %rsi
callq 0xa00e
movq 0x38(%rsp), %rax
movq %rax, (%r12)
movq %r13, 0x8(%r12)
movq %r12, %rdi
addq $0x10, %rdi
movq %r15, %rsi
callq 0xa00e
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x9100
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x5390
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x9117
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x5390
movq %rbx, %rdi
callq 0x6a1a
movq %rax, %rbp
movq %r12, %r13
jmp 0x8faa
movq %r13, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x51b0
movq %rax, %r14
leaq 0xe6c5(%rip), %rsi      # 0x17815
movq %rax, %rdi
callq 0x5150
movq 0x17e91(%rip), %rsi     # 0x20ff0
movq 0x17e4a(%rip), %rdx     # 0x20fb0
jmp 0x9198
movl $0x48, %edi
callq 0x51b0
movq %rax, %r14
leaq 0xe628(%rip), %rsi      # 0x177a4
movq %rax, %rdi
movq %r12, %rdx
movq %rbp, %rcx
callq 0xa9f6
leaq 0x173e7(%rip), %rsi     # 0x20578
leaq 0xe46(%rip), %rdx       # 0x9fde
movq %r14, %rdi
callq 0x55d0
jmp 0x91a2
movq %rax, %rbx
movq %r14, %rdi
callq 0x5280
jmp 0x9218
jmp 0x91df
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x91d0
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x5390
jmp 0x91d0
movq %rax, %rbx
movl $0x28, %esi
movq %r12, %rdi
callq 0x5390
jmp 0x9201
movq %rax, %rbx
jmp 0x91f4
movq %rax, %rbx
movl $0x10, %esi
movq %r14, %rdi
callq 0x5390
movl $0x18, %esi
movq %r12, %rdi
jmp 0x9213
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x9218
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x5390
movq %rbx, %rdi
callq 0x55e0