// File: /workspace/github_c_makefile_star2_O3/mirth-lang[P]mirth/bin/mirth1.c
// Function: mw_mirth_elab_zaResolveDef_filterzearity
static void mw_mirth_elab_zaResolveDef_filterzearity (struct mirth_mirth_zaMirth* in_zaMirth_1, struct mirth_elab_zaResolveDef* in_zaResolveDef_2, struct mirth_mirth_zaMirth* *out_zaMirth_3, struct mirth_elab_zaResolveDef* *out_zaResolveDef_4) {
	uint64_t v5 = in_zaResolveDef_2->mtoken;
	struct mirth_mirth_zaMirth* v6;
	INT v7 = mw_mirth_token_Token_numzeargs(in_zaMirth_1, v5, &v6);
	struct std_list_List_1 v8 = in_zaResolveDef_2->mcandidates;
	incref(MK_std_list_List_1(v8));
	struct std_list_List_1 v9 = { .tag=std_list_List_1_Nil };
	struct std_list_List_1 v10 = { .tag=std_list_List_1_Nil };
	bool v11 = true;
	struct mirth_mirth_zaMirth* r12 = v6;
	struct mirth_elab_zaResolveDef* r13 = in_zaResolveDef_2;
	INT v14 = v7;
	struct std_list_List_1 v15 = v9;
	struct std_list_List_1 v16 = v10;
	struct std_list_List_1 v17 = v8;
	bool v18 = v11;
	bool v19 = v11;
	while (v19) {
		struct mirth_mirth_zaMirth* r20 = r12;
		struct mirth_elab_zaResolveDef* r21 = r13;
		INT v22 = v14;
		struct std_list_List_1 v23 = v15;
		struct std_list_List_1 v24 = v16;
		struct std_list_List_1 v25 = v17;
		bool v26 = v18;
		INT branch_Nat_27;
		struct mirth_mirth_zaMirth* branch_zaMirth_28;
		VAL branch_zux1_29;
		struct std_list_List_1 branch_List_30;
		struct std_list_List_1 branch_List_31;
		struct std_list_List_1 branch_List_32;
		bool branch_Bool_33;
		switch ((v25).tag) {
			case std_list_List_1_Cons: {
				struct std_list_List_1 v34;
				VAL v35 = mtp_std_list_List_1_Cons(v25, &v34);
				incref(MKNAT(v22));
				incref(v35);
				struct mirth_mirth_zaMirth* v36;
				struct mirth_name_QName* v37 = mw_mirth_def_Def_qnamezehard(r20, V_mirth_def_Def(v35), &v36);
				INT v38 = v37->marity;
				incref(MKINT(v38));
				decref(MK_mirth_name_QName(v37));
				INT v39 = v22;
				bool v40 = mw_mirth_elab_arityzecompatiblezy(v39, v38);
				INT branch_Nat_41;
				struct mirth_mirth_zaMirth* branch_zaMirth_42;
				VAL branch_zux1_43;
				struct std_either_Either_2 branch_Either_44;
				if (v40) {
					struct std_either_Either_2 v45 = mtw_std_either_Either_2_Right(v35);
					branch_Either_44 = v45;
					branch_zux1_43 = MK_mirth_elab_zaResolveDef(r21);
					branch_zaMirth_42 = v36;
					branch_Nat_41 = v22;
				} else {
					struct mirth_elab_RejectedDef v46 = mtw_mirth_elab_RejectedDef_WrongArity(V_mirth_def_Def(v35));
					struct std_either_Either_2 v47 = mtw_std_either_Either_2_Left(MK_mirth_elab_RejectedDef(v46));
					branch_Either_44 = v47;
					branch_zux1_43 = MK_mirth_elab_zaResolveDef(r21);
					branch_zaMirth_42 = v36;
					branch_Nat_41 = v22;
				}
				INT branch_Nat_48;
				struct mirth_mirth_zaMirth* branch_zaMirth_49;
				VAL branch_zux1_50;
				struct std_list_List_1 branch_List_51;
				struct std_list_List_1 branch_List_52;
				switch ((branch_Either_44).tag) {
					case std_either_Either_2_Left: {
						VAL v53 = mtp_std_either_Either_2_Left(branch_Either_44);
						struct std_list_List_1 v54 = mw_std_list_List_1_cons(v53, v23);
						branch_List_52 = v24;
						branch_List_51 = v54;
						branch_zux1_50 = branch_zux1_43;
						branch_zaMirth_49 = branch_zaMirth_42;
						branch_Nat_48 = branch_Nat_41;
					} break;
					case std_either_Either_2_Right: {
						VAL v55 = mtp_std_either_Either_2_Right(branch_Either_44);
						struct std_list_List_1 v56 = mw_std_list_List_1_cons(v55, v24);
						branch_List_52 = v56;
						branch_List_51 = v23;
						branch_zux1_50 = branch_zux1_43;
						branch_zaMirth_49 = branch_zaMirth_42;
						branch_Nat_48 = branch_Nat_41;
					} break;
					default: {
						do_panic(str_make("unexpected fallthrough in match\n", 32));
					}
				}
				bool v57 = true;
				branch_Bool_33 = v57;
				branch_List_32 = v34;
				branch_List_31 = branch_List_52;
				branch_List_30 = branch_List_51;
				branch_zux1_29 = branch_zux1_50;
				branch_zaMirth_28 = branch_zaMirth_49;
				branch_Nat_27 = branch_Nat_48;
			} break;
			case std_list_List_1_Nil: {
				struct std_list_List_1 v58 = { .tag=std_list_List_1_Nil };
				bool v59 = false;
				branch_Bool_33 = v59;
				branch_List_32 = v58;
				branch_List_31 = v24;
				branch_List_30 = v23;
				branch_zux1_29 = MK_mirth_elab_zaResolveDef(r21);
				branch_zaMirth_28 = r20;
				branch_Nat_27 = v22;
			} break;
			default: {
				do_panic(str_make("unexpected fallthrough in match\n", 32));
			}
		}
		v19 = branch_Bool_33;
		v18 = branch_Bool_33;
		v17 = branch_List_32;
		v16 = branch_List_31;
		v15 = branch_List_30;
		v14 = branch_Nat_27;
		r13 = V_mirth_elab_zaResolveDef(branch_zux1_29);
		r12 = branch_zaMirth_28;
	}
	decref(MK_std_list_List_1(v17));
	struct std_list_List_1 v60 = mw_std_list_List_1_reverse(v15);
	struct std_list_List_1 v61 = mw_std_list_List_1_reverse(v16);
	struct std_list_List_1 v62 = r13->mrejected;
	incref(MK_std_list_List_1(v62));
	struct std_list_List_1 v63 = mw_std_list_List_1_cat(v60, v62);
	struct std_list_List_1 v64 = r13->mrejected;
	decref(MK_std_list_List_1(v64));
	r13->mrejected = v63;
	struct std_list_List_1 v65 = r13->mcandidates;
	decref(MK_std_list_List_1(v65));
	r13->mcandidates = v61;
	decref(MKNAT(v14));
	*out_zaResolveDef_4 = r13;
	*out_zaMirth_3 = r12;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rcx, -0x70(%rbp)
movq %rdx, -0x78(%rbp)
movq %rsi, %rbx
movabsq $0xfffffffffffc, %r14   # imm = 0xFFFFFFFFFFFC
movq 0x8(%rsi), %rsi
leaq -0x80(%rbp), %rdx
callq 0x27a19
movq %rax, -0x48(%rbp)
movq %rax, -0x60(%rbp)
movl 0x20(%rbx), %eax
movq %rbx, -0x40(%rbp)
movq 0x28(%rbx), %rdi
movq %rdi, %rcx
andq %r14, %rcx
sete %dl
testb $0x3, %dil
setne %sil
orb %dl, %sil
jne 0x411a3
incl (%rcx)
movq -0x80(%rbp), %rbx
movabsq $0xfffffffffffc, %rcx   # imm = 0xFFFFFFFFFFFC
andq %rcx, -0x48(%rbp)
setne %cl
testb $0x3, -0x60(%rbp)
sete %dl
andb %cl, %dl
movb %dl, -0x29(%rbp)
movq $0x0, -0x50(%rbp)
movl $0x0, -0x30(%rbp)
movq $0x0, -0x58(%rbp)
movl $0x0, -0x34(%rbp)
cmpl $0x1, %eax
jne 0x41341
leaq -0x90(%rbp), %rsi
callq 0xd0aa
movq %rax, %r12
movq %rdx, %r15
cmpb $0x0, -0x29(%rbp)
je 0x41209
movq -0x48(%rbp), %rax
incl (%rax)
movq %r12, %r14
movabsq $0xfffffffffffc, %rax   # imm = 0xFFFFFFFFFFFC
andq %rax, %r14
testb $0x1, %r15b
je 0x41233
testq %r14, %r14
sete %al
testb $0x3, %r12b
setne %cl
orb %al, %cl
jne 0x41233
incl (%r14)
movq %r12, %r13
shrq $0x30, %r13
movq %rbx, %rdi
movl %r13d, %esi
movq %r14, %rdx
leaq -0x68(%rbp), %rcx
callq 0x2dac3
movq 0x20(%rax), %rbx
movq %rbx, %rcx
movabsq $0xfffffffffffc, %rdi   # imm = 0xFFFFFFFFFFFC
andq %rdi, %rcx
sete %dl
testb $0x3, %bl
setne %sil
orb %dl, %sil
jne 0x41271
incl (%rcx)
movq %rax, %rcx
andq %rdi, %rcx
sete %dl
testb $0x3, %al
setne %sil
orb %dl, %sil
jne 0x41298
decl (%rcx)
jne 0x41298
movq %rax, %rdi
leaq 0xd04ae(%rip), %rsi     # 0x111741
callq 0xd13d
movq -0x60(%rbp), %rdi
movq %rbx, %rsi
callq 0x32409
testb %al, %al
je 0x412de
movq %r12, %rdi
movq %r15, %rsi
callq 0x206fc
movq %rdx, %rdi
movq -0x68(%rbp), %rbx
callq 0x20aa1
movq %rax, %rdi
movq %rdx, %rsi
movl -0x34(%rbp), %edx
movq -0x58(%rbp), %rcx
callq 0xd1ec
movq %rdx, -0x58(%rbp)
movl $0x1, -0x34(%rbp)
jmp 0x4132f
movl %r13d, %edi
movq %r14, %rsi
callq 0x32468
movabsq $0xfffffffffffc, %rcx   # imm = 0xFFFFFFFFFFFC
leaq 0x4(%rcx), %rdi
orq %rax, %rdi
leaq 0xd0cb0(%rip), %rsi     # 0x111fb1
callq 0x2069e
movq %rdx, %rdi
movq -0x68(%rbp), %rbx
callq 0x20a5a
movq %rax, %rdi
movq %rdx, %rsi
movl -0x30(%rbp), %edx
movq -0x50(%rbp), %rcx
callq 0xd1ec
movq %rdx, -0x50(%rbp)
movl $0x1, -0x30(%rbp)
movl -0x90(%rbp), %eax
movq -0x88(%rbp), %rdi
jmp 0x411e2
testl %eax, %eax
jne 0x41487
xorl %edi, %edi
xorl %esi, %esi
movl -0x30(%rbp), %edx
movq -0x50(%rbp), %rcx
callq 0xd01b
movl %eax, %r12d
movq %rdx, %r13
xorl %edi, %edi
xorl %esi, %esi
movl -0x34(%rbp), %edx
movq -0x58(%rbp), %rcx
callq 0xd01b
movl %eax, %r14d
movq %rdx, %r15
movq -0x40(%rbp), %rax
movl 0x30(%rax), %edx
movq 0x38(%rax), %rcx
movq %rcx, %rax
movabsq $0xfffffffffffc, %rsi   # imm = 0xFFFFFFFFFFFC
andq %rsi, %rax
sete %sil
testb $0x3, %cl
setne %dil
orb %sil, %dil
jne 0x413a2
incl (%rax)
movl %r12d, %edi
movq %r13, %rsi
callq 0x28d8d
movl %eax, %r12d
movq %rdx, %r13
movq -0x40(%rbp), %rdi
movq 0x38(%rdi), %rax
movq %rax, %rcx
movabsq $0xfffffffffffc, %rdx   # imm = 0xFFFFFFFFFFFC
andq %rdx, %rcx
sete %dl
testb $0x3, %al
setne %sil
orb %dl, %sil
movq %rdi, %rsi
jne 0x413fa
movl 0x30(%rsi), %edi
decl (%rcx)
jne 0x413fa
shlq $0x30, %rdi
orq %rax, %rdi
leaq 0xcfe88(%rip), %rsi     # 0x111279
callq 0xd13d
movq -0x40(%rbp), %rsi
movl %r12d, 0x30(%rsi)
movq %r13, 0x38(%rsi)
movq 0x28(%rsi), %rax
movabsq $0xfffffffffffc, %rdi   # imm = 0xFFFFFFFFFFFC
andq %rax, %rdi
sete %cl
testb $0x3, %al
setne %dl
orb %cl, %dl
jne 0x41440
movq %rdi, %rcx
movl 0x20(%rsi), %edi
decl (%rcx)
jne 0x41440
shlq $0x30, %rdi
orq %rax, %rdi
leaq 0xcfe42(%rip), %rsi     # 0x111279
callq 0xd13d
movq -0x40(%rbp), %rsi
movl %r14d, 0x20(%rsi)
movq %r15, 0x28(%rsi)
cmpb $0x0, -0x29(%rbp)
je 0x4146a
movq -0x48(%rbp), %rax
decl (%rax)
jne 0x4146a
leaq 0xcfcb4(%rip), %rsi     # 0x111111
movq -0x60(%rbp), %rdi
callq 0xd13d
movq -0x40(%rbp), %rsi
movq -0x70(%rbp), %rax
movq %rsi, (%rax)
movq -0x78(%rbp), %rax
movq %rbx, (%rax)
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 0x9f22d(%rip), %xmm0    # 0xe06cd
movups %xmm0, 0x18(%rax)
movups 0x9f232(%rip), %xmm0    # 0xe06dd
movups %xmm0, 0x28(%rax)
movq %rax, %rdi
callq 0x9302