// File: /workspace/github_c_makefile_star2_O0/Encryptr[P]O-plus-plus/opp/parser/parser.c
// Function: opp_parse_prefix
static struct Opp_Node* opp_parse_prefix(struct Opp_Parser* parser)
{
	struct Opp_Node* left = opp_parse_unary(parser);
	struct Opp_Node* result = NULL;

	opp_next(parser->lex);
	int operator = parser->lex->t.id;

	while (operator == TOPENP || operator == TOPENB ||
		operator == TDOT || operator == TDECR || 
		operator == TINCR)
	{
		switch (operator)
		{
			case TOPENP: {
				result = opp_new_node(parser, ECALL);
				result->call_expr.callee = left;

				result->call_expr.args = opp_parse_comma(parser);

				if (parser->lex->t.id != TCLOSEP)
					opp_error(parser->lex, "Expected ')' in function call");

				opp_next(parser->lex);
				left = result;
				break;
			}

			case TOPENB: {
				result = opp_new_node(parser, EELEMENT);
				result->elem_expr.name = left;
				opp_next(parser->lex);
				result->elem_expr.loc = opp_parse_allign(parser);

				opp_next(parser->lex);
				left = result;
				break;
			}

			case TDOT: {
				result = opp_new_node(parser, EDOT);
				result->dot_expr.left = left;
				opp_next(parser->lex);
				result->dot_expr.right = opp_parse_unary(parser);
				opp_next(parser->lex);

				left = result;
				break;
			}

			case TDECR: case TINCR: {
				result = opp_new_node(parser, EADJUST);
				result->adjust_expr.left = left;
				result->adjust_expr.type = operator;

				opp_next(parser->lex);
				left = result;
				break;
			}

		}
		operator = parser->lex->t.id;
	}

	return left;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq 0x20(%rsp), %rdi
callq 0xf9c0
movq %rax, 0x18(%rsp)
movq $0x0, 0x10(%rsp)
movq 0x20(%rsp), %rax
movq (%rax), %rdi
callq 0x11bd0
movq 0x20(%rsp), %rax
movq (%rax), %rax
movl 0x30(%rax), %eax
movl %eax, 0xc(%rsp)
movb $0x1, %al
cmpl $0x22, 0xc(%rsp)
movb %al, 0xb(%rsp)
je 0x1080d
movb $0x1, %al
cmpl $0x25, 0xc(%rsp)
movb %al, 0xb(%rsp)
je 0x1080d
movb $0x1, %al
cmpl $0x29, 0xc(%rsp)
movb %al, 0xb(%rsp)
je 0x1080d
movb $0x1, %al
cmpl $0x18, 0xc(%rsp)
movb %al, 0xb(%rsp)
je 0x1080d
cmpl $0x19, 0xc(%rsp)
sete %al
movb %al, 0xb(%rsp)
movb 0xb(%rsp), %al
testb $0x1, %al
jne 0x1081a
jmp 0x109d4
movl 0xc(%rsp), %eax
addl $-0x18, %eax
movl %eax, %ecx
movq %rcx, (%rsp)
subl $0x11, %eax
ja 0x109c0
movq (%rsp), %rax
leaq 0x40d9(%rip), %rcx      # 0x14914
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x20(%rsp), %rdi
movl $0x3, %esi
callq 0xf950
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x20(%rsp), %rdi
callq 0x109e0
movq %rax, %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x20(%rsp), %rax
movq (%rax), %rax
cmpl $0x23, 0x30(%rax)
je 0x108a0
movq 0x20(%rsp), %rax
movq (%rax), %rdi
leaq 0x43b9(%rip), %rsi      # 0x14c52
movb $0x0, %al
callq 0x11370
movq 0x20(%rsp), %rax
movq (%rax), %rdi
callq 0x11bd0
movq 0x10(%rsp), %rax
movq %rax, 0x18(%rsp)
jmp 0x109c0
movq 0x20(%rsp), %rdi
movl $0x7, %esi
callq 0xf950
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x20(%rsp), %rax
movq (%rax), %rdi
callq 0x11bd0
movq 0x20(%rsp), %rdi
callq 0xfad0
movq %rax, %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x20(%rsp), %rax
movq (%rax), %rdi
callq 0x11bd0
movq 0x10(%rsp), %rax
movq %rax, 0x18(%rsp)
jmp 0x109c0
movq 0x20(%rsp), %rdi
movl $0xd, %esi
callq 0xf950
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x20(%rsp), %rax
movq (%rax), %rdi
callq 0x11bd0
movq 0x20(%rsp), %rdi
callq 0xf9c0
movq %rax, %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x18(%rax)
movq 0x20(%rsp), %rax
movq (%rax), %rdi
callq 0x11bd0
movq 0x10(%rsp), %rax
movq %rax, 0x18(%rsp)
jmp 0x109c0
movq 0x20(%rsp), %rdi
movl $0x9, %esi
callq 0xf950
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, 0x18(%rax)
movl 0xc(%rsp), %ecx
movq 0x10(%rsp), %rax
movl %ecx, 0x10(%rax)
movq 0x20(%rsp), %rax
movq (%rax), %rdi
callq 0x11bd0
movq 0x10(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rax
movq (%rax), %rax
movl 0x30(%rax), %eax
movl %eax, 0xc(%rsp)
jmp 0x107cd
movq 0x18(%rsp), %rax
addq $0x28, %rsp
retq
nop