// File: /workspace/github_c_makefile_star2_O2/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, %r14   # imm = 0xFFFFFFFFFFFC
movl 0x18(%rdx), %r12d
movq 0x20(%rdx), %r15
movq %r15, %rax
andq %r14, %rax
sete %cl
testb $0x3, %r15b
setne %sil
orb %cl, %sil
jne 0x596f3
incl (%rax)
movq %rdx, %rax
andq %r14, %rax
sete %cl
testb $0x3, %dl
setne %sil
orb %cl, %sil
jne 0x5971b
decl (%rax)
jne 0x5971b
leaq 0xaffee(%rip), %rsi     # 0x109701
movq %rdx, %rdi
callq 0xce94
movq $0x0, -0x30(%rbp)
movb $0x1, %r13b
leaq -0x48(%rbp), %rbx
movq $0x0, -0x38(%rbp)
testb $0x1, %r13b
je 0x598bf
movl %r12d, %edi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x1075d
testl %eax, %eax
je 0x59874
cmpl $0x1, %eax
jne 0x59939
movq %rdx, %rdi
callq 0xd491
movq %rax, %r12
movq %rdx, %r15
movq %rax, %r13
testb $0x1, %r15b
je 0x59788
movq %r12, %rax
andq %r14, %rax
sete %cl
testb $0x3, %r13b
setne %dl
orb %cl, %dl
jne 0x59788
incl (%rax)
movq 0x8(%r13), %rbx
testb $0x1, 0x10(%r13)
je 0x597a8
movq %rbx, %rax
andq %r14, %rax
sete %cl
testb $0x3, %bl
setne %dl
orb %cl, %dl
jne 0x597a8
incl (%rax)
andq %r14, %r12
sete %al
testb $0x3, %r13b
setne %r14b
orb %al, %r14b
jne 0x597d0
decl (%r12)
jne 0x597d0
movq %r13, %rdi
leaq 0xafcf6(%rip), %rsi     # 0x1094c1
callq 0xce94
cmpq -0x60(%rbp), %rbx
jne 0x59884
movq %r13, %rdi
movq %r15, %rsi
callq 0x8d0c
movq %rdx, %r15
movq -0x40(%rbp), %rax
movq %rax, %rcx
movabsq $0xfffffffffffc, %r14   # imm = 0xFFFFFFFFFFFC
andq %r14, %rcx
sete %dl
testb $0x3, %al
setne %sil
orb %dl, %sil
leaq -0x48(%rbp), %rbx
jne 0x59828
movl -0x48(%rbp), %edi
decl (%rcx)
jne 0x59828
shlq $0x30, %rdi
orq %rax, %rdi
leaq 0xaea56(%rip), %rsi     # 0x108279
callq 0xce94
movq -0x38(%rbp), %rsi
movq %rsi, %rax
andq %r14, %rax
sete %cl
testb $0x3, %sil
setne %dl
movb $0x1, %r13b
orb %cl, %dl
jne 0x5985e
decl (%rax)
jne 0x5985e
movq -0x30(%rbp), %rdi
shlq $0x30, %rdi
orq %rsi, %rdi
leaq 0xaea68(%rip), %rsi     # 0x1082c1
callq 0xce94
xorl %r12d, %r12d
pushq $0x1
popq %rax
movq %rax, -0x30(%rbp)
movq %r15, -0x38(%rbp)
xorl %r15d, %r15d
jmp 0x59732
movl -0x48(%rbp), %r12d
movq -0x40(%rbp), %r15
xorl %r13d, %r13d
jmp 0x59732
testb $0x1, %r15b
sete %al
orb %r14b, %al
leaq -0x48(%rbp), %rbx
jne 0x598a5
decl (%r12)
jne 0x598a5
movq %r13, %rdi
movq %r15, %rsi
callq 0xce94
movl -0x48(%rbp), %r12d
movb $0x1, %r13b
movq -0x40(%rbp), %r15
movabsq $0xfffffffffffc, %r14   # imm = 0xFFFFFFFFFFFC
jmp 0x59732
andq %r15, %r14
sete %al
testb $0x3, %r15b
setne %cl
orb %al, %cl
jne 0x598eb
decl (%r14)
jne 0x598eb
shlq $0x30, %r12
orq %r15, %r12
movq %r12, %rdi
leaq 0xae993(%rip), %rsi     # 0x108279
callq 0xce94
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x3e5cd
testl %eax, %eax
je 0x59919
cmpl $0x1, %eax
jne 0x59939
movq %rdx, %rdi
callq 0xd491
movq %rax, %rbx
movq %rax, %rdi
movq %rdx, %rsi
callq 0x2fb0c
jmp 0x5991c
pushq $0x1
popq %rbx
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
leaq 0x7aecd(%rip), %rdi     # 0xd480d
pushq $0x20
popq %rsi
callq 0x8a21
movq %rax, %rdi
callq 0x8cc6