// File: /workspace/github_c_makefile_star2_O3/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, %r14
movq %rdi, %r12
movabsq $0xfffffffffffc, %rbx   # imm = 0xFFFFFFFFFFFC
movq %rdi, %rax
andq %rbx, %rax
movq %rax, -0x38(%rbp)
setne %al
testb $0x3, %r12b
sete %r13b
andb %al, %r13b
cmpb $0x1, %r13b
jne 0x785ea
movq -0x38(%rbp), %rax
addl $0x3, (%rax)
movq %r12, %rdi
callq 0xe7f9
movq %rax, %r15
movq %r12, %rdi
callq 0xe36d
movq %rax, %rdi
callq 0xe3d6
movq %rax, %rdi
callq 0xe445
movzbl (%r15,%rax), %edi
callq 0xe3d6
movl $0x1, %esi
movq %rax, %rdi
callq 0xe83a
testl %eax, %eax
jne 0x78766
movq %r12, -0x30(%rbp)
movq %r14, -0x40(%rbp)
xorl %r14d, %r14d
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x5110
movslq %eax, %rbx
leaq 0x1(,%rbx,2), %rdi
movl $0x1, %esi
callq 0xe83a
testl %eax, %eax
js 0x7867d
leaq 0x98a53(%rip), %rsi     # 0x1110b8
leaq -0x50(%rbp), %r15
movq %rbx, %rdi
movq %r15, %rdx
callq 0x790e7
movl (%r15), %r14d
movq 0x8(%r15), %r12
jmp 0x78680
xorl %r12d, %r12d
leaq 0x98ad2(%rip), %rsi     # 0x111159
testb %r13b, %r13b
je 0x7869d
movq -0x38(%rbp), %rax
decl (%rax)
jne 0x7869d
movq -0x30(%rbp), %rdi
callq 0xd13d
testl %r14d, %r14d
je 0x78707
cmpl $0x1, %r14d
jne 0x787d5
movq (%r12), %r15
movq 0x8(%r12), %rbx
movq %r12, %rdi
callq 0x5030
testb %r13b, %r13b
je 0x786da
movq -0x38(%rbp), %rax
decl (%rax)
jne 0x786da
movq -0x30(%rbp), %rdi
leaq 0x98a84(%rip), %rsi     # 0x111159
callq 0xd13d
movq %r15, %rdi
movq %rbx, %rsi
callq 0x791b0
leaq -0x58(%rbp), %rbx
movq %r15, %rdi
movl $0x1, %esi
movq %rbx, %rdx
callq 0x7914f
movq (%rbx), %rdi
leaq -0x50(%rbp), %rsi
callq 0x79201
jmp 0x7874c
callq 0x5040
movslq (%rax), %rbx
movl $0x1, %edi
movl $0x18, %esi
callq 0x50c0
testq %rax, %rax
je 0x78805
movl $0x1, (%rax)
movq %rbx, 0x10(%rax)
movq -0x30(%rbp), %rcx
movq %rcx, 0x8(%rax)
leaq 0x9a489(%rip), %rsi     # 0x112bc9
leaq -0x50(%rbp), %rdx
movq %rax, %rdi
callq 0x79264
movq -0x40(%rbp), %rax
movups -0x50(%rbp), %xmm0
movups %xmm0, (%rax)
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x109dc03(%rip), %rdi   # 0x1116370
testq %rdi, %rdi
jne 0x787bd
movl $0x38, %edi
callq 0xf5e4
movq %rax, %rdi
movq $0x38, 0x10(%rax)
movabsq $0x646574616e696d72, %rax # imm = 0x646574616E696D72
movq %rax, 0x48(%rdi)
movups 0x6f702(%rip), %xmm0    # 0xe7e9e
movups %xmm0, 0x18(%rdi)
movups 0x6f707(%rip), %xmm0    # 0xe7eae
movups %xmm0, 0x28(%rdi)
movups 0x6f70c(%rip), %xmm0    # 0xe7ebe
movups %xmm0, 0x38(%rdi)
movq %rdi, 0x109dbb3(%rip)   # 0x1116370
andq %rdi, %rbx
sete %al
testb $0x3, %dil
setne %cl
orb %al, %cl
jne 0x787d0
incl (%rbx)
callq 0x9302
movl $0x20, %edi
callq 0xf5e4
movq $0x20, 0x10(%rax)
movups 0x67edf(%rip), %xmm0    # 0xe06cd
movups %xmm0, 0x18(%rax)
movups 0x67ee4(%rip), %xmm0    # 0xe06dd
movups %xmm0, 0x28(%rax)
movq %rax, %rdi
callq 0x9302
leaq 0x6f7a6(%rip), %rsi     # 0xe7fb2
movl $0x31, %edx
movl $0x2, %edi
callq 0x5060
callq 0x52b6
movl $0x1, %edi
callq 0x5130