// File: /workspace/github_c_makefile_star2_O3/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 0x37fe3
addl $-0x2, %eax
cmpl $0x6, %eax
ja 0x5cfd1
leaq 0x824e6(%rip), %rcx     # 0xdf2e4
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 0x5ce24
incl (%rax)
movl $0x4, %ecx
movq -0x40(%rbp), %rax
movq %r15, %r12
jmp 0x5cfb4
movq %r13, -0x38(%rbp)
leaq -0x58(%rbp), %rbx
leaq -0x30(%rbp), %rax
movq %rdx, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x382d7
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 0x5cdc0
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 0x3cfb6
movq %rdx, %r15
leaq -0x48(%rbp), %rax
movq (%rax), %rax
movl $0x8, %ecx
jmp 0x5cfb4
movq %r13, -0x38(%rbp)
leaq -0x58(%rbp), %rbx
leaq -0x30(%rbp), %rax
movq %rdx, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x38233
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 0x5cdc0
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 0x3c8d3
movq %rdx, %r15
leaq -0x48(%rbp), %rax
movq (%rax), %rax
movl $0x6, %ecx
jmp 0x5cfb4
movq %r13, -0x38(%rbp)
leaq -0x58(%rbp), %rbx
movq %rdx, %rdi
movq %rbx, %rsi
callq 0x381ac
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 0x5cdc0
movq %rax, %r12
movl (%r13), %edi
movq 0x8(%r13), %rsi
movl (%rbx), %edx
movq 0x8(%rbx), %rcx
movq -0x38(%rbp), %r13
callq 0x20ae8
movq %rdx, %r15
leaq -0x30(%rbp), %rax
movq (%rax), %rax
movl $0x7, %ecx
jmp 0x5cfb4
leaq -0x58(%rbp), %rsi
movq %rdx, %rdi
callq 0x38125
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 0x5cdc0
movq %rax, %r12
movl (%rbx), %edi
movq 0x8(%rbx), %rsi
leaq -0x58(%rbp), %rax
movl (%rax), %edx
movq 0x8(%rax), %rcx
callq 0x205af
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
movq 0x10b8d90(%rip), %rdi   # 0x1115d68
testq %rdi, %rdi
jne 0x5d01a
movl $0x29, %edi
callq 0xf5e4
movq %rax, %rdi
movq $0x29, 0x10(%rax)
movups 0x896b2(%rip), %xmm0    # 0xe66ab
movups %xmm0, 0x18(%rax)
movups 0x896b7(%rip), %xmm0    # 0xe66bb
movups %xmm0, 0x28(%rax)
movups 0x896b5(%rip), %xmm0    # 0xe66c4
movups %xmm0, 0x31(%rax)
movq %rax, 0x10b8d4e(%rip)   # 0x1115d68
movabsq $0xfffffffffffc, %rax   # imm = 0xFFFFFFFFFFFC
andq %rdi, %rax
sete %cl
testb $0x3, %dil
setne %dl
orb %cl, %dl
jne 0x5d037
incl (%rax)
callq 0x9302