// File: /workspace/github_c_makefile_star2_O1/lucvoo[P]sparse-dev/evaluate.c
// Function: check_assignment_types
static int check_assignment_types(struct symbol *target, struct expression **rp,
	const char **typediff)
{
	struct symbol *source = degenerate(*rp);
	struct symbol *t, *s;
	int tclass = classify_type(target, &t);
	int sclass = classify_type(source, &s);

	if (tclass & sclass & TYPE_NUM) {
		if (tclass & TYPE_RESTRICT) {
			/* allowed assignments unfoul */
			if (sclass & TYPE_FOULED && unfoul(s) == t)
				goto Cast;
			if (!restricted_value(*rp, target))
				goto Cast;
			if (s == t)
				return 1;
		} else if (!(sclass & TYPE_RESTRICT))
			goto Cast;
                if (t == &bool_ctype) {
                        if (is_fouled_type(s))
                                warning((*rp)->pos, "%s degrades to integer",
                                        show_typename(s->ctype.base_type));
                        goto Cast;
                }
		*typediff = "different base types";
		return 0;
	}

	if (tclass == TYPE_PTR) {
		unsigned long mod1, mod2;
		unsigned long modl, modr;
		struct symbol *b1, *b2;
		// NULL pointer is always OK
		int is_null = is_null_pointer_constant(*rp);
		if (is_null) {
			if (is_null == NULL_ZERO)
				bad_null(*rp);
			goto Cast;
		}
		if (!(sclass & TYPE_PTR)) {
			*typediff = "different base types";
			return 0;
		}
		b1 = examine_pointer_target(t);
		b2 = examine_pointer_target(s);
		mod1 = t->ctype.modifiers & MOD_IGN;
		mod2 = s->ctype.modifiers & MOD_IGN;
		if (whitelist_pointers(b1, b2)) {
			/*
			 * assignments to/from void * are OK, provided that
			 * we do not remove qualifiers from pointed to [C]
			 * or mix address spaces [sparse].
			 */
			if (t->ctype.as != s->ctype.as) {
				*typediff = "different address spaces";
				return 0;
			}
			/*
			 * If this is a function pointer assignment, it is
			 * actually fine to assign a pointer to const data to
			 * it, as a function pointer points to const data
			 * implicitly, i.e., dereferencing it does not produce
			 * an lvalue.
			 */
			if (b1->type == SYM_FN)
				mod1 |= MOD_CONST;
			if (mod2 & ~mod1 & ~MOD_FUN_ATTR) {
				*typediff = "different modifiers";
				return 0;
			}
			goto Cast;
		}
		/* It's OK if the target is more volatile or const than the source */
		/* It's OK if the source is more pure/noreturn than the target */
		modr = mod1 & ~MOD_REV_QUAL;
		modl = mod2 &  MOD_REV_QUAL;
		*typediff = type_difference(&t->ctype, &s->ctype, modl, modr);
		if (*typediff)
			return 0;
		return 1;
	}

	if ((tclass & TYPE_COMPOUND) && s == t)
		return 1;

	if (tclass & TYPE_NUM) {
		/* XXX: need to turn into comparison with NULL */
		if (t == &bool_ctype && (sclass & TYPE_PTR))
			goto Cast;
		*typediff = "different base types";
		return 0;
	}
	*typediff = "invalid types";
	return 0;

Cast:
	*rp = cast_to(*rp, target);
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, 0x8(%rsp)
movq %rsi, %rbx
movq %rdi, %r14
movq (%rsi), %rdi
callq 0x33628
movq %rax, %r12
cmpb $0x3, (%r14)
movq %r14, %r13
jne 0x378c2
movq 0x60(%r14), %r13
cmpb $0xa, (%r13)
jne 0x378dd
movq %r13, %rdi
callq 0x2b5f4
movq %rax, %r13
cmpb $0x3, (%rax)
jne 0x378dd
movq 0x60(%r13), %r13
cmpb $0x9, (%r13)
jne 0x378e8
movq 0x60(%r13), %r13
movzbl (%r13), %eax
cmpq $0x2, %rax
jne 0x37909
movq 0x60(%r13), %rcx
cmpq 0x29682(%rip), %rcx     # 0x60f80
je 0x37915
cmpq 0x29639(%rip), %rcx     # 0x60f40
je 0x3791c
leaq 0x13330(%rip), %rcx     # 0x4ac40
movl (%rcx,%rax,4), %ebp
jmp 0x37921
movl $0x1, %ebp
jmp 0x37921
movl $0x9, %ebp
cmpb $0x3, (%r12)
jne 0x3792d
movq 0x60(%r12), %r12
cmpb $0xa, (%r12)
jne 0x37949
movq %r12, %rdi
callq 0x2b5f4
movq %rax, %r12
cmpb $0x3, (%rax)
jne 0x37949
movq 0x60(%r12), %r12
cmpb $0x9, (%r12)
jne 0x37955
movq 0x60(%r12), %r12
movzbl (%r12), %eax
cmpq $0x2, %rax
jne 0x37977
movq 0x60(%r12), %rcx
cmpq 0x29614(%rip), %rcx     # 0x60f80
je 0x37984
cmpq 0x295cb(%rip), %rcx     # 0x60f40
je 0x3798c
leaq 0x132c2(%rip), %rcx     # 0x4ac40
movl (%rcx,%rax,4), %r15d
jmp 0x37992
movl $0x1, %r15d
jmp 0x37992
movl $0x9, %r15d
movl %ebp, %ecx
andl %r15d, %ecx
testb $0x1, %cl
je 0x379ad
testb $0x4, %bpl
jne 0x379e5
testb $0x4, %r15b
jne 0x37a12
jmp 0x37c44
cmpl $0x10, %ebp
jne 0x37a31
movq (%rbx), %rdi
movq 0x10(%rdi), %rax
cmpq 0x295f0(%rip), %rax     # 0x60fb0
je 0x37a9e
xorl %ecx, %ecx
testb $0x10, 0x1(%rdi)
je 0x37aa3
callq 0xf386
xorl %ecx, %ecx
testl %eax, %eax
setne %cl
addl %ecx, %ecx
jmp 0x37aa3
testb $0x40, %r15b
je 0x379f6
cmpq %r13, 0x60(%r12)
je 0x37c44
movq (%rbx), %rcx
cmpb $0x1, (%rcx)
jne 0x37a09
cmpq $0x0, 0x20(%rcx)
je 0x37c44
cmpq %r13, %r12
je 0x37c52
cmpq 0x295c7(%rip), %r13     # 0x60fe0
je 0x37a58
leaq 0x1327c(%rip), %rax     # 0x4ac9e
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
xorl %eax, %eax
jmp 0x37c57
testb $0x20, %bpl
je 0x37a45
movl $0x1, %eax
cmpq %r13, %r12
je 0x37c57
testb $0x1, %bpl
jne 0x37af3
leaq 0x13560(%rip), %rax     # 0x4afb6
jmp 0x37a22
movq %r12, %rcx
cmpl $0x3, %eax
jne 0x37a65
movq 0x60(%r12), %rcx
cmpb $0x9, (%rcx)
jne 0x37a6e
movq 0x60(%rcx), %rcx
cmpb $0xe, (%rcx)
jne 0x37c44
movq (%rbx), %r15
movq 0x60(%r12), %rdi
callq 0x2386c
movq 0x8(%r15), %rdi
leaq 0x13494(%rip), %rsi     # 0x4af23
movq %rax, %rdx
xorl %eax, %eax
callq 0x118b4
jmp 0x37c44
movl $0x1, %ecx
movb $0x1, %bpl
testl %ecx, %ecx
je 0x37ad5
cmpl $0x2, %ecx
jne 0x37ad0
leaq 0x29b0a(%rip), %rax     # 0x615c0
cmpl $0x0, (%rax)
je 0x37ad0
movq (%rbx), %rax
movq 0x8(%rax), %rdi
leaq 0x134fb(%rip), %rsi     # 0x4afc4
xorl %eax, %eax
callq 0x118b4
jmp 0x37c3f
testb $0x10, %r15b
jne 0x37b0f
leaq 0x131bc(%rip), %rax     # 0x4ac9e
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
xorl %ebp, %ebp
xorl %eax, %eax
jmp 0x37c3f
cmpq 0x294e6(%rip), %r13     # 0x60fe0
jne 0x37a1b
andl $0x10, %r15d
jne 0x37c44
jmp 0x37a1b
movq %r13, %rdi
callq 0x2bfd0
movq %rax, %r15
movq %r12, %rdi
callq 0x2bfd0
movq %r15, %rsi
movq 0x68(%r13), %rcx
movq 0x68(%r12), %r15
cmpq %rax, %rsi
je 0x37c07
cmpq 0x293fa(%rip), %rsi     # 0x60f38
je 0x37ca5
movq %rax, %rdi
cmpq 0x293ea(%rip), %rax     # 0x60f38
je 0x37ca5
cmpb $0x3, (%rsi)
movq %rsi, %rax
jne 0x37b60
movq 0x60(%rsi), %rax
cmpb $0xa, (%rax)
jne 0x37b94
movq %rdi, 0x10(%rsp)
movq %rsi, 0x18(%rsp)
movq %rcx, 0x20(%rsp)
movq %rax, %rdi
callq 0x2b5f4
cmpb $0x3, (%rax)
jne 0x37b85
movq 0x60(%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdi
cmpb $0x9, (%rax)
jne 0x37b9d
movq 0x60(%rax), %rax
cmpb $0x2, (%rax)
jne 0x37c07
movq 0x60(%rax), %rdx
cmpq 0x293d3(%rip), %rdx     # 0x60f80
jne 0x37c07
cmpb $0x3, (%rdi)
jne 0x37bb8
movq 0x60(%rdi), %rdi
cmpb $0xa, (%rdi)
jne 0x37bec
movq %rax, 0x10(%rsp)
movq %rsi, 0x18(%rsp)
movq %rcx, 0x20(%rsp)
callq 0x2b5f4
movq %rax, %rdi
cmpb $0x3, (%rax)
jne 0x37bdd
movq 0x60(%rdi), %rdi
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rax
cmpb $0x9, (%rdi)
jne 0x37bf5
movq 0x60(%rdi), %rdi
cmpb $0x2, (%rdi)
jne 0x37c07
movq 0x60(%rdi), %rdx
cmpq 0x2937b(%rip), %rdx     # 0x60f80
je 0x37c66
andl $0xe00, %ecx            # imm = 0xE00
andl $0x11000000, %r15d      # imm = 0x11000000
addq $0x60, %r13
addq $0x60, %r12
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x32020
movq %rax, %rcx
movq 0x8(%rsp), %rax
movq %rcx, (%rax)
xorl %eax, %eax
testq %rcx, %rcx
sete %al
xorl %ebp, %ebp
testb %bpl, %bpl
je 0x37c57
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x334cd
movq %rax, (%rbx)
movl $0x1, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq %rdi, %rax
je 0x37ca5
movl 0x54(%rax), %eax
movl %eax, %edx
andl $0x3800000, %edx        # imm = 0x3800000
cmpl $0x3000000, %edx        # imm = 0x3000000
jne 0x37c8e
movl $0x3800000, %edx        # imm = 0x3800000
andl 0x54(%rdi), %edx
cmpl $0x3000000, %edx        # imm = 0x3000000
je 0x37ca5
xorl 0x54(%rdi), %eax
andl $0x3800000, %eax        # imm = 0x3800000
leaq 0x301a3(%rip), %rdx     # 0x67e40
orl (%rdx), %eax
jne 0x37c07
movq 0x80(%r13), %rax
cmpq 0x80(%r12), %rax
je 0x37cc2
leaq 0x1301e(%rip), %rax     # 0x4acdb
jmp 0x37ae2
andl $0xe00, %r15d           # imm = 0xE00
movl %ecx, %eax
orl $0x200, %eax            # imm = 0x200
cmpb $0x5, (%rsi)
cmovnel %ecx, %eax
notl %eax
testl %eax, %r15d
je 0x37ad0
leaq 0x1300c(%rip), %rax     # 0x4acf4
jmp 0x37ae2