// File: /workspace/github_c_makefile_star2_O2/mirth-lang[P]mirth/bin/mirth1.c
// Function: mw_mirth_elab_zaTypeElab_elabzeimplicitzevarzx
static struct std_maybe_Maybe_1 mw_mirth_elab_zaTypeElab_elabzeimplicitzevarzx (struct mirth_mirth_zaMirth* in_zaMirth_1, struct mirth_elab_zaTypeElab* in_zaTypeElab_2, uint64_t in_Name_3, struct mirth_type_Type in_Type_4, struct mirth_mirth_zaMirth* *out_zaMirth_5, struct mirth_elab_zaTypeElab* *out_zaTypeElab_6) {
	uint64_t v8 = in_zaTypeElab_2->mtoken;
	struct mirth_mirth_zaMirth* v9;
	mw_mirth_mirth_zaMirth_errorzetokenzx(in_zaMirth_1, v8, &v9);
	struct std_list_List_1 v10 = in_zaTypeElab_2->mctx;
	incref(MK_std_list_List_1(v10));
	struct mirth_mirth_zaMirth* v11;
	struct std_maybe_Maybe_1 v12 = mw_mirth_var_Ctx_lookup(v9, in_Name_3, v10, &v11);
	struct mirth_mirth_zaMirth* branch_zaMirth_13;
	struct mirth_elab_zaTypeElab* branch_zaTypeElab_14;
	struct std_maybe_Maybe_1 branch_Maybe_15;
	switch ((v12).tag) {
		case std_maybe_Maybe_1_Some: {
			VAL v16 = mtp_std_maybe_Maybe_1_Some(v12);
			incref(v16);
			struct mirth_mirth_zaMirth* v17;
			struct mirth_type_Type v18 = mw_mirth_var_Var_type(v11, V_mirth_var_Var(v16), &v17);
			struct mirth_mirth_zaMirth* v19;
			struct mirth_type_Type v20 = mw_mirth_type_Type_unifyzx(v17, in_Type_4, v18, &v19);
			decref(MK_mirth_type_Type(v20));
			struct std_maybe_Maybe_1 v21 = mtw_std_maybe_Maybe_1_Some(v16);
			branch_Maybe_15 = v21;
			branch_zaTypeElab_14 = in_zaTypeElab_2;
			branch_zaMirth_13 = v19;
		} break;
		case std_maybe_Maybe_1_None: {
			bool v22 = in_zaTypeElab_2->mallowzeimplicitzetypezevars;
			struct mirth_mirth_zaMirth* branch_zaMirth_23;
			struct mirth_elab_zaTypeElab* branch_zaTypeElab_24;
			struct std_maybe_Maybe_1 branch_Maybe_25;
			if (v22) {
				struct std_list_List_1 v26 = in_zaTypeElab_2->mctx;
				incref(MK_std_list_List_1(v26));
				struct mirth_mirth_zaMirth* v27;
				uint64_t v28 = mw_mirth_var_Var_Newzx(v11, in_Type_4, in_Name_3, &v27);
				struct std_list_List_1 v29 = mw_mirth_var_Ctx_new(v26, v28);
				struct std_list_List_1 v30 = in_zaTypeElab_2->mctx;
				decref(MK_std_list_List_1(v30));
				in_zaTypeElab_2->mctx = v29;
				struct std_maybe_Maybe_1 v31 = mtw_std_maybe_Maybe_1_Some(MK_mirth_var_Var(v28));
				branch_Maybe_25 = v31;
				branch_zaTypeElab_24 = in_zaTypeElab_2;
				branch_zaMirth_23 = v27;
			} else {
				STR* v32;
				STRLIT(v32, "Implicit type variable not allowed here.", 40);
				struct mirth_mirth_zaMirth* v33;
				mw_mirth_mirth_zaMirth_errorzx(v11, v32, &v33);
				decref(MK_mirth_type_Type(in_Type_4));
				struct std_maybe_Maybe_1 v34 = { .tag=std_maybe_Maybe_1_None };
				branch_Maybe_25 = v34;
				branch_zaTypeElab_24 = in_zaTypeElab_2;
				branch_zaMirth_23 = v33;
			}
			branch_Maybe_15 = branch_Maybe_25;
			branch_zaTypeElab_14 = branch_zaTypeElab_24;
			branch_zaMirth_13 = branch_zaMirth_23;
		} break;
		default: {
			do_panic(str_make("unexpected fallthrough in match\n", 32));
		}
	}
	uint64_t v35 = branch_zaTypeElab_14->mtoken;
	struct mirth_mirth_zaMirth* v36;
	mw_mirth_token_Token_argsze0(branch_zaMirth_13, v35, &v36);
	uint64_t v37 = branch_zaTypeElab_14->mtoken;
	struct mirth_mirth_zaMirth* v38;
	uint64_t v39 = mw_mirth_token_Token_succ(v36, v37, &v38);
	branch_zaTypeElab_14->mtoken = v39;
	*out_zaTypeElab_6 = branch_zaTypeElab_14;
	*out_zaMirth_5 = v38;
	return branch_Maybe_15;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, %r14
movq %r8, %r13
movq %rcx, -0x40(%rbp)
movq %rdx, %rbx
movq %rsi, %r15
movabsq $0xfffffffffffc, %r12   # imm = 0xFFFFFFFFFFFC
movq 0x10(%rsi), %rsi
leaq -0x60(%rbp), %rdx
callq 0x2df0c
movl (%r15), %edx
movq 0x8(%r15), %rcx
movq %rcx, %rax
andq %r12, %rax
sete %sil
testb $0x3, %cl
setne %dil
orb %sil, %dil
jne 0x32a2a
incl (%rax)
movq -0x60(%rbp), %rdi
leaq -0x48(%rbp), %r8
movq %rbx, %rsi
callq 0x32cc5
testl %eax, %eax
movq %r14, -0x50(%rbp)
je 0x32aec
movq %r13, -0x38(%rbp)
cmpl $0x1, %eax
jne 0x32c65
movq %rdx, %rdi
callq 0xd491
movq %rax, %r13
movq %rdx, %rbx
testb $0x1, %bl
je 0x32a7c
movq %r13, %rax
andq %r12, %rax
sete %cl
testb $0x3, %r13b
setne %dl
orb %cl, %dl
jne 0x32a7c
incl (%rax)
movq -0x48(%rbp), %rdi
leaq -0x30(%rbp), %r14
movq %r13, %rsi
movq %r14, %rdx
callq 0x32ea4
movq %rdx, %r8
movq (%r14), %rdi
pushq $0x2
popq %rsi
leaq -0x58(%rbp), %r9
movq -0x40(%rbp), %rdx
movl %eax, %ecx
callq 0x32ede
andq %rdx, %r12
sete %cl
testb $0x3, %dl
setne %sil
orb %cl, %sil
jne 0x32ad5
decl (%r12)
jne 0x32ad5
shlq $0x30, %rax
orq %rdx, %rax
leaq 0xd601c(%rip), %rsi     # 0x108ae9
movq %rax, %rdi
callq 0xce94
movq %r13, %rdi
movq %rbx, %rsi
callq 0x8d0c
movq %rdx, %rbx
movq -0x58(%rbp), %rdi
jmp 0x32b92
cmpb $0x1, 0x19(%r15)
jne 0x32b9c
movq %r13, -0x38(%rbp)
movl (%r15), %r13d
movq 0x8(%r15), %r14
movq %r14, %rax
andq %r12, %rax
sete %cl
testb $0x3, %r14b
setne %dl
orb %cl, %dl
jne 0x32b18
incl (%rax)
movq -0x48(%rbp), %rdi
pushq $0x2
popq %rsi
leaq -0x30(%rbp), %r8
movq -0x40(%rbp), %rdx
movq %rbx, %rcx
callq 0x1c742
movq %rax, %rbx
movl %r13d, %edi
movq %r14, %rsi
movq %rax, %rdx
callq 0x33f57
movl %eax, %r14d
movq %rdx, %r13
movq 0x8(%r15), %rax
andq %rax, %r12
sete %cl
testb $0x3, %al
setne %dl
orb %cl, %dl
jne 0x32b75
movl (%r15), %edi
decl (%r12)
jne 0x32b75
leaq 0xd5710(%rip), %rsi     # 0x108279
shlq $0x30, %rdi
orq %rax, %rdi
callq 0xce94
movl %r14d, (%r15)
movq %r13, 0x8(%r15)
leaq 0xd5f1d(%rip), %rsi     # 0x108aa0
movq %rbx, %rdi
callq 0x8d0c
movq %rdx, %rbx
movq -0x30(%rbp), %rdi
pushq $0x1
popq %r12
movq -0x38(%rbp), %r13
jmp 0x32c19
movq 0x10d9bcd(%rip), %rsi   # 0x110c770
testq %rsi, %rsi
jne 0x32bc1
leaq 0xa625d(%rip), %rdi     # 0xd8e0c
pushq $0x28
popq %rsi
callq 0x8a21
movq %rax, %rsi
movq %rax, 0x10d9baf(%rip)   # 0x110c770
movq %rsi, %rax
andq %r12, %rax
sete %cl
testb $0x3, %sil
setne %dl
orb %cl, %dl
jne 0x32bd7
incl (%rax)
movq -0x48(%rbp), %rdi
leaq -0x30(%rbp), %rdx
callq 0x33f68
movq -0x40(%rbp), %rdi
andq %rdi, %r12
sete %al
testb $0x3, %dil
setne %cl
orb %al, %cl
jne 0x32c10
decl (%r12)
jne 0x32c10
btsq $0x31, %rdi
leaq 0xd5ede(%rip), %rsi     # 0x108ae9
callq 0xce94
movq -0x30(%rbp), %rdi
xorl %r12d, %r12d
xorl %ebx, %ebx
movq 0x10(%r15), %rsi
leaq -0x30(%rbp), %r14
movq %r14, %rdx
callq 0x24a81
movq 0x10(%r15), %rax
movq (%r14), %rcx
leaq 0x1(%rax), %rdx
xorl %esi, %esi
cmpq %rax, 0x10d97bb(%rip)   # 0x110c3f8
cmovaq %rdx, %rsi
movq %rsi, 0x10(%r15)
movq -0x50(%rbp), %rax
movq %r15, (%rax)
movq %rcx, (%r13)
movl %r12d, %eax
movq %rbx, %rdx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa1ba1(%rip), %rdi     # 0xd480d
pushq $0x20
popq %rsi
callq 0x8a21
movq %rax, %rdi
callq 0x8cc6