// File: /workspace/github_c_makefile_star2_O2/mirth-lang[P]mirth/bin/mirth1.c
// Function: mw_mirth_type_StackType_topzeresourcezetycons
static struct std_list_List_1 mw_mirth_type_StackType_topzeresourcezetycons (struct mirth_mirth_zaMirth* in_zaMirth_1, struct mirth_type_StackType in_StackType_2, struct mirth_mirth_zaMirth* *out_zaMirth_3) {
	struct std_list_List_1 v5 = { .tag=std_list_List_1_Nil };
	bool v6 = true;
	struct std_list_List_1 v7 = v5;
	struct mirth_mirth_zaMirth* r8 = in_zaMirth_1;
	struct mirth_type_StackType v9 = in_StackType_2;
	bool v10 = v6;
	bool v11 = v6;
	while (v11) {
		struct std_list_List_1 v12 = v7;
		struct mirth_mirth_zaMirth* r13 = r8;
		struct mirth_type_StackType v14 = v9;
		bool v15 = v10;
		struct mirth_mirth_zaMirth* v16;
		struct mirth_type_StackType v17 = mw_mirth_type_StackType_expand(r13, v14, &v16);
		struct mirth_type_StackType branch_StackType_18;
		struct mirth_mirth_zaMirth* branch_zaMirth_19;
		struct std_list_List_1 branch_List_20;
		bool branch_Bool_21;
		switch ((v17).tag) {
			case mirth_type_StackType_With: {
				struct mirth_type_Type v22;
				struct mirth_type_StackType v23 = mtp_mirth_type_StackType_With(v17, &v22);
				struct mirth_type_Type v24 = mw_mirth_type_Resource_zgType(v22);
				struct mirth_mirth_zaMirth* v25;
				struct std_maybe_Maybe_1 v26 = mw_mirth_type_Type_tyconzy(v16, v24, &v25);
				struct std_list_List_1 branch_List_27;
				bool branch_Bool_28;
				switch ((v26).tag) {
					case std_maybe_Maybe_1_Some: {
						VAL v29 = mtp_std_maybe_Maybe_1_Some(v26);
						struct std_list_List_1 v30 = mw_std_list_List_1_cons(v29, v12);
						bool v31 = true;
						branch_Bool_28 = v31;
						branch_List_27 = v30;
					} break;
					case std_maybe_Maybe_1_None: {
						bool v32 = false;
						branch_Bool_28 = v32;
						branch_List_27 = v12;
					} break;
					default: {
						do_panic(str_make("unexpected fallthrough in match\n", 32));
					}
				}
				branch_Bool_21 = branch_Bool_28;
				branch_List_20 = branch_List_27;
				branch_zaMirth_19 = v25;
				branch_StackType_18 = v23;
			} break;
			case mirth_type_StackType_Cons: {
				struct mirth_type_Type v33;
				struct mirth_type_StackType v34 = mtp_mirth_type_StackType_Cons(v17, &v33);
				decref(MK_mirth_type_Type(v33));
				bool v35 = true;
				branch_Bool_21 = v35;
				branch_List_20 = v12;
				branch_zaMirth_19 = v16;
				branch_StackType_18 = v34;
			} break;
			case mirth_type_StackType_WithLabel: {
				struct mirth_type_Type v36;
				uint64_t v37;
				struct mirth_type_StackType v38 = mtp_mirth_type_StackType_WithLabel(v17, &v36, &v37);
				decref(MK_mirth_type_Type(v36));
				bool v39 = true;
				branch_Bool_21 = v39;
				branch_List_20 = v12;
				branch_zaMirth_19 = v16;
				branch_StackType_18 = v38;
			} break;
			case mirth_type_StackType_ConsLabel: {
				struct mirth_type_Type v40;
				uint64_t v41;
				struct mirth_type_StackType v42 = mtp_mirth_type_StackType_ConsLabel(v17, &v40, &v41);
				decref(MK_mirth_type_Type(v40));
				bool v43 = true;
				branch_Bool_21 = v43;
				branch_List_20 = v12;
				branch_zaMirth_19 = v16;
				branch_StackType_18 = v42;
			} break;
			default: {
				bool v44 = false;
				branch_Bool_21 = v44;
				branch_List_20 = v12;
				branch_zaMirth_19 = v16;
				branch_StackType_18 = v17;
			} break;
		}
		v11 = branch_Bool_21;
		v10 = branch_Bool_21;
		v9 = branch_StackType_18;
		r8 = branch_zaMirth_19;
		v7 = branch_List_20;
	}
	decref(MK_mirth_type_StackType(v9));
	*out_zaMirth_3 = r8;
	return v7;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, -0x60(%rbp)
movq %rdx, %r13
movl %esi, %r15d
movq %rdi, %r14
movabsq $0xfffffffffffc, %r12   # imm = 0xFFFFFFFFFFFC
movq $0x0, -0x50(%rbp)
movb $0x1, %al
leaq 0x87e70(%rip), %rbx     # 0xd2e24
movq $0x0, -0x48(%rbp)
testb $0x1, %al
je 0x4b0df
movq %r14, %rdi
movl %r15d, %esi
movq %r13, %rdx
leaq -0x40(%rbp), %rcx
callq 0x34dd2
movl %eax, %r15d
movq %rdx, %r13
leal -0x5(%r15), %eax
cmpl $0x3, %eax
ja 0x4b0c9
movslq (%rbx,%rax,4), %rax
addq %rbx, %rax
jmpq *%rax
movq %r13, %rdi
leaq -0x38(%rbp), %rsi
callq 0x34ef8
jmp 0x4b086
movq %r13, %rdi
leaq -0x38(%rbp), %rsi
callq 0x34f7f
movl %eax, %r15d
movq %rdx, %r13
movl -0x38(%rbp), %esi
movq -0x30(%rbp), %rdx
movq -0x40(%rbp), %rdi
leaq -0x58(%rbp), %rcx
callq 0x2a670
testl %eax, %eax
je 0x4b0d4
cmpl $0x1, %eax
jne 0x4b12a
movq %rdx, %rdi
callq 0xd491
movq %rax, %rdi
movq %rdx, %rsi
movq -0x50(%rbp), %rdx
movq -0x48(%rbp), %rcx
callq 0xcf39
movq %rdx, -0x48(%rbp)
movb $0x1, %al
pushq $0x1
popq %rcx
movq %rcx, -0x50(%rbp)
jmp 0x4b0d6
movq %r13, %rdi
leaq -0x38(%rbp), %rsi
leaq -0x58(%rbp), %rdx
callq 0x350d3
jmp 0x4b086
movq %r13, %rdi
leaq -0x38(%rbp), %rsi
leaq -0x58(%rbp), %rdx
callq 0x3502f
movl %eax, %r15d
movq %rdx, %r13
movq -0x30(%rbp), %rax
movq %rax, %rcx
andq %r12, %rcx
sete %dl
testb $0x3, %al
setne %sil
orb %dl, %sil
jne 0x4b0be
movl -0x38(%rbp), %edi
decl (%rcx)
jne 0x4b0be
shlq $0x30, %rdi
orq %rax, %rdi
leaq 0xbda30(%rip), %rsi     # 0x108ae9
callq 0xce94
movq -0x40(%rbp), %r14
movb $0x1, %al
jmp 0x4afbc
movq -0x40(%rbp), %r14
xorl %eax, %eax
jmp 0x4afbc
xorl %eax, %eax
movq -0x58(%rbp), %r14
jmp 0x4afbc
andq %r13, %r12
sete %al
testb $0x3, %r13b
setne %cl
orb %al, %cl
jne 0x4b10c
decl (%r12)
jne 0x4b10c
shlq $0x30, %r15
orq %r13, %r15
leaq 0xbdabd(%rip), %rsi     # 0x108bc1
movq %r15, %rdi
callq 0xce94
movq -0x60(%rbp), %rax
movq %r14, (%rax)
movq -0x50(%rbp), %rax
movq -0x48(%rbp), %rdx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x896dc(%rip), %rdi     # 0xd480d
pushq $0x20
popq %rsi
callq 0x8a21
movq %rax, %rdi
callq 0x8cc6