// File: /workspace/github_c_makefile_star2_O0/Encryptr[P]O-plus-plus/opp/analysis/analysis.c
// Function: opp_analize_assign
static Opp_Obj opp_analize_assign(struct Opp_Analize* ctx, struct Opp_Node* node)
{
	if ((node->assign_expr.ident->type != EUNARY 
		|| node->assign_expr.ident->unary_expr.type != TIDENT)
		&& (node->assign_expr.ident->type != EDEREF) 
		&& (node->assign_expr.ident->type != EELEMENT)
		&& (node->assign_expr.ident->type != EDOT))
		opp_semantics_error(ctx, node, "Unexpected expression on lhs of '='");

	Opp_Obj lhs = opp_analize_expr(ctx, node->assign_expr.ident);

	const char* name = ctx->debug.res_name;

	// Global assign error
	if (ctx->curr_ns == ctx->ns)
		opp_semantics_error(ctx, node, "Global assigments are not permited, assiment of '%s'", name);

	// Cannot assign array error
	if (lhs.size > 0)
		opp_semantics_error(ctx, node, "Attempting to assign a value to array '%s'", ctx->debug.res_name);

	Opp_Obj rhs = opp_analize_expr(ctx, node->assign_expr.val);

	// Cannot assign non pointer to array type
	if (rhs.size > 0 && lhs.depth == 0) 
		opp_semantics_error(ctx, node, "Attempting to assign an array type to var '%s'", name);

	// Different depths warning	
	if (rhs.depth != lhs.depth)
		opp_warning(ctx, node, "Assigning var '%s' to incompatible pointer depth", name);

	// Cannot assign non pointer to obj and vise versa
	if ((rhs.decl->t_type == TYPE_STRUCT && rhs.depth == 0)
		|| 
		(lhs.decl->t_type == TYPE_STRUCT && lhs.depth == 0))
		opp_semantics_error(ctx, node, "Assigning var '%s' to a incompatible struct type", name);

	return lhs;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rax
cmpl $0x5, (%rax)
jne 0x315b
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rax
cmpl $0x1, 0x10(%rax)
je 0x319d
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rax
cmpl $0x8, (%rax)
je 0x319d
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rax
cmpl $0x7, (%rax)
je 0x319d
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rax
cmpl $0xd, (%rax)
je 0x319d
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
leaq 0x10671(%rip), %rdx     # 0x13807
movb $0x0, %al
callq 0x2b10
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rax
movq 0x20(%rax), %rsi
callq 0x3770
movq %rax, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq 0x20(%rsp), %rax
movq 0x40(%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x20(%rsp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x31f9
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rcx
leaq 0x10639(%rip), %rdx     # 0x1382b
movb $0x0, %al
callq 0x2b10
movzwl 0x32(%rsp), %eax
cmpl $0x0, %eax
jle 0x3224
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rax
movq 0x40(%rax), %rcx
leaq 0x10643(%rip), %rdx     # 0x13860
movb $0x0, %al
callq 0x2b10
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rsi
callq 0x3770
movq %rax, (%rsp)
movq %rdx, 0x8(%rsp)
movzwl 0xa(%rsp), %eax
cmpl $0x0, %eax
jle 0x3271
movzwl 0x30(%rsp), %eax
cmpl $0x0, %eax
jne 0x3271
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rcx
leaq 0x10621(%rip), %rdx     # 0x1388b
movb $0x0, %al
callq 0x2b10
movzwl 0x8(%rsp), %eax
movzwl 0x30(%rsp), %ecx
cmpl %ecx, %eax
je 0x329c
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rcx
leaq 0x10625(%rip), %rdx     # 0x138ba
movb $0x0, %al
callq 0x2e80
movq (%rsp), %rax
cmpl $0x8, 0x8(%rax)
jne 0x32b0
movzwl 0x8(%rsp), %eax
cmpl $0x0, %eax
je 0x32c5
movq 0x28(%rsp), %rax
cmpl $0x8, 0x8(%rax)
jne 0x32e2
movzwl 0x30(%rsp), %eax
cmpl $0x0, %eax
jne 0x32e2
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rcx
leaq 0x10610(%rip), %rdx     # 0x138eb
movb $0x0, %al
callq 0x2b10
movq 0x28(%rsp), %rax
movq 0x30(%rsp), %rdx
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)