// File: /workspace/github_c_makefile_star2_O2/mirth-lang[P]mirth/bin/mirth1.c
// Function: mw_mirth_var_Ctx_lookup
static struct std_maybe_Maybe_1 mw_mirth_var_Ctx_lookup (struct mirth_mirth_zaMirth* in_zaMirth_1, uint64_t in_Name_2, struct std_list_List_1 in_Ctx_3, struct mirth_mirth_zaMirth* *out_zaMirth_4) {
	struct std_list_List_1 v6 = mw_mirth_var_Ctx_zgList(in_Ctx_3);
	struct std_list_List_1 v7 = mw_std_list_List_1_reverse(v6);
	struct std_maybe_Maybe_1 v8 = { .tag=std_maybe_Maybe_1_None };
	bool v9 = true;
	struct mirth_mirth_zaMirth* r10 = in_zaMirth_1;
	uint64_t v11 = in_Name_2;
	struct std_maybe_Maybe_1 v12 = v8;
	struct std_list_List_1 v13 = v7;
	bool v14 = v9;
	bool v15 = v9;
	while (v15) {
		struct mirth_mirth_zaMirth* r16 = r10;
		uint64_t v17 = v11;
		struct std_maybe_Maybe_1 v18 = v12;
		struct std_list_List_1 v19 = v13;
		bool v20 = v14;
		struct std_list_List_1 v21;
		struct std_maybe_Maybe_1 v22 = mw_std_list_List_1_uncons(v19, &v21);
		struct mirth_mirth_zaMirth* branch_zaMirth_23;
		uint64_t branch_Name_24;
		struct std_maybe_Maybe_1 branch_Maybe_25;
		struct std_list_List_1 branch_List_26;
		bool branch_Bool_27;
		switch ((v22).tag) {
			case std_maybe_Maybe_1_Some: {
				VAL v28 = mtp_std_maybe_Maybe_1_Some(v22);
				incref(v28);
				struct mirth_mirth_zaMirth* v29;
				uint64_t v30 = mw_mirth_var_Var_name(r16, V_mirth_var_Var(v28), &v29);
				uint64_t v31 = v30;
				uint64_t v32 = v17;
				bool v33 = (v31 == v32);
				struct mirth_mirth_zaMirth* branch_zaMirth_34;
				uint64_t branch_Name_35;
				struct std_maybe_Maybe_1 branch_Maybe_36;
				if (v33) {
					struct std_maybe_Maybe_1 v37 = mtw_std_maybe_Maybe_1_Some(v28);
					branch_Maybe_36 = v37;
					branch_Name_35 = v17;
					branch_zaMirth_34 = v29;
				} else {
					decref(v28);
					struct std_maybe_Maybe_1 v38 = { .tag=std_maybe_Maybe_1_None };
					branch_Maybe_36 = v38;
					branch_Name_35 = v17;
					branch_zaMirth_34 = v29;
				}
				struct mirth_mirth_zaMirth* branch_zaMirth_39;
				uint64_t branch_Name_40;
				struct std_maybe_Maybe_1 branch_Maybe_41;
				struct std_list_List_1 branch_List_42;
				switch ((branch_Maybe_36).tag) {
					case std_maybe_Maybe_1_None: {
						branch_List_42 = v21;
						branch_Maybe_41 = v18;
						branch_Name_40 = branch_Name_35;
						branch_zaMirth_39 = branch_zaMirth_34;
					} break;
					default: {
						decref(MK_std_list_List_1(v21));
						decref(MK_std_maybe_Maybe_1(v18));
						struct std_list_List_1 v43 = { .tag=std_list_List_1_Nil };
						branch_List_42 = v43;
						branch_Maybe_41 = branch_Maybe_36;
						branch_Name_40 = branch_Name_35;
						branch_zaMirth_39 = branch_zaMirth_34;
					} break;
				}
				bool v44 = true;
				branch_Bool_27 = v44;
				branch_List_26 = branch_List_42;
				branch_Maybe_25 = branch_Maybe_41;
				branch_Name_24 = branch_Name_40;
				branch_zaMirth_23 = branch_zaMirth_39;
			} break;
			case std_maybe_Maybe_1_None: {
				bool v45 = false;
				branch_Bool_27 = v45;
				branch_List_26 = v21;
				branch_Maybe_25 = v18;
				branch_Name_24 = v17;
				branch_zaMirth_23 = r16;
			} break;
			default: {
				do_panic(str_make("unexpected fallthrough in match\n", 32));
			}
		}
		v15 = branch_Bool_27;
		v14 = branch_Bool_27;
		v13 = branch_List_26;
		v12 = branch_Maybe_25;
		v11 = branch_Name_24;
		r10 = branch_zaMirth_23;
	}
	decref(MK_std_list_List_1(v13));
	*out_zaMirth_4 = r10;
	return v12;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, -0x58(%rbp)
movq %rsi, -0x60(%rbp)
movq %rdi, %rbx
movabsq $0xfffffffffffc, %r13   # imm = 0xFFFFFFFFFFFC
movl %edx, %edi
movq %rcx, %rsi
callq 0xcd32
movl %eax, %edi
movq %rdx, %rsi
movq $0x0, -0x30(%rbp)
movb $0x1, %al
leaq -0x48(%rbp), %r15
movq $0x0, -0x38(%rbp)
testb $0x1, %al
je 0x32e45
movq %r15, %rdx
callq 0x1075d
testl %eax, %eax
je 0x32dfc
cmpl $0x1, %eax
jne 0x32e8d
movq %rdx, %rdi
callq 0xd491
movq %rax, %r12
movq %rdx, %r14
testb $0x1, %r14b
je 0x32d5b
movq %r12, %rax
andq %r13, %rax
sete %cl
testb $0x3, %r12b
setne %dl
orb %cl, %dl
jne 0x32d5b
incl (%rax)
movq %rbx, %rdi
movq %r12, %rsi
leaq -0x50(%rbp), %rdx
callq 0x33fad
cmpq -0x60(%rbp), %rax
jne 0x32e0a
movq %r12, %rdi
movq %r14, %rsi
callq 0x8d0c
movq %rdx, %r14
movq -0x50(%rbp), %rbx
movq -0x40(%rbp), %rax
movq %rax, %rcx
andq %r13, %rcx
sete %dl
testb $0x3, %al
setne %sil
orb %dl, %sil
jne 0x32db8
movl -0x48(%rbp), %edi
decl (%rcx)
jne 0x32db8
shlq $0x30, %rdi
orq %rax, %rdi
leaq 0xd54c6(%rip), %rsi     # 0x108279
callq 0xce94
movq -0x38(%rbp), %rsi
movq %rsi, %rax
andq %r13, %rax
sete %cl
testb $0x3, %sil
setne %dl
orb %cl, %dl
jne 0x32deb
decl (%rax)
jne 0x32deb
movq -0x30(%rbp), %rdi
shlq $0x30, %rdi
orq %rsi, %rdi
leaq 0xd54db(%rip), %rsi     # 0x1082c1
callq 0xce94
xorl %edi, %edi
pushq $0x1
popq %rax
movq %rax, -0x30(%rbp)
movq %r14, -0x38(%rbp)
xorl %esi, %esi
jmp 0x32e3e
movl -0x48(%rbp), %edi
movq -0x40(%rbp), %rsi
xorl %eax, %eax
jmp 0x32d10
testb $0x1, %r14b
je 0x32e33
movq %r12, %rax
andq %r13, %rax
sete %cl
testb $0x3, %r12b
setne %dl
orb %cl, %dl
jne 0x32e33
decl (%rax)
jne 0x32e33
movq %r12, %rdi
movq %r14, %rsi
callq 0xce94
movq -0x50(%rbp), %rbx
movl -0x48(%rbp), %edi
movq -0x40(%rbp), %rsi
movb $0x1, %al
jmp 0x32d10
andq %rsi, %r13
sete %al
testb $0x3, %sil
setne %cl
orb %al, %cl
jne 0x32e6f
decl (%r13)
jne 0x32e6f
shlq $0x30, %rdi
orq %rsi, %rdi
leaq 0xd540f(%rip), %rsi     # 0x108279
callq 0xce94
movq -0x58(%rbp), %rax
movq %rbx, (%rax)
movq -0x30(%rbp), %rax
movq -0x38(%rbp), %rdx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa1979(%rip), %rdi     # 0xd480d
pushq $0x20
popq %rsi
callq 0x8a21
movq %rax, %rdi
callq 0x8cc6