	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gvt_pin_guest_page
_gvt_pin_guest_page:                    ## @gvt_pin_guest_page
	.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	%rcx, -72(%rbp)                 ## 8-byte Spill
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r12
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	%rdx, %rdi
	callq	_roundup
	cltd
	idivl	(%rbx)
	testl	%eax, %eax
	jle	LBB0_1
## %bb.2:
	movl	%eax, %r13d
	xorl	%ebx, %ebx
	xorl	%r15d, %r15d
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_8:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	-48(%rbp), %r15
LBB0_9:                                 ##   in Loop: Header=BB0_3 Depth=1
	incq	%rbx
	cmpl	%r13d, %ebx
	jge	LBB0_10
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	addq	%rbx, %rax
	movq	%rax, -64(%rbp)
	movl	(%r12), %edi
	callq	_mdev_dev
	movq	_IOMMU_WRITE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	_IOMMU_READ@GOTPCREL(%rip), %rdx
	orl	(%rdx), %ecx
	movl	%eax, %edi
	leaq	-64(%rbp), %rsi
	movl	$1, %edx
	leaq	-48(%rbp), %r8
	callq	_vfio_pin_pages
	cmpl	$1, %eax
	jne	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	-48(%rbp), %rdi
	callq	_pfn_valid
	testl	%eax, %eax
	je	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_3 Depth=1
	testl	%ebx, %ebx
	je	LBB0_8
## %bb.11:                              ##   in Loop: Header=BB0_3 Depth=1
	leaq	(%r15,%rbx), %rax
	cmpq	-48(%rbp), %rax
	je	LBB0_9
## %bb.12:
	leaq	L_.str.2(%rip), %rdi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_gvt_vgpu_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
	incl	%ebx
	jmp	LBB0_13
LBB0_1:
	xorl	%r15d, %r15d
LBB0_10:
	movq	%r15, %rdi
	callq	_pfn_to_page
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	movq	%rax, (%rcx)
	xorl	%r14d, %r14d
	jmp	LBB0_14
LBB0_4:
	movl	%eax, %r14d
	movq	-64(%rbp), %rsi
	leaq	L_.str(%rip), %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_gvt_vgpu_err
                                        ## kill: def $r14d killed $r14d def $r14
	jmp	LBB0_13
LBB0_6:
	movq	-48(%rbp), %rsi
	leaq	L_.str.1(%rip), %rdi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_gvt_vgpu_err
	incl	%ebx
	movq	_EFAULT@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
LBB0_13:
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	imull	(%rax), %ebx
	movq	%r12, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movl	%ebx, %edx
	callq	_gvt_unpin_guest_page
LBB0_14:
	movl	%r14d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_IOMMU_READ,4,2                 ## @IOMMU_READ
	.comm	_IOMMU_WRITE,4,2                ## @IOMMU_WRITE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"vfio_pin_pages failed for gfn 0x%lx, ret %d\n"

L_.str.1:                               ## @.str.1
	.asciz	"pfn 0x%lx is not mem backed\n"

	.comm	_EFAULT,4,2                     ## @EFAULT
L_.str.2:                               ## @.str.2
	.asciz	"The pages are not continuous\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_gvt_pin_guest_page
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gvt_pin_guest_page
_gvt_pin_guest_page:                    ; @gvt_pin_guest_page
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x21, x3
	mov	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x24, _PAGE_SIZE@GOTPAGE
Lloh1:
	ldr	x24, [x24, _PAGE_SIZE@GOTPAGEOFF]
	ldr	w1, [x24]
	mov	x0, x2
	bl	_roundup
	ldr	w8, [x24]
	sdiv	w26, w0, w8
	cmp	w26, #1
	b.lt	LBB0_9
; %bb.1:
	mov	x25, #0
	mov	x22, #0
Lloh2:
	adrp	x27, _IOMMU_READ@GOTPAGE
Lloh3:
	ldr	x27, [x27, _IOMMU_READ@GOTPAGEOFF]
Lloh4:
	adrp	x28, _IOMMU_WRITE@GOTPAGE
Lloh5:
	ldr	x28, [x28, _IOMMU_WRITE@GOTPAGEOFF]
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
	ldr	x22, [sp, #16]
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	x25, x25, #1
	cmp	w25, w26
	b.ge	LBB0_10
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	add	x8, x19, x25
	str	x8, [sp, #24]
	ldr	w0, [x20]
	bl	_mdev_dev
	ldr	w8, [x27]
	ldr	w9, [x28]
	orr	w3, w9, w8
	add	x1, sp, #24
	add	x4, sp, #16
	mov	w2, #1
	bl	_vfio_pin_pages
	cmp	w0, #1
	b.ne	LBB0_11
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	x0, [sp, #16]
	bl	_pfn_valid
	cbz	w0, LBB0_12
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	cbz	w25, LBB0_2
; %bb.7:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	x8, [sp, #16]
	add	x9, x22, x25
	cmp	x9, x8
	b.eq	LBB0_3
; %bb.8:
Lloh6:
	adrp	x0, l_.str.2@PAGE
Lloh7:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_gvt_vgpu_err
Lloh8:
	adrp	x8, _EINVAL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	neg	w23, w8
	add	w25, w25, #1
	b	LBB0_13
LBB0_9:
	mov	x22, #0
LBB0_10:
	mov	x0, x22
	bl	_pfn_to_page
	mov	w23, #0
	str	x0, [x21]
	b	LBB0_14
LBB0_11:
	mov	x23, x0
	ldr	x8, [sp, #24]
	stp	x8, x23, [sp]
Lloh11:
	adrp	x0, l_.str@PAGE
Lloh12:
	add	x0, x0, l_.str@PAGEOFF
	bl	_gvt_vgpu_err
	b	LBB0_13
LBB0_12:
	ldr	x8, [sp, #16]
	str	x8, [sp]
Lloh13:
	adrp	x0, l_.str.1@PAGE
Lloh14:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_gvt_vgpu_err
	add	w25, w25, #1
Lloh15:
	adrp	x8, _EFAULT@GOTPAGE
Lloh16:
	ldr	x8, [x8, _EFAULT@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_13:
	ldr	w8, [x24]
	mul	w2, w8, w25
	mov	x0, x20
	mov	x1, x19
	bl	_gvt_unpin_guest_page
LBB0_14:
	mov	x0, x23
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_IOMMU_READ,4,2                 ; @IOMMU_READ
	.comm	_IOMMU_WRITE,4,2                ; @IOMMU_WRITE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"vfio_pin_pages failed for gfn 0x%lx, ret %d\n"

l_.str.1:                               ; @.str.1
	.asciz	"pfn 0x%lx is not mem backed\n"

	.comm	_EFAULT,4,2                     ; @EFAULT
l_.str.2:                               ; @.str.2
	.asciz	"The pages are not continuous\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_gvt_pin_guest_page
.subsections_via_symbols
