// File: /workspace/github_c_makefile_star2_O3/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 0x3e29c
movq %rdx, %rdi
movl %eax, %eax
leaq 0x9e9fc(%rip), %rcx     # 0xdeb9c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x3e10c
movq %rdx, %rcx
andq %r14, %rcx
sete %sil
testb $0x3, %dl
setne %dil
orb %sil, %dil
jne 0x401de
decl (%rcx)
jne 0x401de
shlq $0x30, %rax
orq %rdx, %rax
leaq 0xd1913(%rip), %rsi     # 0x111ae9
movq %rax, %rdi
callq 0xd13d
movq 0x10d5763(%rip), %r12   # 0x1115948
testq %r12, %r12
jne 0x4021c
movl $0x1c, %edi
callq 0xf5e4
movq %rax, %r12
movq $0x1c, 0x10(%rax)
movups 0xa518c(%rip), %xmm0    # 0xe5392
movups %xmm0, 0x18(%rax)
movups 0xa518d(%rip), %xmm0    # 0xe539e
movups %xmm0, 0x24(%rax)
movq %rax, 0x10d572c(%rip)   # 0x1115948
movq %r12, %rax
andq %r14, %rax
sete %cl
testb $0x3, %r12b
setne %dl
orb %cl, %dl
jne 0x40232
incl (%rax)
movq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rbx
movq %r15, %rsi
movq %rbx, %rdx
callq 0x1b59d
movq (%rbx), %rdi
leaq -0x50(%rbp), %rbx
movq %rax, %rsi
movq %r12, %rdx
movl $0x2, %ecx
movq %rbx, %r8
callq 0x1bc32
movq (%rbx), %rdi
xorl %ebx, %ebx
movq -0x38(%rbp), %r15
jmp 0x403c4
callq 0x3e1a0
movl %eax, %ebx
movq %rdx, %r12
movq -0x38(%rbp), %r15
movq -0x40(%rbp), %rdi
jmp 0x403c7
leaq -0x30(%rbp), %rsi
callq 0x3e1e0
movq %rdx, %rcx
andq %r14, %rcx
sete %sil
testb $0x3, %dl
setne %dil
orb %sil, %dil
jne 0x402bd
decl (%rcx)
jne 0x402bd
shlq $0x30, %rax
orq %rdx, %rax
leaq 0xd1834(%rip), %rsi     # 0x111ae9
movq %rax, %rdi
callq 0xd13d
movq 0x10d5694(%rip), %r12   # 0x1115958
testq %r12, %r12
jne 0x40378
movl $0x1d, %edi
callq 0xf5e4
movq %rax, %r12
movq $0x1d, 0x10(%rax)
movups 0xa50c6(%rip), %xmm0    # 0xe53af
movups %xmm0, 0x18(%rax)
movups 0xa50c8(%rip), %xmm0    # 0xe53bc
movups %xmm0, 0x25(%rax)
movq %rax, 0x10d5659(%rip)   # 0x1115958
jmp 0x40378
leaq -0x30(%rbp), %rsi
callq 0x3e14c
movq %rdx, %rcx
andq %r14, %rcx
sete %sil
testb $0x3, %dl
setne %dil
orb %sil, %dil
jne 0x4033a
decl (%rcx)
jne 0x4033a
shlq $0x30, %rax
orq %rdx, %rax
leaq 0xd17b7(%rip), %rsi     # 0x111ae9
movq %rax, %rdi
callq 0xd13d
movq 0x10d560f(%rip), %r12   # 0x1115950
testq %r12, %r12
jne 0x40378
movl $0x1d, %edi
callq 0xf5e4
movq %rax, %r12
movq $0x1d, 0x10(%rax)
movups 0xa504d(%rip), %xmm0    # 0xe53af
movups %xmm0, 0x18(%rax)
movups 0xa504f(%rip), %xmm0    # 0xe53bc
movups %xmm0, 0x25(%rax)
movq %rax, 0x10d55d8(%rip)   # 0x1115950
movq %r12, %rax
andq %r14, %rax
sete %cl
testb $0x3, %r12b
setne %dl
orb %cl, %dl
jne 0x4038e
incl (%rax)
movq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rbx
movq %r15, %rsi
movq %rbx, %rdx
callq 0x1b59d
movq (%rbx), %rdi
leaq -0x50(%rbp), %rbx
movq %rax, %rsi
movq %r12, %rdx
movl $0x2, %ecx
movq %rbx, %r8
callq 0x1bc32
movq (%rbx), %rdi
movq -0x38(%rbp), %r15
xorl %ebx, %ebx
xorl %r12d, %r12d
movq 0x10(%r15), %rsi
leaq -0x30(%rbp), %rdx
callq 0x28295
testb %al, %al
je 0x403e1
movq -0x30(%rbp), %rax
jmp 0x40477
movq %rbx, -0x58(%rbp)
movq %r13, -0x60(%rbp)
movq 0x10(%r15), %rbx
movq 0x10d556c(%rip), %r13   # 0x1115960
testq %r13, %r13
jne 0x4042b
movl $0x20, %edi
callq 0xf5e4
movq %rax, %r13
movq $0x20, 0x10(%rax)
movups 0xa4fb8(%rip), %xmm0    # 0xe53cd
movups %xmm0, 0x18(%rax)
movups 0xa4fbd(%rip), %xmm0    # 0xe53dd
movups %xmm0, 0x28(%rax)
movq %rax, 0x10d5535(%rip)   # 0x1115960
andq %r13, %r14
sete %al
testb $0x3, %r13b
setne %cl
orb %al, %cl
jne 0x4043f
incl (%r14)
movq -0x30(%rbp), %rdi
leaq -0x48(%rbp), %r14
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1b59d
movq (%r14), %rdi
leaq -0x50(%rbp), %rbx
movq %rax, %rsi
movq %r13, %rdx
movl $0x2, %ecx
movq %rbx, %r8
callq 0x1bc32
movq (%rbx), %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