// File: /workspace/github_c_makefile_star2_O1/mirth-lang[P]mirth/bin/mirth1.c
// Function: mw_mirth_type_Type_applyzesubst
static struct mirth_type_Type mw_mirth_type_Type_applyzesubst (struct mirth_mirth_zaMirth* in_zaMirth_1, struct std_list_List_1 in_Subst_2, struct mirth_type_Type in_Type_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_Type branch_Type_9;
	switch ((in_Type_3).tag) {
		case mirth_type_Type_Error: {
			struct mirth_type_Type v10 = { .tag=mirth_type_Type_Error };
			branch_Type_9 = v10;
			branch_Subst_8 = in_Subst_2;
			branch_zaMirth_7 = in_zaMirth_1;
		} break;
		case mirth_type_Type_Ignore: {
			struct mirth_type_Type v11 = { .tag=mirth_type_Type_Ignore };
			branch_Type_9 = v11;
			branch_Subst_8 = in_Subst_2;
			branch_zaMirth_7 = in_zaMirth_1;
		} break;
		case mirth_type_Type_Prim: {
			enum mirth_type_PrimType v12 = mtp_mirth_type_Type_Prim(in_Type_3);
			struct mirth_type_Type v13 = mtw_mirth_type_Type_Prim(v12);
			branch_Type_9 = v13;
			branch_Subst_8 = in_Subst_2;
			branch_zaMirth_7 = in_zaMirth_1;
		} break;
		case mirth_type_Type_Meta: {
			uint64_t v14 = mtp_mirth_type_Type_Meta(in_Type_3);
			struct mirth_mirth_zaMirth* v15;
			struct std_maybe_Maybe_1 v16 = mw_mirth_type_MetaVar_typezy(in_zaMirth_1, v14, &v15);
			struct std_list_List_1 branch_Subst_17;
			struct mirth_mirth_zaMirth* branch_zaMirth_18;
			struct mirth_type_Type branch_Type_19;
			switch ((v16).tag) {
				case std_maybe_Maybe_1_None: {
					struct mirth_type_Type v20 = mtw_mirth_type_Type_Meta(v14);
					branch_Type_19 = v20;
					branch_zaMirth_18 = v15;
					branch_Subst_17 = in_Subst_2;
				} break;
				case std_maybe_Maybe_1_Some: {
					VAL v21 = mtp_std_maybe_Maybe_1_Some(v16);
					struct mirth_mirth_zaMirth* v22;
					struct mirth_type_Type v23 = mw_mirth_type_Type_expand(v15, V_mirth_type_Type(v21), &v22);
					incref(MK_mirth_type_Type(v23));
					struct std_maybe_Maybe_1 v24 = mtw_std_maybe_Maybe_1_Some(MK_mirth_type_Type(v23));
					struct mirth_mirth_zaMirth* v25;
					mw_mirth_type_MetaVar_typezyzx(v22, v24, v14, &v25);
					struct mirth_mirth_zaMirth* v26;
					struct std_list_List_1 v27;
					struct mirth_type_Type v28 = mw_mirth_type_Type_applyzesubst(v25, in_Subst_2, v23, &v26, &v27);
					branch_Type_19 = v28;
					branch_zaMirth_18 = v26;
					branch_Subst_17 = v27;
				} break;
				default: {
					do_panic(str_make("unexpected fallthrough in match\n", 32));
				}
			}
			branch_Type_9 = branch_Type_19;
			branch_Subst_8 = branch_Subst_17;
			branch_zaMirth_7 = branch_zaMirth_18;
		} break;
		case mirth_type_Type_Hole: {
			uint64_t v29 = mtp_mirth_type_Type_Hole(in_Type_3);
			struct mirth_type_Type v30 = mtw_mirth_type_Type_Hole(v29);
			branch_Type_9 = v30;
			branch_Subst_8 = in_Subst_2;
			branch_zaMirth_7 = in_zaMirth_1;
		} break;
		case mirth_type_Type_Var: {
			uint64_t v31 = mtp_mirth_type_Type_Var(in_Type_3);
			incref(MK_std_list_List_1(in_Subst_2));
			struct mirth_mirth_zaMirth* v32;
			struct std_maybe_Maybe_1 v33 = mw_mirth_type_Subst_lookupzevar(in_zaMirth_1, v31, in_Subst_2, &v32);
			struct mirth_type_Type branch_Type_34;
			switch ((v33).tag) {
				case std_maybe_Maybe_1_Some: {
					VAL v35 = mtp_std_maybe_Maybe_1_Some(v33);
					branch_Type_34 = V_mirth_type_Type(v35);
				} break;
				case std_maybe_Maybe_1_None: {
					struct mirth_type_Type v36 = mtw_mirth_type_Type_Var(v31);
					branch_Type_34 = v36;
				} break;
				default: {
					do_panic(str_make("unexpected fallthrough in match\n", 32));
				}
			}
			branch_Type_9 = branch_Type_34;
			branch_Subst_8 = in_Subst_2;
			branch_zaMirth_7 = v32;
		} break;
		case mirth_type_Type_Table: {
			uint64_t v37 = mtp_mirth_type_Type_Table(in_Type_3);
			struct mirth_type_Type v38 = mtw_mirth_type_Type_Table(v37);
			branch_Type_9 = v38;
			branch_Subst_8 = in_Subst_2;
			branch_zaMirth_7 = in_zaMirth_1;
		} break;
		case mirth_type_Type_Data: {
			uint64_t v39 = mtp_mirth_type_Type_Data(in_Type_3);
			struct mirth_type_Type v40 = mtw_mirth_type_Type_Data(v39);
			branch_Type_9 = v40;
			branch_Subst_8 = in_Subst_2;
			branch_zaMirth_7 = in_zaMirth_1;
		} break;
		case mirth_type_Type_DataPartial: {
			struct mirth_data_DataPartial* v41 = mtp_mirth_type_Type_DataPartial(in_Type_3);
			struct mirth_type_Type v42 = mtw_mirth_type_Type_DataPartial(v41);
			branch_Type_9 = v42;
			branch_Subst_8 = in_Subst_2;
			branch_zaMirth_7 = in_zaMirth_1;
		} break;
		case mirth_type_Type_Stack: {
			struct mirth_type_StackType v43 = mtp_mirth_type_Type_Stack(in_Type_3);
			struct mirth_mirth_zaMirth* v44;
			struct std_list_List_1 v45;
			struct mirth_type_StackType v46 = mw_mirth_type_StackType_applyzesubst(in_zaMirth_1, in_Subst_2, v43, &v44, &v45);
			struct mirth_type_Type v47 = mtw_mirth_type_Type_Stack(v46);
			branch_Type_9 = v47;
			branch_Subst_8 = v45;
			branch_zaMirth_7 = v44;
		} break;
		case mirth_type_Type_Arrow: {
			struct mirth_type_ArrowType* v48 = mtp_mirth_type_Type_Arrow(in_Type_3);
			struct mirth_mirth_zaMirth* v49;
			struct std_list_List_1 v50;
			struct mirth_type_ArrowType* v51 = mw_mirth_type_ArrowType_applyzesubst(in_zaMirth_1, in_Subst_2, v48, &v49, &v50);
			struct mirth_type_Type v52 = mtw_mirth_type_Type_Arrow(v51);
			branch_Type_9 = v52;
			branch_Subst_8 = v50;
			branch_zaMirth_7 = v49;
		} break;
		case mirth_type_Type_App: {
			struct mirth_type_Type v53;
			struct mirth_type_Type v54 = mtp_mirth_type_Type_App(in_Type_3, &v53);
			struct mirth_mirth_zaMirth* v55;
			struct std_list_List_1 v56;
			struct mirth_type_Type v57 = mw_mirth_type_Type_applyzesubst(in_zaMirth_1, in_Subst_2, v54, &v55, &v56);
			struct mirth_mirth_zaMirth* v58;
			struct std_list_List_1 v59;
			struct mirth_type_Type v60 = mw_mirth_type_Type_applyzesubst(v55, v56, v53, &v58, &v59);
			struct mirth_type_Type v61 = mtw_mirth_type_Type_App(v57, v60);
			branch_Type_9 = v61;
			branch_Subst_8 = v59;
			branch_zaMirth_7 = v58;
		} break;
		case mirth_type_Type_Mut: {
			struct mirth_type_Type v62 = mtp_mirth_type_Type_Mut(in_Type_3);
			struct mirth_mirth_zaMirth* v63;
			struct std_list_List_1 v64;
			struct mirth_type_Type v65 = mw_mirth_type_Type_applyzesubst(in_zaMirth_1, in_Subst_2, v62, &v63, &v64);
			struct mirth_type_Type v66 = mtw_mirth_type_Type_Mut(v65);
			branch_Type_9 = v66;
			branch_Subst_8 = v64;
			branch_zaMirth_7 = v63;
		} break;
		case mirth_type_Type_Value: {
			struct mirth_type_Value v67 = mtp_mirth_type_Type_Value(in_Type_3);
			struct mirth_mirth_zaMirth* v68;
			struct std_list_List_1 v69;
			struct mirth_type_Type v70 = mw_mirth_type_Value_applyzesubst(in_zaMirth_1, in_Subst_2, v67, &v68, &v69);
			branch_Type_9 = v70;
			branch_Subst_8 = v69;
			branch_zaMirth_7 = v68;
		} 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_Type_9;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
cmpl $0xd, %ecx
ja 0x42283
movq %r9, %rbx
movl %ecx, %eax
movq %rdx, %r15
movl %esi, %r14d
movq %rdi, %r12
movl %ecx, %ecx
leaq 0xa0e45(%rip), %rdx     # 0xe2ba8
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
xorl %r13d, %r13d
jmp 0x42260
leaq -0x50(%rbp), %rsi
movq %r8, %rdi
callq 0x2e294
movq %rdx, %r8
movq %rbx, -0x30(%rbp)
leaq -0x40(%rbp), %rbx
movq %rbx, (%rsp)
leaq -0x80(%rbp), %r13
movq %r12, %rdi
movl %r14d, %esi
movq %r15, %rdx
movl %eax, %ecx
movq %r13, %r9
callq 0x41d32
movl %eax, %r14d
movq %rdx, %r15
movq (%r13), %rdi
movl (%rbx), %esi
movq 0x8(%rbx), %rdx
leaq -0x50(%rbp), %rax
movl (%rax), %ecx
movq 0x8(%rax), %r8
leaq -0x78(%rbp), %r12
movq %r12, (%rsp)
leaq -0x88(%rbp), %rbx
movq %rbx, %r9
callq 0x41d32
movq %rdx, %rcx
movl %r14d, %edi
movq %r15, %rsi
movl %eax, %edx
callq 0x1f801
movq %rdx, %r13
movl (%r12), %r14d
movl 0x4(%r12), %ecx
movq 0x8(%r12), %r15
movq (%rbx), %r12
movq -0x30(%rbp), %rbx
movl $0xb, %eax
jmp 0x42260
movq %rbx, -0x30(%rbp)
movq 0x8(%r8), %rbx
decl (%r8)
jne 0x41e1e
movq %r8, %rdi
callq 0x5030
movq %rbx, %rdi
callq 0x39570
movq %rax, %r13
movl $0x4, %eax
jmp 0x4219c
movq %r8, %rdi
callq 0x2e31b
movq %rdx, %r8
movq %rbx, -0x30(%rbp)
leaq -0x50(%rbp), %rbx
movq %rbx, (%rsp)
leaq -0x40(%rbp), %r9
movq %r12, %rdi
movl %r14d, %esi
movq %r15, %rdx
movl %eax, %ecx
movq %r9, %r12
callq 0x41d32
movl %eax, %edi
movq %rdx, %rsi
callq 0x3f26f
movq %rdx, %r13
movl (%rbx), %r14d
movl 0x4(%rbx), %ecx
movq 0x8(%rbx), %r15
movq -0x30(%rbp), %rbx
movq (%r12), %r12
movl $0xc, %eax
jmp 0x42260
movq %r8, %rdi
callq 0x2e254
movq %rdx, %r8
movq %rbx, -0x30(%rbp)
leaq -0x50(%rbp), %rbx
movq %rbx, (%rsp)
leaq -0x40(%rbp), %r9
movq %r12, %rdi
movl %r14d, %esi
movq %r15, %rdx
movl %eax, %ecx
movq %r9, %r12
callq 0x42e56
movl %eax, %edi
movq %rdx, %rsi
callq 0x3e9e0
movq %rax, %r13
movl (%rbx), %r14d
movl 0x4(%rbx), %ecx
movq 0x8(%rbx), %r15
movq -0x30(%rbp), %rbx
movq (%r12), %r12
movl $0x9, %eax
jmp 0x42260
movq %rbx, -0x30(%rbp)
movl 0x4(%r8), %ebx
decl (%r8)
jne 0x41ef6
movq %r8, %rdi
callq 0x5030
movl %ebx, %edi
callq 0x1ef8a
movq %rdx, %r13
movl $0x2, %eax
jmp 0x4219c
movq 0x8(%r8), %r13
decl (%r8)
jne 0x41f1b
movq %r8, %rdi
callq 0x5030
leaq -0x40(%rbp), %rdx
movq %r12, %rdi
movq %r13, %rsi
callq 0x2e11b
cmpl $0x1, %eax
je 0x420b9
testl %eax, %eax
jne 0x42283
movq %r13, %rdi
callq 0x2e4c2
movq %rdx, %r13
movl $0x3, %eax
movq -0x40(%rbp), %r12
jmp 0x42260
movq %rbx, -0x30(%rbp)
movq 0x8(%r8), %rbx
decl (%r8)
jne 0x41f69
movq %r8, %rdi
callq 0x5030
movq %rbx, %rdi
callq 0x20cc8
movq %rax, %r13
movl $0x7, %eax
jmp 0x4219c
movq %rbx, -0x30(%rbp)
movq 0x8(%r8), %rbx
decl (%r8)
jne 0x41f93
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 0x41fb3
incl (%rax)
movq %rbx, %rdi
movl %r14d, %esi
movq %r15, %rdx
callq 0x433aa
testl %eax, %eax
je 0x4218c
cmpl $0x1, %eax
jne 0x42283
movq %rdx, %rdi
callq 0xdaeb
andq %rax, %r13
shrq $0x30, %rax
jmp 0x4219c
movq %r8, %rdi
callq 0x2e35b
cmpl $0x3, %eax
ja 0x42283
movl %eax, %eax
leaq 0xa0be0(%rip), %rcx     # 0xe2be0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rdx, %rdi
callq 0x2e51d
movq %rax, %rdi
callq 0x3f06c
xorl %edi, %edi
jmp 0x42250
movq %rbx, -0x30(%rbp)
movq 0x8(%r8), %rbx
decl (%r8)
jne 0x42035
movq %r8, %rdi
callq 0x5030
movq %rbx, %rdi
callq 0x3f21c
movq %rax, %r13
movl $0x6, %eax
jmp 0x4219c
movq %r8, %rdi
callq 0x2e219
leaq -0x40(%rbp), %r8
movq %rbx, -0x30(%rbp)
leaq -0x50(%rbp), %rbx
movq %r12, %rdi
movl %r14d, %esi
movq %r15, %rdx
movq %rax, %rcx
movq %r8, %r12
movq %rbx, %r9
callq 0x432ed
movq %rax, %rdi
callq 0x36174
movq %rdx, %r13
movl (%rbx), %r14d
movl 0x4(%rbx), %ecx
movq 0x8(%rbx), %r15
movq -0x30(%rbp), %rbx
movq (%r12), %r12
movl $0xa, %eax
jmp 0x42260
movq %r8, %rdi
callq 0x2e1de
movq %rax, %rdi
callq 0x3f1c1
movq %rdx, %r13
movl $0x8, %eax
jmp 0x42260
movq %r13, -0x68(%rbp)
movq %rbx, -0x30(%rbp)
movabsq $0xfffffffffffc, %r12   # imm = 0xFFFFFFFFFFFC
movq %rdx, %rdi
callq 0xdaeb
movq -0x40(%rbp), %rdi
movq %rax, %rsi
shrq $0x30, %rsi
andq %r12, %rax
leaq -0x78(%rbp), %rcx
movq %rax, %rdx
callq 0x2e18a
movq %rdx, %r13
movq %rax, -0x60(%rbp)
movq %rax, %rdi
shlq $0x30, %rdi
orq %rdx, %rdi
leaq 0xd39e4(%rip), %rsi     # 0x115ae9
movq %rdx, %rax
andq %r12, %rax
sete %cl
testb $0x3, %r13b
setne %dl
orb %cl, %dl
jne 0x4211b
incl (%rax)
callq 0x95f6
movq %rdx, %rbx
movq -0x78(%rbp), %rax
movq %rax, -0x58(%rbp)
leaq 0x10d72f6(%rip), %rdi   # 0x1119428
movq -0x68(%rbp), %rsi
callq 0x13ff0
addq $0x4, %r12
orq %rbx, %r12
leaq 0xd3178(%rip), %rsi     # 0x1152c1
movq %r12, %rdi
movq %rax, %rdx
callq 0x14ab5
leaq -0x50(%rbp), %rbx
movq %rbx, (%rsp)
leaq -0x80(%rbp), %r12
movq -0x58(%rbp), %rdi
movl %r14d, %esi
movq %r15, %rdx
movq -0x60(%rbp), %rcx
movq %r13, %r8
movq %r12, %r9
callq 0x41d32
movq %rdx, %r13
movq (%r12), %r12
movl (%rbx), %r14d
movl 0x4(%rbx), %ecx
movq 0x8(%rbx), %r15
jmp 0x4219c
movq %rbx, %rdi
callq 0x1f7ae
movq %rax, %r13
movl $0x5, %eax
movq -0x30(%rbp), %rbx
jmp 0x42260
movq %rdx, %rdi
callq 0x2e558
movq %rax, %rdi
callq 0x3f0bf
movl $0x2, %edi
jmp 0x42250
movq %rbx, -0x30(%rbp)
movq 0x8(%rdx), %rbx
decl (%rdx)
jne 0x421d3
movq %rdx, %rdi
callq 0x5030
leaq -0x40(%rbp), %r13
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x3b6c3
movq (%r13), %rdi
leaq -0x78(%rbp), %rbx
leaq -0x50(%rbp), %r12
movl %r14d, %esi
movq %r15, %rdx
movq %rax, %rcx
movq %rbx, %r8
movq %r12, %r9
callq 0x432ed
movq %rax, %rdi
callq 0x36174
movq %rdx, %r13
movl (%r12), %r14d
movl 0x4(%r12), %ecx
movq 0x8(%r12), %r15
movq (%rbx), %r12
movl $0xa, %eax
jmp 0x4219c
movsd 0x8(%rdx), %xmm0
decl (%rdx)
jne 0x42246
movq %rdx, %rdi
movsd %xmm0, -0x30(%rbp)
callq 0x5030
movsd -0x30(%rbp), %xmm0
callq 0x3f112
movl $0x1, %edi
movq %rax, %rsi
callq 0x38e10
movq %rdx, %r13
movl $0xd, %eax
movq 0x10(%rbp), %rdx
movl %r14d, (%rdx)
movl %ecx, 0x4(%rdx)
movq %r15, 0x8(%rdx)
movq %r12, (%rbx)
movq %r13, %rdx
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x20, %edi
callq 0xf9f7
movq $0x20, 0x10(%rax)
movups 0xa24b1(%rip), %xmm0    # 0xe474d
movups %xmm0, 0x18(%rax)
movups 0xa24b6(%rip), %xmm0    # 0xe475d
movups %xmm0, 0x28(%rax)
movq %rax, %rdi
callq 0x95a5