// File: /workspace/github_c_makefile_star2_O0/Oric4ever[P]lcc65/6502/build/../src/enode.c
// Function: asgnnode
Tree asgnnode(int op, Tree l, Tree r) {
	Type aty, ty;

	r = pointer(r);
	if ((ty = assign(l->type, r)) == 0) {
		typeerror(ASGN, l, r);
		if (r->type == voidtype)
			r = retype(r, inttype);
		ty = r->type;
	}
	if (l->op != FIELD)
		l = lvalue(l);
	aty = l->type;
	if (isptr(aty))
		aty = unqual(aty)->type;
	if (isconst(aty) || (isstruct(aty) && unqual(aty)->u.sym->u.s.cfields)) {
		if (isaddrop(l->op) && !l->u.sym->computed && !l->u.sym->generated)
			error("assignment to const identifier `%s'\n", l->u.sym->name);
		else
			error("assignment to const location\n");
    }
	r = cast(r, ty);
	if (l->op == FIELD && fieldsize(l->u.field) < 8*l->u.field->type->size) {
		if (isunsigned(l->u.field->type))
			r = bitnode(BAND, r,
				constnode(fieldmask(l->u.field), unsignedtype));
		else {
			int n = 8*l->u.field->type->size - fieldsize(l->u.field);
			/*
			 * The value of assignment is the value of the left
			 * operand (sec. 3.3.16), which for bit fields is the
			 * same as extracting the field. When r is a constant,
			 * the explicit left shift below avoids overflow that
			 * would occur if shnode(LSH, ...) were used. The
			 * subsequent shnode(RSH, ...) will be signed and thus
			 * extend the sign bit correctly.
			 */
			if (r->op == CNST+I)
				r = constnode(r->u.v.i<<n, inttype);
			else
				r = shnode(LSH, r, constnode(n, inttype));
			r = shnode(RSH, r, constnode(n, inttype));
		}
	}
	if (isstruct(ty)) {
		if (r->op == RIGHT && r->kids[0] && r->kids[0]->op == CALL+B
		&& isaddrop(l->op)) {
			/*
			 * When x=f() where f returns a struct and x is a simple
			 * address, release the temporary generated to hold f's
			 * return value and use x in its place. The RIGHT tree
			 * assigned to r below returns x's address, and
			 * rvalue(r) hangs that tree under an INDIR+B,
			 * thus identifying the result as an lvalue.
			 */
			r = r->kids[0];	/* CALL+B node */
			release(r->kids[1]->u.sym);
			r = tree(RIGHT, l->type,
				tree(CALL+B, r->kids[0]->type, r->kids[0], l),
				retype(isarray(l->u.sym->type) ? idnode(l->u.sym) : addrof(idnode(l->u.sym)), l->type));
			return rvalue(r);
		}
		return tree(ASGN+B, ty, l, r);
	}
	return tree(op + (isunsigned(ty) ? I : ttob(ty)), ty, l, r);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movl %edi, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0xf9f0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x20(%rbp), %rsi
callq 0xe2d0
movq %rax, -0x30(%rbp)
cmpq $0x0, %rax
jne 0xc0d7
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl $0x30, %edi
callq 0xc6a0
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
leaq 0x38191(%rip), %rcx     # 0x44240
cmpq (%rcx), %rax
jne 0xc0cb
movq -0x20(%rbp), %rdi
leaq 0x38139(%rip), %rax     # 0x441f8
movq (%rax), %rsi
callq 0x25a20
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x2b0, (%rax)          # imm = 0x2B0
je 0xc0f0
movq -0x18(%rbp), %rdi
callq 0x10510
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpl $0xf, (%rax)
jb 0xc113
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0xc11b
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpl $0x7, (%rax)
jne 0xc14f
movq -0x28(%rbp), %rax
cmpl $0xf, (%rax)
jb 0xc13b
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0xc143
movq -0x28(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpl $0xf, (%rax)
je 0xc1f5
movq -0x28(%rbp), %rax
cmpl $0x1f, (%rax)
je 0xc1f5
movq -0x28(%rbp), %rax
cmpl $0xf, (%rax)
jb 0xc180
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x50(%rbp)
jmp 0xc188
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
cmpl $0x9, (%rax)
je 0xc1bd
movq -0x28(%rbp), %rax
cmpl $0xf, (%rax)
jb 0xc1a8
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x58(%rbp)
jmp 0xc1b0
movq -0x28(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
cmpl $0xa, (%rax)
jne 0xc275
movq -0x28(%rbp), %rax
cmpl $0xf, (%rax)
jb 0xc1d4
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x60(%rbp)
jmp 0xc1dc
movq -0x28(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq 0x18(%rax), %rax
movb 0x48(%rax), %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0xc275
movq -0x18(%rbp), %rax
cmpl $0x107, (%rax)          # imm = 0x107
je 0xc219
movq -0x18(%rbp), %rax
cmpl $0x127, (%rax)          # imm = 0x127
je 0xc219
movq -0x18(%rbp), %rax
cmpl $0x117, (%rax)          # imm = 0x117
jne 0xc265
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movb 0x1b(%rax), %al
shrb $0x3, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0xc265
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movb 0x1b(%rax), %al
shrb $0x2, %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
jne 0xc265
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x10(%rax), %rsi
leaq 0x239bf(%rip), %rdi     # 0x2fc1b
movb $0x0, %al
callq 0xd530
jmp 0xc273
leaq 0x239d4(%rip), %rdi     # 0x2fc40
movb $0x0, %al
callq 0xd530
jmp 0xc275
movq -0x20(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0xe9b0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x2b0, (%rax)          # imm = 0x2B0
jne 0xc41a
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movswl 0x16(%rax), %eax
movq -0x18(%rbp), %rcx
movq 0x28(%rcx), %rcx
movswl 0x14(%rcx), %ecx
subl %ecx, %eax
movq -0x18(%rbp), %rcx
movq 0x28(%rcx), %rcx
movq 0x8(%rcx), %rcx
movl 0x8(%rcx), %ecx
shll $0x3, %ecx
cmpl %ecx, %eax
jge 0xc41a
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x8(%rax), %rax
cmpl $0xf, (%rax)
jb 0xc2f1
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x68(%rbp)
jmp 0xc301
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
cmpl $0x6, (%rax)
jne 0xc35f
movq -0x20(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movswl 0x16(%rax), %ecx
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movswl 0x14(%rax), %eax
subl %eax, %ecx
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
shll %cl, %edi
xorl $-0x1, %edi
leaq 0x37efb(%rip), %rax     # 0x44238
movq (%rax), %rsi
callq 0xc7b0
movq -0x70(%rbp), %rsi
movq %rax, %rdx
movl $0x180, %edi            # imm = 0x180
callq 0xaea0
movq %rax, -0x20(%rbp)
jmp 0xc418
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x8(%rax), %rax
movl 0x8(%rax), %eax
shll $0x3, %eax
movq -0x18(%rbp), %rcx
movq 0x28(%rcx), %rcx
movswl 0x16(%rcx), %ecx
movq -0x18(%rbp), %rdx
movq 0x28(%rdx), %rdx
movswl 0x14(%rdx), %edx
subl %edx, %ecx
subl %ecx, %eax
movl %eax, -0x34(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x15, (%rax)
jne 0xc3ba
movq -0x20(%rbp), %rax
movl 0x28(%rax), %edi
movl -0x34(%rbp), %ecx
shll %cl, %edi
leaq 0x37e4c(%rip), %rax     # 0x441f8
movq (%rax), %rsi
callq 0xc7b0
movq %rax, -0x20(%rbp)
jmp 0xc3e9
movq -0x20(%rbp), %rax
movq %rax, -0x78(%rbp)
movl -0x34(%rbp), %edi
leaq 0x37e2c(%rip), %rax     # 0x441f8
movq (%rax), %rsi
callq 0xc7b0
movq -0x78(%rbp), %rsi
movq %rax, %rdx
movl $0x150, %edi            # imm = 0x150
callq 0xbef0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x80(%rbp)
movl -0x34(%rbp), %edi
leaq 0x37dfd(%rip), %rax     # 0x441f8
movq (%rax), %rsi
callq 0xc7b0
movq -0x80(%rbp), %rsi
movq %rax, %rdx
movl $0x170, %edi            # imm = 0x170
callq 0xbef0
movq %rax, -0x20(%rbp)
jmp 0xc41a
movq -0x30(%rbp), %rax
cmpl $0xf, (%rax)
jb 0xc434
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x88(%rbp)
jmp 0xc43f
movq -0x30(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
cmpl $0x9, (%rax)
je 0xc480
movq -0x30(%rbp), %rax
cmpl $0xf, (%rax)
jb 0xc465
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x90(%rbp)
jmp 0xc470
movq -0x30(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
cmpl $0xa, (%rax)
jne 0xc60c
movq -0x20(%rbp), %rax
cmpl $0x2a0, (%rax)          # imm = 0x2A0
jne 0xc5f0
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0xc5f0
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
cmpl $0xd9, (%rax)
jne 0xc5f0
movq -0x18(%rbp), %rax
cmpl $0x107, (%rax)          # imm = 0x107
je 0xc4db
movq -0x18(%rbp), %rax
cmpl $0x127, (%rax)          # imm = 0x127
je 0xc4db
movq -0x18(%rbp), %rax
cmpl $0x117, (%rax)          # imm = 0x117
jne 0xc5f0
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x28(%rax), %rdi
callq 0x251c0
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0xa0(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rsi
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdx
movq -0x18(%rbp), %rcx
movl $0xd9, %edi
callq 0x256f0
movq %rax, -0x98(%rbp)
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x20(%rax), %rax
cmpl $0xf, (%rax)
jb 0xc55a
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x20(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0xa8(%rbp)
jmp 0xc56d
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
cmpl $0xc, (%rax)
jne 0xc58f
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0xddf0
movq %rax, -0xb0(%rbp)
jmp 0xc5ab
movq -0x18(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0xddf0
movq %rax, %rdi
callq 0xdc70
movq %rax, -0xb0(%rbp)
movq -0xb0(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x25a20
movq -0xa0(%rbp), %rsi
movq -0x98(%rbp), %rdx
movq %rax, %rcx
movl $0x2a0, %edi            # imm = 0x2A0
callq 0x256f0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0xf780
movq %rax, -0x8(%rbp)
jmp 0xc685
movq -0x30(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
movl $0x39, %edi
callq 0x256f0
movq %rax, -0x8(%rbp)
jmp 0xc685
movl -0xc(%rbp), %eax
movl %eax, -0xb4(%rbp)
movq -0x30(%rbp), %rax
cmpl $0xf, (%rax)
jb 0xc62f
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xc0(%rbp)
jmp 0xc63a
movq -0x30(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rax
cmpl $0x6, (%rax)
jne 0xc653
movl $0x5, %eax
movl %eax, -0xc4(%rbp)
jmp 0xc662
movq -0x30(%rbp), %rdi
callq 0x29e30
movl %eax, -0xc4(%rbp)
movl -0xb4(%rbp), %edi
movl -0xc4(%rbp), %eax
addl %eax, %edi
movq -0x30(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x256f0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xd0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)