// File: /workspace/github_c_makefile_star2_O2/Oric4ever[P]lcc65/6502/build/../src/expr.c
// Function: assign
Type assign(xty, p) Type xty; Tree p; {
	Type yty = unqual(p->type);

	if (yty->size == 0)
		return 0;
	xty = unqual(xty);
	if (isenum(xty))
		xty = xty->type;
	if (isarith(xty) && isarith(yty))
		return xty;
	if (isstruct(xty) && xty == yty)
		return xty;
	if (isstruct(xty) && isstruct(yty) && extends(yty, xty))
		return xty;
	if (isptr(xty) && isptr(yty)) {
		Type lty = xty->type, rty = yty->type;
		if (isstruct(lty) && isstruct(rty) && extends(rty, lty))
			return xty;
		if (eqtype(lty, rty, 1)
		|| (eqtype(unqual(lty), unqual(rty), 1)
		&& (   !isconst(rty) || isconst(lty))
		&& (!isvolatile(rty) || isvolatile(lty))))
			return yty;
		if (xty == voidptype || unqual(lty) == voidtype
		||  yty == voidptype || unqual(rty) == voidtype)
			return xty;
		if (lty == inttype && isenum(rty) || rty == inttype && isenum(lty)) {
			if (Aflag >= 1)
				warning("assignment between `%t' and `%t' is compiler-dependent\n",
					xty, yty);
			return xty;
		}
	}
	if (isptr(xty) && isint(p->type) && generic(p->op) == CNST
	&& cast(p, unsignedtype)->u.v.u == 0)
		return xty;
	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rsi), %r15
