// File: /workspace/github_c_makefile_star2_O2/mirth-lang[P]mirth/bin/mirth1.c
// Function: mw_mirth_elab_resolvezedefzenamespace
static struct std_maybe_Maybe_1 mw_mirth_elab_resolvezedefzenamespace (struct mirth_mirth_zaMirth* in_zaMirth_1, uint64_t in_Token_2, struct std_either_Either_2 in_Either_3, bool in_Bool_4, struct mirth_mirth_zaMirth* *out_zaMirth_5) {
	STR* v7;
	STRLIT(v7, "namespace", 9);
	bool v8 = false;
	struct mirth_mirth_zaMirth* v9;
	struct mirth_elab_zaResolveDef* v10;
	mw_mirth_elab_zaResolveDef_Beginzx(v7, in_Token_2, in_Either_3, in_Bool_4, v8, in_zaMirth_1, &v9, &v10);
	struct std_list_List_1 v11 = v10->mcandidates;
	incref(MK_std_list_List_1(v11));
	struct std_list_List_1 v12 = { .tag=std_list_List_1_Nil };
	struct std_list_List_1 v13 = { .tag=std_list_List_1_Nil };
	bool v14 = true;
	struct mirth_mirth_zaMirth* r15 = v9;
	struct mirth_elab_zaResolveDef* r16 = v10;
	struct std_list_List_1 v17 = v12;
	struct std_list_List_1 v18 = v13;
	struct std_list_List_1 v19 = v11;
	bool v20 = v14;
	bool v21 = v14;
	while (v21) {
		struct mirth_mirth_zaMirth* r22 = r15;
		struct mirth_elab_zaResolveDef* r23 = r16;
		struct std_list_List_1 v24 = v17;
		struct std_list_List_1 v25 = v18;
		struct std_list_List_1 v26 = v19;
		bool v27 = v20;
		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 ((v26).tag) {
			case std_list_List_1_Cons: {
				struct std_list_List_1 v34;
				VAL v35 = mtp_std_list_List_1_Cons(v26, &v34);
				incref(v35);
				struct mirth_mirth_zaMirth* v36;
				struct std_maybe_Maybe_1 v37 = mw_mirth_def_Def_aszedefzenamespacezy(r22, V_mirth_def_Def(v35), &v36);
				int64_t v38 = (v37).tag;
				decref(MK_std_maybe_Maybe_1(v37));
				INT v39 = WRAP_I63(0LL);
				INT v40 = v39;
				INT v41 = i64_to_int(v38);
				bool v42 = int_eq(v41, v40);
				bool v43 = !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(v35);
					branch_Either_46 = v47;
					branch_zux1_45 = MK_mirth_elab_zaResolveDef(r23);
					branch_zaMirth_44 = v36;
				} else {
					struct mirth_elab_RejectedDef v48 = mtw_mirth_elab_RejectedDef_WrongSort(V_mirth_def_Def(v35));
					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(r23);
					branch_zaMirth_44 = v36;
				}
				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, v24);
						branch_List_53 = v25;
						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, v25);
						branch_List_53 = v57;
						branch_List_52 = v24;
						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_33 = v58;
				branch_List_32 = v34;
				branch_List_31 = branch_List_53;
				branch_List_30 = branch_List_52;
				branch_zux1_29 = branch_zux1_51;
				branch_zaMirth_28 = 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_33 = v60;
				branch_List_32 = v59;
				branch_List_31 = v25;
				branch_List_30 = v24;
				branch_zux1_29 = MK_mirth_elab_zaResolveDef(r23);
				branch_zaMirth_28 = r22;
			} break;
			default: {
				do_panic(str_make("unexpected fallthrough in match\n", 32));
			}
		}
		v21 = branch_Bool_33;
		v20 = branch_Bool_33;
		v19 = branch_List_32;
		v18 = branch_List_31;
		v17 = branch_List_30;
		r16 = V_mirth_elab_zaResolveDef(branch_zux1_29);
		r15 = branch_zaMirth_28;
	}
	decref(MK_std_list_List_1(v19));
	struct std_list_List_1 v61 = mw_std_list_List_1_reverse(v17);
	struct std_list_List_1 v62 = mw_std_list_List_1_reverse(v18);
	struct std_list_List_1 v63 = r16->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 = r16->mrejected;
	decref(MK_std_list_List_1(v65));
	r16->mrejected = v64;
	struct std_list_List_1 v66 = r16->mcandidates;
	decref(MK_std_list_List_1(v66));
	r16->mcandidates = v62;
	struct mirth_mirth_zaMirth* v67;
	struct mirth_elab_zaResolveDef* v68;
	mw_mirth_elab_zaResolveDef_filterzequalifiers(r15, r16, &v67, &v68);
	struct std_list_List_1 v69 = { .tag=std_list_List_1_Nil };
	struct mirth_mirth_zaMirth* v70;
	struct mirth_elab_zaResolveDef* v71;
	mw_mirth_elab_zaResolveDef_filterzeroots(v67, v68, v69, &v70, &v71);
	struct mirth_mirth_zaMirth* v72;
	struct std_maybe_Maybe_1 v73 = mw_mirth_elab_zaResolveDef_endzx(v70, v71, &v72);
	struct mirth_mirth_zaMirth* v74;
	struct std_maybe_Maybe_1 v75 = mw_std_maybe_Maybe_1_bind_1_sp16(v72, v73, &v74);
	*out_zaMirth_5 = v74;
	return v75;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %r9, -0x78(%rbp)
