	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_agp_generic_insert_memory      ## -- Begin function agp_generic_insert_memory
	.p2align	4, 0x90
_agp_generic_insert_memory:             ## @agp_generic_insert_memory
	.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
                                        ## kill: def $esi killed $esi def $rsi
	movq	24(%rdi), %r15
	testq	%r15, %r15
	je	LBB0_1
## %bb.4:
	movq	%rdi, %r14
	cmpl	$0, (%rdi)
	je	LBB0_25
## %bb.5:
	movl	%edx, %r12d
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	movq	(%r15), %rax
	movl	(%rax), %eax
	xorl	%r13d, %r13d
	addl	$-128, %eax
	movl	$0, %ecx
	cmpl	$4, %eax
	ja	LBB0_12
## %bb.6:
	movq	16(%r15), %rdi
	leaq	LJTI0_0(%rip), %rcx
	movslq	(%rcx,%rax,4), %rax
	addq	%rcx, %rax
	jmpq	*%rax
LBB0_10:
	callq	_A_SIZE_8
	jmp	LBB0_11
LBB0_8:
	callq	_A_SIZE_32
	jmp	LBB0_11
LBB0_7:
	callq	_A_SIZE_16
	jmp	LBB0_11
LBB0_9:
	callq	_A_SIZE_FIX
LBB0_11:
	movl	(%rax), %ecx
LBB0_12:
	movq	_agp_memory_reserved@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rsi
	cltd
	idivl	(%rsi)
	subl	%eax, %ecx
	testl	%ecx, %ecx
	cmovgl	%ecx, %r13d
	cmpl	%r12d, 4(%r14)
	jne	LBB0_1
## %bb.13:
	movq	(%r15), %rax
	movq	%r15, %rdi
	movl	%r12d, %esi
	callq	*8(%rax)
	testl	%eax, %eax
	je	LBB0_14
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
LBB0_2:
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_3
LBB0_14:
	movl	(%r14), %eax
	testl	%eax, %eax
	js	LBB0_1
## %bb.15:
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	addl	%eax, %ecx
	cmpl	%r13d, %ecx
	jg	LBB0_1
## %bb.16:
	testl	%eax, %eax
	je	LBB0_17
## %bb.26:
	movq	-48(%rbp), %r12                 ## 8-byte Reload
	movslq	%r12d, %rbx
	.p2align	4, 0x90
LBB0_28:                                ## =>This Inner Loop Header: Depth=1
	movq	8(%r15), %rdi
	addq	%rbx, %rdi
	callq	_readl
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	_PGE_EMPTY
	testl	%eax, %eax
	je	LBB0_29
## %bb.27:                              ##   in Loop: Header=BB0_28 Depth=1
	incq	%rbx
	movl	(%r14), %eax
	leal	(%rax,%r12), %ecx
	movslq	%ecx, %rcx
	cmpq	%rcx, %rbx
	jl	LBB0_28
	jmp	LBB0_18
LBB0_17:
	xorl	%eax, %eax
	movq	-48(%rbp), %r12                 ## 8-byte Reload
LBB0_18:
	cmpl	$0, 8(%r14)
	jne	LBB0_20
## %bb.19:
	movq	(%r15), %rcx
	xorl	%eax, %eax
	callq	*32(%rcx)
	movl	$1, 8(%r14)
	movl	(%r14), %eax
LBB0_20:
	testl	%eax, %eax
	je	LBB0_24
## %bb.21:
	movslq	%r12d, %r12
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_22:                                ## =>This Inner Loop Header: Depth=1
	movq	(%r15), %rax
	movq	24(%rax), %r13
	movq	16(%r14), %rax
	movl	(%rax,%rbx,4), %edi
	callq	_page_to_phys
	movq	%r15, %rdi
	movl	%eax, %esi
	xorl	%edx, %edx
	callq	*%r13
	leaq	(%r12,%rbx), %rsi
	addq	8(%r15), %rsi
	movl	%eax, %edi
	callq	_writel
	incq	%rbx
	movslq	(%r14), %rax
	cmpq	%rax, %rbx
	jb	LBB0_22
## %bb.23:
	movq	-48(%rbp), %r12                 ## 8-byte Reload
	addl	%ebx, %r12d
LBB0_24:
	movq	8(%r15), %rax
	movslq	%r12d, %rcx
	leaq	(%rcx,%rax), %rdi
	decq	%rdi
	callq	_readl
	movq	(%r15), %rax
	movq	%r14, %rdi
	callq	*16(%rax)
LBB0_25:
	xorl	%eax, %eax
LBB0_3:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_29:
	movq	_EBUSY@GOTPCREL(%rip), %rcx
	jmp	LBB0_2
	.cfi_endproc
	.p2align	2, 0x90
	.data_region jt32
.set L0_0_set_10, LBB0_10-LJTI0_0
.set L0_0_set_8, LBB0_8-LJTI0_0
.set L0_0_set_7, LBB0_7-LJTI0_0
.set L0_0_set_1, LBB0_1-LJTI0_0
.set L0_0_set_9, LBB0_9-LJTI0_0
LJTI0_0:
	.long	L0_0_set_10
	.long	L0_0_set_8
	.long	L0_0_set_7
	.long	L0_0_set_1
	.long	L0_0_set_9
	.end_data_region
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_agp_memory_reserved,4,2        ## @agp_memory_reserved
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_EBUSY,4,2                      ## @EBUSY
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_agp_generic_insert_memory      ; -- Begin function agp_generic_insert_memory
	.p2align	2
