// File: /workspace/github_c_makefile_star2_O3/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 0x40edf
movq %r9, %rbx
movl %ecx, %eax
movq %rdx, %r15
movl %esi, %r14d
movq %rdi, %r12
movl %ecx, %ecx
leaq 0x9e1fd(%rip), %rdx     # 0xdebbc
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
xorl %r13d, %r13d
jmp 0x40ebc
leaq -0x50(%rbp), %rsi
movq %r8, %rdi
callq 0x2d5d6
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 0x4098e
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 0x4098e
movq %rdx, %rcx
movl %r14d, %edi
movq %r15, %rsi
movl %eax, %edx
callq 0x1f39c
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 0x40ebc
movq %rbx, -0x30(%rbp)
movq 0x8(%r8), %rbx
decl (%r8)
jne 0x40a7a
movq %r8, %rdi
callq 0x5030
movq %rbx, %rdi
callq 0x383d6
movq %rax, %r13
movl $0x4, %eax
jmp 0x40df8
movq %r8, %rdi
callq 0x2d65d
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 0x4098e
movl %eax, %edi
movq %rdx, %rsi
callq 0x3df28
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 0x40ebc
movq %r8, %rdi
callq 0x2d596
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 0x41a16
movl %eax, %edi
movq %rdx, %rsi
callq 0x3d699
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 0x40ebc
movq %rbx, -0x30(%rbp)
movl 0x4(%r8), %ebx
decl (%r8)
jne 0x40b52
movq %r8, %rdi
callq 0x5030
movl %ebx, %edi
callq 0x1eb4d
movq %rdx, %r13
movl $0x2, %eax
jmp 0x40df8
movq 0x8(%r8), %r13
decl (%r8)
jne 0x40b77
movq %r8, %rdi
callq 0x5030
leaq -0x40(%rbp), %rdx
movq %r12, %rdi
movq %r13, %rsi
callq 0x2d45d
cmpl $0x1, %eax
je 0x40d15
testl %eax, %eax
jne 0x40edf
movq %r13, %rdi
callq 0x2d804
movq %rdx, %r13
movl $0x3, %eax
movq -0x40(%rbp), %r12
jmp 0x40ebc
movq %rbx, -0x30(%rbp)
movq 0x8(%r8), %rbx
decl (%r8)
jne 0x40bc5
movq %r8, %rdi
callq 0x5030
movq %rbx, %rdi
callq 0x2075d
movq %rax, %r13
movl $0x7, %eax
jmp 0x40df8
movq %rbx, -0x30(%rbp)
movq 0x8(%r8), %rbx
decl (%r8)
jne 0x40bef
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 0x40c0f
incl (%rax)
movq %rbx, %rdi
movl %r14d, %esi
movq %r15, %rdx
callq 0x41f6a
testl %eax, %eax
je 0x40de8
cmpl $0x1, %eax
jne 0x40edf
movq %rdx, %rdi
callq 0xd745
andq %rax, %r13
shrq $0x30, %rax
jmp 0x40df8
movq %r8, %rdi
callq 0x2d69d
cmpl $0x3, %eax
ja 0x40edf
movl %eax, %eax
leaq 0x9df98(%rip), %rcx     # 0xdebf4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %rdx, %rdi
callq 0x2d85f
movq %rax, %rdi
callq 0x3dd25
xorl %edi, %edi
jmp 0x40eac
movq %rbx, -0x30(%rbp)
movq 0x8(%r8), %rbx
decl (%r8)
jne 0x40c91
movq %r8, %rdi
callq 0x5030
movq %rbx, %rdi
callq 0x3ded5
movq %rax, %r13
movl $0x6, %eax
jmp 0x40df8
movq %r8, %rdi
callq 0x2d55b
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 0x41ead
movq %rax, %rdi
callq 0x34fb2
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 0x40ebc
movq %r8, %rdi
callq 0x2d520
movq %rax, %rdi
callq 0x3de7a
movq %rdx, %r13
movl $0x8, %eax
jmp 0x40ebc
movq %r13, -0x68(%rbp)
movq %rbx, -0x30(%rbp)
movabsq $0xfffffffffffc, %r12   # imm = 0xFFFFFFFFFFFC
movq %rdx, %rdi
callq 0xd745
movq -0x40(%rbp), %rdi
movq %rax, %rsi
shrq $0x30, %rsi
andq %r12, %rax
leaq -0x78(%rbp), %rcx
movq %rax, %rdx
callq 0x2d4cc
movq %rdx, %r13
movq %rax, -0x60(%rbp)
movq %rax, %rdi
shlq $0x30, %rdi
orq %rdx, %rdi
leaq 0xd0d88(%rip), %rsi     # 0x111ae9
movq %rdx, %rax
andq %r12, %rax
sete %cl
testb $0x3, %r13b
setne %dl
orb %cl, %dl
jne 0x40d77
incl (%rax)
callq 0x9353
movq %rdx, %rbx
movq -0x78(%rbp), %rax
movq %rax, -0x58(%rbp)
leaq 0x10d469a(%rip), %rdi   # 0x1115428
movq -0x68(%rbp), %rsi
callq 0x13c85
addq $0x4, %r12
orq %rbx, %r12
leaq 0xd051c(%rip), %rsi     # 0x1112c1
movq %r12, %rdi
movq %rax, %rdx
callq 0x14766
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 0x4098e
movq %rdx, %r13
movq (%r12), %r12
movl (%rbx), %r14d
movl 0x4(%rbx), %ecx
movq 0x8(%rbx), %r15
jmp 0x40df8
movq %rbx, %rdi
callq 0x1f349
movq %rax, %r13
movl $0x5, %eax
movq -0x30(%rbp), %rbx
jmp 0x40ebc
movq %rdx, %rdi
callq 0x2d89a
movq %rax, %rdi
callq 0x3dd78
movl $0x2, %edi
jmp 0x40eac
movq %rbx, -0x30(%rbp)
movq 0x8(%rdx), %rbx
decl (%rdx)
jne 0x40e2f
movq %rdx, %rdi
callq 0x5030
leaq -0x40(%rbp), %r13
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x3a37e
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 0x41ead
movq %rax, %rdi
callq 0x34fb2
movq %rdx, %r13
movl (%r12), %r14d
movl 0x4(%r12), %ecx
movq 0x8(%r12), %r15
movq (%rbx), %r12
movl $0xa, %eax
jmp 0x40df8
movsd 0x8(%rdx), %xmm0
decl (%rdx)
jne 0x40ea2
movq %rdx, %rdi
movsd %xmm0, -0x30(%rbp)
callq 0x5030
movsd -0x30(%rbp), %xmm0
callq 0x3ddcb
movl $0x1, %edi
movq %rax, %rsi
callq 0x37c78
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 0xf5e4
movq $0x20, 0x10(%rax)
movups 0x9f7d5(%rip), %xmm0    # 0xe06cd
movups %xmm0, 0x18(%rax)
movups 0x9f7da(%rip), %xmm0    # 0xe06dd
movups %xmm0, 0x28(%rax)
movq %rax, %rdi
callq 0x9302