	.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
	pushq	%rax
	.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	_IB_QPT_SMI@GOTPCREL(%rip), %rsi
	movq	_IB_QPT_GSI@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	%edx, (%rsi)
	je	LBB0_2
## %bb.1:
	cmpl	%edx, %eax
	je	LBB0_2
## %bb.6:
	movq	%rdi, %r14
	movl	4(%r15), %ecx
	movl	8(%r15), %eax
	addl	$2, %ecx
	movq	_QPN_MAX@GOTPCREL(%rip), %rdx
	cmpl	(%rdx), %ecx
	movl	$2, %r13d
	cmovll	%ecx, %r13d
	testl	%eax, %eax
	je	LBB0_9
## %bb.7:
	movl	%r13d, %ecx
	andl	%eax, %ecx
	sarl	%ecx
	cmpl	(%r14), %ecx
	jl	LBB0_9
## %bb.8:
	orl	%eax, %r13d
	addl	$2, %r13d
LBB0_9:
	movq	_BITS_PER_PAGE_MASK@GOTPCREL(%rip), %rcx
	movq	_BITS_PER_PAGE@GOTPCREL(%rip), %rsi
	movl	%r13d, %eax
	cltd
	idivl	(%rsi)
	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_10:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_12 Depth 2
	xorl	%edi, %edi
	cmpl	$0, (%r12)
	sete	%dil
	callq	_unlikely
	testq	%rax, %rax
	je	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_10 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_20
	.p2align	4, 0x90
LBB0_12:                                ##   Parent Loop BB0_10 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	(%r12), %esi
	movl	%ebx, %edi
	callq	_test_and_set_bit
	testl	%eax, %eax
	je	LBB0_22
## %bb.13:                              ##   in Loop: Header=BB0_12 Depth=2
	movl	(%r14), %ecx
	movq	%r15, %rdi
	movq	%r12, %rsi
	movl	%ebx, %edx
	callq	_find_next_offset
	movl	%eax, %ebx
	movq	%r15, %rdi
	movq	%r12, %rsi
	movl	%eax, %edx
	callq	_mk_qpn
	movl	%eax, %r13d
	movq	_BITS_PER_PAGE@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ebx
	jge	LBB0_15
## %bb.14:                              ##   in Loop: Header=BB0_12 Depth=2
	movq	_QPN_MAX@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r13d
	jl	LBB0_12
LBB0_15:                                ##   in Loop: Header=BB0_10 Depth=1
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	cmpl	-48(%rbp), %eax                 ## 4-byte Folded Reload
	jge	LBB0_16
## %bb.18:                              ##   in Loop: Header=BB0_10 Depth=1
	movq	16(%r15), %rax
	movslq	12(%r15), %rcx
	leaq	(%rax,%rcx,4), %rcx
	xorl	%ebx, %ebx
	cmpq	%rcx, %r12
	leaq	4(%r12), %r12
	setae	%bl
	cmovaeq	%rax, %r12
	addl	%ebx, %ebx
	jmp	LBB0_19
	.p2align	4, 0x90
LBB0_16:                                ##   in Loop: Header=BB0_10 Depth=1
	movslq	12(%r15), %r12
	movq	_QPNMAP_ENTRIES@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	je	LBB0_20
## %bb.17:                              ##   in Loop: Header=BB0_10 Depth=1
	leal	1(%r12), %eax
	movl	%eax, 12(%r15)
	shlq	$2, %r12
	addq	16(%r15), %r12
	xorl	%ebx, %ebx
LBB0_19:                                ##   in Loop: Header=BB0_10 Depth=1
	incl	-44(%rbp)                       ## 4-byte Folded Spill
	movq	%r15, %rdi
	movq	%r12, %rsi
	movl	%ebx, %edx
	callq	_mk_qpn
	movl	%eax, %r13d
	jmp	LBB0_10
LBB0_2:
	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_4
## %bb.3:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
	jmp	LBB0_5
LBB0_22:
	movl	%r13d, 4(%r15)
	jmp	LBB0_21
LBB0_4:
	orl	%r12d, %eax
	movl	%eax, (%r15)
LBB0_5:
	movq	%r14, %rdi
	callq	_spin_unlock
LBB0_21:
	movl	%r13d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_20:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r13d, %r13d
	subl	(%rax), %r13d
	jmp	LBB0_21
	.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	_QPN_MAX,4,2                    ## @QPN_MAX
	.comm	_BITS_PER_PAGE_MASK,4,2         ## @BITS_PER_PAGE_MASK
	.comm	_BITS_PER_PAGE,4,2              ## @BITS_PER_PAGE
	.comm	_QPNMAP_ENTRIES,4,2             ## @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
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_3
; %bb.1:
	cmp	w8, w2
	cset	w21, eq
	mov	x8, x21
	bfi	w8, w3, #1, #31
	sub	w8, w8, #2
	mov	w9, #1
	lsl	w22, w9, w8
	add	x20, x19, #24
	mov	x0, x20
	bl	_spin_lock
	ldr	w8, [x19]
	tst	w8, w22
	b.eq	LBB0_17
; %bb.2:
Lloh6:
	adrp	x8, _EINVAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_18
LBB0_3:
	mov	x20, x0
	ldp	w9, w8, [x19, #4]
	add	w9, w9, #2
Lloh9:
	adrp	x24, _QPN_MAX@GOTPAGE
Lloh10:
	ldr	x24, [x24, _QPN_MAX@GOTPAGEOFF]
	ldr	w10, [x24]
	mov	w11, #2
	cmp	w9, w10
	csel	w21, w9, w11, lt
	cbz	w8, LBB0_5
; %bb.4:
	and	w9, w21, w8
	ldr	w10, [x20]
	cmp	w10, w9, asr #1
	orr	w8, w21, w8
	add	w8, w8, #2
	csel	w21, w21, w8, gt
LBB0_5:
	mov	w25, #0
Lloh11:
	adrp	x8, _BITS_PER_PAGE_MASK@GOTPAGE
Lloh12:
	ldr	x8, [x8, _BITS_PER_PAGE_MASK@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	ands	w23, w8, w21
	ldr	x8, [x19, #16]
Lloh14:
	adrp	x26, _BITS_PER_PAGE@GOTPAGE
Lloh15:
	ldr	x26, [x26, _BITS_PER_PAGE@GOTPAGEOFF]
	ldr	w9, [x26]
	sdiv	w9, w21, w9
	add	x22, x8, w9, sxtw #2
	ldr	w8, [x19, #12]
	cset	w9, eq
	sub	w27, w8, w9
Lloh16:
	adrp	x28, _QPNMAP_ENTRIES@GOTPAGE
Lloh17:
	ldr	x28, [x28, _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_20
LBB0_8:                                 ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w1, [x22]
	mov	x0, x23
	bl	_test_and_set_bit
	cbz	w0, LBB0_16
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=2
	ldr	w3, [x20]
	mov	x0, x19
	mov	x1, x22
	mov	x2, x23
	bl	_find_next_offset
	mov	x23, x0
	mov	x0, x19
	mov	x1, x22
	mov	x2, x23
	bl	_mk_qpn
	ldr	w8, [x26]
	ldr	w9, [x24]
	cmp	w23, w8
	ccmp	w0, w9, #0, lt
	b.ge	LBB0_11
; %bb.10:                               ;   in Loop: Header=BB0_8 Depth=2
	mov	x21, x0
	b	LBB0_8
LBB0_11:                                ;   in Loop: Header=BB0_6 Depth=1
	cmp	w25, w27
	b.ge	LBB0_13
; %bb.12:                               ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [x19, #16]
	ldrsw	x9, [x19, #12]
	add	x9, x8, x9, lsl #2
	add	x10, x22, #4
	cmp	x22, x9
	csel	x22, x10, x8, lo
	cset	w8, hs
	lsl	w23, w8, #1
	b	LBB0_15
LBB0_13:                                ;   in Loop: Header=BB0_6 Depth=1
	ldrsw	x8, [x19, #12]
	ldr	w9, [x28]
	cmp	w8, w9
	b.eq	LBB0_20
; %bb.14:                               ;   in Loop: Header=BB0_6 Depth=1
	mov	w23, #0
	ldr	x9, [x19, #16]
	add	w10, w8, #1
	str	w10, [x19, #12]
	add	x22, x9, x8, lsl #2
LBB0_15:                                ;   in Loop: Header=BB0_6 Depth=1
	add	w25, w25, #1
	mov	x0, x19
	mov	x1, x22
	mov	x2, x23
	bl	_mk_qpn
	mov	x21, x0
	b	LBB0_6
LBB0_16:
	str	w21, [x19, #4]
	b	LBB0_19
LBB0_17:
	orr	w8, w8, w22
	str	w8, [x19]
LBB0_18:
	mov	x0, x20
	bl	_spin_unlock
LBB0_19:
	mov	x0, x21
	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_20:
Lloh18:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh19:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_19
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.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	_QPN_MAX,4,2                    ; @QPN_MAX
	.comm	_BITS_PER_PAGE_MASK,4,2         ; @BITS_PER_PAGE_MASK
	.comm	_BITS_PER_PAGE,4,2              ; @BITS_PER_PAGE
	.comm	_QPNMAP_ENTRIES,4,2             ; @QPNMAP_ENTRIES
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_alloc_qpn
.subsections_via_symbols
