// File: /workspace/github_c_makefile_star2_O2/hsjoihs[P]c-compiler/type.c
// Function: debug_print_type
void debug_print_type(const struct Type *ref_type)
{
	struct Type type = *ref_type;
	switch (type.type_category) {
	case PTR_:
		fprintf(stderr, "pointer to ");
		debug_print_type(type.derived_from);
		return;
	case VOID_:
		fprintf(stderr, "void");
		return;
	case INT_:
		fprintf(stderr, "int");
		return;
	case CHAR_:
		fprintf(stderr, "char");
		return;
	case STRUCT_NOT_UNION:
		fprintf(stderr, "struct %s", type.s.struct_or_union_tag);
		return;
	case UNION:
		fprintf(stderr, "union %s", type.s.struct_or_union_tag);
		return;
	case ENUM_:
		fprintf(stderr, "enum %s", type.e.enum_tag);
		return;
	case ARRAY:
		fprintf(stderr, "array (length %d) of ", type.array_length);
		debug_print_type(type.derived_from);
		return;
	case FN:
		fprintf(stderr, "function (");
		switch (type.param_infos_validity) {
		case INVALID: {
			fprintf(stderr, "param: no info");
			break;
		}
		case VALID: {
			if (type.param_infos.length == 0) {
				fprintf(stderr, "no params");
			} else if (type.param_infos.length < 2) {
				const struct TypeAndIdent *vec_0 = type.param_infos.vector[0];
				fprintf(stderr,
				        "%s: ", vec_0->ident_str ? vec_0->ident_str : "@anon");
				debug_print_type(&vec_0->type);
			} else {
				fprintf(stderr, "params: \n");
				for (int i = 0; i < type.param_infos.length; i++) {
					const struct TypeAndIdent *ptr_paraminfo =
					    type.param_infos.vector[i];
					fprintf(stderr, "  %s: ",
					        ptr_paraminfo->ident_str ? ptr_paraminfo->ident_str
					                                 : "@anon");
					debug_print_type(&ptr_paraminfo->type);
					fprintf(stderr, "\n");
				}
			}
			break;
		}
		case VA_ARGS: {
			if (type.param_infos.length == 0) {
				fprintf(stderr, "no params varg");
			} else {
				fprintf(stderr, "params: \n");
				for (int i = 0; i < type.param_infos.length; i++) {
					const struct TypeAndIdent *ptr_paraminfo =
					    type.param_infos.vector[i];
					fprintf(stderr, "  %s: ",
					        ptr_paraminfo->ident_str ? ptr_paraminfo->ident_str
					                                 : "@anon");
					debug_print_type(&ptr_paraminfo->type);
					fprintf(stderr, "\n");
				}
				fprintf(stderr, ", ...");
			}
			break;
		}
		}
		fprintf(stderr, ") returning ");
		debug_print_type(type.derived_from);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r13
leaq 0x6fb6(%rip), %rbx      # 0xf24c
pushq $0x1
popq %r15
movl (%r13), %ecx
cmpq $0x8, %rcx
ja 0x84fc
movq %r13, %rax
movq 0x8(%r13), %r13
movq 0x30(%rax), %rdx
movslq (%rbx,%rcx,4), %rcx
addq %rbx, %rcx
jmpq *%rcx
movq 0xdd35(%rip), %rax      # 0x15ff8
movq (%rax), %rcx
leaq 0x700d(%rip), %rdi      # 0xf2da
pushq $0xb
popq %rsi
movq %r15, %rdx
callq 0x1180
jmp 0x829a
movl 0x18(%rax), %ebx
movq 0x20(%rax), %rcx
movq %rcx, -0x30(%rbp)
movl 0x28(%rax), %r14d
movq 0xdd08(%rip), %rax      # 0x15ff8
movq (%rax), %rcx
leaq 0x7027(%rip), %rdi      # 0xf321
pushq $0xa
popq %rsi
movq %r15, %rdx
callq 0x1180
cmpl $0x2, %r14d
je 0x836c
cmpl $0x1, %r14d
je 0x8352
testl %r14d, %r14d
jne 0x8460
movq 0xdcd7(%rip), %rax      # 0x15ff8
movq (%rax), %rcx
leaq 0x7001(%rip), %rdi      # 0xf32c
pushq $0xe
jmp 0x8457
movl 0x10(%rax), %edx
movq 0xdcbc(%rip), %rax      # 0x15ff8
movq (%rax), %rdi
leaq 0x6fc5(%rip), %rsi      # 0xf30b
xorl %eax, %eax
callq 0x10f0
jmp 0x829a
testq %rbx, %rbx
jne 0x838d
movq 0xdc9a(%rip), %rax      # 0x15ff8
movq (%rax), %rcx
leaq 0x6fd3(%rip), %rdi      # 0xf33b
pushq $0x9
jmp 0x8384
movq 0xdc85(%rip), %rax      # 0x15ff8
movq (%rax), %rcx
testq %rbx, %rbx
jne 0x83d4
leaq 0x6fda(%rip), %rdi      # 0xf35c
pushq $0xe
popq %rsi
movq %r15, %rdx
jmp 0x845b
cmpl $0x1, %ebx
jg 0x848c
movq -0x30(%rbp), %rax
movq (%rax), %r14
movq 0xdc54(%rip), %rax      # 0x15ff8
movq (%rax), %rdi
movq 0x50(%r14), %rdx
testq %rdx, %rdx
leaq 0x6f90(%rip), %rax      # 0xf345
cmoveq %rax, %rdx
leaq 0x6f97(%rip), %rsi      # 0xf357
xorl %eax, %eax
callq 0x10f0
movq %r14, %rdi
callq 0x827e
jmp 0x8460
leaq 0x6f70(%rip), %rdi      # 0xf34b
pushq $0x9
popq %rsi
movq %r15, %rdx
callq 0x1180
testl %ebx, %ebx
movl $0x0, %eax
cmovlel %eax, %ebx
xorl %r15d, %r15d
cmpq %r15, %rbx
je 0x8444
movq -0x30(%rbp), %rax
movq (%rax,%r15,8), %r14
movq 0xdbf1(%rip), %r12      # 0x15ff8
movq (%r12), %rdi
movq 0x50(%r14), %rdx
testq %rdx, %rdx
leaq 0x6f2c(%rip), %rax      # 0xf345
cmoveq %rax, %rdx
leaq 0x6f31(%rip), %rsi      # 0xf355
xorl %eax, %eax
callq 0x10f0
movq %r14, %rdi
callq 0x827e
movq (%r12), %rsi
pushq $0xa
popq %rdi
callq 0x1090
incq %r15
jmp 0x83f3
movq 0xdbad(%rip), %rax      # 0x15ff8
movq (%rax), %rcx
leaq 0x6f16(%rip), %rdi      # 0xf36b
pushq $0x5
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
movq 0xdb91(%rip), %rax      # 0x15ff8
movq (%rax), %rcx
leaq 0x6f00(%rip), %rdi      # 0xf371
pushq $0xc
popq %rsi
pushq $0x1
popq %r15
movq %r15, %rdx
callq 0x1180
leaq 0x6dc5(%rip), %rbx      # 0xf24c
jmp 0x829a
movq 0xdb65(%rip), %rax      # 0x15ff8
movq (%rax), %rcx
leaq 0x6eae(%rip), %rdi      # 0xf34b
pushq $0x9
popq %rsi
movq %r15, %rdx
callq 0x1180
xorl %r15d, %r15d
cmpq %r15, %rbx
je 0x8460
movq -0x30(%rbp), %rax
movq (%rax,%r15,8), %r14
movq 0xdb39(%rip), %r12      # 0x15ff8
movq (%r12), %rdi
movq 0x50(%r14), %rdx
testq %rdx, %rdx
leaq 0x6e74(%rip), %rax      # 0xf345
cmoveq %rax, %rdx
leaq 0x6e79(%rip), %rsi      # 0xf355
xorl %eax, %eax
callq 0x10f0
movq %r14, %rdi
callq 0x827e
movq (%r12), %rsi
pushq $0xa
popq %rdi
callq 0x1090
incq %r15
jmp 0x84ab
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xdae6(%rip), %rax      # 0x15ff8
movq (%rax), %rdi
leaq 0x6dde(%rip), %rsi      # 0xf2fa
jmp 0x855b
movq 0xdad3(%rip), %rax      # 0x15ff8
movq (%rax), %rdi
leaq 0x6dc1(%rip), %rsi      # 0xf2f0
jmp 0x855b
movq 0xdac0(%rip), %rax      # 0x15ff8
movq (%rax), %rcx
leaq 0x73aa(%rip), %rdi      # 0xf8ec
pushq $0x3
jmp 0x8596
movq 0x40(%rax), %rdx
movq 0xdaa7(%rip), %rax      # 0x15ff8
movq (%rax), %rdi
leaq 0x6da8(%rip), %rsi      # 0xf303
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10f0
movq 0xda81(%rip), %rax      # 0x15ff8
movq (%rax), %rcx
leaq 0x6d65(%rip), %rdi      # 0xf2e6
jmp 0x8594
movq 0xda6e(%rip), %rax      # 0x15ff8
movq (%rax), %rcx
leaq 0x6d57(%rip), %rdi      # 0xf2eb
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1180