// File: /workspace/github_c_makefile_star2_O1/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, %r12
movq %rdi, -0x50(%rbp)
movq $0x0, -0x38(%rbp)
xorl %edi, %edi
xorl %esi, %esi
callq 0xd37c
movl %eax, %edi
movq %rdx, %rsi
leaq -0x48(%rbp), %r14
movq $0x0, -0x30(%rbp)
movq %r14, %rdx
callq 0x115ef
testl %eax, %eax
je 0x36c76
cmpl $0x1, %eax
jne 0x36dc1
movq %rdx, %rdi
callq 0xdaeb
movq %rax, %rbx
movq %rdx, %r15
testb $0x1, %r15b
je 0x36c47
movq %rbx, %rax
movabsq $0xfffffffffffc, %rcx   # imm = 0xFFFFFFFFFFFC
andq %rcx, %rax
sete %cl
testb $0x3, %bl
setne %dl
orb %cl, %dl
jne 0x36c47
incl (%rax)
leaq 0x10e2392(%rip), %rdi   # 0x1118fe0
movq %rbx, %rsi
callq 0x13ff0
movq %rax, %rdi
callq 0x140f0
movq %rax, %r13
cmpq %r12, %rax
jne 0x36c84
movq %rbx, %rdi
movq %r15, %rsi
callq 0x95f6
movq %rdx, %r15
jmp 0x36c8d
movl -0x48(%rbp), %edi
movq -0x40(%rbp), %rsi
xorl %ebx, %ebx
jmp 0x36d65
testb $0x1, %r15b
jne 0x36c99
xorl %r15d, %r15d
movabsq $0xfffffffffffc, %r8    # imm = 0xFFFFFFFFFFFC
jmp 0x36cd2
movq %rbx, %rax
movabsq $0xfffffffffffc, %r8    # imm = 0xFFFFFFFFFFFC
andq %r8, %rax
sete %cl
testb $0x3, %bl
setne %dl
orb %cl, %dl
jne 0x36ccf
decl (%rax)
jne 0x36ccf
movq %rbx, %rdi
movq %r15, %rsi
callq 0xd4e3
movabsq $0xfffffffffffc, %r8    # imm = 0xFFFFFFFFFFFC
xorl %r15d, %r15d
movl -0x48(%rbp), %edi
cmpq %r12, %r13
jne 0x36d5f
movq -0x40(%rbp), %rax
movq %rax, %rcx
andq %r8, %rcx
sete %dl
testb $0x3, %al
setne %sil
orb %dl, %sil
jne 0x36d17
decl (%rcx)
jne 0x36d17
shlq $0x30, %rdi
orq %rax, %rdi
leaq 0xde571(%rip), %rsi     # 0x115279
callq 0xd4e3
movabsq $0xfffffffffffc, %r8    # imm = 0xFFFFFFFFFFFC
movq -0x38(%rbp), %rsi
movq %rsi, %rax
andq %r8, %rax
sete %cl
testb $0x3, %sil
setne %dl
movb $0x1, %bl
orb %cl, %dl
jne 0x36d4c
decl (%rax)
jne 0x36d4c
movq -0x30(%rbp), %rdi
shlq $0x30, %rdi
orq %rsi, %rdi
leaq 0xde57a(%rip), %rsi     # 0x1152c1
callq 0xd4e3
xorl %edi, %edi
movl $0x1, %eax
movq %rax, -0x30(%rbp)
movq %r15, -0x38(%rbp)
xorl %esi, %esi
jmp 0x36d65
movb $0x1, %bl
movq -0x40(%rbp), %rsi
testb %bl, %bl
jne 0x36bff
movabsq $0xfffffffffffc, %rdx   # imm = 0xFFFFFFFFFFFC
andq %rsi, %rdx
sete %al
testb $0x3, %sil
setne %cl
orb %al, %cl
jne 0x36d9f
decl (%rdx)
jne 0x36d9f
shlq $0x30, %rdi
orq %rsi, %rdi
leaq 0xde4df(%rip), %rsi     # 0x115279
callq 0xd4e3
movq -0x58(%rbp), %rax
movq -0x50(%rbp), %rcx
movq %rcx, (%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
movl $0x20, %edi
callq 0xf9f7
movq $0x20, 0x10(%rax)
movups 0xad973(%rip), %xmm0    # 0xe474d
movups %xmm0, 0x18(%rax)
movups 0xad978(%rip), %xmm0    # 0xe475d
movups %xmm0, 0x28(%rax)
movq %rax, %rdi
callq 0x95a5