// File: /workspace/github_c_makefile_star2_O2/Oric4ever[P]lcc65/6502/build/../src/types.c
// Function: composite
Type composite(ty1, ty2) Type ty1, ty2; {
	if (ty1 == ty2)
		return ty1;
	if (ty1->op != ty2->op)
		return 0;
	switch (ty1->op) {
	case CONST+VOLATILE:
		return qual(CONST, qual(VOLATILE, composite(ty1->type, ty2->type)));
	case CONST: case VOLATILE:
		return qual(ty1->op, composite(ty1->type, ty2->type));
	case POINTER:
		return ptr(composite(ty1->type, ty2->type));
	case ARRAY: {
		Type ty = composite(ty1->type, ty2->type);
		if (ty) {
			if (ty1->size && ty1->type->size && ty2->size == 0)
				return array(ty, ty1->size/ty1->type->size, ty1->align);
			if (ty2->size && ty2->type->size && ty1->size == 0)
				return array(ty, ty2->size/ty2->type->size, ty2->align);
			return array(ty, 0, 0);
		}
		break;
		}
	case FUNCTION: {
		List list = 0;
		Type ty = composite(ty1->type, ty2->type);
		if (ty) {
			Type *p1, *p2, proto = 0;
			if (ty1->u.proto && ty2->u.proto == 0)
				return func(ty, ty1->u.proto);
			if (ty2->u.proto && ty1->u.proto == 0)
				return func(ty, ty2->u.proto);
			for (p1 = ty1->u.proto, p2 = ty2->u.proto; *p1 && *p2; p1++, p2++) {
				Type ty;
				if ((ty = composite(unqual(*p1), unqual(*p2))) == 0)
					return 0;
				if (isconst(*p1) || isconst(*p2))
					ty = qual(CONST, ty);
				if (isvolatile(*p1) || isvolatile(*p2))
					ty = qual(VOLATILE, ty);
				list = append(ty, list);
			}
			if (*p1 || *p2)
				return 0;
			return funcl(ty, list);
		}
		break;
		}
	case CHAR:   case SHORT: case INT:     case DOUBLE:
	case VOID:   case FLOAT: case UNSIGNED:
	case STRUCT: case UNION: case ENUM:
		break;
	default:
		assert(0);
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq %rsi, %rdi
je 0x17678
movq %rsi, %r12
movl (%rbx), %r14d
cmpl (%rsi), %r14d
jne 0x17676
leal -0x1(%r14), %eax
cmpl $0x1e, %eax
ja 0x1789b
leaq 0x7913(%rip), %rcx      # 0x1ef80
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rbx), %rdi
movq 0x10(%r12), %rsi
callq 0x1763b
movl %r14d, %edi
jmp 0x17819
movq 0x10(%rbx), %rdi
movq 0x10(%r12), %rsi
callq 0x1763b
testq %rax, %rax
je 0x17676
movq %rax, %r14
movq 0x18(%rbx), %r15
movq 0x18(%r12), %r12
testq %r15, %r15
je 0x1782f
testq %r12, %r12
je 0x17844
xorl %ebx, %ebx
xorl %ebp, %ebp
xorl %r13d, %r13d
movq (%r15,%rbp), %rdi
movq (%r12,%rbp), %rsi
testq %rdi, %rdi
je 0x17879
testq %rsi, %rsi
je 0x17678
cmpl $0xf, (%rdi)
jb 0x176f7
movq 0x10(%rdi), %rdi
cmpl $0xf, (%rsi)
jb 0x17700
movq 0x10(%rsi), %rsi
callq 0x1763b
testq %rax, %rax
je 0x17678
movq (%r15,%rbp), %rcx
movl (%rcx), %ecx
movl %ecx, %edx
orl $0x10, %edx
cmpl $0x1f, %edx
je 0x1772c
movq (%r12,%rbp), %rdx
movl (%rdx), %edx
orl $0x10, %edx
cmpl $0x1f, %edx
jne 0x1773d
pushq $0xf
popq %rdi
movq %rax, %rsi
callq 0x178ba
movq (%r15,%rbp), %rcx
movl (%rcx), %ecx
cmpl $0x10, %ecx
je 0x17757
cmpl $0x1f, %ecx
je 0x17757
movq (%r12,%rbp), %rcx
movl (%rcx), %ecx
cmpl $0x1f, %ecx
je 0x17757
cmpl $0x10, %ecx
jne 0x17762
pushq $0x10
popq %rdi
movq %rax, %rsi
callq 0x178ba
movq %rax, %rdi
movq %r13, %rsi
callq 0x156a0
movq %rax, %r13
addq $0x8, %rbp
jmp 0x176d8
movq 0x10(%rbx), %rdi
movq 0x10(%r12), %rsi
callq 0x1763b
testq %rax, %rax
je 0x17676
movq %rax, %rdi
movl 0x8(%rbx), %eax
testl %eax, %eax
je 0x177b1
movq 0x10(%rbx), %rcx
movl 0x8(%rcx), %ecx
testl %ecx, %ecx
je 0x177b1
cmpl $0x0, 0x8(%r12)
je 0x1785d
movl 0x8(%r12), %ecx
testl %ecx, %ecx
je 0x177d0
testl %eax, %eax
setne %al
movq 0x10(%r12), %rdx
movl 0x8(%rdx), %esi
testl %esi, %esi
sete %dl
orb %al, %dl
je 0x17837
xorl %esi, %esi
xorl %edx, %edx
jmp 0x17866
movq 0x10(%rbx), %rdi
movq 0x10(%r12), %rsi
callq 0x1763b
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1736a
movq 0x10(%rbx), %rdi
movq 0x10(%r12), %rsi
callq 0x1763b
pushq $0x10
popq %rdi
movq %rax, %rsi
callq 0x178ba
pushq $0xf
popq %rdi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x178ba
movq %r14, %rdi
movq %r12, %rsi
jmp 0x1784a
movl %ecx, %eax
cltd
idivl %esi
movswl 0x4(%r12), %edx
jmp 0x17864
movq %r14, %rdi
movq %r15, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x179be
cltd
idivl %ecx
movswl 0x4(%rbx), %edx
movl %eax, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x17382
testq %rsi, %rsi
jne 0x17676
movq %r14, %rdi
movq %r13, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x17a0f
leaq 0x48f9(%rip), %rdi      # 0x1c19b
leaq 0x797f(%rip), %rsi      # 0x1f228
leaq 0x7e04(%rip), %rcx      # 0x1f6b4
movl $0xb1, %edx
callq 0x30d0