	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_memrw                          ## -- Begin function memrw
	.p2align	4, 0x90
_memrw:                                 ## @memrw
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	xorl	%r14d, %r14d
	cmpq	$0, (%rsi)
	jle	LBB0_30
## %bb.1:
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movq	_CDEV_MINOR_MEM@GOTPCREL(%rip), %r12
	movq	_CDEV_MINOR_KMEM@GOTPCREL(%rip), %r14
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_2:                                 ##   in Loop: Header=BB0_4 Depth=1
	addq	$16, %r13
	movq	%r13, 32(%r15)
	movq	8(%r15), %rax
	leaq	-1(%rax), %rcx
	movq	%rcx, 8(%r15)
	testq	%rax, %rax
	jle	LBB0_7
LBB0_3:                                 ##   in Loop: Header=BB0_4 Depth=1
	cmpq	$0, (%r15)
	jle	LBB0_8
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movq	32(%r15), %r13
	cmpq	$0, (%r13)
	je	LBB0_2
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	%rbx, %rdi
	callq	_dev2unit
	cmpq	(%r12), %rax
	je	LBB0_9
## %bb.6:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	%rbx, %rdi
	callq	_dev2unit
	cmpq	(%r14), %rax
	jne	LBB0_3
	jmp	LBB0_18
LBB0_7:                                 ##   in Loop: Header=BB0_4 Depth=1
	leaq	L_.str(%rip), %rdi
	callq	_panic
	jmp	LBB0_3
LBB0_8:
	xorl	%r14d, %r14d
	jmp	LBB0_30
LBB0_9:
	movq	_PAGE_MASK@GOTPCREL(%rip), %rbx
	movq	(%rbx), %r12
	notq	%r12
	andq	16(%r15), %r12
	movq	%r12, %rdi
	callq	_is_physical_memory
	testl	%eax, %eax
	je	LBB0_28
## %bb.10:
	movq	(%rbx), %rax
	movq	16(%r15), %r14
	andq	%rax, %r14
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rsi
	andq	8(%r13), %rax
	movq	%rsi, %rdi
	subq	%rax, %rdi
	subq	%r14, %rsi
	callq	_ulmin
	movq	(%r13), %rsi
	movq	%rax, %rdi
	callq	_ulmin
	movq	%rax, %r13
	movq	%r12, %rdi
	callq	_vm_phys_paddr_to_vm_page
	movq	%rax, -56(%rbp)
	testq	%rax, %rax
	je	LBB0_25
## %bb.11:
	movq	%rax, %rbx
	movq	_dcache_color_ignore@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	movl	$1, %r12d
	jne	LBB0_13
## %bb.12:
	movq	_DCACHE_COLORS@GOTPCREL(%rip), %rax
	movq	(%rax), %r12
LBB0_13:
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	imulq	%r12, %rdi
	callq	_kva_alloc
	testq	%rax, %rax
	je	LBB0_33
## %bb.14:
	movq	%r13, -48(%rbp)                 ## 8-byte Spill
	movq	%rax, %r13
	cmpq	$1, %r12
	je	LBB0_17
## %bb.15:
	movslq	(%rbx), %rdx
	movq	%rax, %r13
	cmpq	$-1, %rdx
	je	LBB0_17
## %bb.16:
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rcx
	imulq	(%rcx), %rdx
	addq	%rax, %rdx
	movq	%rdx, %r13
LBB0_17:
	leaq	-56(%rbp), %rsi
	movq	%rax, %rbx
	movq	%r13, %rdi
	movl	$1, %edx
	callq	_pmap_qenter
	addq	%r13, %r14
	movq	%r14, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	movq	%r15, %rdx
	callq	_uiomove
	movl	%eax, %r14d
	movq	%r13, %rdi
	movl	$1, %esi
	callq	_pmap_qremove
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	imulq	(%rax), %r12
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_kva_free
	jmp	LBB0_30
LBB0_18:
	movq	16(%r15), %rdi
	callq	_trunc_page
	movq	%rax, %rbx
	movq	(%r13), %rdi
	addq	16(%r15), %rdi
	callq	_round_page
	cmpq	%rax, %rbx
	jge	LBB0_22
## %bb.19:
	movq	%rax, %r14
	movq	_PAGE_SIZE@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_20:                                ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	callq	_pmap_kextract
	testq	%rax, %rax
	je	LBB0_28
## %bb.21:                              ##   in Loop: Header=BB0_20 Depth=1
	addq	(%r12), %rbx
	cmpq	%r14, %rbx
	jl	LBB0_20
LBB0_22:
	movq	16(%r15), %rbx
	movq	_VM_MIN_DIRECT_ADDRESS@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rbx
	jge	LBB0_31
## %bb.23:
	movq	24(%r15), %rax
	movq	_UIO_READ@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_26
## %bb.24:
	movq	_VM_PROT_READ@GOTPCREL(%rip), %rax
	jmp	LBB0_27
LBB0_25:
	movq	%r12, %rdi
	callq	_TLB_PHYS_TO_DIRECT
	addq	%rax, %r14
	movq	%r14, %rdi
	movq	%r13, %rsi
	jmp	LBB0_32
