// File: /workspace/github_c_makefile_star2_O3/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 $0x78, %rsp
movq %r9, -0x60(%rbp)
movl %r8d, %r13d
movq %rcx, %r14
movl %edx, %r15d
movq %rsi, %r12
movq %rdi, %r10
movq 0x10ece74(%rip), %rdi   # 0x1115408
testq %rdi, %rdi
jne 0x285cd
movl $0x9, %edi
movq %r10, %rbx
callq 0xf5e4
movq %rbx, %r10
movq %rax, %rdi
movq $0x9, 0x10(%rax)
movabsq $0x63617073656d616e, %rax # imm = 0x63617073656D616E
movq %rax, 0x18(%rdi)
movb $0x65, 0x20(%rdi)
movq %rdi, 0x10ece3b(%rip)   # 0x1115408
movabsq $0xfffffffffffc, %rcx   # imm = 0xFFFFFFFFFFFC
movq %rdi, %rax
andq %rcx, %rax
sete %cl
testb $0x3, %dil
setne %dl
orb %cl, %dl
jne 0x285ed
incl (%rax)
subq $0x8, %rsp
leaq -0xa0(%rbp), %rbx
leaq -0x78(%rbp), %rax
movzbl %r13b, %r8d
movq $0x0, -0x48(%rbp)
movq %r12, %rsi
movl %r15d, %edx
movq %r14, %rcx
xorl %r9d, %r9d
pushq %rbx
pushq %rax
pushq %r10
callq 0x28951
addq $0x20, %rsp
movq (%rbx), %rcx
movl 0x20(%rcx), %eax
movq %rcx, -0x38(%rbp)
movq 0x28(%rcx), %rdi
movq %rdi, %rcx
movabsq $0xfffffffffffc, %rdx   # imm = 0xFFFFFFFFFFFC
andq %rdx, %rcx
sete %dl
testb $0x3, %dil
setne %sil
orb %dl, %sil
jne 0x28651
incl (%rcx)
movq -0x78(%rbp), %r12
movq $0x0, -0x40(%rbp)
movq $0x0, -0x50(%rbp)
movl $0x0, -0x2c(%rbp)
cmpl $0x1, %eax
jne 0x287a1
leaq -0x70(%rbp), %rsi
callq 0xd0aa
movq %rax, %rbx
movq %rdx, %r14
movq %rax, %r13
movabsq $0xfffffffffffc, %rax   # imm = 0xFFFFFFFFFFFC
andq %rax, %r13
testb $0x1, %r14b
je 0x286ae
testq %r13, %r13
sete %al
testb $0x3, %bl
setne %cl
orb %al, %cl
jne 0x286ae
incl (%r13)
movq %rbx, %r15
shrq $0x30, %r15
movq %r12, %rdi
movl %r15d, %esi
movq %r13, %rdx
leaq -0x58(%rbp), %rcx
callq 0x28c9f
movl %eax, %r12d
movq %rdx, %rax
movabsq $0xfffffffffffc, %rcx   # imm = 0xFFFFFFFFFFFC
andq %rcx, %rax
sete %cl
testb $0x3, %dl
setne %sil
orb %cl, %sil
jne 0x28703
decl (%rax)
jne 0x28703
movq %r12, %rdi
shlq $0x30, %rdi
orq %rdx, %rdi
leaq 0xe8bc3(%rip), %rsi     # 0x1112c1
callq 0xd13d
leaq 0x1(,%r12,2), %rdi
movl $0x1, %esi
callq 0xe83a
testl %eax, %eax
je 0x2874f
movq %rbx, %rdi
movq %r14, %rsi
callq 0x206fc
movq %rdx, %rdi
movq -0x58(%rbp), %r12
callq 0x20aa1
movq %rax, %rdi
movq %rdx, %rsi
movl -0x2c(%rbp), %edx
movq -0x50(%rbp), %rcx
callq 0xd1ec
movq %rdx, -0x50(%rbp)
movl $0x1, -0x2c(%rbp)
jmp 0x28795
movl %r15d, %edi
movq %r13, %rsi
callq 0x28d34
movq %rax, %rdi
leaq 0xe984d(%rip), %rsi     # 0x111fb1
callq 0x2069e
movq %rdx, %rdi
movq -0x58(%rbp), %r12
callq 0x20a5a
movq %rax, %rdi
movq %rdx, %rsi
movq -0x48(%rbp), %rdx
movq -0x40(%rbp), %rcx
callq 0xd1ec
movq %rdx, -0x40(%rbp)
movl $0x1, %eax
movq %rax, -0x48(%rbp)
movl -0x70(%rbp), %eax
movq -0x68(%rbp), %rdi
jmp 0x2866c
testl %eax, %eax
jne 0x28921
xorl %edi, %edi
xorl %esi, %esi
movq -0x48(%rbp), %rdx
movq -0x40(%rbp), %rcx
callq 0xd01b
movl %eax, %r15d
movq %rdx, %r13
xorl %edi, %edi
xorl %esi, %esi
movl -0x2c(%rbp), %edx
movq -0x50(%rbp), %rcx
callq 0xd01b
movl %eax, %ebx
movq %rdx, %r14
movq -0x38(%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 0x28802
incl (%rax)
movl %r15d, %edi
movq %r13, %rsi
callq 0x28d8d
movl %eax, %r15d
movq %rdx, %r13
movq -0x38(%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, %rdx
jne 0x2885a
movl 0x30(%rdx), %edi
decl (%rcx)
jne 0x2885a
shlq $0x30, %rdi
orq %rax, %rdi
leaq 0xe8a28(%rip), %rsi     # 0x111279
callq 0xd13d
movq -0x38(%rbp), %rdx
movl %r15d, 0x30(%rdx)
movq %r13, 0x38(%rdx)
movq 0x28(%rdx), %rax
movabsq $0xfffffffffffc, %r8    # imm = 0xFFFFFFFFFFFC
andq %rax, %r8
sete %cl
testb $0x3, %al
setne %dl
orb %cl, %dl
movq -0x38(%rbp), %rsi
jne 0x288a2
movl 0x20(%rsi), %edi
decl (%r8)
jne 0x288a2
shlq $0x30, %rdi
orq %rax, %rdi
leaq 0xe89e0(%rip), %rsi     # 0x111279
callq 0xd13d
movq -0x38(%rbp), %rsi
movl %ebx, 0x20(%rsi)
movq %r14, 0x28(%rsi)
leaq -0x70(%rbp), %rbx
leaq -0x58(%rbp), %r14
movq %r12, %rdi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x28dc9
movq (%rbx), %rdi
movq (%r14), %rsi
leaq -0x98(%rbp), %rbx
leaq -0x90(%rbp), %r14
xorl %edx, %edx
xorl %ecx, %ecx
movq %rbx, %r8
movq %r14, %r9
callq 0x2917d
movq (%rbx), %rdi
movq (%r14), %rsi
leaq -0x88(%rbp), %rbx
movq %rbx, %rdx
callq 0x2a68a
movq (%rbx), %rdi
leaq -0x80(%rbp), %rbx
movl %eax, %esi
movq %rbx, %rcx
callq 0x2c99a
movq (%rbx), %rcx
movq -0x60(%rbp), %rsi
movq %rcx, (%rsi)
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x20, %edi
callq 0xf5e4
movq $0x20, 0x10(%rax)
movups 0xb7d93(%rip), %xmm0    # 0xe06cd
movups %xmm0, 0x18(%rax)
movups 0xb7d98(%rip), %xmm0    # 0xe06dd
movups %xmm0, 0x28(%rax)
movq %rax, %rdi
callq 0x9302