	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function remote_fileio_func_read
_remote_fileio_func_read:               ## @remote_fileio_func_read
	.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	%r13
	pushq	%r12
	pushq	%rbx
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, -56(%rbp)
	leaq	-56(%rbp), %rdi
	leaq	-80(%rbp), %rsi
	callq	_remote_fileio_extract_int
	testq	%rax, %rax
	je	LBB0_2
LBB0_1:
	xorl	%eax, %eax
	callq	_remote_fileio_ioerror
LBB0_25:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movl	-80(%rbp), %edi
	callq	_remote_fileio_map_fd
	movl	%eax, %ebx
	movq	_FIO_FD_INVALID@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ebx
	jne	LBB0_4
LBB0_3:
	xorl	%eax, %eax
	callq	_remote_fileio_badfd
	jmp	LBB0_25
LBB0_4:
	leaq	-56(%rbp), %rdi
	leaq	-64(%rbp), %rsi
	callq	_remote_fileio_extract_long
	testq	%rax, %rax
	jne	LBB0_1
## %bb.5:
	movq	-64(%rbp), %r15
	leaq	-56(%rbp), %rdi
	leaq	-72(%rbp), %rsi
	callq	_remote_fileio_extract_int
	testq	%rax, %rax
	jne	LBB0_1
## %bb.6:
	movq	-72(%rbp), %r12
	cmpl	$129, %ebx
	je	LBB0_10
## %bb.7:
	cmpl	$128, %ebx
	je	LBB0_3
## %bb.8:
	movq	%r12, %rdi
	callq	_xmalloc
	movq	%rax, %r13
	movq	_SEEK_CUR@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	%ebx, %edi
	xorl	%esi, %esi
	callq	_lseek
	movl	%eax, %r14d
	movq	_remote_fio_no_longjmp@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
	movl	%ebx, %edi
	movq	%r13, -48(%rbp)                 ## 8-byte Spill
	movq	%r13, %rsi
	movq	%r12, %rdx
	callq	_read
	testl	%eax, %eax
	js	LBB0_17
## %bb.9:
	movl	%eax, %r13d
	jmp	LBB0_19
LBB0_10:
	movl	$32768, %edi                    ## imm = 0x8000
	callq	_xmalloc
	movq	%rax, %rbx
	movq	_remote_fileio_func_read.remaining_buf(%rip), %rsi
	testq	%rsi, %rsi
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	je	LBB0_14
## %bb.11:
	movq	_remote_fio_no_longjmp@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
	movslq	_remote_fileio_func_read.remaining_length(%rip), %rdx
	movq	%rbx, %rdi
	cmpq	%rdx, %r12
	jae	LBB0_13
## %bb.12:
	movl	%r12d, %edx
	callq	_memcpy
	movq	_remote_fileio_func_read.remaining_buf(%rip), %rdi
	movq	%r12, %rsi
	addq	%rdi, %rsi
	movl	_remote_fileio_func_read.remaining_length(%rip), %edx
	subl	%r12d, %edx
	callq	_memmove
	subl	%r12d, _remote_fileio_func_read.remaining_length(%rip)
	movl	%r12d, %r13d
	jmp	LBB0_19
LBB0_17:
	movq	_SEEK_CUR@GOTPCREL(%rip), %rdx
	movq	_errno@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_EINTR@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_23
## %bb.18:
	movl	(%rdx), %edx
	movl	%ebx, %edi
	xorl	%esi, %esi
	callq	_lseek
	movl	%eax, %r13d
	subl	%r14d, %r13d
	jne	LBB0_19
	jmp	LBB0_23
LBB0_14:
	movq	_gdb_stdtargin@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	%rbx, %rsi
	movl	$32767, %edx                    ## imm = 0x7FFF
	callq	_ui_file_read
	movl	%eax, %r13d
	movq	_remote_fio_no_longjmp@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
	testl	%r13d, %r13d
	jle	LBB0_22
## %bb.15:
	movl	%r13d, %ebx
	cmpq	%rbx, %r12
	jae	LBB0_20
## %bb.16:
	subq	%r12, %rbx
	movq	%rbx, %rdi
	callq	_xmalloc
	movq	%rax, _remote_fileio_func_read.remaining_buf(%rip)
	movl	%ebx, _remote_fileio_func_read.remaining_length(%rip)
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	addq	%r12, %rsi
	movq	%rax, %rdi
	movl	%ebx, %edx
	callq	_memcpy
	movl	%r12d, %r13d
	jmp	LBB0_19
