	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function remote_fileio_func_open
_remote_fileio_func_open:               ## @remote_fileio_func_open
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r12
	pushq	%rbx
	subq	$32, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, -56(%rbp)
	leaq	-56(%rbp), %rdi
	leaq	-60(%rbp), %rsi
	leaq	-36(%rbp), %rdx
	callq	_remote_fileio_extract_ptr_w_len
	testq	%rax, %rax
	jne	LBB0_1
## %bb.2:
	leaq	-56(%rbp), %rdi
	leaq	-48(%rbp), %rsi
	callq	_remote_fileio_extract_int
	testq	%rax, %rax
	jne	LBB0_1
## %bb.3:
	movq	-48(%rbp), %rdi
	callq	_remote_fileio_oflags_to_host
	movl	%eax, %r15d
	leaq	-56(%rbp), %rdi
	leaq	-48(%rbp), %rsi
	callq	_remote_fileio_extract_int
	testq	%rax, %rax
	jne	LBB0_1
## %bb.4:
	movq	-48(%rbp), %rdi
	movl	$1, %esi
	callq	_remote_fileio_mode_to_host
	movl	%eax, %r14d
	movl	-36(%rbp), %edi
	callq	_alloca
	movq	%rax, %rbx
	movl	-60(%rbp), %edi
	movl	-36(%rbp), %edx
	movq	%rax, %rsi
	callq	_remote_read_bytes
	cmpl	-36(%rbp), %eax
	jne	LBB0_1
