// File: /workspace/github_c_makefile_star2_O2/mirth-lang[P]mirth/bin/mirth1.c
// Function: mw_mirth_elab_zaAB_elabzeatomzeresolvezedefzx
static void mw_mirth_elab_zaAB_elabzeatomzeresolvezedefzx (struct mirth_mirth_zaMirth* in_zaMirth_1, struct mirth_arrow_Arrow* in_zaAB_2, struct std_either_Either_2 in_Either_3, struct mirth_mirth_zaMirth* *out_zaMirth_4, struct mirth_arrow_Arrow* *out_zaAB_5) {
	struct mirth_arrow_Arrow* v6;
	struct mirth_type_StackType v7 = mw_mirth_elab_zaAB_abzetypezo(in_zaAB_2, &v6);
	struct mirth_mirth_zaMirth* v8;
	bool v9 = mw_mirth_type_StackType_topzetypeszearezefinezy(in_zaMirth_1, v7, &v8);
	bool v10 = !v9;
	struct mirth_arrow_Arrow* v11;
	uint64_t v12 = mw_mirth_elab_zaAB_abzetokenzo(v6, &v11);
	STR* v13;
	STRLIT(v13, "word", 4);
	bool v14 = false;
	struct mirth_mirth_zaMirth* v15;
	struct mirth_elab_zaResolveDef* v16;
	mw_mirth_elab_zaResolveDef_Beginzx(v13, v12, in_Either_3, v14, v10, v8, &v15, &v16);
	struct std_list_List_1 v17 = v16->mcandidates;
	incref(MK_std_list_List_1(v17));
	struct std_list_List_1 v18 = { .tag=std_list_List_1_Nil };
	struct std_list_List_1 v19 = { .tag=std_list_List_1_Nil };
	bool v20 = true;
	struct mirth_mirth_zaMirth* r21 = v15;
	struct mirth_elab_zaResolveDef* r22 = v16;
	struct std_list_List_1 v23 = v18;
	struct std_list_List_1 v24 = v19;
	struct std_list_List_1 v25 = v17;
	bool v26 = v20;
	bool v27 = v20;
	while (v27) {
		struct mirth_mirth_zaMirth* r28 = r21;
		struct mirth_elab_zaResolveDef* r29 = r22;
		struct std_list_List_1 v30 = v23;
		struct std_list_List_1 v31 = v24;
		struct std_list_List_1 v32 = v25;
		bool v33 = v26;
		struct mirth_mirth_zaMirth* branch_zaMirth_34;
		VAL branch_zux1_35;
		struct std_list_List_1 branch_List_36;
		struct std_list_List_1 branch_List_37;
		struct std_list_List_1 branch_List_38;
		bool branch_Bool_39;
		switch ((v32).tag) {
			case std_list_List_1_Cons: {
				struct std_list_List_1 v40;
				VAL v41 = mtp_std_list_List_1_Cons(v32, &v40);
				incref(v41);
				struct mirth_mirth_zaMirth* v42;
				bool v43 = mw_mirth_def_Def_callablezy(r28, V_mirth_def_Def(v41), &v42);
				struct mirth_mirth_zaMirth* branch_zaMirth_44;
				VAL branch_zux1_45;
				struct std_either_Either_2 branch_Either_46;
				if (v43) {
					struct std_either_Either_2 v47 = mtw_std_either_Either_2_Right(v41);
					branch_Either_46 = v47;
					branch_zux1_45 = MK_mirth_elab_zaResolveDef(r29);
					branch_zaMirth_44 = v42;
				} else {
					struct mirth_elab_RejectedDef v48 = mtw_mirth_elab_RejectedDef_WrongSort(V_mirth_def_Def(v41));
					struct std_either_Either_2 v49 = mtw_std_either_Either_2_Left(MK_mirth_elab_RejectedDef(v48));
					branch_Either_46 = v49;
					branch_zux1_45 = MK_mirth_elab_zaResolveDef(r29);
					branch_zaMirth_44 = v42;
				}
				struct mirth_mirth_zaMirth* branch_zaMirth_50;
				VAL branch_zux1_51;
				struct std_list_List_1 branch_List_52;
				struct std_list_List_1 branch_List_53;
				switch ((branch_Either_46).tag) {
					case std_either_Either_2_Left: {
						VAL v54 = mtp_std_either_Either_2_Left(branch_Either_46);
						struct std_list_List_1 v55 = mw_std_list_List_1_cons(v54, v30);
						branch_List_53 = v31;
						branch_List_52 = v55;
						branch_zux1_51 = branch_zux1_45;
						branch_zaMirth_50 = branch_zaMirth_44;
					} break;
					case std_either_Either_2_Right: {
						VAL v56 = mtp_std_either_Either_2_Right(branch_Either_46);
						struct std_list_List_1 v57 = mw_std_list_List_1_cons(v56, v31);
						branch_List_53 = v57;
						branch_List_52 = v30;
						branch_zux1_51 = branch_zux1_45;
						branch_zaMirth_50 = branch_zaMirth_44;
					} break;
					default: {
						do_panic(str_make("unexpected fallthrough in match\n", 32));
					}
				}
				bool v58 = true;
				branch_Bool_39 = v58;
				branch_List_38 = v40;
				branch_List_37 = branch_List_53;
				branch_List_36 = branch_List_52;
				branch_zux1_35 = branch_zux1_51;
				branch_zaMirth_34 = branch_zaMirth_50;
			} break;
			case std_list_List_1_Nil: {
				struct std_list_List_1 v59 = { .tag=std_list_List_1_Nil };
				bool v60 = false;
				branch_Bool_39 = v60;
				branch_List_38 = v59;
				branch_List_37 = v31;
				branch_List_36 = v30;
				branch_zux1_35 = MK_mirth_elab_zaResolveDef(r29);
				branch_zaMirth_34 = r28;
			} break;
			default: {
				do_panic(str_make("unexpected fallthrough in match\n", 32));
			}
		}
		v27 = branch_Bool_39;
		v26 = branch_Bool_39;
		v25 = branch_List_38;
		v24 = branch_List_37;
		v23 = branch_List_36;
		r22 = V_mirth_elab_zaResolveDef(branch_zux1_35);
		r21 = branch_zaMirth_34;
	}
	decref(MK_std_list_List_1(v25));
	struct std_list_List_1 v61 = mw_std_list_List_1_reverse(v23);
	struct std_list_List_1 v62 = mw_std_list_List_1_reverse(v24);
	struct std_list_List_1 v63 = r22->mrejected;
	incref(MK_std_list_List_1(v63));
	struct std_list_List_1 v64 = mw_std_list_List_1_cat(v61, v63);
	struct std_list_List_1 v65 = r22->mrejected;
	decref(MK_std_list_List_1(v65));
	r22->mrejected = v64;
	struct std_list_List_1 v66 = r22->mcandidates;
	decref(MK_std_list_List_1(v66));
	r22->mcandidates = v62;
	struct mirth_mirth_zaMirth* v67;
	struct mirth_elab_zaResolveDef* v68;
	mw_mirth_elab_zaResolveDef_filterzearity(r21, r22, &v67, &v68);
	struct mirth_mirth_zaMirth* v69;
	struct mirth_elab_zaResolveDef* v70;
	mw_mirth_elab_zaResolveDef_filterzequalifiers(v67, v68, &v69, &v70);
	uint64_t v71 = v70->mtoken;
	struct mirth_mirth_zaMirth* v72;
	bool v73 = mw_mirth_token_Token_canzebezerelativezenamezeorzednamezy(v69, v71, &v72);
	struct mirth_arrow_Arrow* branch_zaAB_74;
	struct mirth_mirth_zaMirth* branch_zaMirth_75;
	struct mirth_elab_zaResolveDef* branch_zaResolveDef_76;
	if (v73) {
		struct mirth_arrow_Arrow* v77;
		struct mirth_type_StackType v78 = mw_mirth_elab_zaAB_abzetypezo(v11, &v77);
		struct mirth_mirth_zaMirth* v79;
		bool v80 = mw_mirth_type_StackType_topzetypeszearezefinezy(v72, v78, &v79);
		struct mirth_arrow_Arrow* branch_zaAB_81;
		struct mirth_mirth_zaMirth* branch_zaMirth_82;
		struct mirth_elab_zaResolveDef* branch_zaResolveDef_83;
		if (v80) {
			struct mirth_arrow_Arrow* v84;
			struct mirth_type_StackType v85 = mw_mirth_elab_zaAB_abzetypezo(v77, &v84);
			struct mirth_mirth_zaMirth* v86;
			struct std_list_List_1 v87 = mw_mirth_type_StackType_topzenamespaces(v79, v85, &v86);
			struct mirth_mirth_zaMirth* v88;
			struct mirth_elab_zaResolveDef* v89;
			mw_mirth_elab_zaResolveDef_filterzeroots(v86, v70, v87, &v88, &v89);
			branch_zaResolveDef_83 = v89;
			branch_zaMirth_82 = v88;
			branch_zaAB_81 = v84;
		} else {
			branch_zaResolveDef_83 = v70;
			branch_zaMirth_82 = v79;
			branch_zaAB_81 = v77;
		}
		branch_zaResolveDef_76 = branch_zaResolveDef_83;
		branch_zaMirth_75 = branch_zaMirth_82;
		branch_zaAB_74 = branch_zaAB_81;
	} else {
		struct std_list_List_1 v90 = { .tag=std_list_List_1_Nil };
		struct mirth_mirth_zaMirth* v91;
		struct mirth_elab_zaResolveDef* v92;
		mw_mirth_elab_zaResolveDef_filterzeroots(v72, v70, v90, &v91, &v92);
		branch_zaResolveDef_76 = v92;
		branch_zaMirth_75 = v91;
		branch_zaAB_74 = v11;
	}
	struct mirth_mirth_zaMirth* v93;
	struct std_maybe_Maybe_1 v94 = mw_mirth_elab_zaResolveDef_endzx(branch_zaMirth_75, branch_zaResolveDef_76, &v93);
	struct mirth_mirth_zaMirth* branch_zaMirth_95;
	struct mirth_arrow_Arrow* branch_zaAB_96;
	switch ((v94).tag) {
		case std_maybe_Maybe_1_None: {
			struct mirth_mirth_zaMirth* v97;
			struct mirth_arrow_Arrow* v98;
			mw_mirth_elab_zaAB_elabzeatomzefailedzx(v93, branch_zaAB_74, &v97, &v98);
			branch_zaAB_96 = v98;
			branch_zaMirth_95 = v97;
		} break;
		case std_maybe_Maybe_1_Some: {
			VAL v99 = mtp_std_maybe_Maybe_1_Some(v94);
			struct mirth_mirth_zaMirth* v100;
			struct mirth_arrow_Arrow* v101;
			mw_mirth_elab_zaAB_elabzeatomzedefzx(v93, branch_zaAB_74, V_mirth_def_Def(v99), &v100, &v101);
			branch_zaAB_96 = v101;
			branch_zaMirth_95 = v100;
		} break;
		default: {
			do_panic(str_make("unexpected fallthrough in match\n", 32));
		}
	}
	*out_zaAB_5 = branch_zaAB_96;
	*out_zaMirth_4 = branch_zaMirth_95;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %r9, -0x88(%rbp)
movq %r8, -0x90(%rbp)
movq %rcx, %rbx
movl %edx, %r14d
movq %rdi, %r15
leaq -0xe0(%rbp), %r13
movq %rsi, %rdi
movq %r13, %rsi
callq 0x3f687
leaq -0xa0(%rbp), %rcx
movq %r15, %rdi
movl %eax, %esi
callq 0x4a037
movl %eax, %r12d
movq (%r13), %rdi
leaq -0x80(%rbp), %rsi
callq 0x3f5b0
movq %rax, %r13
movq 0x10bf453(%rip), %rdi   # 0x110ca68
testq %rdi, %rdi
jne 0x4d633
leaq 0x8c8b4(%rip), %rdi     # 0xd9ed5
pushq $0x4
popq %rsi
callq 0x8a21
movq %rax, %rdi
movq %rax, 0x10bf435(%rip)   # 0x110ca68
xorb $0x1, %r12b
movabsq $0xfffffffffffc, %rcx   # imm = 0xFFFFFFFFFFFC
movq %rdi, %rax
andq %rcx, %rax
sete %cl
testb $0x3, %dil
setne %dl
orb %cl, %dl
jne 0x4d657
incl (%rax)
subq $0x8, %rsp
leaq -0xd8(%rbp), %r15
leaq -0x98(%rbp), %rax
movzbl %r12b, %r9d
movq $0x0, -0x50(%rbp)
movq %r13, %rsi
movl %r14d, %edx
movq %rbx, %rcx
xorl %r8d, %r8d
pushq %r15
pushq %rax
pushq -0xa0(%rbp)
callq 0x25fba
addq $0x20, %rsp
movq (%r15), %r12
movl 0x20(%r12), %edi
movq 0x28(%r12), %rcx
movq %rcx, %rax
movabsq $0xfffffffffffc, %rdx   # imm = 0xFFFFFFFFFFFC
andq %rdx, %rax
sete %dl
testb $0x3, %cl
setne %sil
orb %dl, %sil
jne 0x4d6c1
incl (%rax)
movq -0x98(%rbp), %rbx
leaq -0x40(%rbp), %rsi
xorl %r14d, %r14d
xorl %r13d, %r13d
xorl %r15d, %r15d
movb $0x1, %dl
movq %rbx, -0x68(%rbp)
movq %rcx, %rax
testb $0x1, %dl
je 0x4d7ed
xorl %edx, %edx
movl $0x0, %ecx
testl %edi, %edi
je 0x4d6db
movl %r13d, -0x44(%rbp)
movq %r14, -0x60(%rbp)
cmpl $0x1, %edi
jne 0x4db2f
movq %r15, -0x58(%rbp)
movq %rax, %rdi
callq 0xce01
movq %rax, %r13
movq %rdx, %rbx
movq %rax, %r14
movabsq $0xfffffffffffc, %rax   # imm = 0xFFFFFFFFFFFC
andq %rax, %r14
testb $0x1, %bl
je 0x4d73e
testq %r14, %r14
sete %al
testb $0x3, %r13b
setne %cl
orb %al, %cl
jne 0x4d73e
incl (%r14)
movq %r13, %r15
shrq $0x30, %r15
movq -0x68(%rbp), %rdi
movl %r15d, %esi
movq %r14, %rdx
leaq -0x30(%rbp), %rcx
callq 0x4db46
testb %al, %al
je 0x4d79a
movq %r13, %rdi
movq %rbx, %rsi
callq 0x1e454
movq %rdx, %rdi
movq -0x30(%rbp), %rbx
callq 0x1e7e4
movq %rax, %rdi
movq %rdx, %rsi
movq -0x50(%rbp), %rdx
movq -0x60(%rbp), %rcx
callq 0xcf39
movq %rdx, %r14
pushq $0x1
popq %rax
movq %rax, -0x50(%rbp)
movq -0x58(%rbp), %r15
movl -0x44(%rbp), %r13d
jmp 0x4d7dd
movl %r15d, %edi
movq %r14, %rsi
callq 0x26334
movq %rax, %rdi
leaq 0xbb802(%rip), %rsi     # 0x108fb1
callq 0x1e400
movq %rdx, %rdi
movq -0x30(%rbp), %rbx
callq 0x1e79d
movq %rax, %rdi
movq %rdx, %rsi
movl -0x44(%rbp), %edx
movq -0x58(%rbp), %rcx
callq 0xcf39
movq %rdx, %r15
pushq $0x1
popq %r13
movq -0x60(%rbp), %r14
movl -0x40(%rbp), %edi
movq -0x38(%rbp), %rcx
leaq -0x40(%rbp), %rsi
jmp 0x4d6d5
movq %rax, %rcx
movabsq $0xfffffffffffc, %rdx   # imm = 0xFFFFFFFFFFFC
andq %rdx, %rcx
sete %dl
testb $0x3, %al
setne %sil
orb %dl, %sil
jne 0x4d822
decl (%rcx)
jne 0x4d822
shlq $0x30, %rdi
orq %rax, %rdi
leaq 0xbaa5c(%rip), %rsi     # 0x108279
callq 0xce94
movl %r13d, %edi
movq %r15, %rsi
callq 0xcd32
movl %eax, %r15d
movq %rdx, %r13
movq -0x50(%rbp), %rdi
movq %r14, %rsi
callq 0xcd32
movl %eax, %ebx
movq %rdx, %r14
movl 0x30(%r12), %edx
movq 0x38(%r12), %rcx
movq %rcx, %rax
movabsq $0xfffffffffffc, %rsi   # imm = 0xFFFFFFFFFFFC
andq %rsi, %rax
sete %sil
testb $0x3, %cl
setne %dil
orb %sil, %dil
jne 0x4d870
incl (%rax)
movl %r15d, %edi
movq %r13, %rsi
callq 0x26383
movl %eax, %r13d
movq %rdx, %r15
movq 0x38(%r12), %rax
movq %rax, %rcx
movabsq $0xfffffffffffc, %rdx   # imm = 0xFFFFFFFFFFFC
andq %rdx, %rcx
sete %dl
testb $0x3, %al
setne %sil
orb %dl, %sil
jne 0x4d8c0
movl 0x30(%r12), %edi
decl (%rcx)
jne 0x4d8c0
shlq $0x30, %rdi
orq %rax, %rdi
leaq 0xba9be(%rip), %rsi     # 0x108279
callq 0xce94
movl %r13d, 0x30(%r12)
movq %r15, 0x38(%r12)
movq 0x28(%r12), %rax
movq %rax, %rcx
movabsq $0xfffffffffffc, %rdx   # imm = 0xFFFFFFFFFFFC
andq %rdx, %rcx
sete %dl
testb $0x3, %al
setne %sil
orb %dl, %sil
jne 0x4d909
movl 0x20(%r12), %edi
decl (%rcx)
jne 0x4d909
shlq $0x30, %rdi
orq %rax, %rdi
leaq 0xba975(%rip), %rsi     # 0x108279
callq 0xce94
movl %ebx, 0x20(%r12)
movq %r14, 0x28(%r12)
leaq -0xd0(%rbp), %rbx
leaq -0xc8(%rbp), %r14
movq -0x68(%rbp), %rdi
movq %r12, %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x3d5e8
movq (%rbx), %rdi
movq (%r14), %rsi
leaq -0xc0(%rbp), %r14
leaq -0x78(%rbp), %rbx
movq %r14, %rdx
movq %rbx, %rcx
callq 0x263b9
movq (%rbx), %rbx
movq 0x8(%rbx), %rsi
movq (%r14), %rdi
leaq -0x40(%rbp), %rdx
callq 0x252f3
cmpl $0x1b, %eax
je 0x4d986
cmpl $0x1c, %eax
jne 0x4da24
movq %rdx, %rdi
callq 0x253ff
movq %rax, %rdi
callq 0x2c322
movq -0x40(%rbp), %r14
jmp 0x4d9a4
movq %rdx, %rdi
callq 0x253e2
movq -0x40(%rbp), %rdi
leaq -0x30(%rbp), %r14
movq %rax, %rsi
movq %r14, %rdx
callq 0x2c1b0
movq (%r14), %r14
testb %al, %al
je 0x4da62
movq -0x80(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x3f687
leaq -0x30(%rbp), %rcx
movq %r14, %rdi
movl %eax, %esi
callq 0x4a037
testb %al, %al
je 0x4db1e
movq -0x40(%rbp), %rdi
leaq -0x70(%rbp), %rbx
movq %rbx, %rsi
callq 0x3f687
movq -0x30(%rbp), %rdi
leaq -0xb8(%rbp), %r14
movl %eax, %esi
movq %r14, %rcx
callq 0x4a0ee
movq %rdx, %rcx
movq (%r14), %rdi
movq -0x78(%rbp), %rsi
leaq -0xb0(%rbp), %r14
leaq -0xa8(%rbp), %r15
movl %eax, %edx
movq %r14, %r8
movq %r15, %r9
callq 0x267d7
movq (%r15), %rsi
movq (%r14), %rdi
movq (%rbx), %rbx
jmp 0x4da8a
movq %rdx, %rcx
movabsq $0xfffffffffffc, %rsi   # imm = 0xFFFFFFFFFFFC
andq %rsi, %rcx
sete %sil
testb $0x3, %dl
setne %dil
orb %sil, %dil
jne 0x4da5e
decl (%rcx)
jne 0x4da5e
shlq $0x30, %rax
orq %rdx, %rax
leaq 0xbb483(%rip), %rsi     # 0x108ed9
movq %rax, %rdi
callq 0xce94
movq -0x40(%rbp), %r14
leaq -0x40(%rbp), %r15
leaq -0x30(%rbp), %r12
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r15, %r8
movq %r12, %r9
callq 0x267d7
movq (%r12), %rsi
movq (%r15), %rdi
movq -0x80(%rbp), %rbx
leaq -0x40(%rbp), %rdx
callq 0x27e9f
cmpl $0x1, %eax
je 0x4dabc
testl %eax, %eax
jne 0x4db2f
movq -0x40(%rbp), %rdi
leaq -0x30(%rbp), %r14
leaq -0x70(%rbp), %r15
movq %rbx, %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x4dcf1
jmp 0x4daf2
movq %rdx, %rdi
callq 0xd491
movq -0x40(%rbp), %rdi
movabsq $0xfffffffffffc, %rcx   # imm = 0xFFFFFFFFFFFC
andq %rax, %rcx
movq %rax, %rdx
shrq $0x30, %rdx
leaq -0x30(%rbp), %r14
leaq -0x70(%rbp), %r15
movq %rbx, %rsi
movq %r14, %r8
movq %r15, %r9
callq 0x4dd33
movq (%r15), %rax
movq (%r14), %rcx
movq -0x88(%rbp), %rdx
movq %rax, (%rdx)
movq -0x90(%rbp), %rax
movq %rcx, (%rax)
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq -0x78(%rbp), %rsi
movq -0x30(%rbp), %rdi
movq -0x40(%rbp), %rbx
jmp 0x4da8a
leaq 0x86cd7(%rip), %rdi     # 0xd480d
pushq $0x20
popq %rsi
callq 0x8a21
movq %rax, %rdi
callq 0x8cc6