// File: /workspace/github_cpp_makefile_star2_O3/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 0x9126
movq %rax, %r13
movq %rbx, %rdi
callq 0x69d4
movq %rax, %rbp
leaq 0x10(%rsp), %r14
leaq 0x40(%rsp), %r15
leaq 0x17c81(%rip), %rax     # 0x20b08
addq $0x10, %rax
movq %rax, 0x38(%rsp)
leaq 0x17a81(%rip), %rax     # 0x20918
addq $0x10, %rax
movq %rax, 0x30(%rsp)
leaq 0x177e9(%rip), %rax     # 0x20690
addq $0x10, %rax
movq %rax, 0x8(%rsp)
leal -0x1f(%rbp), %eax
cmpl $0x3, %eax
jb 0x8ec1
cmpl $0x17, %ebp
jne 0x9030
movq %rbx, %rdi
callq 0x69fe
cmpl $0x17, %ebp
je 0x8f9e
cmpl $0x1f, %ebp
je 0x8f0d
cmpl $0x21, %ebp
je 0x9042
movl $0x18, %edi
callq 0x5380
movq %rax, %r12
movq %rbx, %rdi
callq 0x9126
movq 0x8(%rsp), %rcx
movq %rcx, (%r12)
movq %r13, 0x8(%r12)
movq %rax, 0x10(%r12)
jmp 0x901d
movq %rbx, %rdi
movq %r14, %r15
callq 0x69fe
movq %rax, %r12
movq %rdx, %rbp
testl %r12d, %r12d
jne 0x906e
movl $0x18, %edi
callq 0x5380
movq %rax, %r12
movl $0x10, %edi
callq 0x5380
movq %rax, %r14
movq 0x30(%rbx), %rdi
movq %rbp, %rsi
callq 0x10a4c
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 0x8f87
movq (%rax), %rsi
incq %rsi
callq 0x5390
movl $0x20, %esi
movq %rbp, %rdi
callq 0x5390
movq %r15, %r14
leaq 0x40(%rsp), %r15
jmp 0x901d
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x98ea
movl $0x28, %edi
callq 0x5380
movq %rax, %r12
movq %r15, %rdi
movq %r14, %rsi
callq 0x9eb0
movq 0x38(%rsp), %rax
movq %rax, (%r12)
movq %r13, 0x8(%r12)
movq %r12, %rdi
addq $0x10, %rdi
movq %r15, %rsi
callq 0x9eb0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x9006
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x5390
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x901d
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x5390
movq %rbx, %rdi
callq 0x69d4
movq %rax, %rbp
movq %r12, %r13
jmp 0x8eb0
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 0xe7bf(%rip), %rsi      # 0x17815
movq %rax, %rdi
callq 0x5150
movq 0x17f8b(%rip), %rsi     # 0x20ff0
movq 0x17f44(%rip), %rdx     # 0x20fb0
jmp 0x909e
movl $0x48, %edi
callq 0x51b0
movq %rax, %r14
leaq 0xe722(%rip), %rsi      # 0x177a4
movq %rax, %rdi
movq %r12, %rdx
movq %rbp, %rcx
callq 0xa896
leaq 0x174e1(%rip), %rsi     # 0x20578
leaq 0xde2(%rip), %rdx       # 0x9e80
movq %r14, %rdi
callq 0x55d0
jmp 0x90a8
movq %rax, %rbx
movq %r14, %rdi
callq 0x5280
jmp 0x911e
jmp 0x90e5
movq %rax, %rbx
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0x90d6
movq 0x50(%rsp), %rsi
subq %rdi, %rsi
callq 0x5390
jmp 0x90d6
movq %rax, %rbx
movl $0x28, %esi
movq %r12, %rdi
callq 0x5390
jmp 0x9107
movq %rax, %rbx
jmp 0x90fa
movq %rax, %rbx
movl $0x10, %esi
movq %r14, %rdi
callq 0x5390
movl $0x18, %esi
movq %r12, %rdi
jmp 0x9119
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x911e
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x5390
movq %rbx, %rdi
callq 0x55e0