LBB0_13:
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_memcpy
	movq	_remote_fileio_func_read.remaining_buf(%rip), %rdi
	callq	_xfree
	movq	$0, _remote_fileio_func_read.remaining_buf(%rip)
	movl	_remote_fileio_func_read.remaining_length(%rip), %r13d
LBB0_19:
	testl	%r13d, %r13d
	jle	LBB0_22
LBB0_20:
	movq	%r15, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	movl	%r13d, %edx
	callq	_remote_fileio_write_bytes
	cmpl	%r13d, %eax
	je	LBB0_21
LBB0_23:
	movl	$-1, %edi
	callq	_remote_fileio_return_errno
	jmp	LBB0_24
LBB0_22:
	testl	%r13d, %r13d
	movl	$0, %r13d
	js	LBB0_23
LBB0_21:
	movl	%r13d, %edi
	callq	_remote_fileio_return_success
LBB0_24:
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_xfree
	jmp	LBB0_25
	.cfi_endproc
                                        ## -- End function
	.comm	_FIO_FD_INVALID,4,2             ## @FIO_FD_INVALID
.zerofill __DATA,__bss,_remote_fileio_func_read.remaining_buf,8,3 ## @remote_fileio_func_read.remaining_buf
.zerofill __DATA,__bss,_remote_fileio_func_read.remaining_length,4,2 ## @remote_fileio_func_read.remaining_length
	.comm	_remote_fio_no_longjmp,4,2      ## @remote_fio_no_longjmp
	.comm	_gdb_stdtargin,4,2              ## @gdb_stdtargin
	.comm	_SEEK_CUR,4,2                   ## @SEEK_CUR
	.comm	_errno,4,2                      ## @errno
	.comm	_EINTR,4,2                      ## @EINTR
	.no_dead_strip	_remote_fileio_func_read