cmpl $0xf, (%r15)
jb 0x962d
movq 0x10(%r15), %r15
cmpl $0x0, 0x8(%r15)
je 0x9903
movl (%rbx), %eax
cmpl $0xf, %eax
jb 0x9652
movq 0x10(%rbx), %rbx
movl (%rbx), %eax
cmpl $0xf, %eax
jb 0x9652
movq 0x10(%rbx), %rcx
movl (%rcx), %ecx
jmp 0x9654
movl %eax, %ecx
cmpl $0xd, %ecx
jne 0x965f
movq 0x10(%rbx), %rbx
movl (%rbx), %eax
movl %eax, %ecx
cmpl $0xf, %eax
jb 0x966c
movq 0x10(%rbx), %rcx
movl (%rcx), %ecx
cmpl $0x6, %ecx
ja 0x9688
movl (%r15), %ecx
cmpl $0xf, %ecx
jb 0x967f
movq 0x10(%r15), %rcx
movl (%rcx), %ecx
cmpl $0x7, %ecx
jb 0x9905
cmpl $0xf, %eax
jb 0x96a8
movq 0x10(%rbx), %rcx
movl (%rcx), %ecx
cmpl $0x9, %ecx
je 0x96af
cmpq %r15, %rbx
jne 0x96b8
cmpl $0xa, %ecx
je 0x9905
jmp 0x96b8
movl %eax, %ecx
cmpl $0x9, %eax
jne 0x9698
cmpq %r15, %rbx
je 0x9905
cmpl $0xf, %eax
jb 0x96ca
movq 0x10(%rbx), %rcx
movl (%rcx), %ecx
cmpl $0x9, %ecx
jne 0x96d1
jmp 0x96d6
movl %eax, %ecx
cmpl $0x9, %eax
je 0x96d6
cmpl $0xa, %ecx
jne 0x9704
movl (%r15), %ecx
cmpl $0xf, %ecx
jb 0x96e4
movq 0x10(%r15), %rcx
movl (%rcx), %ecx
cmpl $0x9, %ecx
je 0x96ee
cmpl $0xa, %ecx
jne 0x9704
movq %r15, %rdi
movq %rbx, %rsi
callq 0x17ccb
testq %rax, %rax
jne 0x9905
movl (%rbx), %eax
cmpl $0xf, %eax
jb 0x970f
movq 0x10(%rbx), %rax
movl (%rax), %eax
cmpl $0x7, %eax
jne 0x98ac
movl (%r15), %eax
cmpl $0xf, %eax
jb 0x9726
movq 0x10(%r15), %rax
movl (%rax), %eax
cmpl $0x7, %eax
jne 0x98ac
movq 0x10(%rbx), %r12
movq 0x10(%r15), %r13
movl (%r12), %eax
cmpl $0xf, %eax
jb 0x9747
movq 0x10(%r12), %rax
movl (%rax), %eax
cmpl $0x9, %eax
je 0x9751
cmpl $0xa, %eax
jne 0x977e
movl (%r13), %eax
cmpl $0xf, %eax
jb 0x9760
movq 0x10(%r13), %rax
movl (%rax), %eax
cmpl $0x9, %eax
je 0x976a
cmpl $0xa, %eax
jne 0x977e
movq %r13, %rdi
movq %r12, %rsi
callq 0x17ccb
testq %rax, %rax
jne 0x9905
pushq $0x1
popq %rdx
movq %r12, %rdi
movq %r13, %rsi
callq 0x17b46
testl %eax, %eax
je 0x9798
movq %r15, %rbx
jmp 0x9905
cmpl $0xf, (%r12)
movq %r12, %rdi
jb 0x97a7
movq 0x10(%r12), %rdi
cmpl $0xf, (%r13)
movq %r13, %rsi
jb 0x97b5
movq 0x10(%r13), %rsi
pushq $0x1
popq %rdx
callq 0x17b46
testl %eax, %eax
je 0x97fc
movl (%r13), %ecx
cmpl $0xf, %ecx
je 0x97da
cmpl $0x1f, %ecx
je 0x97da
cmpl $0x10, %ecx
jne 0x9790
movl (%r12), %eax
jmp 0x97f2
movl (%r12), %eax
movl %eax, %edx
orl $0x10, %edx
cmpl $0x1f, %edx
jne 0x97fc
cmpl $0x1f, %ecx
je 0x97f2
cmpl $0x10, %ecx
jne 0x9790
cmpl $0x10, %eax
je 0x9790
cmpl $0x1f, %eax
je 0x9790
leaq 0x287ed(%rip), %rax     # 0x31ff0
movq (%rax), %rcx
cmpq %rcx, %rbx
je 0x9905
movl (%r12), %eax
movq %r12, %rsi
cmpl $0xf, %eax
jb 0x9820
movq 0x10(%r12), %rsi
cmpq %rcx, %r15
je 0x9905
leaq 0x287b0(%rip), %rcx     # 0x31fe0
movq (%rcx), %rdx
cmpq %rdx, %rsi
je 0x9905
movl (%r13), %ecx
movq %r13, %rsi
cmpl $0xf, %ecx
jb 0x984c
movq 0x10(%r13), %rsi
cmpq %rdx, %rsi
je 0x9905
leaq 0x2873c(%rip), %rdx     # 0x31f98
movq (%rdx), %rdx
cmpq %rdx, %r12
jne 0x9874
cmpl $0xf, %ecx
jb 0x986f
movq 0x10(%r13), %rcx
movl (%rcx), %ecx
cmpl $0xd, %ecx
je 0x988a
cmpq %rdx, %r13
jne 0x98ac
cmpl $0xf, %eax
jb 0x9885
movq 0x10(%r12), %rax
movl (%rax), %eax
cmpl $0xd, %eax
jne 0x98ac
leaq 0x221c7(%rip), %rax     # 0x2ba58
cmpl $0x0, (%rax)
jle 0x9905
leaq 0x138a5(%rip), %rdi     # 0x1d142
movq %rbx, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x9239
jmp 0x9905
movl (%rbx), %eax
cmpl $0xf, %eax
jb 0x98b9
movq 0x10(%rbx), %rax
movl (%rax), %eax
cmpl $0x7, %eax
jne 0x9903
movq 0x8(%r14), %rcx
movl (%rcx), %eax
cmpl $0xf, %eax
jb 0x98d6
movq 0x10(%rcx), %rax
movl (%rax), %eax
cmpl $0x2, %eax
ja 0x98db
jmp 0x9903
cmpl $0x3, %eax
jb 0x9903
cmpl $0x6, %eax
ja 0x9903
movl (%r14), %eax
andl $-0x10, %eax
cmpl $0x10, %eax
jne 0x9903
leaq 0x286e6(%rip), %rax     # 0x31fd8
movq (%rax), %rsi
movq %r14, %rdi
callq 0x9912
cmpl $0x0, 0x28(%rax)
je 0x9905
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq