// File: /workspace/github_c_makefile_star2_O1/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 0x18d77
movq %rsi, %r15
movl (%rbx), %r14d
cmpl (%rsi), %r14d
jne 0x18d75
leal -0x1(%r14), %eax
cmpl $0x1e, %eax
ja 0x18ff6
leaq 0x8194(%rip), %rcx      # 0x20f00
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(%r15), %rsi
callq 0x18d3a
movl %r14d, %edi
jmp 0x18f78
movq 0x10(%rbx), %rdi
movq 0x10(%r15), %rsi
callq 0x18d3a
movq %rax, %r14
testq %rax, %rax
je 0x18f8e
movq 0x18(%rbx), %r12
testq %r12, %r12
je 0x18dcb
cmpq $0x0, 0x18(%r15)
je 0x18fa4
testq %r12, %r12
sete %al
movq 0x18(%r15), %r15
testq %r15, %r15
setne %cl
testb %cl, %al
jne 0x18f90
movq (%r12), %rdi
testq %rdi, %rdi
sete %al
je 0x18fd3
movq (%r15), %rsi
testq %rsi, %rsi
je 0x18fd8
xorl %ebx, %ebx
xorl %r13d, %r13d
cmpl $0xf, (%rdi)
jb 0x18e0d
movq 0x10(%rdi), %rdi
cmpl $0xf, (%rsi)
jb 0x18e16
movq 0x10(%rsi), %rsi
callq 0x18d3a
movq %rax, %rbp
testq %rax, %rax
je 0x18e85
movq (%r12), %rax
movl (%rax), %eax
orl $0x10, %eax
cmpl $0x1f, %eax
je 0x18e3e
movq (%r15), %rax
movl (%rax), %eax
orl $0x10, %eax
cmpl $0x1f, %eax
jne 0x18eb8
movl $0xf, %edi
movq %rbp, %rsi
callq 0x19015
movq (%r12), %rcx
movl (%rcx), %ecx
cmpl $0x10, %ecx
je 0x18e6a
cmpl $0x1f, %ecx
je 0x18e6a
movq (%r15), %rcx
movl (%rcx), %ecx
cmpl $0x1f, %ecx
je 0x18e6a
cmpl $0x10, %ecx
jne 0x18e77
movl $0x10, %edi
movq %rax, %rsi
callq 0x19015
movq %rax, %rdi
movq %r13, %rsi
callq 0x16aec
movq %rax, %r13
testq %rbp, %rbp
je 0x18fc5
addq $0x8, %r15
movq 0x8(%r12), %rdi
testq %rdi, %rdi
sete %al
je 0x18fdf
addq $0x8, %r12
movq (%r15), %rsi
testq %rsi, %rsi
jne 0x18e04
jmp 0x18fdb
movq %rbp, %rax
jmp 0x18e4b
movq 0x10(%rbx), %rdi
movq 0x10(%r15), %rsi
callq 0x18d3a
movq %rax, %r14
testq %rax, %rax
je 0x18f8e
movl 0x8(%rbx), %eax
testl %eax, %eax
je 0x18ef3
movq 0x10(%rbx), %rcx
movl 0x8(%rcx), %ecx
testl %ecx, %ecx
je 0x18ef3
cmpl $0x0, 0x8(%r15)
je 0x18fb1
movl 0x8(%r15), %ecx
testl %ecx, %ecx
je 0x18f14
testl %eax, %eax
setne %al
movq 0x10(%r15), %rdx
movl 0x8(%rdx), %esi
testl %esi, %esi
sete %dl
orb %al, %dl
je 0x18f98
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
jmp 0x18fbd
movq 0x10(%rbx), %rdi
movq 0x10(%r15), %rsi
callq 0x18d3a
movq 0x190b4(%rip), %r8      # 0x31fe8
movl $0x7, %edi
movq %rax, %rsi
movl $0x2, %edx
movl $0x1, %ecx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x18963
movq 0x10(%rbx), %rdi
movq 0x10(%r15), %rsi
callq 0x18d3a
movl $0x10, %edi
movq %rax, %rsi
callq 0x19015
movl $0xf, %edi
movq %rax, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x19015
jmp 0x18fc5
movq %r14, %rdi
movq %r15, %rsi
jmp 0x18faa
movl %ecx, %eax
cltd
idivl %esi
movswl 0x4(%r15), %edx
jmp 0x18fb8
movq %r14, %rdi
movq %r12, %rsi
callq 0x1911b
jmp 0x18fc2
cltd
idivl %ecx
movswl 0x4(%rbx), %edx
movq %r14, %rdi
movl %eax, %esi
callq 0x18a62
movq %rax, %rbx
testq %r14, %r14
jne 0x18d77
jmp 0x18d75
xorl %r13d, %r13d
jmp 0x18fdf
xorl %r13d, %r13d
testb %al, %al
je 0x18fe5
cmpq $0x0, (%r15)
je 0x18fe9
xorl %ebx, %ebx
jmp 0x18fc5
movq %r14, %rdi
movq %r13, %rsi
callq 0x1917b
jmp 0x18fc2
leaq 0x519e(%rip), %rdi      # 0x1e19b
leaq 0x81a4(%rip), %rsi      # 0x211a8
leaq 0x8629(%rip), %rcx      # 0x21634
movl $0xb1, %edx
callq 0x30d0