	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function alloc_scratch_pages
_alloc_scratch_pages:                   ## @alloc_scratch_pages
	.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, %rbx
	movq	8(%rdi), %rax
	movq	_I915_GTT_PAGE_SIZE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r15d
	movb	8(%rax), %cl
	sarl	%cl, %r15d
	movl	%esi, %r12d
	movq	16(%rax), %r14
	movq	(%rax), %rax
	movq	_GTT_TYPE_PPGTT_PTE_PT@GOTPCREL(%rip), %rcx
	cmpl	%esi, (%rcx)
	seta	%cl
	movq	(%rax), %r13
	movq	_GTT_TYPE_MAX@GOTPCREL(%rip), %rax
	cmpl	%esi, (%rax)
	setbe	%al
	orb	%cl, %al
	movzbl	%al, %edi
	callq	_WARN_ON
	testq	%rax, %rax
	je	LBB0_5
## %bb.1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%ebx, %ebx
LBB0_3:
	subl	(%rax), %ebx
LBB0_4:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movq	%r14, -72(%rbp)                 ## 8-byte Spill
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_get_zeroed_page
	testq	%rax, %rax
	je	LBB0_8
## %bb.6:
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movq	%rax, %rdi
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	callq	_virt_to_page
	movq	_PCI_DMA_BIDIRECTIONAL@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r8d
	xorl	%ebx, %ebx
	movq	%r13, %rdi
	movl	%eax, %esi
	xorl	%edx, %edx
	movl	$4096, %ecx                     ## imm = 0x1000
	callq	_dma_map_page
	movl	%eax, %r14d
	movq	%r13, %rdi
	movl	%eax, %esi
	callq	_dma_mapping_error
	testq	%rax, %rax
	je	LBB0_9
## %bb.7:
	leaq	L_.str.1(%rip), %rdi
	callq	_gvt_vgpu_err
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_virt_to_page
	movl	%eax, %edi
	callq	___free_page
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_8:
	leaq	L_.str(%rip), %rdi
	callq	_gvt_vgpu_err
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_9:
	movq	_I915_GTT_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	sarl	%cl, %r14d
	movslq	%r14d, %rax
	movq	-64(%rbp), %r13                 ## 8-byte Reload
	movq	16(%r13), %rcx
	movl	%r12d, %r14d
	shlq	$4, %r14
	movq	%rax, (%rcx,%r14)
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_virt_to_page
	movq	16(%r13), %rcx
	movl	%eax, 8(%rcx,%r14)
	movl	(%r13), %esi
	movq	(%rcx,%r14), %rcx
	leaq	L_.str.2(%rip), %rdi
	movl	%r12d, %edx
	callq	_gvt_dbg_mm
	movq	_GTT_TYPE_PPGTT_PTE_PT@GOTPCREL(%rip), %rax
	cmpl	%r12d, (%rax)
	jae	LBB0_4
## %bb.10:
	leaq	-48(%rbp), %r14
	movq	%r14, %rdi
	xorl	%esi, %esi
	movl	$8, %edx
	callq	_memset
	leal	-1(%r12), %ebx
	movl	%ebx, %edi
	callq	_get_entry_type
	movl	%eax, -44(%rbp)
	movq	16(%r13), %rax
	shlq	$4, %rbx
	movq	(%rax,%rbx), %rsi
	movq	%r14, %rdi
	movq	-72(%rbp), %r13                 ## 8-byte Reload
	callq	*8(%r13)
	movq	__PAGE_PRESENT@GOTPCREL(%rip), %rcx
	movq	__PAGE_RW@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	(%rcx), %eax
	orl	-48(%rbp), %eax
	movl	%eax, -48(%rbp)
	movq	_GTT_TYPE_PPGTT_PDE_PT@GOTPCREL(%rip), %rcx
	cmpl	%r12d, (%rcx)
	jne	LBB0_12
## %bb.11:
	movq	_PPAT_CACHED@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%eax, -48(%rbp)
LBB0_12:
	testl	%r15d, %r15d
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	jle	LBB0_15
## %bb.13:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	movq	%r12, %rdi
	leaq	-48(%rbp), %rsi
	movl	%ebx, %edx
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	movq	%r14, %r9
	callq	*(%r13)
	incl	%ebx
	cmpl	%ebx, %r15d
	jne	LBB0_14
