// File: /workspace/github_c_makefile_star2_O2/mirth-lang[P]mirth/bin/mirth1.c
// Function: mw_mirth_type_Type_zgSortzy
static struct std_maybe_Maybe_1 mw_mirth_type_Type_zgSortzy (struct mirth_mirth_zaMirth* in_zaMirth_1, struct mirth_type_Type in_Type_2, struct mirth_mirth_zaMirth* *out_zaMirth_3) {
	struct mirth_mirth_zaMirth* branch_zaMirth_5;
	struct std_maybe_Maybe_1 branch_Maybe_6;
	switch ((in_Type_2).tag) {
		case mirth_type_Type_Meta: {
			uint64_t v7 = mtp_mirth_type_Type_Meta(in_Type_2);
			struct mirth_mirth_zaMirth* v8;
			struct std_maybe_Maybe_1 v9 = mw_mirth_type_MetaVar_typezy(in_zaMirth_1, v7, &v8);
			struct mirth_mirth_zaMirth* branch_zaMirth_10;
			struct std_maybe_Maybe_1 branch_Maybe_11;
			switch ((v9).tag) {
				case std_maybe_Maybe_1_None: {
					struct std_maybe_Maybe_1 v12 = { .tag=std_maybe_Maybe_1_None };
					branch_Maybe_11 = v12;
					branch_zaMirth_10 = v8;
				} break;
				case std_maybe_Maybe_1_Some: {
					VAL v13 = mtp_std_maybe_Maybe_1_Some(v9);
					struct mirth_mirth_zaMirth* v14;
					struct mirth_type_Type v15 = mw_mirth_type_Type_expand(v8, V_mirth_type_Type(v13), &v14);
					incref(MK_mirth_type_Type(v15));
					struct std_maybe_Maybe_1 v16 = mtw_std_maybe_Maybe_1_Some(MK_mirth_type_Type(v15));
					struct mirth_mirth_zaMirth* v17;
					mw_mirth_type_MetaVar_typezyzx(v14, v16, v7, &v17);
					struct mirth_mirth_zaMirth* v18;
					struct std_maybe_Maybe_1 v19 = mw_mirth_type_Type_zgSortzy(v17, v15, &v18);
					branch_Maybe_11 = v19;
					branch_zaMirth_10 = v18;
				} break;
				default: {
					do_panic(str_make("unexpected fallthrough in match\n", 32));
				}
			}
			branch_Maybe_6 = branch_Maybe_11;
			branch_zaMirth_5 = branch_zaMirth_10;
		} break;
		case mirth_type_Type_Prim: {
			enum mirth_type_PrimType v20 = mtp_mirth_type_Type_Prim(in_Type_2);
			struct mirth_mirth_zaMirth* v21;
			struct std_maybe_Maybe_1 v22 = mw_mirth_type_PrimType_zgSortzy(in_zaMirth_1, v20, &v21);
			branch_Maybe_6 = v22;
			branch_zaMirth_5 = v21;
		} break;
		default: {
			decref(MK_mirth_type_Type(in_Type_2));
			struct std_maybe_Maybe_1 v23 = { .tag=std_maybe_Maybe_1_None };
			branch_Maybe_6 = v23;
			branch_zaMirth_5 = in_zaMirth_1;
		} break;
	}
	*out_zaMirth_3 = branch_zaMirth_5;
	return branch_Maybe_6;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %rbx
movq %rdi, %r14
cmpl $0x2, %esi
je 0x3db74
cmpl $0x3, %esi
jne 0x3dba1
movq %rdx, %rdi
callq 0x2aabf
movq %rax, %r15
leaq -0x30(%rbp), %rdx
movq %r14, %rdi
movq %rax, %rsi
callq 0x2aadc
cmpl $0x1, %eax
je 0x3dbf0
testl %eax, %eax
jne 0x3dc81
xorl %eax, %eax
movq -0x30(%rbp), %r14
jmp 0x3dbdc
movq %rdx, %rdi
callq 0x2aa5d
decl %eax
cmpl $0x2, %eax
ja 0x3dbda
movl %eax, %eax
leaq 0x96a74(%rip), %rcx     # 0xd4600
movq (%rcx,%rax,8), %rdi
leaq 0xcb8e1(%rip), %rsi     # 0x109478
callq 0x8d0c
pushq $0x1
popq %rax
jmp 0x3dbde
movabsq $0xfffffffffffc, %rax   # imm = 0xFFFFFFFFFFFC
andq %rdx, %rax
sete %cl
testb $0x3, %dl
setne %dil
orb %cl, %dil
jne 0x3dbda
decl (%rax)
jne 0x3dbda
shlq $0x30, %rsi
orq %rdx, %rsi
leaq 0xcaf1a(%rip), %rax     # 0x108ae9
movq %rsi, %rdi
movq %rax, %rsi
callq 0xce94
xorl %eax, %eax
xorl %edx, %edx
movq %r14, (%rbx)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdx, %rdi
callq 0xd491
movq -0x30(%rbp), %rdi
movq %rax, %rsi
shrq $0x30, %rsi
movabsq $0xfffffffffffc, %r13   # imm = 0xFFFFFFFFFFFC
andq %r13, %rax
leaq -0x38(%rbp), %rcx
movq %rax, %rdx
callq 0x2ab4b
movl %eax, %r12d
movq %rdx, %r14
movq %r12, %rdi
shlq $0x30, %rdi
orq %rdx, %rdi
leaq 0xcaeb6(%rip), %rsi     # 0x108ae9
andq %rdx, %r13
sete %al
testb $0x3, %r14b
setne %cl
orb %al, %cl
jne 0x3dc48
incl (%r13)
callq 0x8d0c
movq -0x38(%rbp), %rdi
leaq -0x48(%rbp), %r13
movq %rdx, %rsi
movq %r15, %rdx
movq %r13, %rcx
callq 0x2ab8f
movq (%r13), %rdi
leaq -0x40(%rbp), %r15
movl %r12d, %esi
movq %r14, %rdx
movq %r15, %rcx
callq 0x3db20
movq (%r15), %r14
jmp 0x3dbde
leaq 0x96b85(%rip), %rdi     # 0xd480d
pushq $0x20
popq %rsi
callq 0x8a21
movq %rax, %rdi
callq 0x8cc6