	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function map_aperture
_map_aperture:                          ## @map_aperture
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	%rdi, %rbx
	callq	_vgpu_aperture_pa_base
	movl	%eax, %r15d
	movq	%rbx, %rdi
	callq	_vgpu_aperture_sz
	movq	%rax, %r12
	movq	(%rbx), %rcx
	movq	_INTEL_GVT_PCI_BAR_APERTURE@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	xorl	%eax, %eax
	cmpl	%r14d, (%rcx,%rdx,4)
	je	LBB0_3
## %bb.1:
	movq	%rbx, %rdi
	callq	_vgpu_cfg_space
	movq	%rbx, %rdi
	callq	_vgpu_cfg_space
	movq	_PCI_BASE_ADDRESS_2@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	(%rax,%rcx,4), %r13d
	movq	%rbx, %rdi
	callq	_vgpu_aperture_offset
	addl	%eax, %r13d
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	sarl	%cl, %r13d
	sarl	%cl, %r15d
	shrq	%cl, %r12
	movq	%rbx, %rdi
	movl	%r13d, %esi
	movl	%r15d, %edx
	movq	%r12, %rcx
	movl	%r14d, %r8d
	callq	_intel_gvt_hypervisor_map_gfn_to_mfn
	testl	%eax, %eax
	jne	LBB0_3
## %bb.2:
	movq	(%rbx), %rax
	movq	_INTEL_GVT_PCI_BAR_APERTURE@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	%r14d, (%rax,%rcx,4)
	xorl	%eax, %eax
LBB0_3:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_INTEL_GVT_PCI_BAR_APERTURE,8,3 ## @INTEL_GVT_PCI_BAR_APERTURE
	.comm	_PCI_BASE_ADDRESS_2,8,3         ## @PCI_BASE_ADDRESS_2
	.comm	_PCI_BASE_ADDRESS_MEM_TYPE_64,4,2 ## @PCI_BASE_ADDRESS_MEM_TYPE_64
	.comm	_PAGE_SHIFT,4,2                 ## @PAGE_SHIFT
	.no_dead_strip	_map_aperture
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function map_aperture
_map_aperture:                          ; @map_aperture
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x19, x1
	mov	x20, x0
	bl	_vgpu_aperture_pa_base
	mov	x21, x0
	mov	x0, x20
	bl	_vgpu_aperture_sz
	ldr	x8, [x20]
Lloh0:
	adrp	x23, _INTEL_GVT_PCI_BAR_APERTURE@GOTPAGE
Lloh1:
	ldr	x23, [x23, _INTEL_GVT_PCI_BAR_APERTURE@GOTPAGEOFF]
	ldr	x9, [x23]
	ldr	w8, [x8, x9, lsl #2]
	cmp	w8, w19
	b.ne	LBB0_2
; %bb.1:
	mov	w0, #0
	b	LBB0_4
LBB0_2:
	mov	x22, x0
	mov	x0, x20
	bl	_vgpu_cfg_space
	mov	x0, x20
	bl	_vgpu_cfg_space
Lloh2:
	adrp	x8, _PCI_BASE_ADDRESS_2@GOTPAGE
Lloh3:
	ldr	x8, [x8, _PCI_BASE_ADDRESS_2@GOTPAGEOFF]
Lloh4:
	ldr	x8, [x8]
	ldr	w24, [x0, x8, lsl #2]
	mov	x0, x20
	bl	_vgpu_aperture_offset
	add	w8, w0, w24
Lloh5:
	adrp	x9, _PAGE_SHIFT@GOTPAGE
Lloh6:
	ldr	x9, [x9, _PAGE_SHIFT@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	asr	w1, w8, w9
	asr	w2, w21, w9
	lsr	x3, x22, x9
	mov	x0, x20
	mov	x4, x19
	bl	_intel_gvt_hypervisor_map_gfn_to_mfn
	cbnz	w0, LBB0_4
; %bb.3:
	ldr	x8, [x20]
	ldr	x9, [x23]
	str	w19, [x8, x9, lsl #2]
LBB0_4:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.comm	_INTEL_GVT_PCI_BAR_APERTURE,8,3 ; @INTEL_GVT_PCI_BAR_APERTURE
	.comm	_PCI_BASE_ADDRESS_2,8,3         ; @PCI_BASE_ADDRESS_2
	.comm	_PCI_BASE_ADDRESS_MEM_TYPE_64,4,2 ; @PCI_BASE_ADDRESS_MEM_TYPE_64
	.comm	_PAGE_SHIFT,4,2                 ; @PAGE_SHIFT
	.no_dead_strip	_map_aperture
.subsections_via_symbols