## %bb.5:
	leaq	-40(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_stat
	testl	%eax, %eax
	je	LBB0_6
LBB0_14:
	movq	_remote_fio_no_longjmp@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
	movq	%rbx, %rdi
	movl	%r15d, %esi
	movl	%r14d, %edx
	callq	_open
	testl	%eax, %eax
	js	LBB0_15
## %bb.16:
	movl	%eax, %edi
	callq	_remote_fileio_fd_to_targetfd
	movl	%eax, %edi
	callq	_remote_fileio_return_success
	jmp	LBB0_17
LBB0_1:
	xorl	%eax, %eax
	callq	_remote_fileio_ioerror
LBB0_17:
	addq	$32, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movl	-40(%rbp), %r12d
	movl	%r12d, %edi
	callq	_S_ISREG
	testl	%eax, %eax
	jne	LBB0_10
## %bb.7:
	movl	%r12d, %edi
	callq	_S_ISDIR
	testq	%rax, %rax
	je	LBB0_8
LBB0_10:
	movl	%r12d, %edi
	callq	_S_ISDIR
	testq	%rax, %rax
	je	LBB0_14
## %bb.11:
	movq	_O_WRONLY@GOTPCREL(%rip), %rcx
	movl	%r15d, %eax
	notl	%eax
	testl	%eax, (%rcx)
	je	LBB0_13
## %bb.12:
	movq	_O_RDWR@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	jne	LBB0_14
LBB0_13:
	movq	_FILEIO_EISDIR@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_15:
	movl	$-1, %edi
	callq	_remote_fileio_return_errno
	jmp	LBB0_17
LBB0_8:
	movq	_FILEIO_ENODEV@GOTPCREL(%rip), %rax
LBB0_9:
	movl	(%rax), %esi
	movl	$-1, %edi
	callq	_remote_fileio_reply
	jmp	LBB0_17
	.cfi_endproc
                                        ## -- End function
	.comm	_FILEIO_ENODEV,4,2              ## @FILEIO_ENODEV
	.comm	_O_WRONLY,4,2                   ## @O_WRONLY
	.comm	_O_RDWR,4,2                     ## @O_RDWR
	.comm	_FILEIO_EISDIR,4,2              ## @FILEIO_EISDIR
	.comm	_remote_fio_no_longjmp,4,2      ## @remote_fio_no_longjmp
	.no_dead_strip	_remote_fileio_func_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function remote_fileio_func_open
_remote_fileio_func_open:               ; @remote_fileio_func_open
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	str	x0, [sp, #24]
	add	x0, sp, #24
	add	x1, sp, #20
	add	x2, sp, #16
	bl	_remote_fileio_extract_ptr_w_len
	cbnz	x0, LBB0_7
; %bb.1:
	add	x0, sp, #24
	add	x1, sp, #8
	bl	_remote_fileio_extract_int
	cbnz	x0, LBB0_7
; %bb.2:
	ldr	x0, [sp, #8]
	bl	_remote_fileio_oflags_to_host
	mov	x19, x0
	add	x0, sp, #24
	add	x1, sp, #8
	bl	_remote_fileio_extract_int
	cbnz	x0, LBB0_7
; %bb.3:
	ldr	x0, [sp, #8]
	mov	w1, #1
	bl	_remote_fileio_mode_to_host
	mov	x20, x0
	ldr	w0, [sp, #16]
	bl	_alloca
	mov	x21, x0
	ldp	w2, w0, [sp, #16]
	mov	x1, x21
	bl	_remote_read_bytes
	ldr	w8, [sp, #16]
	cmp	w0, w8
	b.ne	LBB0_7
; %bb.4:
	mov	x1, sp
	mov	x0, x21
	bl	_stat
	cbz	w0, LBB0_9
LBB0_5:
Lloh0:
	adrp	x8, _remote_fio_no_longjmp@GOTPAGE
Lloh1:
	ldr	x8, [x8, _remote_fio_no_longjmp@GOTPAGEOFF]
	mov	w9, #1
Lloh2:
	str	w9, [x8]
	mov	x0, x21
	mov	x1, x19
	mov	x2, x20
	bl	_open
	tbnz	w0, #31, LBB0_15
; %bb.6:
	bl	_remote_fileio_fd_to_targetfd
	bl	_remote_fileio_return_success
	b	LBB0_8
LBB0_7:
	bl	_remote_fileio_ioerror
LBB0_8:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_9:
	ldr	w22, [sp]
	mov	x0, x22
	bl	_S_ISREG
	cbnz	w0, LBB0_11
; %bb.10:
	mov	x0, x22
	bl	_S_ISDIR
	cbz	x0, LBB0_16
LBB0_11:
	mov	x0, x22
	bl	_S_ISDIR
	cbz	x0, LBB0_5
; %bb.12:
Lloh3:
	adrp	x8, _O_WRONLY@GOTPAGE
Lloh4:
	ldr	x8, [x8, _O_WRONLY@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	bics	wzr, w8, w19
	b.eq	LBB0_14
; %bb.13:
Lloh6:
	adrp	x8, _O_RDWR@GOTPAGE
Lloh7:
	ldr	x8, [x8, _O_RDWR@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	bics	wzr, w8, w19
	b.ne	LBB0_5
LBB0_14:
Lloh9:
	adrp	x8, _FILEIO_EISDIR@GOTPAGE
Lloh10:
	ldr	x8, [x8, _FILEIO_EISDIR@GOTPAGEOFF]
	b	LBB0_17
LBB0_15:
	mov	w0, #-1
	bl	_remote_fileio_return_errno
	b	LBB0_8
LBB0_16:
Lloh11:
	adrp	x8, _FILEIO_ENODEV@GOTPAGE
Lloh12:
	ldr	x8, [x8, _FILEIO_ENODEV@GOTPAGEOFF]
LBB0_17:
	ldr	w1, [x8]
	mov	w0, #-1
	bl	_remote_fileio_reply
	b	LBB0_8
	.loh AdrpLdrGotStr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_FILEIO_ENODEV,4,2              ; @FILEIO_ENODEV
	.comm	_O_WRONLY,4,2                   ; @O_WRONLY
	.comm	_O_RDWR,4,2                     ; @O_RDWR
	.comm	_FILEIO_EISDIR,4,2              ; @FILEIO_EISDIR
	.comm	_remote_fio_no_longjmp,4,2      ; @remote_fio_no_longjmp
	.no_dead_strip	_remote_fileio_func_open
.subsections_via_symbols