.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_read
_remote_fileio_func_read:               ; @remote_fileio_func_read
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	str	x0, [sp, #24]
	add	x0, sp, #24
	add	x1, sp, #16
	bl	_remote_fileio_extract_int
	cbz	x0, LBB0_3
LBB0_1:
	bl	_remote_fileio_ioerror
LBB0_2:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_3:
	ldr	w0, [sp, #16]
	bl	_remote_fileio_map_fd
Lloh0:
	adrp	x8, _FIO_FD_INVALID@GOTPAGE
Lloh1:
	ldr	x8, [x8, _FIO_FD_INVALID@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w0, w8
	b.ne	LBB0_5
LBB0_4:
	bl	_remote_fileio_badfd
	b	LBB0_2
LBB0_5:
	mov	x22, x0
	add	x0, sp, #24
	mov	x1, sp
	bl	_remote_fileio_extract_long
	cbnz	x0, LBB0_1
; %bb.6:
	ldr	x20, [sp]
	add	x0, sp, #24
	add	x1, sp, #8
	bl	_remote_fileio_extract_int
	cbnz	x0, LBB0_1
; %bb.7:
	ldr	x21, [sp, #8]
	cmp	w22, #129
	b.eq	LBB0_11
; %bb.8:
	cmp	w22, #128
	b.eq	LBB0_4
; %bb.9:
	mov	x0, x21
	bl	_xmalloc
	mov	x19, x0
Lloh3:
	adrp	x25, _SEEK_CUR@GOTPAGE
Lloh4:
	ldr	x25, [x25, _SEEK_CUR@GOTPAGEOFF]
	ldr	w2, [x25]
	mov	x0, x22
	mov	w1, #0
	bl	_lseek
	mov	x24, x0
Lloh5:
	adrp	x8, _remote_fio_no_longjmp@GOTPAGE
Lloh6:
	ldr	x8, [x8, _remote_fio_no_longjmp@GOTPAGEOFF]
	mov	w9, #1
Lloh7:
	str	w9, [x8]
	mov	x0, x22
	mov	x1, x19
	mov	x2, x21
	bl	_read
	tbnz	w0, #31, LBB0_14
; %bb.10:
	mov	x23, x0
	b	LBB0_20
LBB0_11:
	mov	w0, #32768
	bl	_xmalloc
	mov	x19, x0
	adrp	x24, _remote_fileio_func_read.remaining_buf@PAGE
	ldr	x1, [x24, _remote_fileio_func_read.remaining_buf@PAGEOFF]
	cbz	x1, LBB0_16
; %bb.12:
Lloh8:
	adrp	x8, _remote_fio_no_longjmp@GOTPAGE
Lloh9:
	ldr	x8, [x8, _remote_fio_no_longjmp@GOTPAGEOFF]
	mov	w9, #1
Lloh10:
	str	w9, [x8]
	adrp	x22, _remote_fileio_func_read.remaining_length@PAGE
	ldrsw	x2, [x22, _remote_fileio_func_read.remaining_length@PAGEOFF]
	mov	x0, x19
	cmp	x21, x2
	b.hs	LBB0_19
; %bb.13:
	mov	x2, x21
	bl	_memcpy
	ldr	x0, [x24, _remote_fileio_func_read.remaining_buf@PAGEOFF]
	add	x1, x0, x21
	ldr	w8, [x22, _remote_fileio_func_read.remaining_length@PAGEOFF]
	sub	w2, w8, w21
	bl	_memmove
	ldr	w8, [x22, _remote_fileio_func_read.remaining_length@PAGEOFF]
	sub	w8, w8, w21
	str	w8, [x22, _remote_fileio_func_read.remaining_length@PAGEOFF]
	mov	x23, x21
	b	LBB0_20
LBB0_14:
Lloh11:
	adrp	x8, _errno@GOTPAGE
Lloh12:
	ldr	x8, [x8, _errno@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
Lloh14:
	adrp	x9, _EINTR@GOTPAGE
Lloh15:
	ldr	x9, [x9, _EINTR@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ne	LBB0_25
; %bb.15:
	ldr	w2, [x25]
	mov	x0, x22
	mov	w1, #0
	bl	_lseek
	subs	w23, w0, w24
	b.ne	LBB0_20
	b	LBB0_25
LBB0_16:
Lloh17:
	adrp	x8, _gdb_stdtargin@GOTPAGE
Lloh18:
	ldr	x8, [x8, _gdb_stdtargin@GOTPAGEOFF]
Lloh19:
	ldr	w0, [x8]
	mov	x1, x19
	mov	w2, #32767
	bl	_ui_file_read
	mov	x23, x0
Lloh20:
	adrp	x8, _remote_fio_no_longjmp@GOTPAGE
Lloh21:
	ldr	x8, [x8, _remote_fio_no_longjmp@GOTPAGEOFF]
	mov	w9, #1
Lloh22:
	str	w9, [x8]
	cmp	w0, #1
	b.lt	LBB0_22
; %bb.17:
	mov	w8, w23
	cmp	x21, x8
	b.hs	LBB0_21
; %bb.18:
	sub	x22, x8, x21
	mov	x0, x22
	bl	_xmalloc
	str	x0, [x24, _remote_fileio_func_read.remaining_buf@PAGEOFF]
	adrp	x8, _remote_fileio_func_read.remaining_length@PAGE
	str	w22, [x8, _remote_fileio_func_read.remaining_length@PAGEOFF]
	add	x1, x19, x21
	mov	x2, x22
	bl	_memcpy
	mov	x23, x21
	b	LBB0_20
LBB0_19:
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_memcpy
	ldr	x0, [x24, _remote_fileio_func_read.remaining_buf@PAGEOFF]
	bl	_xfree
	str	xzr, [x24, _remote_fileio_func_read.remaining_buf@PAGEOFF]
	ldr	w23, [x22, _remote_fileio_func_read.remaining_length@PAGEOFF]
LBB0_20:
	cmp	w23, #1
	b.lt	LBB0_22
LBB0_21:
	mov	x0, x20
	mov	x1, x19
	mov	x2, x23
	bl	_remote_fileio_write_bytes
	cmp	w0, w23
	b.eq	LBB0_24
	b	LBB0_25
LBB0_22:
	tbnz	w23, #31, LBB0_25
; %bb.23:
	mov	w23, #0
LBB0_24:
	mov	x0, x23
	bl	_remote_fileio_return_success
	b	LBB0_26
LBB0_25:
	mov	w0, #-1
	bl	_remote_fileio_return_errno
LBB0_26:
	mov	x0, x19
	bl	_xfree
	b	LBB0_2
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotStr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotStr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotStr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_FIO_FD_INVALID,4,2             ; @FIO_FD_INVALID
.zerofill __DATA,__bss,_remote_fileio_func_read.remaining_buf,8,3 ; @remote_fileio_func_read.remaining_buf
.zerofill __DATA,__bss,_remote_fileio_func_read.remaining_length,4,2 ; @remote_fileio_func_read.remaining_length
	.comm	_remote_fio_no_longjmp,4,2      ; @remote_fio_no_longjmp
	.comm	_gdb_stdtargin,4,2              ; @gdb_stdtargin
	.comm	_SEEK_CUR,4,2                   ; @SEEK_CUR
	.comm	_errno,4,2                      ; @errno
	.comm	_EINTR,4,2                      ; @EINTR
	.no_dead_strip	_remote_fileio_func_read
.subsections_via_symbols
