// File: /workspace/github_c_makefile_star2_O3/mirth-lang[P]mirth/bin/mirth1.c
// Function: mw_mirth_type_StackTypeCounts_label
static INT mw_mirth_type_StackTypeCounts_label (struct mirth_mirth_zaMirth* in_zaMirth_1, uint64_t in_Label_2, struct mirth_type_StackTypeCounts* in_StackTypeCounts_3, struct mirth_mirth_zaMirth* *out_zaMirth_4) {
	struct std_list_List_1 v6 = in_StackTypeCounts_3->mlabels;
	incref(MK_std_list_List_1(v6));
	decref(MK_mirth_type_StackTypeCounts(in_StackTypeCounts_3));
	struct std_maybe_Maybe_1 v7 = { .tag=std_maybe_Maybe_1_None };
	bool v8 = true;
	uint64_t v9 = in_Label_2;
	struct std_maybe_Maybe_1 v10 = v7;
	struct std_list_List_1 v11 = v6;
	bool v12 = v8;
	bool v13 = v8;
	while (v13) {
		uint64_t v14 = v9;
		struct std_maybe_Maybe_1 v15 = v10;
		struct std_list_List_1 v16 = v11;
		bool v17 = v12;
		struct std_list_List_1 v18;
		struct std_maybe_Maybe_1 v19 = mw_std_list_List_1_uncons(v16, &v18);
		uint64_t branch_Label_20;
		struct std_maybe_Maybe_1 branch_Maybe_21;
		struct std_list_List_1 branch_List_22;
		bool branch_Bool_23;
		switch ((v19).tag) {
			case std_maybe_Maybe_1_Some: {
				VAL v24 = mtp_std_maybe_Maybe_1_Some(v19);
				incref(v24);
				VAL v25 = V_std_map_KeyValuePair_2(v24)->mkey;
				incref(v25);
				decref(MK_std_map_KeyValuePair_2(V_std_map_KeyValuePair_2(v24)));
				uint64_t v26 = V_mirth_label_Label(v25);
				uint64_t v27 = v14;
				bool v28 = (v26 == v27);
				uint64_t branch_Label_29;
				struct std_maybe_Maybe_1 branch_Maybe_30;
				if (v28) {
					struct std_maybe_Maybe_1 v31 = mtw_std_maybe_Maybe_1_Some(v24);
					branch_Maybe_30 = v31;
					branch_Label_29 = v14;
				} else {
					decref(v24);
					struct std_maybe_Maybe_1 v32 = { .tag=std_maybe_Maybe_1_None };
					branch_Maybe_30 = v32;
					branch_Label_29 = v14;
				}
				uint64_t branch_Label_33;
				struct std_maybe_Maybe_1 branch_Maybe_34;
				struct std_list_List_1 branch_List_35;
				switch ((branch_Maybe_30).tag) {
					case std_maybe_Maybe_1_None: {
						branch_List_35 = v18;
						branch_Maybe_34 = v15;
						branch_Label_33 = branch_Label_29;
					} break;
					default: {
						decref(MK_std_list_List_1(v18));
						decref(MK_std_maybe_Maybe_1(v15));
						struct std_list_List_1 v36 = { .tag=std_list_List_1_Nil };
						branch_List_35 = v36;
						branch_Maybe_34 = branch_Maybe_30;
						branch_Label_33 = branch_Label_29;
					} break;
				}
				bool v37 = true;
				branch_Bool_23 = v37;
				branch_List_22 = branch_List_35;
				branch_Maybe_21 = branch_Maybe_34;
				branch_Label_20 = branch_Label_33;
			} break;
			case std_maybe_Maybe_1_None: {
				bool v38 = false;
				branch_Bool_23 = v38;
				branch_List_22 = v18;
				branch_Maybe_21 = v15;
				branch_Label_20 = v14;
			} break;
			default: {
				do_panic(str_make("unexpected fallthrough in match\n", 32));
			}
		}
		v13 = branch_Bool_23;
		v12 = branch_Bool_23;
		v11 = branch_List_22;
		v10 = branch_Maybe_21;
		v9 = branch_Label_20;
	}
	decref(MK_std_list_List_1(v11));
	struct std_maybe_Maybe_1 v39 = mw_std_maybe_Maybe_1_map_1_sp18(v10);
	INT branch_Nat_40;
	switch ((v39).tag) {
		case std_maybe_Maybe_1_Some: {
			VAL v41 = mtp_std_maybe_Maybe_1_Some(v39);
			branch_Nat_40 = value_nat(v41);
		} break;
		case std_maybe_Maybe_1_None: {
			INT v42 = WRAP_I63(0LL);
			branch_Nat_40 = v42;
		} break;
		default: {
			do_panic(str_make("unexpected fallthrough in match\n", 32));
		}
	}
	*out_zaMirth_4 = in_zaMirth_1;
	return branch_Nat_40;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rcx, -0x58(%rbp)
movq %rsi, -0x60(%rbp)
movq %rdi, -0x50(%rbp)
movabsq $0xfffffffffffc, %rbx   # imm = 0xFFFFFFFFFFFC
movl 0x18(%rdx), %r14d
movq 0x20(%rdx), %r12
movq %r12, %rax
andq %rbx, %rax
sete %cl
testb $0x3, %r12b
setne %sil
orb %cl, %sil
jne 0x5e4bf
incl (%rax)
movq %rdx, %rax
andq %rbx, %rax
sete %cl
testb $0x3, %dl
setne %sil
orb %cl, %sil
jne 0x5e4e7
decl (%rax)
jne 0x5e4e7
leaq 0xb4222(%rip), %rsi     # 0x112701
movq %rdx, %rdi
callq 0xd13d
movq $0x0, -0x38(%rbp)
movq $0x0, -0x30(%rbp)
movl %r14d, %edi
movq %r12, %rsi
leaq -0x48(%rbp), %rdx
callq 0x111eb
cmpl $0x1, %eax
jne 0x5e655
movq %rdx, %rdi
callq 0xd745
movq %rax, %r12
movq %rdx, %r14
movq %rax, %r15
testb $0x1, %r14b
je 0x5e53c
movq %r12, %rax
andq %rbx, %rax
sete %cl
testb $0x3, %r15b
setne %dl
orb %cl, %dl
jne 0x5e53c
incl (%rax)
movq 0x8(%r15), %r13
testb $0x1, 0x10(%r15)
je 0x5e55d
movq %r13, %rax
andq %rbx, %rax
sete %cl
testb $0x3, %r13b
setne %dl
orb %cl, %dl
jne 0x5e55d
incl (%rax)
andq %rbx, %r12
sete %al
testb $0x3, %r15b
setne %bl
orb %al, %bl
jne 0x5e583
decl (%r12)
jne 0x5e583
movq %r15, %rdi
leaq 0xb3f43(%rip), %rsi     # 0x1124c1
callq 0xd13d
cmpq -0x60(%rbp), %r13
jne 0x5e622
movq %r15, %rdi
movq %r14, %rsi
callq 0x9353
movq %rdx, %r15
movq -0x40(%rbp), %rax
movq %rax, %rcx
movabsq $0xfffffffffffc, %rbx   # imm = 0xFFFFFFFFFFFC
andq %rbx, %rcx
sete %dl
testb $0x3, %al
setne %sil
orb %dl, %sil
jne 0x5e5d7
movl -0x48(%rbp), %edi
decl (%rcx)
jne 0x5e5d7
shlq $0x30, %rdi
orq %rax, %rdi
leaq 0xb2ca7(%rip), %rsi     # 0x111279
callq 0xd13d
movq -0x38(%rbp), %rsi
movq %rsi, %rax
andq %rbx, %rax
sete %cl
testb $0x3, %sil
setne %dl
orb %cl, %dl
jne 0x5e60a
decl (%rax)
jne 0x5e60a
movq -0x30(%rbp), %rdi
shlq $0x30, %rdi
orq %rsi, %rdi
leaq 0xb2cbc(%rip), %rsi     # 0x1112c1
callq 0xd13d
xorl %r14d, %r14d
movl $0x1, %eax
movq %rax, -0x30(%rbp)
movq %r15, -0x38(%rbp)
xorl %r12d, %r12d
jmp 0x5e4f7
testb $0x1, %r14b
sete %al
orb %bl, %al
jne 0x5e63e
decl (%r12)
jne 0x5e63e
movq %r15, %rdi
movq %r14, %rsi
callq 0xd13d
movl -0x48(%rbp), %r14d
movq -0x40(%rbp), %r12
movabsq $0xfffffffffffc, %rbx   # imm = 0xFFFFFFFFFFFC
jmp 0x5e4f7
testl %eax, %eax
jne 0x5e6d7
movq -0x40(%rbp), %rax
andq %rax, %rbx
sete %cl
testb $0x3, %al
setne %dl
orb %cl, %dl
movq -0x38(%rbp), %r14
jne 0x5e68a
movl -0x48(%rbp), %edi
decl (%rbx)
jne 0x5e68a
shlq $0x30, %rdi
orq %rax, %rdi
leaq 0xb2bf4(%rip), %rsi     # 0x111279
callq 0xd13d
movq -0x30(%rbp), %rdi
movq %r14, %rsi
callq 0x42171
movl $0x1, %ebx
testl %eax, %eax
je 0x5e6ba
cmpl $0x1, %eax
jne 0x5e6d7
movq %rdx, %rdi
callq 0xd745
movq %rax, %rbx
movq %rax, %rdi
movq %rdx, %rsi
callq 0x324c1
movq -0x58(%rbp), %rax
movq -0x50(%rbp), %rcx
movq %rcx, (%rax)
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x20, %edi
callq 0xf5e4
movq $0x20, 0x10(%rax)
movups 0x81fdd(%rip), %xmm0    # 0xe06cd
movups %xmm0, 0x18(%rax)
movups 0x81fe2(%rip), %xmm0    # 0xe06dd
movups %xmm0, 0x28(%rax)
movq %rax, %rdi
callq 0x9302