	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_agp_allocate_memory            ## -- Begin function agp_allocate_memory
	.p2align	4, 0x90
_agp_allocate_memory:                   ## @agp_allocate_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	testq	%rdi, %rdi
	je	LBB0_19
## %bb.1:
	movq	%rdx, %rbx
	movq	%rsi, %r14
	movq	%rdi, %r15
	addq	$16, %rdi
	callq	_atomic_read
	movslq	%eax, %rcx
	addq	%r14, %rcx
	setb	%al
	movslq	(%r15), %rdx
	xorl	%r12d, %r12d
	cmpq	%rdx, %rcx
	ja	LBB0_20
## %bb.2:
	testb	%al, %al
	jne	LBB0_20
## %bb.3:
	movq	_AGP_USER_TYPES@GOTPCREL(%rip), %rax
	cmpq	%rbx, (%rax)
	jle	LBB0_8
## %bb.4:
	testq	%rbx, %rbx
	je	LBB0_11
## %bb.5:
	movq	8(%r15), %rax
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	*16(%rax)
	testq	%rax, %rax
	jne	LBB0_9
	jmp	LBB0_19
LBB0_8:
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_agp_generic_alloc_user
	testq	%rax, %rax
	je	LBB0_19
LBB0_9:
	movq	%rax, %r12
LBB0_10:
	movq	%r15, (%r12)
	jmp	LBB0_20
LBB0_11:
	movq	_ENTRIES_PER_PAGE@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	leaq	(%r14,%rcx), %rax
	decq	%rax
	movq	%rax, %rdx
	orq	%rcx, %rdx
	shrq	$32, %rdx
	je	LBB0_14
## %bb.12:
	xorl	%edx, %edx
	divq	%rcx
	movq	%rax, %rdi
	jmp	LBB0_15
LBB0_14:
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%ecx
	movl	%eax, %edi
LBB0_15:
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_agp_create_memory
	testq	%rax, %rax
	je	LBB0_19
## %bb.16:
	movq	%rax, %r12
	movq	8(%r15), %rax
	movq	8(%rax), %rcx
	testq	%rcx, %rcx
	je	LBB0_21
## %bb.17:
	movq	%r15, %rdi
	movq	%r12, %rsi
	movq	%r14, %rdx
	callq	*%rcx
	testq	%rax, %rax
	je	LBB0_10
LBB0_18:
	movq	%r12, %rdi
	callq	_agp_free_memory
LBB0_19:
	xorl	%r12d, %r12d
LBB0_20:
	movq	%r12, %rax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_21:
	testq	%r14, %r14
	je	LBB0_10
## %bb.22:
	movq	%r15, %rdi
	callq	*(%rax)
	testq	%rax, %rax
	je	LBB0_18
## %bb.23:
	decq	%r14
	xorl	%ebx, %ebx
LBB0_24:                                ## =>This Inner Loop Header: Depth=1
	movq	16(%r12), %rcx
	movq	%rax, (%rcx,%rbx,8)
	incl	8(%r12)
	cmpq	%rbx, %r14
	je	LBB0_10
## %bb.25:                              ##   in Loop: Header=BB0_24 Depth=1
	movq	8(%r15), %rax
	movq	%r15, %rdi
	callq	*(%rax)
	incq	%rbx
	testq	%rax, %rax
	jne	LBB0_24
	jmp	LBB0_18
	.cfi_endproc
                                        ## -- End function
	.comm	_AGP_USER_TYPES,8,3             ## @AGP_USER_TYPES
	.comm	_ENTRIES_PER_PAGE,8,3           ## @ENTRIES_PER_PAGE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_agp_allocate_memory            ; -- Begin function agp_allocate_memory
	.p2align	2
_agp_allocate_memory:                   ; @agp_allocate_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
	cbz	x0, LBB0_12
; %bb.1:
	mov	x22, x2
	mov	x21, x1
	mov	x19, x0
	add	x0, x0, #16
	bl	_atomic_read
	mov	x20, #0
	adds	x9, x21, w0, sxtw
	cset	w8, hs
	ldrsw	x10, [x19]
	cmp	x9, x10
	b.hi	LBB0_13
; %bb.2:
	tbnz	w8, #0, LBB0_13
; %bb.3:
Lloh0:
	adrp	x8, _AGP_USER_TYPES@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AGP_USER_TYPES@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x8, x22
	b.le	LBB0_6
; %bb.4:
	cbz	x22, LBB0_8
; %bb.5:
	ldr	x8, [x19, #8]
	ldr	x8, [x8, #16]
	mov	x0, x21
	mov	x1, x22
	blr	x8
	mov	x20, x0
	cbnz	x0, LBB0_7
	b	LBB0_13
LBB0_6:
	mov	x0, x21
	mov	x1, x22
	bl	_agp_generic_alloc_user
	mov	x20, x0
	cbz	x0, LBB0_13
LBB0_7:
	str	x19, [x20]
	b	LBB0_13
LBB0_8:
Lloh3:
	adrp	x8, _ENTRIES_PER_PAGE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ENTRIES_PER_PAGE@GOTPAGEOFF]
Lloh5:
	ldr	x8, [x8]
	add	x9, x21, x8
	sub	x9, x9, #1
	udiv	x0, x9, x8
                                        ; kill: def $w0 killed $w0 killed $x0
	bl	_agp_create_memory
	mov	x20, x0
	cbz	x0, LBB0_13
; %bb.9:
	ldr	x8, [x19, #8]
	ldr	x9, [x8, #8]
	cbz	x9, LBB0_14
; %bb.10:
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	blr	x9
	cbz	x0, LBB0_7
LBB0_11:
	mov	x0, x20
	bl	_agp_free_memory
LBB0_12:
	mov	x20, #0
LBB0_13:
	mov	x0, x20
	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
LBB0_14:
	cbz	x21, LBB0_7
; %bb.15:
	ldr	x8, [x8]
	mov	x0, x19
	blr	x8
	cbz	x0, LBB0_11
; %bb.16:
	mov	x22, #0
	sub	x21, x21, #1
LBB0_17:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x20, #16]
	str	x0, [x8, x22, lsl #3]
	ldr	w8, [x20, #8]
	add	w8, w8, #1
	str	w8, [x20, #8]
	cmp	x21, x22
	b.eq	LBB0_7
; %bb.18:                               ;   in Loop: Header=BB0_17 Depth=1
	ldr	x8, [x19, #8]
	ldr	x8, [x8]
	mov	x0, x19
	blr	x8
	add	x22, x22, #1
	cbnz	x0, LBB0_17
	b	LBB0_11
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_AGP_USER_TYPES,8,3             ; @AGP_USER_TYPES
	.comm	_ENTRIES_PER_PAGE,8,3           ; @ENTRIES_PER_PAGE
.subsections_via_symbols