LBB0_26:
	movq	_VM_PROT_WRITE@GOTPCREL(%rip), %rax
LBB0_27:
	movl	(%rax), %edx
	movq	(%r13), %rsi
	movq	%rbx, %rdi
	callq	_kernacc
	movq	_FALSE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_31
LBB0_28:
	movq	_EFAULT@GOTPCREL(%rip), %rax
LBB0_29:
	movl	(%rax), %r14d
LBB0_30:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_31:
	movq	(%r13), %rsi
	movq	%rbx, %rdi
LBB0_32:
	movq	%r15, %rdx
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_uiomove                        ## TAILCALL
LBB0_33:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_29
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"memrw"

	.comm	_CDEV_MINOR_MEM,8,3             ## @CDEV_MINOR_MEM
	.comm	_PAGE_MASK,8,3                  ## @PAGE_MASK
	.comm	_EFAULT,4,2                     ## @EFAULT
	.comm	_PAGE_SIZE,8,3                  ## @PAGE_SIZE
	.comm	_dcache_color_ignore,8,3        ## @dcache_color_ignore
	.comm	_DCACHE_COLORS,8,3              ## @DCACHE_COLORS
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_CDEV_MINOR_KMEM,8,3            ## @CDEV_MINOR_KMEM
	.comm	_UIO_READ,8,3                   ## @UIO_READ
	.comm	_VM_PROT_READ,4,2               ## @VM_PROT_READ
	.comm	_VM_PROT_WRITE,4,2              ## @VM_PROT_WRITE
	.comm	_VM_MIN_DIRECT_ADDRESS,8,3      ## @VM_MIN_DIRECT_ADDRESS
	.comm	_FALSE,8,3                      ## @FALSE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_memrw                          ; -- Begin function memrw
	.p2align	2
_memrw:                                 ; @memrw
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	ldr	x8, [x1]
	cmp	x8, #1
	b.lt	LBB0_8
; %bb.1:
	mov	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x21, l_.str@PAGE
Lloh1:
	add	x21, x21, l_.str@PAGEOFF
Lloh2:
	adrp	x23, _CDEV_MINOR_MEM@GOTPAGE
Lloh3:
	ldr	x23, [x23, _CDEV_MINOR_MEM@GOTPAGEOFF]
Lloh4:
	adrp	x24, _CDEV_MINOR_KMEM@GOTPAGE
