// File: /workspace/github_c_makefile_star2_O2/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, %r15
movabsq $0xfffffffffffc, %rbx   # imm = 0xFFFFFFFFFFFC
movq 0x8(%rsi), %rsi
leaq -0x90(%rbp), %rdx
callq 0x24ee3
movq %rbx, %r8
movq %rax, %rbx
movq %rax, -0x50(%rbp)
movl 0x20(%r15), %edi
movq 0x28(%r15), %rcx
movq %rcx, %rax
andq %r8, %rax
sete %dl
testb $0x3, %cl
setne %sil
orb %dl, %sil
jne 0x3d647
incl (%rax)
movq -0x90(%rbp), %r12
andq %r8, %rbx
setne %al
testb $0x3, -0x50(%rbp)
sete %dl
andb %al, %dl
movb %dl, -0x29(%rbp)
xorl %r14d, %r14d
leaq -0x88(%rbp), %rsi
movq $0x0, -0x48(%rbp)
xorl %r9d, %r9d
xorl %r13d, %r13d
movq %rbx, -0x40(%rbp)
movb $0x1, %dl
movq %rcx, %rax
testb $0x1, %dl
je 0x3d816
xorl %edx, %edx
movl $0x0, %ecx
testl %edi, %edi
je 0x3d67e
movl %r9d, -0x30(%rbp)
movq %r13, -0x38(%rbp)
cmpl $0x1, %edi
jne 0x3d96b
movq %r14, -0x58(%rbp)
movq %rax, %rdi
callq 0xce01
movq %rax, %r13
cmpb $0x0, -0x29(%rbp)
je 0x3d6bd
incl (%rbx)
movq %r13, %r14
movabsq $0xfffffffffffc, %rax   # imm = 0xFFFFFFFFFFFC
andq %rax, %r14
movq %rdx, -0x68(%rbp)
testb $0x1, %dl
je 0x3d6ea
testq %r14, %r14
sete %al
testb $0x3, %r13b
setne %cl
orb %al, %cl
jne 0x3d6ea
incl (%r14)
movq %r13, %rbx
shrq $0x30, %rbx
movq %r12, %rdi
movl %ebx, %esi
movq %r14, %rdx
leaq -0x60(%rbp), %rcx
callq 0x2b1e9
movq 0x20(%rax), %r12
movq %r12, %rcx
movabsq $0xfffffffffffc, %rdi   # imm = 0xFFFFFFFFFFFC
andq %rdi, %rcx
sete %dl
testb $0x3, %r12b
setne %sil
orb %dl, %sil
jne 0x3d728
incl (%rcx)
movq %rax, %rcx
andq %rdi, %rcx
sete %dl
testb $0x3, %al
setne %sil
orb %dl, %sil
jne 0x3d74f
decl (%rcx)
jne 0x3d74f
movq %rax, %rdi
leaq 0xcaff7(%rip), %rsi     # 0x108741
callq 0xce94
movq -0x50(%rbp), %rdi
movq %r12, %rsi
callq 0x2fa38
testb %al, %al
je 0x3d7a2
movq %r13, %rdi
movq -0x68(%rbp), %rsi
callq 0x1e454
movq %rdx, %rdi
movq -0x60(%rbp), %r12
callq 0x1e7e4
movq %rax, %rdi
movq %rdx, %rsi
movq -0x58(%rbp), %rdx
movq -0x48(%rbp), %rcx
callq 0xcf39
movq %rdx, -0x48(%rbp)
pushq $0x1
popq %rax
movl %eax, %r14d
movq -0x40(%rbp), %rbx
movq -0x38(%rbp), %r13
movl -0x30(%rbp), %r9d
jmp 0x3d7f6
movl %ebx, %edi
movq %r14, %rsi
callq 0x2fa8d
movabsq $0xfffffffffffc, %rcx   # imm = 0xFFFFFFFFFFFC
leaq 0x4(%rcx), %rdi
orq %rax, %rdi
leaq 0xcb7ed(%rip), %rsi     # 0x108fb1
callq 0x1e400
movq %rdx, %rdi
movq -0x60(%rbp), %r12
callq 0x1e79d
movq %rax, %rdi
movq %rdx, %rsi
movl -0x30(%rbp), %edx
movq -0x38(%rbp), %rcx
callq 0xcf39
movq %rdx, %r13
pushq $0x1
popq %r9
movq -0x40(%rbp), %rbx
movq -0x58(%rbp), %r14
movl -0x88(%rbp), %edi
movq -0x80(%rbp), %rcx
movabsq $0xfffffffffffc, %r8    # imm = 0xFFFFFFFFFFFC
leaq -0x88(%rbp), %rsi
jmp 0x3d67c
movq %r12, -0x38(%rbp)
movq %rax, %rcx
andq %r8, %rcx
sete %dl
testb $0x3, %al
setne %sil
orb %dl, %sil
jne 0x3d84b
decl (%rcx)
jne 0x3d84b
shlq $0x30, %rdi
orq %rax, %rdi
leaq 0xcaa39(%rip), %rsi     # 0x108279
movl %r9d, %ebx
callq 0xce94
movl %ebx, %r9d
movl %r9d, %edi
movq %r13, %rsi
callq 0xcd32
movl %eax, %ebx
movq %rdx, %r13
movl %r14d, %edi
movq -0x48(%rbp), %rsi
callq 0xcd32
movl %eax, %r14d
movq %rdx, %r12
movl 0x30(%r15), %edx
movq 0x38(%r15), %rcx
movq %rcx, %rax
movabsq $0xfffffffffffc, %rsi   # imm = 0xFFFFFFFFFFFC
andq %rsi, %rax
sete %sil
testb $0x3, %cl
setne %dil
orb %sil, %dil
jne 0x3d897
incl (%rax)
movl %ebx, %edi
movq %r13, %rsi
callq 0x26383
movl %eax, %ebx
movq %rdx, %r13
movq 0x38(%r15), %rax
movq %rax, %rcx
movabsq $0xfffffffffffc, %r8    # imm = 0xFFFFFFFFFFFC
andq %r8, %rcx
sete %dl
testb $0x3, %al
setne %sil
orb %dl, %sil
jne 0x3d8ed
movl 0x30(%r15), %edi
decl (%rcx)
jne 0x3d8ed
shlq $0x30, %rdi
orq %rax, %rdi
leaq 0xca99b(%rip), %rsi     # 0x108279
callq 0xce94
movabsq $0xfffffffffffc, %r8    # imm = 0xFFFFFFFFFFFC
movl %ebx, 0x30(%r15)
movq %r13, 0x38(%r15)
movq 0x28(%r15), %rax
andq %rax, %r8
sete %cl
testb $0x3, %al
setne %dl
orb %cl, %dl
jne 0x3d924
movl 0x20(%r15), %edi
decl (%r8)
jne 0x3d924
shlq $0x30, %rdi
orq %rax, %rdi
leaq 0xca95a(%rip), %rsi     # 0x108279
callq 0xce94
movl %r14d, 0x20(%r15)
movq %r12, 0x28(%r15)
cmpb $0x0, -0x29(%rbp)
je 0x3d94a
movq -0x40(%rbp), %rax
decl (%rax)
jne 0x3d94a
leaq 0xca7d0(%rip), %rsi     # 0x108111
movq -0x50(%rbp), %rdi
callq 0xce94
movq -0x70(%rbp), %rax
movq %r15, (%rax)
movq -0x78(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rcx, (%rax)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x96e9b(%rip), %rdi     # 0xd480d
pushq $0x20
popq %rsi
callq 0x8a21
movq %rax, %rdi
callq 0x8cc6