	.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
	movq	%rdi, %r14
	movq	_IB_QPT_SMI@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	cmpl	%esi, (%rax)
	je	LBB0_2
## %bb.1:
	movq	_IB_QPT_GSI@GOTPCREL(%rip), %rax
	movl	$1, %r12d
	cmpl	%esi, (%rax)
	jne	LBB0_7
LBB0_2:
	movq	8(%r14), %rbx
	xorl	%edi, %edi
	cmpl	$0, 4(%rbx)
	sete	%dil
	callq	_unlikely
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_get_map_page
	xorl	%edi, %edi
	cmpl	$0, 4(%rbx)
	sete	%dil
	callq	_unlikely
	testq	%rax, %rax
	je	LBB0_4
LBB0_19:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_20
LBB0_4:
	movl	4(%rbx), %esi
	movl	%r12d, %edi
	callq	_test_and_set_bit
	testl	%eax, %eax
	je	LBB0_5
## %bb.6:
	movq	_EBUSY@GOTPCREL(%rip), %rax
LBB0_20:
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
	jmp	LBB0_21
LBB0_7:
	movl	(%r14), %eax
	incl	%eax
	movq	_QPN_MAX@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	movl	4(%r14), %esi
	movl	$2, %r12d
	cmovll	%eax, %r12d
	movq	_BITS_PER_PAGE@GOTPCREL(%rip), %r13
	movl	%r12d, %eax
	cltd
	idivl	(%r13)
	movslq	%eax, %r15
	shlq	$3, %r15
	addq	8(%r14), %r15
	movq	_BITS_PER_PAGE_MASK@GOTPCREL(%rip), %rax
	xorl	%ecx, %ecx
	movl	(%rax), %ebx
	andl	%r12d, %ebx
	sete	%cl
	subl	%ecx, %esi
	movl	%esi, -48(%rbp)                 ## 4-byte Spill
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
LBB0_8:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_11 Depth 2
	xorl	%edi, %edi
	cmpl	$0, 4(%r15)
	sete	%dil
	callq	_unlikely
	testq	%rax, %rax
	je	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_get_map_page
	xorl	%edi, %edi
	cmpl	$0, 4(%r15)
	sete	%dil
	callq	_unlikely
	testq	%rax, %rax
	jne	LBB0_19
LBB0_10:                                ##   in Loop: Header=BB0_8 Depth=1
	movq	%r15, %rdi
	callq	_atomic_read
	movl	%eax, %edi
	callq	_likely
	testq	%rax, %rax
	je	LBB0_14
	.p2align	4, 0x90
LBB0_11:                                ##   Parent Loop BB0_8 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	4(%r15), %esi
	movl	%ebx, %edi
	callq	_test_and_set_bit
	testl	%eax, %eax
	je	LBB0_22
## %bb.12:                              ##   in Loop: Header=BB0_11 Depth=2
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_find_next_offset
	movl	%eax, %ebx
	movq	%r14, %rdi
	movq	%r15, %rsi
	movl	%eax, %edx
	callq	_mk_qpn
	cmpl	(%r13), %ebx
	jge	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_11 Depth=2
	movl	%eax, %r12d
	movq	_QPN_MAX@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jl	LBB0_11
LBB0_14:                                ##   in Loop: Header=BB0_8 Depth=1
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	cmpl	-48(%rbp), %eax                 ## 4-byte Folded Reload
	jge	LBB0_15
## %bb.17:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	8(%r14), %rax
	movslq	4(%r14), %rcx
	leaq	(%rax,%rcx,8), %rcx
	xorl	%ebx, %ebx
	cmpq	%rcx, %r15
	leaq	8(%r15), %r15
	setae	%bl
	cmovaeq	%rax, %r15
	addl	%ebx, %ebx
	jmp	LBB0_18
	.p2align	4, 0x90
LBB0_15:                                ##   in Loop: Header=BB0_8 Depth=1
	movslq	4(%r14), %r15
	movq	_QPNMAP_ENTRIES@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r15d
	je	LBB0_19
## %bb.16:                              ##   in Loop: Header=BB0_8 Depth=1
	leal	1(%r15), %eax
	movl	%eax, 4(%r14)
	shlq	$3, %r15
	addq	8(%r14), %r15
	xorl	%ebx, %ebx
LBB0_18:                                ##   in Loop: Header=BB0_8 Depth=1
	incl	-44(%rbp)                       ## 4-byte Folded Spill
	movq	%r14, %rdi
	movq	%r15, %rsi
	movl	%ebx, %edx
	callq	_mk_qpn
	movl	%eax, %r12d
	jmp	LBB0_8
LBB0_22:
	movq	%r15, %rdi
	callq	_atomic_dec
	movl	%r12d, (%r14)
	jmp	LBB0_21
LBB0_5:
	movq	%rbx, %rdi
	callq	_atomic_dec
LBB0_21:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_IB_QPT_SMI,4,2                 ## @IB_QPT_SMI
	.comm	_IB_QPT_GSI,4,2                 ## @IB_QPT_GSI
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_EBUSY,4,2                      ## @EBUSY
	.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
	.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, x0
Lloh0:
	adrp	x8, _IB_QPT_SMI@GOTPAGE
Lloh1:
	ldr	x8, [x8, _IB_QPT_SMI@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w1
	b.ne	LBB0_2
; %bb.1:
	mov	w20, #0
	b	LBB0_4
LBB0_2:
Lloh3:
	adrp	x8, _IB_QPT_GSI@GOTPAGE
Lloh4:
	ldr	x8, [x8, _IB_QPT_GSI@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w8, w1
	b.ne	LBB0_10
; %bb.3:
	mov	w20, #1
LBB0_4:
	ldr	x21, [x19, #8]
	ldr	w8, [x21, #4]
	cmp	w8, #0
	cset	w0, eq
	bl	_unlikely
	cbz	x0, LBB0_7
; %bb.5:
	mov	x0, x19
	mov	x1, x21
	bl	_get_map_page
	ldr	w8, [x21, #4]
	cmp	w8, #0
	cset	w0, eq
	bl	_unlikely
	cbz	x0, LBB0_7
LBB0_6:
Lloh6:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_9
LBB0_7:
	ldr	w1, [x21, #4]
	mov	x0, x20
	bl	_test_and_set_bit
	cbz	w0, LBB0_23
; %bb.8:
Lloh8:
	adrp	x8, _EBUSY@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
LBB0_9:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_24
LBB0_10:
	mov	w23, #0
	ldp	w8, w9, [x19]
	add	w10, w8, #1
Lloh10:
	adrp	x24, _QPN_MAX@GOTPAGE
Lloh11:
	ldr	x24, [x24, _QPN_MAX@GOTPAGEOFF]
	ldr	w11, [x24]
	cmp	w10, w11
	mov	w10, #2
	csinc	w20, w10, w8, ge
Lloh12:
	adrp	x8, _BITS_PER_PAGE_MASK@GOTPAGE
Lloh13:
	ldr	x8, [x8, _BITS_PER_PAGE_MASK@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	ands	w22, w20, w8
	ldr	x8, [x19, #8]
Lloh15:
	adrp	x25, _BITS_PER_PAGE@GOTPAGE
Lloh16:
	ldr	x25, [x25, _BITS_PER_PAGE@GOTPAGEOFF]
	ldr	w10, [x25]
	sdiv	w10, w20, w10
	add	x21, x8, w10, sxtw #3
	cset	w8, eq
	sub	w26, w9, w8
Lloh17:
	adrp	x27, _QPNMAP_ENTRIES@GOTPAGE
Lloh18:
	ldr	x27, [x27, _QPNMAP_ENTRIES@GOTPAGEOFF]
LBB0_11:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_14 Depth 2
	ldr	w8, [x21, #4]
	cmp	w8, #0
	cset	w0, eq
	bl	_unlikely
	cbz	x0, LBB0_13
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	mov	x0, x19
	mov	x1, x21
	bl	_get_map_page
	ldr	w8, [x21, #4]
	cmp	w8, #0
	cset	w0, eq
	bl	_unlikely
	cbnz	x0, LBB0_6
LBB0_13:                                ;   in Loop: Header=BB0_11 Depth=1
	mov	x0, x21
	bl	_atomic_read
	bl	_likely
	cbz	x0, LBB0_17
LBB0_14:                                ;   Parent Loop BB0_11 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w1, [x21, #4]
	mov	x0, x22
	bl	_test_and_set_bit
	cbz	w0, LBB0_22
; %bb.15:                               ;   in Loop: Header=BB0_14 Depth=2
	mov	x0, x21
	mov	x1, x22
	bl	_find_next_offset
	mov	x22, x0
	mov	x0, x19
	mov	x1, x21
	mov	x2, x22
	bl	_mk_qpn
	ldr	w8, [x25]
	ldr	w9, [x24]
	cmp	w22, w8
	ccmp	w0, w9, #0, lt
	b.ge	LBB0_17
; %bb.16:                               ;   in Loop: Header=BB0_14 Depth=2
	mov	x20, x0
	b	LBB0_14
LBB0_17:                                ;   in Loop: Header=BB0_11 Depth=1
	cmp	w23, w26
	b.ge	LBB0_19
; %bb.18:                               ;   in Loop: Header=BB0_11 Depth=1
	ldr	x8, [x19, #8]
	ldrsw	x9, [x19, #4]
	add	x9, x8, x9, lsl #3
	add	x10, x21, #8
	cmp	x21, x9
	csel	x21, x10, x8, lo
	cset	w8, hs
	lsl	w22, w8, #1
	b	LBB0_21
LBB0_19:                                ;   in Loop: Header=BB0_11 Depth=1
	ldrsw	x8, [x19, #4]
	ldr	w9, [x27]
	cmp	w8, w9
	b.eq	LBB0_6
; %bb.20:                               ;   in Loop: Header=BB0_11 Depth=1
	mov	w22, #0
	ldr	x9, [x19, #8]
	add	w10, w8, #1
	str	w10, [x19, #4]
	add	x21, x9, x8, lsl #3
LBB0_21:                                ;   in Loop: Header=BB0_11 Depth=1
	add	w23, w23, #1
	mov	x0, x19
	mov	x1, x21
	mov	x2, x22
	bl	_mk_qpn
	mov	x20, x0
	b	LBB0_11
LBB0_22:
	mov	x0, x21
	bl	_atomic_dec
	str	w20, [x19]
	b	LBB0_24
LBB0_23:
	mov	x0, x21
	bl	_atomic_dec
LBB0_24:
	mov	x0, x20
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_IB_QPT_SMI,4,2                 ; @IB_QPT_SMI
	.comm	_IB_QPT_GSI,4,2                 ; @IB_QPT_GSI
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_EBUSY,4,2                      ; @EBUSY
	.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
	.no_dead_strip	_alloc_qpn
.subsections_via_symbols