Lloh5:
	ldr	x24, [x24, _CDEV_MINOR_KMEM@GOTPAGEOFF]
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	x8, x22, #16
	str	x8, [x19, #32]
	ldr	x8, [x19, #8]
	sub	x9, x8, #1
	str	x9, [x19, #8]
	cmp	x8, #0
	b.le	LBB0_7
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	ldr	x8, [x19]
	cmp	x8, #0
	b.le	LBB0_8
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x22, [x19, #32]
	ldr	x8, [x22]
	cbz	x8, LBB0_2
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x20
	bl	_dev2unit
	ldr	x8, [x23]
	cmp	x0, x8
	b.eq	LBB0_9
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x20
	bl	_dev2unit
	ldr	x8, [x24]
	cmp	x0, x8
	b.ne	LBB0_3
	b	LBB0_16
LBB0_7:                                 ;   in Loop: Header=BB0_4 Depth=1
	mov	x0, x21
	bl	_panic
	b	LBB0_3
LBB0_8:
	mov	w19, #0
	b	LBB0_24
LBB0_9:
	ldr	x8, [x19, #16]
Lloh6:
	adrp	x20, _PAGE_MASK@GOTPAGE
Lloh7:
	ldr	x20, [x20, _PAGE_MASK@GOTPAGEOFF]
	ldr	x9, [x20]
	bic	x21, x8, x9
	mov	x0, x21
	bl	_is_physical_memory
	cbz	w0, LBB0_22
; %bb.10:
	ldr	x8, [x19, #16]
	ldr	x9, [x20]
Lloh8:
	adrp	x24, _PAGE_SIZE@GOTPAGE
Lloh9:
	ldr	x24, [x24, _PAGE_SIZE@GOTPAGEOFF]
	and	x25, x9, x8
	ldr	x8, [x24]
	ldr	x10, [x22, #8]
	and	x9, x10, x9
	sub	x0, x8, x9
	sub	x1, x8, x25
	bl	_ulmin
	ldr	x1, [x22]
	bl	_ulmin
	mov	x20, x0
	mov	x0, x21
	bl	_vm_phys_paddr_to_vm_page
	str	x0, [sp, #8]
	cbz	x0, LBB0_26
; %bb.11:
	mov	x23, x0
Lloh10:
	adrp	x8, _dcache_color_ignore@GOTPAGE
Lloh11:
	ldr	x8, [x8, _dcache_color_ignore@GOTPAGEOFF]
Lloh12:
	adrp	x9, _DCACHE_COLORS@GOTPAGE
Lloh13:
	ldr	x9, [x9, _DCACHE_COLORS@GOTPAGEOFF]
Lloh14:
	ldr	x8, [x8]
Lloh15:
	ldr	x9, [x9]
	cmp	x8, #0
	csinc	x26, x9, xzr, eq
	ldr	x8, [x24]
	mul	x0, x8, x26
	bl	_kva_alloc
	cbz	x0, LBB0_28
; %bb.12:
	mov	x21, x0
	mov	x22, x0
	cmp	x26, #1
	b.eq	LBB0_15
; %bb.13:
	ldrsw	x8, [x23]
	mov	x22, x21
	cmn	w8, #1
	b.eq	LBB0_15
; %bb.14:
	ldr	x9, [x24]
	madd	x22, x9, x8, x21
LBB0_15:
	add	x1, sp, #8
	mov	x0, x22
	mov	w2, #1
	bl	_pmap_qenter
	add	x0, x22, x25
	mov	x1, x20
	mov	x2, x19
	bl	_uiomove
	mov	x19, x0
	mov	x0, x22
	mov	w1, #1
	bl	_pmap_qremove
	ldr	x8, [x24]
	mul	x1, x8, x26
	mov	x0, x21
	bl	_kva_free
	b	LBB0_24
LBB0_16:
	ldr	x0, [x19, #16]
	bl	_trunc_page
	mov	x20, x0
	ldr	x8, [x19, #16]
	ldr	x9, [x22]
	add	x0, x9, x8
	bl	_round_page
	cmp	x20, x0
	b.ge	LBB0_20
; %bb.17:
	mov	x21, x0
Lloh16:
	adrp	x23, _PAGE_SIZE@GOTPAGE
Lloh17:
	ldr	x23, [x23, _PAGE_SIZE@GOTPAGEOFF]
LBB0_18:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	bl	_pmap_kextract
	cbz	x0, LBB0_22
; %bb.19:                               ;   in Loop: Header=BB0_18 Depth=1
	ldr	x8, [x23]
	add	x20, x8, x20
	cmp	x20, x21
	b.lt	LBB0_18
LBB0_20:
	ldr	x20, [x19, #16]
Lloh18:
	adrp	x8, _VM_MIN_DIRECT_ADDRESS@GOTPAGE
Lloh19:
	ldr	x8, [x8, _VM_MIN_DIRECT_ADDRESS@GOTPAGEOFF]
Lloh20:
	ldr	x8, [x8]
	cmp	x20, x8
	b.ge	LBB0_25
; %bb.21:
	ldr	x8, [x19, #24]
Lloh21:
	adrp	x9, _UIO_READ@GOTPAGE
Lloh22:
	ldr	x9, [x9, _UIO_READ@GOTPAGEOFF]
Lloh23:
	ldr	x9, [x9]
Lloh24:
	adrp	x10, _VM_PROT_READ@GOTPAGE
Lloh25:
	ldr	x10, [x10, _VM_PROT_READ@GOTPAGEOFF]
Lloh26:
	adrp	x11, _VM_PROT_WRITE@GOTPAGE
Lloh27:
	ldr	x11, [x11, _VM_PROT_WRITE@GOTPAGEOFF]
	cmp	x8, x9
	csel	x8, x10, x11, eq
	ldr	w2, [x8]
	ldr	x1, [x22]
	mov	x0, x20
	bl	_kernacc
Lloh28:
	adrp	x8, _FALSE@GOTPAGE
Lloh29:
	ldr	x8, [x8, _FALSE@GOTPAGEOFF]
Lloh30:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_25
LBB0_22:
Lloh31:
	adrp	x8, _EFAULT@GOTPAGE
Lloh32:
	ldr	x8, [x8, _EFAULT@GOTPAGEOFF]
LBB0_23:
	ldr	w19, [x8]
LBB0_24:
	mov	x0, x19
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_25:
	ldr	x1, [x22]
	mov	x0, x20
	b	LBB0_27
LBB0_26:
	mov	x0, x21
	bl	_TLB_PHYS_TO_DIRECT
	add	x0, x0, x25
	mov	x1, x20
LBB0_27:
	mov	x2, x19
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	b	_uiomove
LBB0_28:
Lloh33:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh34:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_23
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh14
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh33, Lloh34
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"memrw"

	.comm	_CDEV_MINOR_MEM,8,3             ; @CDEV_MINOR_MEM
	.comm	_PAGE_MASK,8,3                  ; @PAGE_MASK
	.comm	_EFAULT,4,2                     ; @EFAULT
	.comm	_PAGE_SIZE,8,3                  ; @PAGE_SIZE
	.comm	_dcache_color_ignore,8,3        ; @dcache_color_ignore
	.comm	_DCACHE_COLORS,8,3              ; @DCACHE_COLORS
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_CDEV_MINOR_KMEM,8,3            ; @CDEV_MINOR_KMEM
	.comm	_UIO_READ,8,3                   ; @UIO_READ
	.comm	_VM_PROT_READ,4,2               ; @VM_PROT_READ
	.comm	_VM_PROT_WRITE,4,2              ; @VM_PROT_WRITE
	.comm	_VM_MIN_DIRECT_ADDRESS,8,3      ; @VM_MIN_DIRECT_ADDRESS
	.comm	_FALSE,8,3                      ; @FALSE
.subsections_via_symbols
