	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cxl_alloc_spa
_cxl_alloc_spa:                         ## @cxl_alloc_spa
	.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
	movl	%esi, %r14d
	movq	%rdi, %rbx
	movq	8(%rdi), %rsi
	movl	$0, (%rsi)
	movq	_PAGE_SIZE@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	cmpl	$1048576, %edi                  ## imm = 0x100000
	ja	LBB0_2
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movl	%edi, 16(%rsi)
	callq	_spa_max_procs
	movq	8(%rbx), %rsi
	movq	%rax, 8(%rsi)
	cmpq	(%rbx), %rax
	jge	LBB0_4
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movl	(%rsi), %ecx
	incl	%ecx
	movl	%ecx, (%rsi)
	movl	(%r15), %edi
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %edi
	cmpl	$1048576, %edi                  ## imm = 0x100000
	jbe	LBB0_6
LBB0_2:
	leaq	16(%rbx), %rdi
	movq	8(%rsi), %rdx
	movl	16(%rsi), %ecx
	leaq	L_.str(%rip), %rsi
	callq	_dev_warn
	movq	_CXL_MODE_DEDICATED@GOTPCREL(%rip), %rax
	movq	8(%rbx), %rsi
	cmpl	%r14d, (%rax)
	je	LBB0_4
## %bb.3:
	movq	8(%rsi), %rax
	movq	%rax, (%rbx)
LBB0_4:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movq	___GFP_ZERO@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	orl	(%rax), %edi
	movl	(%rsi), %esi
	callq	___get_free_pages
	movq	8(%rbx), %rdx
	movq	%rax, 24(%rdx)
	testq	%rax, %rax
	je	LBB0_5
## %bb.8:
	movb	(%rdx), %cl
	movl	$1, %esi
	shll	%cl, %esi
	movq	8(%rdx), %rdx
	movq	(%rbx), %rcx
	leaq	L_.str.2(%rip), %rdi
	callq	_pr_devel
	xorl	%eax, %eax
	jmp	LBB0_9
LBB0_5:
	leaq	L_.str.1(%rip), %rdi
	callq	_pr_err
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_9:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"num_of_processes too large for the SPA, limiting to %i (0x%x)\n"

	.comm	_CXL_MODE_DEDICATED,4,2         ## @CXL_MODE_DEDICATED
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	___GFP_ZERO,4,2                 ## @__GFP_ZERO
L_.str.1:                               ## @.str.1
	.asciz	"cxl_alloc_spa: Unable to allocate scheduled process area\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
L_.str.2:                               ## @.str.2
	.asciz	"spa pages: %i afu->spa_max_procs: %i   afu->num_procs: %i\n"

	.no_dead_strip	_cxl_alloc_spa
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cxl_alloc_spa
_cxl_alloc_spa:                         ; @cxl_alloc_spa
	.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	x20, x1
	mov	x19, x0
	ldr	x8, [x0, #8]
	str	wzr, [x8]
Lloh0:
	adrp	x21, _PAGE_SIZE@GOTPAGE
Lloh1:
	ldr	x21, [x21, _PAGE_SIZE@GOTPAGEOFF]
	ldr	w0, [x21]
	cmp	w0, #256, lsl #12               ; =1048576
	b.hi	LBB0_3
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	str	w0, [x8, #16]
	bl	_spa_max_procs
	ldp	x9, x8, [x19]
	str	x0, [x8, #8]
	cmp	x0, x9
	b.ge	LBB0_5
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	ldr	w9, [x8]
	add	w9, w9, #1
	str	w9, [x8]
	ldr	w10, [x21]
	lsl	w0, w10, w9
	cmp	w0, #256, lsl #12               ; =1048576
	b.ls	LBB0_1
LBB0_3:
	add	x0, x19, #16
	ldr	x2, [x8, #8]
	ldr	w3, [x8, #16]
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_warn
Lloh4:
	adrp	x8, _CXL_MODE_DEDICATED@GOTPAGE
Lloh5:
	ldr	x8, [x8, _CXL_MODE_DEDICATED@GOTPAGEOFF]
Lloh6:
	ldr	w9, [x8]
	ldr	x8, [x19, #8]
	cmp	w9, w20
	b.eq	LBB0_5
; %bb.4:
	ldr	x9, [x8, #8]
	str	x9, [x19]
LBB0_5:
Lloh7:
	adrp	x9, _GFP_KERNEL@GOTPAGE
Lloh8:
	ldr	x9, [x9, _GFP_KERNEL@GOTPAGEOFF]
Lloh9:
	ldr	w9, [x9]
Lloh10:
	adrp	x10, ___GFP_ZERO@GOTPAGE
Lloh11:
	ldr	x10, [x10, ___GFP_ZERO@GOTPAGEOFF]
Lloh12:
	ldr	w10, [x10]
	orr	w0, w10, w9
	ldr	w1, [x8]
	bl	___get_free_pages
	ldr	x8, [x19, #8]
	str	x0, [x8, #24]
	cbz	x0, LBB0_7
; %bb.6:
	ldr	w9, [x8]
	mov	w10, #1
	lsl	w1, w10, w9
	ldr	x2, [x8, #8]
	ldr	x3, [x19]
Lloh13:
	adrp	x0, l_.str.2@PAGE
Lloh14:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_pr_devel
	mov	w0, #0
	b	LBB0_8
LBB0_7:
Lloh15:
	adrp	x0, l_.str.1@PAGE
Lloh16:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_pr_err
Lloh17:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh18:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_8:
	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	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"num_of_processes too large for the SPA, limiting to %i (0x%x)\n"

	.comm	_CXL_MODE_DEDICATED,4,2         ; @CXL_MODE_DEDICATED
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	___GFP_ZERO,4,2                 ; @__GFP_ZERO
l_.str.1:                               ; @.str.1
	.asciz	"cxl_alloc_spa: Unable to allocate scheduled process area\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
l_.str.2:                               ; @.str.2
	.asciz	"spa pages: %i afu->spa_max_procs: %i   afu->num_procs: %i\n"

	.no_dead_strip	_cxl_alloc_spa
.subsections_via_symbols
