// File: /workspace/github_c_makefile_star2_O2/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 0x34dd2
addl $-0x2, %eax
cmpl $0x6, %eax
ja 0x582c4
leaq 0x7b1e6(%rip), %rcx     # 0xd32e4
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 0x58124
incl (%rax)
pushq $0x4
popq %rcx
movq -0x40(%rbp), %rax
movq %r15, %r12
jmp 0x582a7
movq %r13, -0x38(%rbp)
leaq -0x58(%rbp), %rbx
leaq -0x30(%rbp), %rax
movq %rdx, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x350d3
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 0x580c0
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 0x39a7a
movq %rdx, %r15
leaq -0x48(%rbp), %rax
movq (%rax), %rax
pushq $0x8
jmp 0x582a6
movq %r13, -0x38(%rbp)
leaq -0x58(%rbp), %rbx
leaq -0x30(%rbp), %rax
movq %rdx, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x3502f
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 0x580c0
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 0x393fa
movq %rdx, %r15
leaq -0x48(%rbp), %rax
movq (%rax), %rax
pushq $0x6
jmp 0x582a6
movq %r13, -0x38(%rbp)
leaq -0x58(%rbp), %rbx
movq %rdx, %rdi
movq %rbx, %rsi
callq 0x34f7f
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 0x580c0
movq %rax, %r12
movl (%r13), %edi
movq 0x8(%r13), %rsi
movl (%rbx), %edx
movq 0x8(%rbx), %rcx
movq -0x38(%rbp), %r13
callq 0x1e82b
movq %rdx, %r15
leaq -0x30(%rbp), %rax
movq (%rax), %rax
pushq $0x7
jmp 0x582a6
leaq -0x58(%rbp), %rsi
movq %rdx, %rdi
callq 0x34ef8
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 0x580c0
movq %rax, %r12
movl (%rbx), %edi
movq 0x8(%rbx), %rsi
leaq -0x58(%rbp), %rax
movl (%rax), %edx
movq 0x8(%rax), %rcx
callq 0x1e310
movq %rdx, %r15
leaq -0x30(%rbp), %rax
movq (%rax), %rax
pushq $0x5
popq %rcx
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 0x10b4a9d(%rip), %rdi   # 0x110cd68
testq %rdi, %rdi
jne 0x582e9
leaq 0x825a5(%rip), %rdi     # 0xda87c
pushq $0x29
popq %rsi
callq 0x8a21
movq %rax, %rdi
movq %rax, 0x10b4a7f(%rip)   # 0x110cd68
movabsq $0xfffffffffffc, %rax   # imm = 0xFFFFFFFFFFFC
andq %rdi, %rax
sete %cl
testb $0x3, %dil
setne %dl
orb %cl, %dl
jne 0x58306
incl (%rax)
callq 0x8cc6