LBB0_15:
	xorl	%ebx, %ebx
	jmp	LBB0_4
	.cfi_endproc
                                        ## -- End function
	.comm	_I915_GTT_PAGE_SIZE,4,2         ## @I915_GTT_PAGE_SIZE
	.comm	_GTT_TYPE_PPGTT_PTE_PT,4,2      ## @GTT_TYPE_PPGTT_PTE_PT
	.comm	_GTT_TYPE_MAX,4,2               ## @GTT_TYPE_MAX
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"fail to allocate scratch page\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_PCI_DMA_BIDIRECTIONAL,4,2      ## @PCI_DMA_BIDIRECTIONAL
L_.str.1:                               ## @.str.1
	.asciz	"fail to dmamap scratch_pt\n"

	.comm	_I915_GTT_PAGE_SHIFT,4,2        ## @I915_GTT_PAGE_SHIFT
L_.str.2:                               ## @.str.2
	.asciz	"vgpu%d create scratch_pt: type %d mfn=0x%lx\n"

	.comm	__PAGE_PRESENT,4,2              ## @_PAGE_PRESENT
	.comm	__PAGE_RW,4,2                   ## @_PAGE_RW
	.comm	_GTT_TYPE_PPGTT_PDE_PT,4,2      ## @GTT_TYPE_PPGTT_PDE_PT
	.comm	_PPAT_CACHED,4,2                ## @PPAT_CACHED
	.no_dead_strip	_alloc_scratch_pages
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function alloc_scratch_pages
_alloc_scratch_pages:                   ; @alloc_scratch_pages
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x21, x1
	mov	x19, x0
	ldr	x8, [x0, #8]
	ldr	x24, [x8, #16]
Lloh0:
	adrp	x9, _I915_GTT_PAGE_SIZE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _I915_GTT_PAGE_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	w25, [x9]
	ldr	w26, [x8, #8]
	ldr	x8, [x8]
	ldr	x22, [x8]
Lloh3:
	adrp	x27, _GTT_TYPE_PPGTT_PTE_PT@GOTPAGE
Lloh4:
	ldr	x27, [x27, _GTT_TYPE_PPGTT_PTE_PT@GOTPAGEOFF]
	ldr	w8, [x27]
	cmp	w8, w1
Lloh5:
	adrp	x8, _GTT_TYPE_MAX@GOTPAGE
Lloh6:
	ldr	x8, [x8, _GTT_TYPE_MAX@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	ccmp	w8, w1, #0, ls
	cset	w0, ls
	bl	_WARN_ON
	cbz	x0, LBB0_2
; %bb.1:
Lloh8:
	adrp	x8, _EINVAL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_7
LBB0_2:
Lloh10:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh11:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh12:
	ldr	w0, [x8]
	bl	_get_zeroed_page
	cbz	x0, LBB0_5
; %bb.3:
	mov	x20, x0
	bl	_virt_to_page
	mov	x1, x0
Lloh13:
	adrp	x8, _PCI_DMA_BIDIRECTIONAL@GOTPAGE
Lloh14:
	ldr	x8, [x8, _PCI_DMA_BIDIRECTIONAL@GOTPAGEOFF]
Lloh15:
	ldr	w4, [x8]
	mov	x0, x22
	mov	w2, #0
	mov	w3, #4096
	bl	_dma_map_page
	mov	x23, x0
	mov	x0, x22
	mov	x1, x23
	bl	_dma_mapping_error
	cbz	x0, LBB0_9
; %bb.4:
Lloh16:
	adrp	x0, l_.str.1@PAGE
Lloh17:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_gvt_vgpu_err
	mov	x0, x20
	bl	_virt_to_page
	bl	___free_page
	b	LBB0_6
LBB0_5:
Lloh18:
	adrp	x0, l_.str@PAGE
Lloh19:
	add	x0, x0, l_.str@PAGEOFF
	bl	_gvt_vgpu_err
LBB0_6:
Lloh20:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh21:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_7:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_8:
	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
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_9:
Lloh22:
	adrp	x8, _I915_GTT_PAGE_SHIFT@GOTPAGE
Lloh23:
	ldr	x8, [x8, _I915_GTT_PAGE_SHIFT@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	asr	w8, w23, w8
	sxtw	x8, w8
	ldr	x9, [x19, #16]
	mov	w10, w21
	lsl	x22, x10, #4
	str	x8, [x9, x22]
	mov	x0, x20
	bl	_virt_to_page
	ldr	x8, [x19, #16]
	add	x8, x8, x22
	str	w0, [x8, #8]
	ldr	w1, [x19]
	ldr	x3, [x8]
Lloh25:
	adrp	x0, l_.str.2@PAGE
Lloh26:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	x2, x21
	bl	_gvt_dbg_mm
	ldr	w8, [x27]
	cmp	w8, w21
	b.hs	LBB0_15
; %bb.10:
	asr	w23, w25, w26
	add	x0, sp, #8
	mov	w1, #0
	mov	w2, #8
	bl	_memset
	sub	w22, w21, #1
	mov	x0, x22
	bl	_get_entry_type
	str	w0, [sp, #12]
	ldr	x8, [x24, #8]
	ldr	x9, [x19, #16]
	lsl	x10, x22, #4
	ldr	x1, [x9, x10]
	add	x0, sp, #8
	blr	x8
Lloh27:
	adrp	x8, __PAGE_PRESENT@GOTPAGE
Lloh28:
	ldr	x8, [x8, __PAGE_PRESENT@GOTPAGEOFF]
Lloh29:
	ldr	w8, [x8]
Lloh30:
	adrp	x9, __PAGE_RW@GOTPAGE
Lloh31:
	ldr	x9, [x9, __PAGE_RW@GOTPAGEOFF]
Lloh32:
	ldr	w9, [x9]
	orr	w8, w9, w8
	ldr	w9, [sp, #8]
	orr	w8, w8, w9
	str	w8, [sp, #8]
Lloh33:
	adrp	x9, _GTT_TYPE_PPGTT_PDE_PT@GOTPAGE
Lloh34:
	ldr	x9, [x9, _GTT_TYPE_PPGTT_PDE_PT@GOTPAGEOFF]
Lloh35:
	ldr	w9, [x9]
	cmp	w9, w21
	b.ne	LBB0_12
; %bb.11:
Lloh36:
	adrp	x9, _PPAT_CACHED@GOTPAGE
Lloh37:
	ldr	x9, [x9, _PPAT_CACHED@GOTPAGEOFF]
Lloh38:
	ldr	w9, [x9]
	orr	w8, w9, w8
	str	w8, [sp, #8]
LBB0_12:
	cmp	w23, #1
	b.lt	LBB0_15
; %bb.13:
	mov	w21, #0
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x24]
	add	x1, sp, #8
	mov	x0, x20
	mov	x2, x21
	mov	w3, #0
	mov	w4, #0
	mov	x5, x19
	blr	x8
	add	w21, w21, #1
	cmp	w23, w21
	b.ne	LBB0_14
LBB0_15:
	mov	w0, #0
	b	LBB0_8
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.cfi_endproc
                                        ; -- End function
	.comm	_I915_GTT_PAGE_SIZE,4,2         ; @I915_GTT_PAGE_SIZE
	.comm	_GTT_TYPE_PPGTT_PTE_PT,4,2      ; @GTT_TYPE_PPGTT_PTE_PT
	.comm	_GTT_TYPE_MAX,4,2               ; @GTT_TYPE_MAX
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"fail to allocate scratch page\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_PCI_DMA_BIDIRECTIONAL,4,2      ; @PCI_DMA_BIDIRECTIONAL
l_.str.1:                               ; @.str.1
	.asciz	"fail to dmamap scratch_pt\n"

	.comm	_I915_GTT_PAGE_SHIFT,4,2        ; @I915_GTT_PAGE_SHIFT
l_.str.2:                               ; @.str.2
	.asciz	"vgpu%d create scratch_pt: type %d mfn=0x%lx\n"

	.comm	__PAGE_PRESENT,4,2              ; @_PAGE_PRESENT
	.comm	__PAGE_RW,4,2                   ; @_PAGE_RW
	.comm	_GTT_TYPE_PPGTT_PDE_PT,4,2      ; @GTT_TYPE_PPGTT_PDE_PT
	.comm	_PPAT_CACHED,4,2                ; @PPAT_CACHED
	.no_dead_strip	_alloc_scratch_pages
.subsections_via_symbols
