// File: /workspace/github_c_makefile_star2_O2/mirth-lang[P]mirth/bin/mirth1.c
// Function: mw_mirth_elab_zaTypeElab_elabzetypezeatomzx
static struct mirth_type_Type mw_mirth_elab_zaTypeElab_elabzetypezeatomzx (struct mirth_mirth_zaMirth* in_zaMirth_1, struct mirth_elab_zaTypeElab* in_zaTypeElab_2, struct mirth_mirth_zaMirth* *out_zaMirth_3, struct mirth_elab_zaTypeElab* *out_zaTypeElab_4) {
	uint64_t v6 = in_zaTypeElab_2->mtoken;
	struct mirth_mirth_zaMirth* v7;
	struct mirth_elab_zaTypeElab* v8;
	struct mirth_type_StackTypePart v9 = mw_mirth_elab_zaTypeElab_elabzestackzetypezepartzx(in_zaMirth_1, in_zaTypeElab_2, &v7, &v8);
	struct mirth_mirth_zaMirth* branch_zaMirth_10;
	struct mirth_elab_zaTypeElab* branch_zaTypeElab_11;
	struct mirth_type_Type branch_Type_12;
	switch ((v9).tag) {
		case mirth_type_StackTypePart_Cons: {
			struct mirth_type_Type v13 = mtp_mirth_type_StackTypePart_Cons(v9);
			branch_Type_12 = v13;
			branch_zaTypeElab_11 = v8;
			branch_zaMirth_10 = v7;
		} break;
		case mirth_type_StackTypePart_ConsLabel: {
			uint64_t v14;
			struct mirth_type_Type v15 = mtp_mirth_type_StackTypePart_ConsLabel(v9, &v14);
			decref(MK_mirth_type_Type(v15));
			STR* v16;
			STRLIT(v16, "Expected type, not label.", 25);
			struct mirth_mirth_zaMirth* v17;
			mw_mirth_mirth_zaMirth_emitzeerrorzx(v7, v6, v16, &v17);
			struct mirth_type_Type v18 = { .tag=mirth_type_Type_Error };
			branch_Type_12 = v18;
			branch_zaTypeElab_11 = v8;
			branch_zaMirth_10 = v17;
		} break;
		case mirth_type_StackTypePart_With: {
			struct mirth_type_Type v19 = mtp_mirth_type_StackTypePart_With(v9);
			decref(MK_mirth_type_Type(v19));
			STR* v20;
			STRLIT(v20, "Expected type, not resource.", 28);
			struct mirth_mirth_zaMirth* v21;
			mw_mirth_mirth_zaMirth_emitzeerrorzx(v7, v6, v20, &v21);
			struct mirth_type_Type v22 = { .tag=mirth_type_Type_Error };
			branch_Type_12 = v22;
			branch_zaTypeElab_11 = v8;
			branch_zaMirth_10 = v21;
		} break;
		case mirth_type_StackTypePart_WithLabel: {
			uint64_t v23;
			struct mirth_type_Type v24 = mtp_mirth_type_StackTypePart_WithLabel(v9, &v23);
			decref(MK_mirth_type_Type(v24));
			STR* v25;
			STRLIT(v25, "Expected type, not labelled resource.", 37);
			struct mirth_mirth_zaMirth* v26;
			mw_mirth_mirth_zaMirth_emitzeerrorzx(v7, v6, v25, &v26);
			struct mirth_type_Type v27 = { .tag=mirth_type_Type_Error };
			branch_Type_12 = v27;
			branch_zaTypeElab_11 = v8;
			branch_zaMirth_10 = v26;
		} break;
		default: {
			do_panic(str_make("unexpected fallthrough in match\n", 32));
		}
	}
	*out_zaTypeElab_4 = branch_zaTypeElab_11;
	*out_zaMirth_3 = branch_zaMirth_10;
	return branch_Type_12;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rcx, %r14
movq %rdx, %rbx
movq 0x10(%rsi), %r15
leaq -0x30(%rbp), %rdx
leaq -0x28(%rbp), %rcx
callq 0x3ac59
movq %rdx, %rdi
movl %eax, %eax
leaq 0x95fd0(%rip), %rcx     # 0xd2bac
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x3aac9
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %rsi
jmp 0x3cd85
movabsq $0xfffffffffffc, %r12   # imm = 0xFFFFFFFFFFFC
callq 0x3ab5d
movq %rdx, %rcx
andq %r12, %rcx
sete %sil
testb $0x3, %dl
setne %dil
orb %sil, %dil
jne 0x3cc36
decl (%rcx)
jne 0x3cc36
shlq $0x30, %rax
orq %rdx, %rax
leaq 0xcbebb(%rip), %rsi     # 0x108ae9
movq %rax, %rdi
callq 0xce94
movq 0x10cfd3b(%rip), %rdx   # 0x110c978
testq %rdx, %rdx
jne 0x3cc5b
leaq 0x9c98b(%rip), %rdi     # 0xd95d4
pushq $0x1c
popq %rsi
callq 0x8a21
movq %rax, %rdx
movq %rax, 0x10cfd1d(%rip)   # 0x110c978
andq %rdx, %r12
sete %al
testb $0x3, %dl
setne %cl
orb %al, %cl
jne 0x3cc6f
incl (%r12)
movq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %r12
jmp 0x3cd6e
movabsq $0xfffffffffffc, %r12   # imm = 0xFFFFFFFFFFFC
leaq -0x38(%rbp), %rsi
callq 0x3ab9d
movq %rdx, %rcx
andq %r12, %rcx
sete %sil
testb $0x3, %dl
setne %dil
orb %sil, %dil
jne 0x3ccbf
decl (%rcx)
jne 0x3ccbf
shlq $0x30, %rax
orq %rdx, %rax
leaq 0xcbe32(%rip), %rsi     # 0x108ae9
movq %rax, %rdi
callq 0xce94
movq 0x10cfcba(%rip), %rdx   # 0x110c980
testq %rdx, %rdx
jne 0x3cd52
leaq 0x9c91b(%rip), %rdi     # 0xd95f1
pushq $0x25
popq %rsi
callq 0x8a21
movq %rax, %rdx
movq %rax, 0x10cfc98(%rip)   # 0x110c980
jmp 0x3cd52
movabsq $0xfffffffffffc, %r12   # imm = 0xFFFFFFFFFFFC
leaq -0x38(%rbp), %rsi
callq 0x3ab09
movq %rdx, %rcx
andq %r12, %rcx
sete %sil
testb $0x3, %dl
setne %dil
orb %sil, %dil
jne 0x3cd2d
decl (%rcx)
jne 0x3cd2d
shlq $0x30, %rax
orq %rdx, %rax
leaq 0xcbdc4(%rip), %rsi     # 0x108ae9
movq %rax, %rdi
callq 0xce94
movq 0x10cfc3c(%rip), %rdx   # 0x110c970
testq %rdx, %rdx
jne 0x3cd52
leaq 0x9c87a(%rip), %rdi     # 0xd95ba
pushq $0x19
popq %rsi
callq 0x8a21
movq %rax, %rdx
movq %rax, 0x10cfc1e(%rip)   # 0x110c970
andq %rdx, %r12
sete %al
testb $0x3, %dl
setne %cl
orb %al, %cl
jne 0x3cd66
incl (%r12)
movq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %r12
movq %r15, %rsi
movq %r12, %rcx
callq 0x2ceb4
movq -0x28(%rbp), %rcx
movq (%r12), %rsi
xorl %eax, %eax
xorl %edx, %edx
movq %rcx, (%r14)
movq %rsi, (%rbx)
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq