	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function alloc_qpn
_alloc_qpn:                             ## @alloc_qpn
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
                                        ## kill: def $ecx killed $ecx def $rcx
	movq	%rsi, %r15
	movq	8(%rdi), %rax
	testq	%rax, %rax
	je	LBB0_1
## %bb.25:
	movq	%r15, %rsi
                                        ## kill: def $ecx killed $ecx killed $rcx
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmpq	*%rax                           ## TAILCALL
LBB0_1:
	movq	_IB_QPT_SMI@GOTPCREL(%rip), %rsi
	movq	_IB_QPT_GSI@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	%edx, (%rsi)
	je	LBB0_3
## %bb.2:
	cmpl	%edx, %eax
	je	LBB0_3
## %bb.7:
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	movl	4(%r15), %r13d
	movl	8(%r15), %eax
	leal	(%rax,%r13), %ecx
	notl	%r13d
	movq	_RVT_QPN_MAX@GOTPCREL(%rip), %rdx
	andl	$1, %r13d
	orl	%eax, %r13d
	cmpl	(%rdx), %ecx
	cmovll	%ecx, %r13d
	movq	_RVT_BITS_PER_PAGE_MASK@GOTPCREL(%rip), %rcx
	movq	_RVT_BITS_PER_PAGE@GOTPCREL(%rip), %r14
	movl	%r13d, %eax
	cltd
	idivl	(%r14)
	movslq	%eax, %r12
	shlq	$2, %r12
	addq	16(%r15), %r12
	xorl	%eax, %eax
	movl	(%rcx), %ebx
	andl	%r13d, %ebx
	movl	12(%r15), %ecx
	sete	%al
	subl	%eax, %ecx
	movl	%ecx, -48(%rbp)                 ## 4-byte Spill
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
LBB0_8:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_10 Depth 2
	xorl	%edi, %edi
	cmpl	$0, (%r12)
	sete	%dil
	callq	_unlikely
	testq	%rax, %rax
	je	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_get_map_page
	xorl	%edi, %edi
	cmpl	$0, (%r12)
	sete	%dil
	callq	_unlikely
	testq	%rax, %rax
	jne	LBB0_23
	.p2align	4, 0x90
LBB0_10:                                ##   Parent Loop BB0_8 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	(%r12), %esi
	movl	%ebx, %edi
	callq	_test_and_set_bit
	testl	%eax, %eax
	je	LBB0_26
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=2
	addl	8(%r15), %ebx
	movq	%r15, %rdi
	movq	%r12, %rsi
	movl	%ebx, %edx
	callq	_mk_qpn
	cmpl	(%r14), %ebx
	jge	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_10 Depth=2
	movl	%eax, %r13d
	movq	_RVT_QPN_MAX@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r13d
	jl	LBB0_10
LBB0_13:                                ##   in Loop: Header=BB0_8 Depth=1
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	cmpl	-48(%rbp), %eax                 ## 4-byte Folded Reload
	jge	LBB0_14
## %bb.16:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	16(%r15), %rax
	movslq	12(%r15), %rcx
	leaq	(%rax,%rcx,4), %rcx
	cmpq	%rcx, %r12
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	jae	LBB0_18
## %bb.17:                              ##   in Loop: Header=BB0_8 Depth=1
	addq	$4, %r12
	andl	$1, %ebx
	orl	8(%r15), %ebx
	jmp	LBB0_19
LBB0_14:                                ##   in Loop: Header=BB0_8 Depth=1
	movslq	12(%r15), %r12
	movq	_RVT_QPNMAP_ENTRIES@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	je	LBB0_23
## %bb.15:                              ##   in Loop: Header=BB0_8 Depth=1
	leal	1(%r12), %eax
	movl	%eax, 12(%r15)
	shlq	$2, %r12
	addq	16(%r15), %r12
	andl	$1, %ebx
	orl	8(%r15), %ebx
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	jmp	LBB0_19
LBB0_18:                                ##   in Loop: Header=BB0_8 Depth=1
	notl	%ebx
	andl	$1, %ebx
	orl	8(%r15), %ebx
	movq	%rax, %r12
LBB0_19:                                ##   in Loop: Header=BB0_8 Depth=1
	movl	(%rcx), %edi
	cmpl	$2, %edi
	jl	LBB0_20
## %bb.21:                              ##   in Loop: Header=BB0_8 Depth=1
	decl	%edi
	callq	_BIT
                                        ## kill: def $eax killed $eax def $rax
	addl	%eax, %eax
	addl	$-2, %eax
	testl	%ebx, %eax
	setne	%al
	jmp	LBB0_22
LBB0_20:                                ##   in Loop: Header=BB0_8 Depth=1
	xorl	%eax, %eax
LBB0_22:                                ##   in Loop: Header=BB0_8 Depth=1
	incl	-44(%rbp)                       ## 4-byte Folded Spill
	movzbl	%al, %edi
	callq	_WARN_ON
	movq	%r15, %rdi
	movq	%r12, %rsi
	movl	%ebx, %edx
	callq	_mk_qpn
	movl	%eax, %r13d
	jmp	LBB0_8
LBB0_3:
	xorl	%r13d, %r13d
	cmpl	%edx, %eax
	sete	%r13b
	leal	(%r13,%rcx,2), %ebx
	addb	$-2, %bl
	movl	$1, %r12d
	movl	%ebx, %ecx
	shll	%cl, %r12d
	leaq	24(%r15), %r14
	movq	%r14, %rdi
	callq	_spin_lock
	movl	(%r15), %eax
	movzbl	%bl, %ecx
	btl	%ecx, %eax
	jae	LBB0_5
## %bb.4:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
	jmp	LBB0_6
LBB0_26:
	movl	%r13d, 4(%r15)
	jmp	LBB0_24
LBB0_5:
	orl	%r12d, %eax
	movl	%eax, (%r15)
LBB0_6:
	movq	%r14, %rdi
	callq	_spin_unlock
LBB0_24:
	movl	%r13d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_23:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
	jmp	LBB0_24
	.cfi_endproc
                                        ## -- End function
	.comm	_IB_QPT_SMI,4,2                 ## @IB_QPT_SMI
	.comm	_IB_QPT_GSI,4,2                 ## @IB_QPT_GSI
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_RVT_QPN_MAX,4,2                ## @RVT_QPN_MAX
	.comm	_RVT_BITS_PER_PAGE_MASK,4,2     ## @RVT_BITS_PER_PAGE_MASK
	.comm	_RVT_BITS_PER_PAGE,4,2          ## @RVT_BITS_PER_PAGE
	.comm	_RVT_QPNMAP_ENTRIES,4,2         ## @RVT_QPNMAP_ENTRIES
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_alloc_qpn
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function alloc_qpn
_alloc_qpn:                             ; @alloc_qpn
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x1
	mov	x20, x0
	ldr	x4, [x0, #8]
	cbz	x4, LBB0_2
; %bb.1:
	mov	x0, x20
	mov	x1, x19
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	br	x4
LBB0_2:
Lloh0:
	adrp	x8, _IB_QPT_SMI@GOTPAGE
Lloh1:
	ldr	x8, [x8, _IB_QPT_SMI@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x8]
Lloh3:
	adrp	x8, _IB_QPT_GSI@GOTPAGE
Lloh4:
	ldr	x8, [x8, _IB_QPT_GSI@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w9, w2
	ccmp	w8, w2, #4, ne
	b.ne	LBB0_5
; %bb.3:
	cmp	w8, w2
	cset	w23, eq
	mov	x8, x23
	bfi	w8, w3, #1, #31
	sub	w8, w8, #2
	mov	w9, #1
	lsl	w21, w9, w8
	add	x20, x19, #24
	mov	x0, x20
	bl	_spin_lock
	ldr	w8, [x19]
	tst	w8, w21
	b.eq	LBB0_23
; %bb.4:
Lloh6:
	adrp	x8, _EINVAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_24
LBB0_5:
	mov	w24, #0
	ldp	w8, w9, [x19, #4]
	mvn	w10, w8
Lloh9:
	adrp	x25, _RVT_QPN_MAX@GOTPAGE
Lloh10:
	ldr	x25, [x25, _RVT_QPN_MAX@GOTPAGEOFF]
	ldr	w11, [x25]
	and	w10, w10, #0x1
	orr	w10, w10, w9
	add	w8, w9, w8
	cmp	w8, w11
	csel	w23, w8, w10, lt
Lloh11:
	adrp	x8, _RVT_BITS_PER_PAGE_MASK@GOTPAGE
Lloh12:
	ldr	x8, [x8, _RVT_BITS_PER_PAGE_MASK@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	ands	w21, w23, w8
	ldr	x8, [x19, #16]
Lloh14:
	adrp	x26, _RVT_BITS_PER_PAGE@GOTPAGE
Lloh15:
	ldr	x26, [x26, _RVT_BITS_PER_PAGE@GOTPAGEOFF]
	ldr	w9, [x26]
	sdiv	w9, w23, w9
	add	x22, x8, w9, sxtw #2
	ldr	w8, [x19, #12]
	cset	w9, eq
	sub	w27, w8, w9
Lloh16:
	adrp	x28, _RVT_QPNMAP_ENTRIES@GOTPAGE
Lloh17:
	ldr	x28, [x28, _RVT_QPNMAP_ENTRIES@GOTPAGEOFF]
LBB0_6:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_8 Depth 2
	ldr	w8, [x22]
	cmp	w8, #0
	cset	w0, eq
	bl	_unlikely
	cbz	x0, LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	x0, x19
	mov	x1, x22
	bl	_get_map_page
	ldr	w8, [x22]
	cmp	w8, #0
	cset	w0, eq
	bl	_unlikely
	cbnz	x0, LBB0_26
LBB0_8:                                 ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w1, [x22]
	mov	x0, x21
	bl	_test_and_set_bit
	cbz	w0, LBB0_22
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=2
	ldr	w8, [x19, #8]
	add	w21, w8, w21
	mov	x0, x19
	mov	x1, x22
	mov	x2, x21
	bl	_mk_qpn
	ldr	w8, [x26]
	ldr	w9, [x25]
	cmp	w21, w8
	ccmp	w0, w9, #0, lt
	b.ge	LBB0_11
; %bb.10:                               ;   in Loop: Header=BB0_8 Depth=2
	mov	x23, x0
	b	LBB0_8
LBB0_11:                                ;   in Loop: Header=BB0_6 Depth=1
	cmp	w24, w27
	b.ge	LBB0_14
; %bb.12:                               ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [x19, #16]
	ldrsw	x9, [x19, #12]
	add	x9, x8, x9, lsl #2
	cmp	x22, x9
	b.hs	LBB0_17
; %bb.13:                               ;   in Loop: Header=BB0_6 Depth=1
	add	x22, x22, #4
	b	LBB0_16
LBB0_14:                                ;   in Loop: Header=BB0_6 Depth=1
	ldrsw	x8, [x19, #12]
	ldr	w9, [x28]
	cmp	w8, w9
	b.eq	LBB0_26
; %bb.15:                               ;   in Loop: Header=BB0_6 Depth=1
	ldr	x9, [x19, #16]
	add	w10, w8, #1
	str	w10, [x19, #12]
	add	x22, x9, x8, lsl #2
LBB0_16:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	w8, [x19, #8]
	and	w9, w21, #0x1
	orr	w21, w8, w9
	b	LBB0_18
LBB0_17:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	w9, [x19, #8]
	mvn	w10, w21
	and	w10, w10, #0x1
	orr	w21, w9, w10
	mov	x22, x8
LBB0_18:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	w8, [x20]
	cmp	w8, #2
	b.lt	LBB0_20
; %bb.19:                               ;   in Loop: Header=BB0_6 Depth=1
	sub	w0, w8, #1
	bl	_BIT
	lsl	w8, w0, #1
	sub	w8, w8, #2
	tst	w8, w21
	cset	w0, ne
	b	LBB0_21
LBB0_20:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	w0, #0
LBB0_21:                                ;   in Loop: Header=BB0_6 Depth=1
	add	w24, w24, #1
	bl	_WARN_ON
	mov	x0, x19
	mov	x1, x22
	mov	x2, x21
	bl	_mk_qpn
	mov	x23, x0
	b	LBB0_6
LBB0_22:
	str	w23, [x19, #4]
	b	LBB0_25
LBB0_23:
	orr	w8, w8, w21
	str	w8, [x19]
LBB0_24:
	mov	x0, x20
	bl	_spin_unlock
LBB0_25:
	mov	x0, x23
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_26:
Lloh18:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh19:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_25
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_IB_QPT_SMI,4,2                 ; @IB_QPT_SMI
	.comm	_IB_QPT_GSI,4,2                 ; @IB_QPT_GSI
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_RVT_QPN_MAX,4,2                ; @RVT_QPN_MAX
	.comm	_RVT_BITS_PER_PAGE_MASK,4,2     ; @RVT_BITS_PER_PAGE_MASK
	.comm	_RVT_BITS_PER_PAGE,4,2          ; @RVT_BITS_PER_PAGE
	.comm	_RVT_QPNMAP_ENTRIES,4,2         ; @RVT_QPNMAP_ENTRIES
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_alloc_qpn
.subsections_via_symbols
