	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function via_alloc_desc_pages
_via_alloc_desc_pages:                  ## @via_alloc_desc_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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	sarl	$2, %ecx
	movl	%ecx, (%rdi)
	movl	8(%rdi), %eax
	addl	%ecx, %eax
	decl	%eax
	cltd
	idivl	%ecx
	movl	%eax, 4(%rdi)
	movq	_GFP_KERNEL@GOTPCREL(%rip), %r14
	movl	(%r14), %edx
	movl	%eax, %edi
	movl	$8, %esi
	callq	_kcalloc
	movq	%rax, 16(%r15)
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	_dr_via_desc_pages_alloc@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 24(%r15)
	movl	4(%r15), %esi
	testl	%esi, %esi
	jle	LBB0_6
## %bb.3:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r14), %edi
	callq	___get_free_page
	movq	16(%r15), %rcx
	movq	%rax, (%rcx,%rbx,8)
	testq	%rax, %rax
	je	LBB0_1
## %bb.4:                               ##   in Loop: Header=BB0_5 Depth=1
	incq	%rbx
	movslq	4(%r15), %rsi
	cmpq	%rsi, %rbx
	jl	LBB0_5
LBB0_6:
	movl	8(%r15), %edx
	leaq	L_.str(%rip), %rdi
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_DRM_DEBUG
	xorl	%eax, %eax
	jmp	LBB0_7
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_7:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_dr_via_desc_pages_alloc,4,2    ## @dr_via_desc_pages_alloc
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Allocated %d pages for %d descriptors.\n"

	.no_dead_strip	_via_alloc_desc_pages
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function via_alloc_desc_pages
_via_alloc_desc_pages:                  ; @via_alloc_desc_pages
	.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
	mov	x19, x0
Lloh0:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	asr	w8, w8, #2
	ldr	w9, [x0, #8]
	add	w9, w8, w9
	sub	w9, w9, #1
	sdiv	w0, w9, w8
	stp	w8, w0, [x19]
Lloh3:
	adrp	x20, _GFP_KERNEL@GOTPAGE
Lloh4:
	ldr	x20, [x20, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w2, [x20]
	mov	w1, #8
	bl	_kcalloc
	str	x0, [x19, #16]
	cbz	x0, LBB0_6
; %bb.1:
Lloh5:
	adrp	x8, _dr_via_desc_pages_alloc@GOTPAGE
Lloh6:
	ldr	x8, [x8, _dr_via_desc_pages_alloc@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	str	w8, [x19, #24]
	ldr	w1, [x19, #4]
	cmp	w1, #1
	b.lt	LBB0_5
; %bb.2:
	mov	x21, #0
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x20]
	bl	___get_free_page
	ldr	x8, [x19, #16]
	str	x0, [x8, x21, lsl #3]
	cbz	x0, LBB0_6
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	add	x21, x21, #1
	ldrsw	x1, [x19, #4]
	cmp	x21, x1
	b.lt	LBB0_3
LBB0_5:
	ldr	w2, [x19, #8]
Lloh8:
	adrp	x0, l_.str@PAGE
Lloh9:
	add	x0, x0, l_.str@PAGEOFF
                                        ; kill: def $w1 killed $w1 killed $x1
	bl	_DRM_DEBUG
	mov	w0, #0
	b	LBB0_7
LBB0_6:
Lloh10:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_7:
	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 AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_dr_via_desc_pages_alloc,4,2    ; @dr_via_desc_pages_alloc
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Allocated %d pages for %d descriptors.\n"

	.no_dead_strip	_via_alloc_desc_pages
.subsections_via_symbols
