// File: /workspace/github_c_makefile_star2_O2/Oric4ever[P]lcc65/6502/build/../src/types.c
// Function: outtype
void outtype(ty) Type ty; {
	switch (ty->op) {
	case CONST+VOLATILE:
		print("%k %k %t", CONST, VOLATILE, ty->type);
		break;
	case CONST: case VOLATILE:
		print("%k %t", ty->op, ty->type);
		break;
	case STRUCT: case UNION: case ENUM:
		assert(ty->u.sym);
		if (ty->size == 0)
			print("incomplete ");
		assert(ty->u.sym->name);
		if (*ty->u.sym->name >= '1' && *ty->u.sym->name <= '9') {
			Symbol p = findtype(ty);
			if (p == 0)
				print("%k defined at %w", ty->op, &ty->u.sym->src);
			else
				print(p->name);
		} else {
			print("%k %s", ty->op, ty->u.sym->name);
			if (ty->size == 0)
				print(" defined at %w", &ty->u.sym->src);
		}
		break;
	case VOID: case FLOAT: case DOUBLE:
	case CHAR: case SHORT: case INT: case UNSIGNED:
		print(ty->u.sym->name);
		break;
	case POINTER:
		print("pointer to %t", ty->type);
		break;
	case FUNCTION:
		print("%t function", ty->type);
		if (ty->u.proto) {
			Type *p = ty->u.proto;
			print("(%t", *p);
			while (*++p)
				if (*p == voidtype)
					print(",...");
				else
					print(",%t", *p);
			print(")");
		}
		break;
	case ARRAY:
		if (ty->size > 0 && ty->type && ty->type->size > 0) {
			print("array %d", ty->size/ty->type->size);
			while (ty->type && isarray(ty->type) && ty->type->type->size > 0) {
				ty = ty->type;
				print(",%d", ty->size/ty->type->size);
			}
		} else
			print("incomplete array");
		if (ty->type)
			print(" of %t", ty->type);
		break;
	default:
		assert(0);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl (%rdi), %esi
leal -0x1(%rsi), %eax
cmpl $0x1e, %eax
ja 0x1852d
movq %rdi, %rbx
leaq 0x6d9d(%rip), %rcx      # 0x1f078
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x18(%rbx), %rax
movq 0x10(%rax), %rdi
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x106a9
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x184ef
cmpl $0x0, 0x8(%rbx)
jne 0x1831d
leaq 0x748b(%rip), %rdi      # 0x1f79d
xorl %eax, %eax
callq 0x106a9
movq 0x18(%rbx), %rax
movq 0x10(%rax), %rdx
testq %rdx, %rdx
je 0x1850e
movb (%rdx), %al
addb $-0x31, %al
cmpb $0x8, %al
ja 0x18369
movq %rbx, %rdi
callq 0x16023
testq %rax, %rax
jne 0x182e8
movl (%rbx), %esi
movq 0x18(%rbx), %rdx
addq $0x28, %rdx
leaq 0x7469(%rip), %rdi      # 0x1f7b9
jmp 0x1835d
movq 0x10(%rbx), %rdx
leaq 0x742b(%rip), %rdi      # 0x1f788
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x106a9
movl (%rbx), %esi
leaq 0x7548(%rip), %rdi      # 0x1f8ba
xorl %eax, %eax
callq 0x106a9
cmpl $0x0, 0x8(%rbx)
jne 0x184dd
movq 0x18(%rbx), %rsi
addq $0x28, %rsi
leaq 0x7429(%rip), %rdi      # 0x1f7bb
jmp 0x184d1
movq 0x10(%rbx), %rsi
leaq 0x7436(%rip), %rdi      # 0x1f7d8
xorl %eax, %eax
callq 0x106a9
movq 0x18(%rbx), %r15
testq %r15, %r15
je 0x184dd
movq (%r15), %rsi
leaq 0x7424(%rip), %rdi      # 0x1f7e4
xorl %eax, %eax
callq 0x106a9
addq $0x8, %r15
leaq 0x5be2(%rip), %rbx      # 0x1dfb4
leaq 0x740f(%rip), %r14      # 0x1f7e8
movq (%r15), %rsi
testq %rsi, %rsi
je 0x184e3
cmpq 0x19bf4(%rip), %rsi     # 0x31fe0
je 0x183fa
movq %r14, %rdi
xorl %eax, %eax
callq 0x106a9
jmp 0x18404
movq %rbx, %rdi
xorl %eax, %eax
callq 0x106a9
addq $0x8, %r15
jmp 0x183d9
movl 0x8(%rbx), %eax
testl %eax, %eax
jle 0x184b0
movq 0x10(%rbx), %rcx
testq %rcx, %rcx
je 0x184b0
movl 0x8(%rcx), %ecx
testl %ecx, %ecx
jle 0x184b0
xorl %edx, %edx
divl %ecx
leaq 0x73b4(%rip), %rdi      # 0x1f7ec
movl %eax, %esi
xorl %eax, %eax
callq 0x106a9
leaq 0x7be2(%rip), %r14      # 0x2002a
movq 0x10(%rbx), %rbx
testq %rbx, %rbx
je 0x184dd
movl (%rbx), %eax
cmpl $0xf, %eax
jb 0x18462
movq 0x10(%rbx), %rax
movl (%rax), %eax
cmpl $0xc, %eax
jne 0x184c7
movq 0x10(%rbx), %rax
movl 0x8(%rax), %ecx
testl %ecx, %ecx
jle 0x184c7
movl 0x8(%rbx), %eax
cltd
idivl %ecx
movq %r14, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x106a9
jmp 0x18448
movq 0x10(%rbx), %rcx
leaq 0x72f4(%rip), %rdi      # 0x1f785
pushq $0xf
popq %rsi
pushq $0x10
popq %rdx
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x106a9
movq 0x10(%rbx), %rsi
leaq 0x731c(%rip), %rdi      # 0x1f7ca
jmp 0x184d1
leaq 0x733e(%rip), %rdi      # 0x1f7f5
xorl %eax, %eax
callq 0x106a9
movq 0x10(%rbx), %rbx
testq %rbx, %rbx
je 0x184dd
leaq 0x7338(%rip), %rdi      # 0x1f806
movq %rbx, %rsi
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x106a9
popq %rbx
popq %r14
popq %r15
retq
leaq 0x5fd0(%rip), %rdi      # 0x1e4ba
jmp 0x182ec
leaq 0x3cd6(%rip), %rdi      # 0x1c1cc
leaq 0x6d2b(%rip), %rsi      # 0x1f228
leaq 0x728a(%rip), %rcx      # 0x1f78e
movl $0x1b3, %edx            # imm = 0x1B3
callq 0x30d0
leaq 0x7294(%rip), %rdi      # 0x1f7a9
leaq 0x6d0c(%rip), %rsi      # 0x1f228
leaq 0x726b(%rip), %rcx      # 0x1f78e
movl $0x1b6, %edx            # imm = 0x1B6
callq 0x30d0
leaq 0x3c67(%rip), %rdi      # 0x1c19b
leaq 0x6ced(%rip), %rsi      # 0x1f228
leaq 0x724c(%rip), %rcx      # 0x1f78e
movl $0x1e4, %edx            # imm = 0x1E4
callq 0x30d0