// File: /workspace/github_c_makefile_star2_O2/mirth-lang[P]mirth/bin/mirth1.c
// Function: mw_std_prim_zaWorld_openzefilezx
static void mw_std_prim_zaWorld_openzefilezx (STR* in_Path_1, struct std_result_zaResult_2 *out_zaResult_2) {
	incref(MKSTR(in_Path_1));
	int64_t v5 = mw_std_posix_OpenFlags_None();
	INT v6 = WRAP_I63(0LL);
	int64_t v7 = int_to_i64(v6);
	incref(MKSTR(in_Path_1));
	incref(MKSTR(in_Path_1));
	void* v8 = str_base(in_Path_1);
	uint64_t v9 = str_size(in_Path_1);
	INT v10 = u64_to_int(v9);
	uint8_t v11 = mw_std_prelude_unsafe_1_sp12(v10, v8);
	INT v12 = WRAP_I63(0LL);
	INT v13 = v12;
	uint64_t v14 = (uint64_t)(v11);
	INT v15 = u64_to_int(v14);
	bool v16 = int_eq(v15, v13);
	if (v16) {
	} else {
		STR* v17;
		STRLIT(v17, "tried to use Str as CStr, but Str is not zero terminated", 56);
		do_panic(v17);
	}
	int64_t v18 = mext_std_prim_zaWorld_rawzeposixzeopenzx(v8, v5, v7);
	INT v19 = WRAP_I63(0LL);
	INT v20 = v19;
	INT v21 = i64_to_int(v18);
	bool v22 = int_lt(v21, v20);
	struct std_maybe_zaMaybe_1 branch_zaMaybe_23;
	if (v22) {
		struct std_maybe_zaMaybe_1 v24 = { .tag=std_maybe_zaMaybe_1_zaNone };
		branch_zaMaybe_23 = v24;
	} else {
		struct std_maybe_zaMaybe_1 v25;
		mtw_std_maybe_zaMaybe_1_zaSome(MKI64(v18), &v25);
		branch_zaMaybe_23 = v25;
	}
	decref(MKSTR(in_Path_1));
	struct std_result_zaResult_2 branch_zaResult_26;
	switch ((branch_zaMaybe_23).tag) {
		case std_maybe_zaMaybe_1_zaSome: {
			VAL v27;
			mtp_std_maybe_zaMaybe_1_zaSome(branch_zaMaybe_23, &v27);
			decref(MKSTR(in_Path_1));
			bool v28 = true;
			struct std_file_zaFile* v29;
			mtw_std_file_zaFile_zaFile(value_i64(v27), v28, &v29);
			struct std_result_zaResult_2 v30;
			mtw_std_result_zaResult_2_zaOk(MK_std_file_zaFile(v29), &v30);
			branch_zaResult_26 = v30;
		} break;
		case std_maybe_zaMaybe_1_zaNone: {
			int64_t v31 = mw_std_prelude_unsafe_1_sp1();
			struct std_file_IOError v32 = mtw_std_file_IOError_OpenFailed(in_Path_1, v31);
			struct std_result_zaResult_2 v33;
			mtw_std_result_zaResult_2_zaErr(MK_std_file_IOError(v32), &v33);
			branch_zaResult_26 = v33;
		} break;
		default: {
			do_panic(str_make("unexpected fallthrough in match\n", 32));
		}
	}
	*out_zaResult_2 = branch_zaResult_26;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, -0x38(%rbp)
movq %rdi, %r14
movabsq $0xfffffffffffc, %r12   # imm = 0xFFFFFFFFFFFC
movq %rdi, %rcx
andq %r12, %rcx
setne %al
testb $0x3, %r14b
sete %bl
andb %al, %bl
cmpb $0x1, %bl
jne 0x71cbb
addl $0x3, (%rcx)
movq %rcx, -0x30(%rbp)
movq %r14, %rdi
callq 0xdf99
movq %rax, %r15
movq %r14, %rdi
callq 0xdb65
movq %rax, %rdi
callq 0xdbc8
movq %rax, %rdi
callq 0xdc43
movzbl (%r15,%rax), %edi
callq 0xdbc8
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0xd759
testb %al, %al
je 0x71e24
xorl %r13d, %r13d
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x7269e
movq %rax, %r15
movq %rax, %rdi
callq 0xd86d
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0x89cc
movl $0x0, %r12d
testb %al, %al
jne 0x71d4d
leaq 0x96383(%rip), %rsi     # 0x1080b8
leaq -0x48(%rbp), %r12
movq %r15, %rdi
movq %r12, %rdx
callq 0x726ad
movl (%r12), %r13d
movq 0x8(%r12), %r12
leaq 0x96405(%rip), %r15     # 0x108159
testb %bl, %bl
je 0x71d6b
movq -0x30(%rbp), %rax
decl (%rax)
jne 0x71d6b
movq %r14, %rdi
movq %r15, %rsi
callq 0xce94
testl %r13d, %r13d
je 0x71dcd
cmpl $0x1, %r13d
jne 0x71e63
leaq -0x58(%rbp), %rsi
movq %r12, %rdi
callq 0x7270b
testb %bl, %bl
je 0x71d9d
movq -0x30(%rbp), %rax
decl (%rax)
jne 0x71d9d
movq %r14, %rdi
movq %r15, %rsi
callq 0xce94
movq -0x58(%rbp), %r14
movq -0x50(%rbp), %rsi
movq %r14, %rdi
callq 0x72788
pushq $0x1
popq %rsi
leaq -0x60(%rbp), %r15
movq %r14, %rdi
movq %r15, %rdx
callq 0x72731
movq (%r15), %rdi
leaq -0x48(%rbp), %rsi
callq 0x727d3
jmp 0x71e0a
callq 0x728d6
movq %rax, %r15
pushq $0x1
popq %rdi
pushq $0x18
popq %rsi
callq 0x50c0
testq %rax, %rax
je 0x71e7a
movl $0x1, (%rax)
movq %r15, 0x10(%rax)
movq %r14, 0x8(%rax)
leaq 0x97dcb(%rip), %rsi     # 0x109bc9
leaq -0x48(%rbp), %rdx
movq %rax, %rdi
callq 0x7282c
movq -0x38(%rbp), %rax
movups -0x48(%rbp), %xmm0
movups %xmm0, (%rax)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x109b545(%rip), %rdi   # 0x110d370
testq %rdi, %rdi
jne 0x71e49
leaq 0x6a265(%rip), %rdi     # 0xdc09c
pushq $0x38
popq %rsi
callq 0x8a21
movq %rax, %rdi
movq %rax, 0x109b527(%rip)   # 0x110d370
andq %rdi, %r12
sete %al
testb $0x3, %dil
setne %cl
orb %al, %cl
jne 0x71e5e
incl (%r12)
callq 0x8cc6
leaq 0x629a3(%rip), %rdi     # 0xd480d
pushq $0x20
popq %rsi
callq 0x8a21
movq %rax, %rdi
callq 0x8cc6
leaq 0x6a32f(%rip), %rsi     # 0xdc1b0
pushq $0x2
popq %rdi
pushq $0x31
popq %rdx
callq 0x5060
callq 0x52ae
pushq $0x1
popq %rdi
callq 0x5130