	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_agp_generic_remove_memory      ## -- Begin function agp_generic_remove_memory
	.p2align	4, 0x90
_agp_generic_remove_memory:             ## @agp_generic_remove_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
	movq	8(%rdi), %r14
	testq	%r14, %r14
	je	LBB0_1
## %bb.2:
	movq	%rdi, %r12
	cmpl	$0, (%rdi)
	je	LBB0_12
## %bb.3:
	movl	%edx, %r13d
	cmpl	%edx, 4(%r12)
	jne	LBB0_1
## %bb.4:
	movl	%esi, %r15d
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_agp_num_entries
	movl	(%r12), %ecx
	testl	%ecx, %ecx
	js	LBB0_6
## %bb.5:
	addl	%r15d, %ecx
	cmpl	%eax, %ecx
	jg	LBB0_6
## %bb.7:
	movq	(%r14), %rax
	movq	%r14, %rdi
	movl	%r13d, %esi
	callq	*(%rax)
	testl	%eax, %eax
	je	LBB0_8
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_13
LBB0_6:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_13
LBB0_8:
	movslq	%r15d, %rbx
	movl	(%r12), %eax
	addl	%ebx, %eax
	cmpl	%ebx, %eax
	jbe	LBB0_11
## %bb.9:
	movslq	%r15d, %r15
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movl	16(%r14), %edi
	movq	8(%r14), %rsi
	addq	%rbx, %rsi
	callq	_writel
	incq	%rbx
	movslq	(%r12), %rax
	addq	%r15, %rax
	cmpq	%rax, %rbx
	jb	LBB0_10
LBB0_11:
	movq	8(%r14), %rax
	leaq	(%rbx,%rax), %rdi
	decq	%rdi
	callq	_readl
	movq	(%r14), %rax
	movq	%r12, %rdi
	callq	*8(%rax)
LBB0_12:
	xorl	%ebx, %ebx
LBB0_13:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_agp_generic_remove_memory      ; -- Begin function agp_generic_remove_memory
	.p2align	2
_agp_generic_remove_memory:             ; @agp_generic_remove_memory
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	ldr	x20, [x0, #8]
	cbz	x20, LBB0_6
; %bb.1:
	mov	x19, x0
	ldr	w8, [x0]
	cbz	w8, LBB0_10
; %bb.2:
	mov	x22, x2
	ldr	w8, [x19, #4]
	cmp	w8, w2
	b.ne	LBB0_6
; %bb.3:
	mov	x21, x1
	bl	_agp_num_entries
	ldr	w8, [x19]
	tbnz	w8, #31, LBB0_6
; %bb.4:
	add	w8, w8, w21
	cmp	w8, w0
	b.gt	LBB0_6
; %bb.5:
	ldr	x8, [x20]
	ldr	x8, [x8]
	mov	x0, x20
	mov	x1, x22
	blr	x8
	cbz	w0, LBB0_7
LBB0_6:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_11
LBB0_7:
	sxtw	x22, w21
	ldr	w8, [x19]
	add	w8, w8, w21
	cmp	w8, w21
	b.ls	LBB0_9
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x20, #16]
	ldr	x8, [x20, #8]
	add	x1, x22, x8
	bl	_writel
	add	x22, x22, #1
	ldrsw	x8, [x19]
	add	x8, x8, w21, sxtw
	cmp	x22, x8
	b.lo	LBB0_8
LBB0_9:
	ldr	x8, [x20, #8]
	add	x8, x22, x8
	sub	x0, x8, #1
	bl	_readl
	ldr	x8, [x20]
	ldr	x8, [x8, #8]
	mov	x0, x19
	blr	x8
LBB0_10:
	mov	w0, #0
LBB0_11:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
.subsections_via_symbols