_agp_generic_insert_memory:             ; @agp_generic_insert_memory
	.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
	ldr	x20, [x0, #24]
	cbz	x20, LBB0_12
; %bb.1:
	mov	x19, x0
	ldr	w8, [x0]
	cbz	w8, LBB0_27
; %bb.2:
	mov	x22, x2
	mov	x21, x1
	ldr	x8, [x20]
	ldr	w8, [x8]
	sub	w8, w8, #128
	cmp	w8, #4
	b.hi	LBB0_5
; %bb.3:
	ldr	x0, [x20, #16]
Lloh0:
	adrp	x9, lJTI0_0@PAGE
Lloh1:
	add	x9, x9, lJTI0_0@PAGEOFF
	adr	x10, LBB0_4
	ldrb	w11, [x9, x8]
	add	x10, x10, x11, lsl #2
	br	x10
LBB0_4:
	bl	_A_SIZE_8
	b	LBB0_9
LBB0_5:
	mov	w8, #0
	b	LBB0_10
LBB0_6:
	bl	_A_SIZE_32
	b	LBB0_9
LBB0_7:
	bl	_A_SIZE_16
	b	LBB0_9
LBB0_8:
	bl	_A_SIZE_FIX
LBB0_9:
	ldr	w8, [x0]
LBB0_10:
Lloh2:
	adrp	x9, _agp_memory_reserved@GOTPAGE
Lloh3:
	ldr	x9, [x9, _agp_memory_reserved@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
Lloh5:
	adrp	x10, _PAGE_SIZE@GOTPAGE
Lloh6:
	ldr	x10, [x10, _PAGE_SIZE@GOTPAGEOFF]
Lloh7:
	ldr	w10, [x10]
	sdiv	w9, w9, w10
	sub	w8, w8, w9
	cmp	w8, #0
	csel	w23, w8, wzr, gt
	ldr	w8, [x19, #4]
	cmp	w8, w22
	b.ne	LBB0_12
; %bb.11:
	ldr	x8, [x20]
	ldr	x8, [x8, #8]
	mov	x0, x20
	mov	x1, x22
	blr	x8
	cbz	w0, LBB0_14
LBB0_12:
Lloh8:
	adrp	x8, _EINVAL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_13:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_28
LBB0_14:
	ldr	w8, [x19]
	tbnz	w8, #31, LBB0_12
; %bb.15:
	add	w9, w8, w21
	cmp	w9, w23
	b.gt	LBB0_12
; %bb.16:
	cbz	w8, LBB0_20
; %bb.17:
	sxtw	x22, w21
LBB0_18:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x20, #8]
	add	x0, x22, x8
	bl	_readl
	mov	x1, x0
	mov	x0, x20
	bl	_PGE_EMPTY
	cbz	w0, LBB0_29
; %bb.19:                               ;   in Loop: Header=BB0_18 Depth=1
	add	x22, x22, #1
	ldr	w8, [x19]
	add	w9, w8, w21
	cmp	x22, w9, sxtw
	b.lt	LBB0_18
LBB0_20:
	ldr	w9, [x19, #8]
	cbnz	w9, LBB0_22
; %bb.21:
	ldr	x8, [x20]
	ldr	x8, [x8, #32]
	blr	x8
	mov	w8, #1
	str	w8, [x19, #8]
	ldr	w8, [x19]
LBB0_22:
	cbz	w8, LBB0_26
; %bb.23:
	mov	x22, #0
	mov	x8, x21
	sxtw	x23, w8
LBB0_24:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x20]
	ldr	x24, [x8, #24]
	ldr	x8, [x19, #16]
	ldr	w0, [x8, x22, lsl #2]
	bl	_page_to_phys
	mov	x1, x0
	mov	x0, x20
	mov	w2, #0
	blr	x24
	ldr	x8, [x20, #8]
	add	x9, x23, x22
	add	x1, x9, x8
	bl	_writel
	add	x22, x22, #1
	ldrsw	x8, [x19]
	cmp	x22, x8
	b.lo	LBB0_24
; %bb.25:
	add	w21, w21, w22
LBB0_26:
	ldr	x8, [x20, #8]
	add	x8, x8, w21, sxtw
	sub	x0, x8, #1
	bl	_readl
	ldr	x8, [x20]
	ldr	x8, [x8, #16]
	mov	x0, x19
	blr	x8
LBB0_27:
	mov	w0, #0
LBB0_28:
	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
LBB0_29:
Lloh10:
	adrp	x8, _EBUSY@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
	b	LBB0_13
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.cfi_endproc
	.section	__TEXT,__const
lJTI0_0:
	.byte	(LBB0_4-LBB0_4)>>2
	.byte	(LBB0_6-LBB0_4)>>2
	.byte	(LBB0_7-LBB0_4)>>2
	.byte	(LBB0_12-LBB0_4)>>2
	.byte	(LBB0_8-LBB0_4)>>2
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_agp_memory_reserved,4,2        ; @agp_memory_reserved
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_EBUSY,4,2                      ; @EBUSY
.subsections_via_symbols
