// File: /workspace/github_c_makefile_star2_O1/mirth-lang[P]mirth/bin/mirth1.c
// Function: mw_mirth_elab_zaTypeElab_elabzeresourcezeargzx
static struct mirth_type_Type mw_mirth_elab_zaTypeElab_elabzeresourcezeargzx (struct mirth_mirth_zaMirth* in_zaMirth_1, struct mirth_elab_zaTypeElab* in_zaTypeElab_2, struct mirth_mirth_zaMirth* *out_zaMirth_3, struct mirth_elab_zaTypeElab* *out_zaTypeElab_4) {
	uint64_t v6 = in_zaTypeElab_2->mtoken;
	struct mirth_mirth_zaMirth* v7;
	struct mirth_elab_zaTypeElab* v8;
	struct mirth_type_StackTypePart v9 = mw_mirth_elab_zaTypeElab_elabzestackzetypezepartzx(in_zaMirth_1, in_zaTypeElab_2, &v7, &v8);
	struct mirth_mirth_zaMirth* branch_zaMirth_10;
	struct mirth_elab_zaTypeElab* branch_zaTypeElab_11;
	struct mirth_type_Type branch_Resource_12;
	switch ((v9).tag) {
		case mirth_type_StackTypePart_Cons: {
			struct mirth_type_Type v13 = mtp_mirth_type_StackTypePart_Cons(v9);
			decref(MK_mirth_type_Type(v13));
			STR* v14;
			STRLIT(v14, "Expected resource, not type.", 28);
			struct mirth_mirth_zaMirth* v15;
			mw_mirth_mirth_zaMirth_emitzeerrorzx(v7, v6, v14, &v15);
			struct mirth_type_Type v16 = { .tag=mirth_type_Type_Error };
			branch_Resource_12 = v16;
			branch_zaTypeElab_11 = v8;
			branch_zaMirth_10 = v15;
		} break;
		case mirth_type_StackTypePart_ConsLabel: {
			uint64_t v17;
			struct mirth_type_Type v18 = mtp_mirth_type_StackTypePart_ConsLabel(v9, &v17);
			decref(MK_mirth_type_Type(v18));
			STR* v19;
			STRLIT(v19, "Expected resource, not label.", 29);
			struct mirth_mirth_zaMirth* v20;
			mw_mirth_mirth_zaMirth_emitzeerrorzx(v7, v6, v19, &v20);
			struct mirth_type_Type v21 = { .tag=mirth_type_Type_Error };
			branch_Resource_12 = v21;
			branch_zaTypeElab_11 = v8;
			branch_zaMirth_10 = v20;
		} break;
		case mirth_type_StackTypePart_With: {
			struct mirth_type_Type v22 = mtp_mirth_type_StackTypePart_With(v9);
			branch_Resource_12 = v22;
			branch_zaTypeElab_11 = v8;
			branch_zaMirth_10 = v7;
		} break;
		case mirth_type_StackTypePart_WithLabel: {
			uint64_t v23;
			struct mirth_type_Type v24 = mtp_mirth_type_StackTypePart_WithLabel(v9, &v23);
			decref(MK_mirth_type_Type(v24));
			STR* v25;
			STRLIT(v25, "Expected resource, not label.", 29);
			struct mirth_mirth_zaMirth* v26;
			mw_mirth_mirth_zaMirth_emitzeerrorzx(v7, v6, v25, &v26);
			struct mirth_type_Type v27 = { .tag=mirth_type_Type_Error };
			branch_Resource_12 = v27;
			branch_zaTypeElab_11 = v8;
			branch_zaMirth_10 = v26;
		} break;
		default: {
			do_panic(str_make("unexpected fallthrough in match\n", 32));
		}
	}
	uint64_t v28 = branch_zaTypeElab_11->mtoken;
	struct mirth_mirth_zaMirth* v29;
	bool v30 = mw_mirth_token_Token_argzeendzy(branch_zaMirth_10, v28, &v29);
	struct mirth_mirth_zaMirth* branch_zaMirth_31;
	struct mirth_elab_zaTypeElab* branch_zaTypeElab_32;
	if (v30) {
		branch_zaTypeElab_32 = branch_zaTypeElab_11;
		branch_zaMirth_31 = v29;
	} else {
		uint64_t v33 = branch_zaTypeElab_11->mtoken;
		STR* v34;
		STRLIT(v34, "Unexpected token after resource.", 32);
		struct mirth_mirth_zaMirth* v35;
		mw_mirth_mirth_zaMirth_emitzeerrorzx(v29, v33, v34, &v35);
		branch_zaTypeElab_32 = branch_zaTypeElab_11;
		branch_zaMirth_31 = v35;
	}
	*out_zaTypeElab_4 = branch_zaTypeElab_32;
	*out_zaMirth_3 = branch_zaMirth_31;
	return branch_Resource_12;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, -0x68(%rbp)
movq %rdx, %r13
movabsq $0xfffffffffffc, %r14   # imm = 0xFFFFFFFFFFFC
movq 0x10(%rsi), %r15
leaq -0x40(%rbp), %rdx
leaq -0x38(%rbp), %rcx
callq 0x3f5e3
movq %rdx, %rdi
movl %eax, %eax
leaq 0xa1649(%rip), %rcx     # 0xe2b88
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x3f453
movq %rdx, %rcx
andq %r14, %rcx
sete %sil
testb $0x3, %dl
setne %dil
orb %sil, %dil
jne 0x4157d
decl (%rcx)
jne 0x4157d
shlq $0x30, %rax
orq %rdx, %rax
leaq 0xd4574(%rip), %rsi     # 0x115ae9
movq %rax, %rdi
callq 0xd4e3
cmpq $0x0, 0x10d83c3(%rip)   # 0x1119948
jne 0x415b6
movl $0x1c, %edi
callq 0xf9f7
movq $0x1c, 0x10(%rax)
movups 0xa7f23(%rip), %xmm0    # 0xe94c3
movups %xmm0, 0x18(%rax)
movups 0xa7f24(%rip), %xmm0    # 0xe94cf
movups %xmm0, 0x24(%rax)
movq %rax, 0x10d8392(%rip)   # 0x1119948
movq 0x10d838b(%rip), %r12   # 0x1119948
movq %r12, %rax
andq %r14, %rax
sete %cl
testb $0x3, %r12b
setne %dl
orb %cl, %dl
jne 0x415d3
incl (%rax)
movq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rbx
movq %r15, %rsi
movq %rbx, %rdx
callq 0x1b861
movq (%rbx), %rdi
leaq -0x50(%rbp), %rbx
movq %rax, %rsi
movq %r12, %rdx
movl $0x2, %ecx
movq %rbx, %r8
callq 0x1bf3a
movq (%rbx), %rdi
xorl %ebx, %ebx
movq -0x38(%rbp), %r15
jmp 0x41765
callq 0x3f4e7
movl %eax, %ebx
movq %rdx, %r12
movq -0x38(%rbp), %r15
movq -0x40(%rbp), %rdi
jmp 0x41768
leaq -0x30(%rbp), %rsi
callq 0x3f527
movq %rdx, %rcx
andq %r14, %rcx
sete %sil
testb $0x3, %dl
setne %dil
orb %sil, %dil
jne 0x4165e
decl (%rcx)
jne 0x4165e
shlq $0x30, %rax
orq %rdx, %rax
leaq 0xd4493(%rip), %rsi     # 0x115ae9
movq %rax, %rdi
callq 0xd4e3
cmpq $0x0, 0x10d82f2(%rip)   # 0x1119958
jne 0x41697
movl $0x1d, %edi
callq 0xf9f7
movq $0x1d, 0x10(%rax)
movups 0xa7e5f(%rip), %xmm0    # 0xe94e0
movups %xmm0, 0x18(%rax)
movups 0xa7e61(%rip), %xmm0    # 0xe94ed
movups %xmm0, 0x25(%rax)
movq %rax, 0x10d82c1(%rip)   # 0x1119958
movq 0x10d82ba(%rip), %r12   # 0x1119958
jmp 0x41719
leaq -0x30(%rbp), %rsi
callq 0x3f493
movq %rdx, %rcx
andq %r14, %rcx
sete %sil
testb $0x3, %dl
setne %dil
orb %sil, %dil
jne 0x416d9
decl (%rcx)
jne 0x416d9
shlq $0x30, %rax
orq %rdx, %rax
leaq 0xd4418(%rip), %rsi     # 0x115ae9
movq %rax, %rdi
callq 0xd4e3
cmpq $0x0, 0x10d826f(%rip)   # 0x1119950
jne 0x41712
movl $0x1d, %edi
callq 0xf9f7
movq $0x1d, 0x10(%rax)
movups 0xa7de4(%rip), %xmm0    # 0xe94e0
movups %xmm0, 0x18(%rax)
movups 0xa7de6(%rip), %xmm0    # 0xe94ed
movups %xmm0, 0x25(%rax)
movq %rax, 0x10d823e(%rip)   # 0x1119950
movq 0x10d8237(%rip), %r12   # 0x1119950
movq %r12, %rax
andq %r14, %rax
sete %cl
testb $0x3, %r12b
setne %dl
orb %cl, %dl
jne 0x4172f
incl (%rax)
movq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rbx
movq %r15, %rsi
movq %rbx, %rdx
callq 0x1b861
movq (%rbx), %rdi
leaq -0x50(%rbp), %rbx
movq %rax, %rsi
movq %r12, %rdx
movl $0x2, %ecx
movq %rbx, %r8
callq 0x1bf3a
movq (%rbx), %rdi
movq -0x38(%rbp), %r15
xorl %ebx, %ebx
xorl %r12d, %r12d
movq 0x10(%r15), %rsi
leaq -0x30(%rbp), %rdx
callq 0x28899
testb %al, %al
je 0x41782
movq -0x30(%rbp), %rax
jmp 0x41819
movq %rbx, -0x58(%rbp)
movq %r13, -0x60(%rbp)
movq 0x10(%r15), %r13
cmpq $0x0, 0x10d81ca(%rip)   # 0x1119960
jne 0x417c7
movl $0x20, %edi
callq 0xf9f7
movq $0x20, 0x10(%rax)
movups 0xa7d4d(%rip), %xmm0    # 0xe94fe
movups %xmm0, 0x18(%rax)
movups 0xa7d52(%rip), %xmm0    # 0xe950e
movups %xmm0, 0x28(%rax)
movq %rax, 0x10d8199(%rip)   # 0x1119960
movq 0x10d8192(%rip), %rbx   # 0x1119960
andq %rbx, %r14
sete %al
testb $0x3, %bl
setne %cl
orb %al, %cl
jne 0x417e1
incl (%r14)
movq -0x30(%rbp), %rdi
leaq -0x48(%rbp), %r14
movq %r13, %rsi
movq %r14, %rdx
callq 0x1b861
movq (%r14), %rdi
leaq -0x50(%rbp), %r14
movq %rax, %rsi
movq %rbx, %rdx
movl $0x2, %ecx
movq %r14, %r8
callq 0x1bf3a
movq (%r14), %rax
movq -0x60(%rbp), %r13
movq -0x58(%rbp), %rbx
movq -0x68(%rbp), %rcx
movq %r15, (%rcx)
movq %rax, (%r13)
movl %ebx, %eax
movq %r12, %rdx
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq