// File: /workspace/github_c_makefile_star2_O1/mirth-lang[P]mirth/bin/mirth1.c
// Function: mw_mirth_type_StackType_semifreshen
static struct mirth_type_StackType mw_mirth_type_StackType_semifreshen (struct mirth_mirth_zaMirth* in_zaMirth_1, struct mirth_type_StackType in_StackType_2, struct mirth_type_StackType in_StackType_3, struct mirth_mirth_zaMirth* *out_zaMirth_4, struct mirth_type_StackType *out_StackType_6) {
	struct mirth_mirth_zaMirth* v7;
	struct mirth_type_StackType v8 = mw_mirth_type_StackType_expand(in_zaMirth_1, in_StackType_3, &v7);
	struct mirth_mirth_zaMirth* branch_zaMirth_9;
	struct mirth_type_StackType branch_StackType_10;
	struct mirth_type_StackType branch_StackType_11;
	switch ((v8).tag) {
		case mirth_type_StackType_Unit: {
			incref(MK_mirth_type_StackType(in_StackType_2));
			branch_StackType_11 = in_StackType_2;
			branch_StackType_10 = in_StackType_2;
			branch_zaMirth_9 = v7;
		} break;
		case mirth_type_StackType_Cons: {
			struct mirth_type_Type v12;
			struct mirth_type_StackType v13 = mtp_mirth_type_StackType_Cons(v8, &v12);
			struct mirth_mirth_zaMirth* v14;
			struct mirth_type_StackType v15;
			struct mirth_type_StackType v16 = mw_mirth_type_StackType_semifreshen(v7, in_StackType_2, v13, &v14, &v15);
			struct mirth_type_StackType v17 = mtw_mirth_type_StackType_Cons(v15, v12);
			branch_StackType_11 = v17;
			branch_StackType_10 = v16;
			branch_zaMirth_9 = v14;
		} break;
		case mirth_type_StackType_With: {
			struct mirth_type_Type v18;
			struct mirth_type_StackType v19 = mtp_mirth_type_StackType_With(v8, &v18);
			struct mirth_mirth_zaMirth* v20;
			struct mirth_type_StackType v21;
			struct mirth_type_StackType v22 = mw_mirth_type_StackType_semifreshen(v7, in_StackType_2, v19, &v20, &v21);
			struct mirth_type_StackType v23 = mtw_mirth_type_StackType_With(v21, v18);
			branch_StackType_11 = v23;
			branch_StackType_10 = v22;
			branch_zaMirth_9 = v20;
		} break;
		case mirth_type_StackType_ConsLabel: {
			struct mirth_type_Type v24;
			uint64_t v25;
			struct mirth_type_StackType v26 = mtp_mirth_type_StackType_ConsLabel(v8, &v24, &v25);
			struct mirth_mirth_zaMirth* v27;
			struct mirth_type_StackType v28;
			struct mirth_type_StackType v29 = mw_mirth_type_StackType_semifreshen(v7, in_StackType_2, v26, &v27, &v28);
			struct mirth_type_StackType v30 = mtw_mirth_type_StackType_ConsLabel(v28, v24, v25);
			branch_StackType_11 = v30;
			branch_StackType_10 = v29;
			branch_zaMirth_9 = v27;
		} break;
		case mirth_type_StackType_WithLabel: {
			struct mirth_type_Type v31;
			uint64_t v32;
			struct mirth_type_StackType v33 = mtp_mirth_type_StackType_WithLabel(v8, &v31, &v32);
			struct mirth_mirth_zaMirth* v34;
			struct mirth_type_StackType v35;
			struct mirth_type_StackType v36 = mw_mirth_type_StackType_semifreshen(v7, in_StackType_2, v33, &v34, &v35);
			struct mirth_type_StackType v37 = mtw_mirth_type_StackType_WithLabel(v35, v31, v32);
			branch_StackType_11 = v37;
			branch_StackType_10 = v36;
			branch_zaMirth_9 = v34;
		} break;
		default: {
			STR* v38;
			STRLIT(v38, "expected unit-based stack in semifreshen!", 41);
			do_panic(v38);
		} break;
	}
	*out_StackType_6 = branch_StackType_11;
	*out_zaMirth_4 = branch_zaMirth_9;
	return branch_StackType_10;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r9, %r14
movq %r8, %r13
movq %rsi, %r15
leaq -0x40(%rbp), %rax
movl %edx, %esi
movq %rcx, %rdx
movq %rax, %rcx
callq 0x3917b
addl $-0x2, %eax
cmpl $0x6, %eax
ja 0x5e805
leaq 0x84c6a(%rip), %rcx     # 0xe329c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movabsq $0xfffffffffffc, %rax   # imm = 0xFFFFFFFFFFFC
andq %r15, %rax
sete %cl
testb $0x3, %r15b
setne %dl
orb %cl, %dl
jne 0x5e658
incl (%rax)
movl $0x4, %ecx
movq -0x40(%rbp), %rax
movq %r15, %r12
jmp 0x5e7e8
movq %r13, -0x38(%rbp)
leaq -0x58(%rbp), %rbx
leaq -0x30(%rbp), %rax
movq %rdx, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x39471
movq %rdx, %rcx
movq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %r8
leaq -0x68(%rbp), %r13
movq %r15, %rsi
movl %eax, %edx
movq %r13, %r9
callq 0x5e5f4
movq %rax, %r12
leaq -0x30(%rbp), %rax
movq (%rax), %r8
movl (%r13), %edi
movq 0x8(%r13), %rsi
movl (%rbx), %edx
movq 0x8(%rbx), %rcx
movq -0x38(%rbp), %r13
callq 0x3e2fd
movq %rdx, %r15
leaq -0x48(%rbp), %rax
movq (%rax), %rax
movl $0x8, %ecx
jmp 0x5e7e8
movq %r13, -0x38(%rbp)
leaq -0x58(%rbp), %rbx
leaq -0x30(%rbp), %rax
movq %rdx, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x393cd
movq %rdx, %rcx
movq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %r8
leaq -0x68(%rbp), %r13
movq %r15, %rsi
movl %eax, %edx
movq %r13, %r9
callq 0x5e5f4
movq %rax, %r12
leaq -0x30(%rbp), %rax
movq (%rax), %r8
movl (%r13), %edi
movq 0x8(%r13), %rsi
movl (%rbx), %edx
movq 0x8(%rbx), %rcx
movq -0x38(%rbp), %r13
callq 0x3dc1a
movq %rdx, %r15
leaq -0x48(%rbp), %rax
movq (%rax), %rax
movl $0x6, %ecx
jmp 0x5e7e8
movq %r13, -0x38(%rbp)
leaq -0x58(%rbp), %rbx
movq %rdx, %rdi
movq %rbx, %rsi
callq 0x39346
movq %rdx, %rcx
movq -0x40(%rbp), %rdi
leaq -0x30(%rbp), %r8
leaq -0x68(%rbp), %r13
movq %r15, %rsi
movl %eax, %edx
movq %r13, %r9
callq 0x5e5f4
movq %rax, %r12
movl (%r13), %edi
movq 0x8(%r13), %rsi
movl (%rbx), %edx
movq 0x8(%rbx), %rcx
movq -0x38(%rbp), %r13
callq 0x21053
movq %rdx, %r15
leaq -0x30(%rbp), %rax
movq (%rax), %rax
movl $0x7, %ecx
jmp 0x5e7e8
leaq -0x58(%rbp), %rsi
movq %rdx, %rdi
callq 0x392bf
movq %rdx, %rcx
movq -0x40(%rbp), %rdi
leaq -0x30(%rbp), %r8
leaq -0x68(%rbp), %rbx
movq %r15, %rsi
movl %eax, %edx
movq %rbx, %r9
callq 0x5e5f4
movq %rax, %r12
movl (%rbx), %edi
movq 0x8(%rbx), %rsi
leaq -0x58(%rbp), %rax
movl (%rax), %edx
movq 0x8(%rax), %rcx
callq 0x20b1a
movq %rdx, %r15
leaq -0x30(%rbp), %rax
movq (%rax), %rax
movl $0x5, %ecx
movl %ecx, (%r14)
movq %r15, 0x8(%r14)
movq %rax, (%r13)
movq %r12, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, 0x10bb55b(%rip)   # 0x1119d68
jne 0x5e849
movl $0x29, %edi
callq 0xf9f7
movq $0x29, 0x10(%rax)
movups 0x8bfb4(%rip), %xmm0    # 0xea7dc
movups %xmm0, 0x18(%rax)
movups 0x8bfb9(%rip), %xmm0    # 0xea7ec
movups %xmm0, 0x28(%rax)
movups 0x8bfb7(%rip), %xmm0    # 0xea7f5
movups %xmm0, 0x31(%rax)
movq %rax, 0x10bb51f(%rip)   # 0x1119d68
movq 0x10bb518(%rip), %rdi   # 0x1119d68
movabsq $0xfffffffffffc, %rax   # imm = 0xFFFFFFFFFFFC
andq %rdi, %rax
sete %cl
testb $0x3, %dil
setne %dl
orb %cl, %dl
jne 0x5e86d
incl (%rax)
callq 0x95a5