// File: /workspace/github_c_makefile_star2_O3/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 0x19af1
movq %rdi, %rbx
leaq 0x77ed(%rip), %rcx      # 0x21078
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 0x11732
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0x19ab3
cmpl $0x0, 0x8(%rbx)
jne 0x198cd
leaq 0x7edb(%rip), %rdi      # 0x2179d
xorl %eax, %eax
callq 0x11732
movq 0x18(%rbx), %rax
movq 0x10(%rax), %rdx
testq %rdx, %rdx
je 0x19ad2
movb (%rdx), %al
addb $-0x31, %al
cmpb $0x8, %al
ja 0x19919
movq %rbx, %rdi
callq 0x173f0
testq %rax, %rax
jne 0x19898
movl (%rbx), %esi
movq 0x18(%rbx), %rdx
addq $0x28, %rdx
leaq 0x7eb9(%rip), %rdi      # 0x217b9
jmp 0x1990d
movq 0x10(%rbx), %rdx
leaq 0x7e7b(%rip), %rdi      # 0x21788
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x11732
movl (%rbx), %esi
leaq 0x7f98(%rip), %rdi      # 0x218ba
xorl %eax, %eax
callq 0x11732
cmpl $0x0, 0x8(%rbx)
jne 0x19aad
movq 0x18(%rbx), %rsi
addq $0x28, %rsi
leaq 0x7e79(%rip), %rdi      # 0x217bb
jmp 0x19aa1
movq 0x10(%rbx), %rsi
leaq 0x7e86(%rip), %rdi      # 0x217d8
xorl %eax, %eax
callq 0x11732
movq 0x18(%rbx), %r15
testq %r15, %r15
je 0x19aad
movq (%r15), %rsi
leaq 0x7e74(%rip), %rdi      # 0x217e4
xorl %eax, %eax
callq 0x11732
movq 0x8(%r15), %rsi
testq %rsi, %rsi
je 0x199bd
addq $0x10, %r15
leaq 0x6629(%rip), %rbx      # 0x1ffb4
leaq 0x7e56(%rip), %r14      # 0x217e8
cmpq 0x19647(%rip), %rsi     # 0x32fe0
je 0x199a7
movq %r14, %rdi
xorl %eax, %eax
callq 0x11732
jmp 0x199b1
movq %rbx, %rdi
xorl %eax, %eax
callq 0x11732
movq (%r15), %rsi
addq $0x8, %r15
testq %rsi, %rsi
jne 0x19992
leaq 0x6aee(%rip), %rdi      # 0x204b2
jmp 0x1989c
movl 0x8(%rbx), %eax
testl %eax, %eax
jle 0x19a83
movq 0x10(%rbx), %rcx
testq %rcx, %rcx
je 0x19a83
movl 0x8(%rcx), %ecx
testl %ecx, %ecx
jle 0x19a83
xorl %edx, %edx
divl %ecx
leaq 0x7df5(%rip), %rdi      # 0x217ec
movl %eax, %esi
xorl %eax, %eax
callq 0x11732
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0x19a91
leaq 0x8616(%rip), %r14      # 0x2202a
movq %rax, %r15
movl (%rax), %eax
cmpl $0xf, %eax
jb 0x19a24
movq 0x10(%r15), %rax
movl (%rax), %eax
cmpl $0xc, %eax
jne 0x19a91
movq 0x10(%r15), %rax
movl 0x8(%rax), %ecx
testl %ecx, %ecx
jle 0x19a91
movl 0x8(%r15), %eax
cltd
idivl %ecx
movq %r14, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x11732
movq 0x10(%r15), %rax
movq %r15, %rbx
testq %rax, %rax
jne 0x19a14
jmp 0x19a91
movq 0x10(%rbx), %rcx
leaq 0x7d25(%rip), %rdi      # 0x21785
movl $0xf, %esi
movl $0x10, %edx
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x11732
movq 0x10(%rbx), %rsi
leaq 0x7d49(%rip), %rdi      # 0x217ca
jmp 0x19aa1
leaq 0x7d6b(%rip), %rdi      # 0x217f5
xorl %eax, %eax
callq 0x11732
movq 0x10(%rbx), %rsi
testq %rsi, %rsi
je 0x19aad
leaq 0x7d65(%rip), %rdi      # 0x21806
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x11732
popq %rbx
popq %r14
popq %r15
retq
leaq 0x4712(%rip), %rdi      # 0x1e1cc
leaq 0x7767(%rip), %rsi      # 0x21228
leaq 0x7cc6(%rip), %rcx      # 0x2178e
movl $0x1b3, %edx            # imm = 0x1B3
callq 0x30d0
leaq 0x7cd0(%rip), %rdi      # 0x217a9
leaq 0x7748(%rip), %rsi      # 0x21228
leaq 0x7ca7(%rip), %rcx      # 0x2178e
movl $0x1b6, %edx            # imm = 0x1B6
callq 0x30d0
leaq 0x46a3(%rip), %rdi      # 0x1e19b
leaq 0x7729(%rip), %rsi      # 0x21228
leaq 0x7c88(%rip), %rcx      # 0x2178e
movl $0x1e4, %edx            # imm = 0x1E4
callq 0x30d0