movl %r8d, %r13d
movq %rcx, %r14
movl %edx, %r15d
movq %rsi, %r12
movq %rdi, %r10
movq 0x10e6821(%rip), %rdi   # 0x110c408
testq %rdi, %rdi
jne 0x25c0b
leaq 0xb1858(%rip), %rdi     # 0xd744b
pushq $0x9
popq %rsi
movq %r10, %rbx
callq 0x8a21
movq %rbx, %r10
movq %rax, %rdi
movq %rax, 0x10e67fd(%rip)   # 0x110c408
movabsq $0xfffffffffffc, %rcx   # imm = 0xFFFFFFFFFFFC
movq %rdi, %rax
andq %rcx, %rax
sete %cl
testb $0x3, %dil
setne %dl
orb %cl, %dl
jne 0x25c2b
incl (%rax)
subq $0x8, %rsp
leaq -0xa8(%rbp), %rbx
leaq -0x80(%rbp), %rax
movzbl %r13b, %r8d
movq $0x0, -0x40(%rbp)
movq %r12, %rsi
movl %r15d, %edx
movq %r14, %rcx
xorl %r9d, %r9d
pushq %rbx
pushq %rax
pushq %r10
callq 0x25fba
addq $0x20, %rsp
movq (%rbx), %rax
movl 0x20(%rax), %edi
movq %rax, -0x70(%rbp)
movq 0x28(%rax), %rcx
movq %rcx, %rax
movabsq $0xfffffffffffc, %rbx   # imm = 0xFFFFFFFFFFFC
andq %rbx, %rax
sete %dl
testb $0x3, %cl
setne %sil
orb %dl, %sil
jne 0x25c8e
incl (%rax)
movq -0x80(%rbp), %r14
leaq -0x60(%rbp), %rsi
xorl %r15d, %r15d
xorl %r13d, %r13d
xorl %r12d, %r12d
movb $0x1, %dl
movq %rcx, %rax
testb $0x1, %dl
je 0x25e0c
xorl %edx, %edx
movl $0x0, %ecx
testl %edi, %edi
je 0x25ca1
movq %r15, -0x38(%rbp)
cmpl $0x1, %edi
jne 0x25fa3
movl %r13d, -0x2c(%rbp)
movq %r12, -0x50(%rbp)
movq %rax, %rdi
callq 0xce01
movq %rax, %r12
movq %rax, %r15
andq %rbx, %r15
movq %rdx, -0x68(%rbp)
testb $0x1, %dl
je 0x25cfb
testq %r15, %r15
sete %al
testb $0x3, %r12b
setne %cl
orb %al, %cl
jne 0x25cfb
incl (%r15)
movq %r12, %r13
shrq $0x30, %r13
movq %r14, %rdi
movl %r13d, %esi
movq %r15, %rdx
leaq -0x48(%rbp), %rcx
callq 0x262ab
movl %eax, %ebx
movq %rdx, %rax
movabsq $0xfffffffffffc, %rcx   # imm = 0xFFFFFFFFFFFC
andq %rcx, %rax
sete %cl
testb $0x3, %dl
setne %sil
orb %cl, %sil
jne 0x25d4f
decl (%rax)
jne 0x25d4f
movq %rbx, %rdi
shlq $0x30, %rdi
orq %rdx, %rdi
leaq 0xe2577(%rip), %rsi     # 0x1082c1
callq 0xce94
movq %rbx, %rdi
callq 0xd86d
movq %rax, %rdi
pushq $0x1
popq %rsi
callq 0xd759
testb %al, %al
je 0x25db5
movl %r13d, %edi
movq %r15, %rsi
callq 0x26334
movq %rax, %rdi
leaq 0xe3236(%rip), %rsi     # 0x108fb1
callq 0x1e400
movq %rdx, %rdi
movq -0x48(%rbp), %r14
callq 0x1e79d
movq %rax, %rdi
movq %rdx, %rsi
movl -0x2c(%rbp), %edx
movq -0x50(%rbp), %rcx
callq 0xcf39
movq %rdx, %r12
pushq $0x1
popq %r13
movabsq $0xfffffffffffc, %rbx   # imm = 0xFFFFFFFFFFFC
movq -0x38(%rbp), %r15
jmp 0x25dfc
movq %r12, %rdi
movq -0x68(%rbp), %rsi
callq 0x1e454
movq %rdx, %rdi
movq -0x48(%rbp), %r14
callq 0x1e7e4
movq %rax, %rdi
movq %rdx, %rsi
movq -0x40(%rbp), %rdx
movq -0x38(%rbp), %rcx
callq 0xcf39
movq %rdx, %r15
pushq $0x1
popq %rax
movq %rax, -0x40(%rbp)
movabsq $0xfffffffffffc, %rbx   # imm = 0xFFFFFFFFFFFC
movq -0x50(%rbp), %r12
movl -0x2c(%rbp), %r13d
movl -0x60(%rbp), %edi
movq -0x58(%rbp), %rcx
leaq -0x60(%rbp), %rsi
jmp 0x25c9f
movq %r14, -0x38(%rbp)
movq %rax, %rcx
andq %rbx, %rcx
sete %dl
testb $0x3, %al
setne %sil
orb %dl, %sil
jne 0x25e3b
decl (%rcx)
jne 0x25e3b
shlq $0x30, %rdi
orq %rax, %rdi
leaq 0xe2443(%rip), %rsi     # 0x108279
callq 0xce94
movl %r13d, %edi
movq %r12, %rsi
callq 0xcd32
movl %eax, %r12d
movq %rdx, %r13
movq -0x40(%rbp), %rdi
movq %r15, %rsi
callq 0xcd32
movl %eax, %ebx
movq %rdx, %r15
movq -0x70(%rbp), %r14
movl 0x30(%r14), %edx
movq 0x38(%r14), %rcx
movq %rcx, %rax
movabsq $0xfffffffffffc, %rsi   # imm = 0xFFFFFFFFFFFC
andq %rsi, %rax
sete %sil
testb $0x3, %cl
setne %dil
orb %sil, %dil
jne 0x25e8b
incl (%rax)
movl %r12d, %edi
movq %r13, %rsi
callq 0x26383
movl %eax, %r12d
movq %rdx, %r13
movq 0x38(%r14), %rax
movq %rax, %rcx
movabsq $0xfffffffffffc, %rdx   # imm = 0xFFFFFFFFFFFC
andq %rdx, %rcx
sete %dl
testb $0x3, %al
setne %sil
orb %dl, %sil
jne 0x25ed9
movl 0x30(%r14), %edi
decl (%rcx)
jne 0x25ed9
shlq $0x30, %rdi
orq %rax, %rdi
leaq 0xe23a5(%rip), %rsi     # 0x108279
callq 0xce94
movl %r12d, 0x30(%r14)
movq %r13, 0x38(%r14)
movq 0x28(%r14), %rax
movabsq $0xfffffffffffc, %rsi   # imm = 0xFFFFFFFFFFFC
andq %rax, %rsi
sete %cl
testb $0x3, %al
setne %dl
orb %cl, %dl
jne 0x25f19
movl 0x20(%r14), %edi
decl (%rsi)
jne 0x25f19
shlq $0x30, %rdi
orq %rax, %rdi
leaq 0xe2365(%rip), %rsi     # 0x108279
callq 0xce94
movl %ebx, 0x20(%r14)
movq %r15, 0x28(%r14)
leaq -0x60(%rbp), %rbx
leaq -0x48(%rbp), %r15
movq -0x38(%rbp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x263b9
movq (%rbx), %rdi
movq (%r15), %rsi
leaq -0xa0(%rbp), %rbx
leaq -0x98(%rbp), %r14
xorl %edx, %edx
xorl %ecx, %ecx
movq %rbx, %r8
movq %r14, %r9
callq 0x267d7
movq (%rbx), %rdi
movq (%r14), %rsi
leaq -0x90(%rbp), %rbx
movq %rbx, %rdx
callq 0x27e9f
movq (%rbx), %rdi
leaq -0x88(%rbp), %rbx
movl %eax, %esi
movq %rbx, %rcx
callq 0x2a088
movq (%rbx), %rcx
movq -0x78(%rbp), %rsi
movq %rcx, (%rsi)
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xae863(%rip), %rdi     # 0xd480d
pushq $0x20
popq %rsi
callq 0x8a21
movq %rax, %rdi
callq 0x8cc6