// File: /workspace/github_c_makefile_star2_O1/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 0x432bd
movq %r9, %rbx
movl %ecx, %eax
movq %rdx, %r15
movl %esi, %r14d
movq %rdi, %r12
movl %ecx, %ecx
leaq 0x9fd9d(%rip), %rdx     # 0xe2c24
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
xorl %edx, %edx
jmp 0x4329c
leaq -0x60(%rbp), %rsi
movq %r8, %rdi
callq 0x39346
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 0x42e56
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 0x41d32
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 0x21053
movl $0x7, %eax
jmp 0x4329c
leaq -0x70(%rbp), %rsi
movq %r8, %rdi
callq 0x392bf
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 0x42e56
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 0x41d32
movq %rdx, %rcx
movl %r14d, %edi
movq %r15, %rsi
movl %eax, %edx
callq 0x20b1a
movl (%r12), %r14d
movl 0x4(%r12), %r13d
movq 0x8(%r12), %r15
movq (%rbx), %r12
movq -0x30(%rbp), %rbx
movl $0x5, %eax
jmp 0x4329c
leaq -0x70(%rbp), %rsi
leaq -0x48(%rbp), %rdx
movq %r8, %rdi
callq 0x393cd
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 0x42e56
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 0x41d32
movq %rdx, %rcx
leaq -0x48(%rbp), %rdx
movq (%rdx), %r8
movl %r14d, %edi
movq %r15, %rsi
movl %eax, %edx
callq 0x3dc1a
movl (%r12), %r14d
movl 0x4(%r12), %r13d
movq 0x8(%r12), %r15
movq (%rbx), %r12
movq -0x30(%rbp), %rbx
movl $0x6, %eax
jmp 0x4329c
leaq -0x60(%rbp), %rsi
leaq -0x50(%rbp), %rdx
movq %r8, %rdi
callq 0x39471
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 0x42e56
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 0x41d32
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 0x3e2fd
movl $0x8, %eax
jmp 0x4329c
movq 0x8(%r8), %r13
decl (%r8)
jne 0x430fe
movq %r8, %rdi
callq 0x5030
leaq -0x60(%rbp), %rdx
movq %r12, %rdi
movq %r13, %rsi
callq 0x2e11b
cmpl $0x1, %eax
je 0x431a7
testl %eax, %eax
jne 0x432bd
movq %r13, %rdi
callq 0x39515
movl $0x4, %eax
movq -0x60(%rbp), %r12
jmp 0x42e92
movq %rbx, -0x30(%rbp)
movq 0x8(%r8), %rbx
decl (%r8)
jne 0x43149
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 0x43169
incl (%rax)
movq %rbx, %rdi
movl %r14d, %esi
movq %r15, %rdx
callq 0x433aa
testl %eax, %eax
je 0x43288
cmpl $0x1, %eax
jne 0x432bd
movq %rdx, %rdi
callq 0xdaeb
andq %rax, %r13
movq %rax, %rdi
shrq $0x30, %rdi
movq %r13, %rsi
callq 0x391d9
jmp 0x43298
movq %r13, -0x40(%rbp)
movq %rbx, -0x30(%rbp)
movabsq $0xfffffffffffc, %r12   # imm = 0xFFFFFFFFFFFC
movq %rdx, %rdi
callq 0xdaeb
movq -0x60(%rbp), %rdi
movq %rax, %rsi
shrq $0x30, %rsi
andq %r12, %rax
leaq -0x80(%rbp), %rcx
movq %rax, %rdx
callq 0x2e18a
movq %rdx, %r13
movq %rax, -0x38(%rbp)
movq %rax, %rdi
shlq $0x30, %rdi
orq %rdx, %rdi
leaq 0xd28f6(%rip), %rsi     # 0x115ae9
movq %rdx, %rax
andq %r12, %rax
sete %cl
testb $0x3, %r13b
setne %dl
orb %cl, %dl
jne 0x43209
incl (%rax)
callq 0x95f6
movq %rdx, %rbx
movq -0x80(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq 0x10d6205(%rip), %rdi   # 0x1119428
movq -0x40(%rbp), %rsi
callq 0x13ff0
addq $0x4, %r12
orq %rbx, %r12
leaq 0xd2087(%rip), %rsi     # 0x1152c1
movq %r12, %rdi
movq %rax, %rdx
callq 0x14ab5
movq -0x38(%rbp), %rdi
movq %r13, %rsi
callq 0x391d9
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 0x42e56
movq (%r12), %r12
movl (%rbx), %r14d
movl 0x4(%rbx), %r13d
movq 0x8(%rbx), %r15
jmp 0x43298
movq %rbx, %rdi
callq 0x36b6e
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 0xf9f7
movq $0x20, 0x10(%rax)
movups 0xa1477(%rip), %xmm0    # 0xe474d
movups %xmm0, 0x18(%rax)
movups 0xa147c(%rip), %xmm0    # 0xe475d
movups %xmm0, 0x28(%rax)
movq %rax, %rdi
callq 0x95a5