// File: /workspace/github_c_makefile_star2_O3/mirth-lang[P]mirth/bin/mirth1.c
// Function: mw_mirth_type_StackType_applyzesubst
static struct mirth_type_StackType mw_mirth_type_StackType_applyzesubst (struct mirth_mirth_zaMirth* in_zaMirth_1, struct std_list_List_1 in_Subst_2, struct mirth_type_StackType in_StackType_3, struct mirth_mirth_zaMirth* *out_zaMirth_4, struct std_list_List_1 *out_Subst_5) {
	struct mirth_mirth_zaMirth* branch_zaMirth_7;
	struct std_list_List_1 branch_Subst_8;
	struct mirth_type_StackType branch_StackType_9;
	switch ((in_StackType_3).tag) {
		case mirth_type_StackType_Error: {
			struct mirth_type_StackType v10 = { .tag=mirth_type_StackType_Error };
			branch_StackType_9 = v10;
			branch_Subst_8 = in_Subst_2;
			branch_zaMirth_7 = in_zaMirth_1;
		} break;
		case mirth_type_StackType_Ignore: {
			struct mirth_type_StackType v11 = { .tag=mirth_type_StackType_Ignore };
			branch_StackType_9 = v11;
			branch_Subst_8 = in_Subst_2;
			branch_zaMirth_7 = in_zaMirth_1;
		} break;
		case mirth_type_StackType_Unit: {
			struct mirth_type_StackType v12 = { .tag=mirth_type_StackType_Unit };
			branch_StackType_9 = v12;
			branch_Subst_8 = in_Subst_2;
			branch_zaMirth_7 = in_zaMirth_1;
		} break;
		case mirth_type_StackType_Meta: {
			uint64_t v13 = mtp_mirth_type_StackType_Meta(in_StackType_3);
			struct mirth_mirth_zaMirth* v14;
			struct std_maybe_Maybe_1 v15 = mw_mirth_type_MetaVar_typezy(in_zaMirth_1, v13, &v14);
			struct std_list_List_1 branch_Subst_16;
			struct mirth_mirth_zaMirth* branch_zaMirth_17;
			struct mirth_type_StackType branch_StackType_18;
			switch ((v15).tag) {
				case std_maybe_Maybe_1_None: {
					struct mirth_type_StackType v19 = mtw_mirth_type_StackType_Meta(v13);
					branch_StackType_18 = v19;
					branch_zaMirth_17 = v14;
					branch_Subst_16 = in_Subst_2;
				} break;
				case std_maybe_Maybe_1_Some: {
					VAL v20 = mtp_std_maybe_Maybe_1_Some(v15);
					struct mirth_mirth_zaMirth* v21;
					struct mirth_type_Type v22 = mw_mirth_type_Type_expand(v14, V_mirth_type_Type(v20), &v21);
					incref(MK_mirth_type_Type(v22));
					struct std_maybe_Maybe_1 v23 = mtw_std_maybe_Maybe_1_Some(MK_mirth_type_Type(v22));
					struct mirth_mirth_zaMirth* v24;
					mw_mirth_type_MetaVar_typezyzx(v21, v23, v13, &v24);
					struct mirth_type_StackType v25 = mw_mirth_type_Type_zgStackType(v22);
					struct mirth_mirth_zaMirth* v26;
					struct std_list_List_1 v27;
					struct mirth_type_StackType v28 = mw_mirth_type_StackType_applyzesubst(v24, in_Subst_2, v25, &v26, &v27);
					branch_StackType_18 = v28;
					branch_zaMirth_17 = v26;
					branch_Subst_16 = v27;
				} break;
				default: {
					do_panic(str_make("unexpected fallthrough in match\n", 32));
				}
			}
			branch_StackType_9 = branch_StackType_18;
			branch_Subst_8 = branch_Subst_16;
			branch_zaMirth_7 = branch_zaMirth_17;
		} break;
		case mirth_type_StackType_Var: {
			uint64_t v29 = mtp_mirth_type_StackType_Var(in_StackType_3);
			incref(MK_std_list_List_1(in_Subst_2));
			struct mirth_mirth_zaMirth* v30;
			struct std_maybe_Maybe_1 v31 = mw_mirth_type_Subst_lookupzevar(in_zaMirth_1, v29, in_Subst_2, &v30);
			struct mirth_type_StackType branch_StackType_32;
			switch ((v31).tag) {
				case std_maybe_Maybe_1_Some: {
					VAL v33 = mtp_std_maybe_Maybe_1_Some(v31);
					struct mirth_type_StackType v34 = mw_mirth_type_Type_zgStackType(V_mirth_type_Type(v33));
					branch_StackType_32 = v34;
				} break;
				case std_maybe_Maybe_1_None: {
					struct mirth_type_StackType v35 = mtw_mirth_type_StackType_Var(v29);
					branch_StackType_32 = v35;
				} break;
				default: {
					do_panic(str_make("unexpected fallthrough in match\n", 32));
				}
			}
			branch_StackType_9 = branch_StackType_32;
			branch_Subst_8 = in_Subst_2;
			branch_zaMirth_7 = v30;
		} break;
		case mirth_type_StackType_Cons: {
			struct mirth_type_Type v36;
			struct mirth_type_StackType v37 = mtp_mirth_type_StackType_Cons(in_StackType_3, &v36);
			struct mirth_mirth_zaMirth* v38;
			struct std_list_List_1 v39;
			struct mirth_type_StackType v40 = mw_mirth_type_StackType_applyzesubst(in_zaMirth_1, in_Subst_2, v37, &v38, &v39);
			struct mirth_mirth_zaMirth* v41;
			struct std_list_List_1 v42;
			struct mirth_type_Type v43 = mw_mirth_type_Type_applyzesubst(v38, v39, v36, &v41, &v42);
			struct mirth_type_StackType v44 = mtw_mirth_type_StackType_Cons(v40, v43);
			branch_StackType_9 = v44;
			branch_Subst_8 = v42;
			branch_zaMirth_7 = v41;
		} break;
		case mirth_type_StackType_With: {
			struct mirth_type_Type v45;
			struct mirth_type_StackType v46 = mtp_mirth_type_StackType_With(in_StackType_3, &v45);
			struct mirth_mirth_zaMirth* v47;
			struct std_list_List_1 v48;
			struct mirth_type_StackType v49 = mw_mirth_type_StackType_applyzesubst(in_zaMirth_1, in_Subst_2, v46, &v47, &v48);
			struct mirth_mirth_zaMirth* v50;
			struct std_list_List_1 v51;
			struct mirth_type_Type v52 = mw_mirth_type_Resource_applyzesubst(v47, v48, v45, &v50, &v51);
			struct mirth_type_StackType v53 = mtw_mirth_type_StackType_With(v49, v52);
			branch_StackType_9 = v53;
			branch_Subst_8 = v51;
			branch_zaMirth_7 = v50;
		} break;
		case mirth_type_StackType_ConsLabel: {
			struct mirth_type_Type v54;
			uint64_t v55;
			struct mirth_type_StackType v56 = mtp_mirth_type_StackType_ConsLabel(in_StackType_3, &v54, &v55);
			struct mirth_mirth_zaMirth* v57;
			struct std_list_List_1 v58;
			struct mirth_type_StackType v59 = mw_mirth_type_StackType_applyzesubst(in_zaMirth_1, in_Subst_2, v56, &v57, &v58);
			struct mirth_mirth_zaMirth* v60;
			struct std_list_List_1 v61;
			struct mirth_type_Type v62 = mw_mirth_type_Type_applyzesubst(v57, v58, v54, &v60, &v61);
			struct mirth_type_StackType v63 = mtw_mirth_type_StackType_ConsLabel(v59, v62, v55);
			branch_StackType_9 = v63;
			branch_Subst_8 = v61;
			branch_zaMirth_7 = v60;
		} break;
		case mirth_type_StackType_WithLabel: {
			struct mirth_type_Type v64;
			uint64_t v65;
			struct mirth_type_StackType v66 = mtp_mirth_type_StackType_WithLabel(in_StackType_3, &v64, &v65);
			struct mirth_mirth_zaMirth* v67;
			struct std_list_List_1 v68;
			struct mirth_type_StackType v69 = mw_mirth_type_StackType_applyzesubst(in_zaMirth_1, in_Subst_2, v66, &v67, &v68);
			struct mirth_mirth_zaMirth* v70;
			struct std_list_List_1 v71;
			struct mirth_type_Type v72 = mw_mirth_type_Resource_applyzesubst(v67, v68, v64, &v70, &v71);
			struct mirth_type_StackType v73 = mtw_mirth_type_StackType_WithLabel(v69, v72, v65);
			branch_StackType_9 = v73;
			branch_Subst_8 = v71;
			branch_zaMirth_7 = v70;
		} break;
		default: {
			do_panic(str_make("unexpected fallthrough in match\n", 32));
		}
	}
	*out_Subst_5 = branch_Subst_8;
	*out_zaMirth_4 = branch_zaMirth_7;
	return branch_StackType_9;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
cmpl $0x8, %ecx
ja 0x41e7d
movq %r9, %rbx
movl %ecx, %eax
movq %rdx, %r15
movl %esi, %r14d
movq %rdi, %r12
movl %ecx, %ecx
leaq 0x9d1f1(%rip), %rdx     # 0xdec38
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
xorl %edx, %edx
jmp 0x41e5c
leaq -0x60(%rbp), %rsi
movq %r8, %rdi
callq 0x381ac
movq %rdx, %r8
movq %rbx, -0x30(%rbp)
leaq -0x80(%rbp), %rbx
movq %rbx, (%rsp)
leaq -0x50(%rbp), %r13
movq %r12, %rdi
movl %r14d, %esi
movq %r15, %rdx
movl %eax, %ecx
movq %r13, %r9
callq 0x41a16
movl %eax, -0x40(%rbp)
movq %rdx, -0x38(%rbp)
movq (%r13), %rdi
movl (%rbx), %esi
movq 0x8(%rbx), %rdx
leaq -0x60(%rbp), %rax
movl (%rax), %ecx
movq 0x8(%rax), %r8
leaq -0x70(%rbp), %r15
movq %r15, (%rsp)
leaq -0x48(%rbp), %rbx
movq %rbx, %r9
callq 0x4098e
movq %rdx, %rcx
movl (%r15), %r14d
movl 0x4(%r15), %r13d
movq 0x8(%r15), %r15
movq (%rbx), %r12
movq -0x30(%rbp), %rbx
movl -0x40(%rbp), %edi
movq -0x38(%rbp), %rsi
movl %eax, %edx
callq 0x20ae8
movl $0x7, %eax
jmp 0x41e5c
leaq -0x70(%rbp), %rsi
movq %r8, %rdi
callq 0x38125
movq %rdx, %r8
movq %rbx, -0x30(%rbp)
leaq -0x60(%rbp), %rbx
movq %rbx, (%rsp)
leaq -0x48(%rbp), %r13
movq %r12, %rdi
movl %r14d, %esi
movq %r15, %rdx
movl %eax, %ecx
movq %r13, %r9
callq 0x41a16
movl %eax, %r14d
movq %rdx, %r15
movq (%r13), %rdi
movl (%rbx), %esi
movq 0x8(%rbx), %rdx
leaq -0x70(%rbp), %rax
movl (%rax), %ecx
movq 0x8(%rax), %r8
leaq -0x80(%rbp), %r12
movq %r12, (%rsp)
leaq -0x50(%rbp), %rbx
movq %rbx, %r9
callq 0x4098e
movq %rdx, %rcx
movl %r14d, %edi
movq %r15, %rsi
movl %eax, %edx
callq 0x205af
movl (%r12), %r14d
movl 0x4(%r12), %r13d
movq 0x8(%r12), %r15
movq (%rbx), %r12
movq -0x30(%rbp), %rbx
movl $0x5, %eax
jmp 0x41e5c
leaq -0x70(%rbp), %rsi
leaq -0x48(%rbp), %rdx
movq %r8, %rdi
callq 0x38233
movq %rdx, %r8
movq %rbx, -0x30(%rbp)
leaq -0x60(%rbp), %rbx
movq %rbx, (%rsp)
leaq -0x50(%rbp), %r13
movq %r12, %rdi
movl %r14d, %esi
movq %r15, %rdx
movl %eax, %ecx
movq %r13, %r9
callq 0x41a16
movl %eax, %r14d
movq %rdx, %r15
movq (%r13), %rdi
movl (%rbx), %esi
movq 0x8(%rbx), %rdx
leaq -0x70(%rbp), %rax
movl (%rax), %ecx
movq 0x8(%rax), %r8
leaq -0x80(%rbp), %r12
movq %r12, (%rsp)
leaq -0x90(%rbp), %rbx
movq %rbx, %r9
callq 0x4098e
movq %rdx, %rcx
leaq -0x48(%rbp), %rdx
movq (%rdx), %r8
movl %r14d, %edi
movq %r15, %rsi
movl %eax, %edx
callq 0x3c8d3
movl (%r12), %r14d
movl 0x4(%r12), %r13d
movq 0x8(%r12), %r15
movq (%rbx), %r12
movq -0x30(%rbp), %rbx
movl $0x6, %eax
jmp 0x41e5c
leaq -0x60(%rbp), %rsi
leaq -0x50(%rbp), %rdx
movq %r8, %rdi
callq 0x382d7
movq %rdx, %r8
movq %rbx, -0x30(%rbp)
leaq -0x80(%rbp), %rbx
movq %rbx, (%rsp)
leaq -0x90(%rbp), %r13
movq %r12, %rdi
movl %r14d, %esi
movq %r15, %rdx
movl %eax, %ecx
movq %r13, %r9
callq 0x41a16
movl %eax, -0x40(%rbp)
movq %rdx, -0x38(%rbp)
movq (%r13), %rdi
movl (%rbx), %esi
movq 0x8(%rbx), %rdx
leaq -0x60(%rbp), %rax
movl (%rax), %ecx
movq 0x8(%rax), %r8
leaq -0x70(%rbp), %r15
movq %r15, (%rsp)
leaq -0x48(%rbp), %rbx
movq %rbx, %r9
callq 0x4098e
movq %rdx, %rcx
movl (%r15), %r14d
movl 0x4(%r15), %r13d
movq 0x8(%r15), %r15
movq (%rbx), %r12
movq -0x30(%rbp), %rbx
leaq -0x50(%rbp), %rdx
movq (%rdx), %r8
movl -0x40(%rbp), %edi
movq -0x38(%rbp), %rsi
movl %eax, %edx
callq 0x3cfb6
movl $0x8, %eax
jmp 0x41e5c
movq 0x8(%r8), %r13
decl (%r8)
jne 0x41cbe
movq %r8, %rdi
callq 0x5030
leaq -0x60(%rbp), %rdx
movq %r12, %rdi
movq %r13, %rsi
callq 0x2d45d
cmpl $0x1, %eax
je 0x41d67
testl %eax, %eax
jne 0x41e7d
movq %r13, %rdi
callq 0x3837b
movl $0x4, %eax
movq -0x60(%rbp), %r12
jmp 0x41a52
movq %rbx, -0x30(%rbp)
movq 0x8(%r8), %rbx
decl (%r8)
jne 0x41d09
movq %r8, %rdi
callq 0x5030
movabsq $0xfffffffffffc, %r13   # imm = 0xFFFFFFFFFFFC
movq %r15, %rax
andq %r13, %rax
sete %cl
testb $0x3, %r15b
setne %dl
orb %cl, %dl
jne 0x41d29
incl (%rax)
movq %rbx, %rdi
movl %r14d, %esi
movq %r15, %rdx
callq 0x41f6a
testl %eax, %eax
je 0x41e48
cmpl $0x1, %eax
jne 0x41e7d
movq %rdx, %rdi
callq 0xd745
andq %rax, %r13
movq %rax, %rdi
shrq $0x30, %rdi
movq %r13, %rsi
callq 0x38041
jmp 0x41e58
movq %r13, -0x40(%rbp)
movq %rbx, -0x30(%rbp)
movabsq $0xfffffffffffc, %r12   # imm = 0xFFFFFFFFFFFC
movq %rdx, %rdi
callq 0xd745
movq -0x60(%rbp), %rdi
movq %rax, %rsi
shrq $0x30, %rsi
andq %r12, %rax
leaq -0x80(%rbp), %rcx
movq %rax, %rdx
callq 0x2d4cc
movq %rdx, %r13
movq %rax, -0x38(%rbp)
movq %rax, %rdi
shlq $0x30, %rdi
orq %rdx, %rdi
leaq 0xcfd36(%rip), %rsi     # 0x111ae9
movq %rdx, %rax
andq %r12, %rax
sete %cl
testb $0x3, %r13b
setne %dl
orb %cl, %dl
jne 0x41dc9
incl (%rax)
callq 0x9353
movq %rdx, %rbx
movq -0x80(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq 0x10d3645(%rip), %rdi   # 0x1115428
movq -0x40(%rbp), %rsi
callq 0x13c85
addq $0x4, %r12
orq %rbx, %r12
leaq 0xcf4c7(%rip), %rsi     # 0x1112c1
movq %r12, %rdi
movq %rax, %rdx
callq 0x14766
movq -0x38(%rbp), %rdi
movq %r13, %rsi
callq 0x38041
movq %rdx, %r8
leaq -0x70(%rbp), %rbx
movq %rbx, (%rsp)
leaq -0x48(%rbp), %r12
movq -0x88(%rbp), %rdi
movl %r14d, %esi
movq %r15, %rdx
movl %eax, %ecx
movq %r12, %r9
callq 0x41a16
movq (%r12), %r12
movl (%rbx), %r14d
movl 0x4(%rbx), %r13d
movq 0x8(%rbx), %r15
jmp 0x41e58
movq %rbx, %rdi
callq 0x359bd
movq %rax, %rdx
movl $0x3, %eax
movq -0x30(%rbp), %rbx
movq 0x10(%rbp), %rcx
movl %r14d, (%rcx)
movl %r13d, 0x4(%rcx)
movq %r15, 0x8(%rcx)
movq %r12, (%rbx)
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x20, %edi
callq 0xf5e4
movq $0x20, 0x10(%rax)
movups 0x9e837(%rip), %xmm0    # 0xe06cd
movups %xmm0, 0x18(%rax)
movups 0x9e83c(%rip), %xmm0    # 0xe06dd
movups %xmm0, 0x28(%rax)
movq %rax, %rdi
callq 0x9302