// File: /workspace/github_c_makefile_star2_O1/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 0x7a4a6
movq -0x38(%rbp), %rax
addl $0x3, (%rax)
movq %r12, %rdi
callq 0xebc3
movq %rax, %r15
movq %r12, %rdi
callq 0xe740
movq %rax, %rdi
callq 0xe7a9
movq %rax, %rdi
callq 0xe818
movzbl (%r15,%rax), %edi
callq 0xe7a9
movl $0x1, %esi
movq %rax, %rdi
callq 0xec04
testl %eax, %eax
jne 0x7a622
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 0xec04
testl %eax, %eax
js 0x7a539
leaq 0x9ab97(%rip), %rsi     # 0x1150b8
leaq -0x50(%rbp), %r15
movq %rbx, %rdi
movq %r15, %rdx
callq 0x7afd9
movl (%r15), %r14d
movq 0x8(%r15), %r12
jmp 0x7a53c
xorl %r12d, %r12d
leaq 0x9ac16(%rip), %rsi     # 0x115159
testb %r13b, %r13b
je 0x7a559
movq -0x38(%rbp), %rax
decl (%rax)
jne 0x7a559
movq -0x30(%rbp), %rdi
callq 0xd4e3
testl %r14d, %r14d
je 0x7a5c3
cmpl $0x1, %r14d
jne 0x7a693
movq (%r12), %r15
movq 0x8(%r12), %rbx
movq %r12, %rdi
callq 0x5030
testb %r13b, %r13b
je 0x7a596
movq -0x38(%rbp), %rax
decl (%rax)
jne 0x7a596
movq -0x30(%rbp), %rdi
leaq 0x9abc8(%rip), %rsi     # 0x115159
callq 0xd4e3
movq %r15, %rdi
movq %rbx, %rsi
callq 0x7b0a2
leaq -0x58(%rbp), %rbx
movq %r15, %rdi
movl $0x1, %esi
movq %rbx, %rdx
callq 0x7b041
movq (%rbx), %rdi
leaq -0x50(%rbp), %rsi
callq 0x7b0f3
jmp 0x7a608
callq 0x5040
movslq (%rax), %rbx
movl $0x1, %edi
movl $0x18, %esi
callq 0x50c0
testq %rax, %rax
je 0x7a6c3
movl $0x1, (%rax)
movq %rbx, 0x10(%rax)
movq -0x30(%rbp), %rcx
movq %rcx, 0x8(%rax)
leaq 0x9c5cd(%rip), %rsi     # 0x116bc9
leaq -0x50(%rbp), %rdx
movq %rax, %rdi
callq 0x7b156
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
cmpq $0x0, 0x109fd46(%rip)   # 0x111a370
jne 0x7a674
movl $0x38, %edi
callq 0xf9f7
movq $0x38, 0x10(%rax)
movabsq $0x646574616e696d72, %rcx # imm = 0x646574616E696D72
movq %rcx, 0x48(%rax)
movups 0x7197c(%rip), %xmm0    # 0xebfcf
movups %xmm0, 0x18(%rax)
movups 0x71981(%rip), %xmm0    # 0xebfdf
movups %xmm0, 0x28(%rax)
movups 0x71986(%rip), %xmm0    # 0xebfef
movups %xmm0, 0x38(%rax)
movq %rax, 0x109fcfc(%rip)   # 0x111a370
movq 0x109fcf5(%rip), %rdi   # 0x111a370
andq %rdi, %rbx
sete %al
testb $0x3, %dil
setne %cl
orb %al, %cl
jne 0x7a68e
incl (%rbx)
callq 0x95a5
movl $0x20, %edi
callq 0xf9f7
movq $0x20, 0x10(%rax)
movups 0x6a0a1(%rip), %xmm0    # 0xe474d
movups %xmm0, 0x18(%rax)
movups 0x6a0a6(%rip), %xmm0    # 0xe475d
movups %xmm0, 0x28(%rax)
movq %rax, %rdi
callq 0x95a5
leaq 0x71a19(%rip), %rsi     # 0xec0e3
movl $0x31, %edx
movl $0x2, %edi
callq 0x5060
callq 0x52be
movl $0x1, %edi
callq 0x5130