	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ubi_wl_get_peb                 ## -- Begin function ubi_wl_get_peb
	.p2align	4, 0x90
_ubi_wl_get_peb:                        ## @ubi_wl_get_peb
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	leaq	28(%rdi), %r12
	movq	%r12, %rdi
	callq	_down_read
	leaq	24(%r15), %r14
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	callq	_spin_lock
	cmpl	$0, 36(%r15)
	jne	LBB0_6
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	cmpq	$0, (%r15)
	je	LBB0_3
## %bb.4:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	%r15, %rdi
	callq	_produce_free_peb
	movl	%eax, %ebx
	movq	%r14, %rdi
	callq	_spin_unlock
	testl	%ebx, %ebx
	js	LBB0_8
## %bb.5:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	%r12, %rdi
	callq	_up_read
	movq	%r12, %rdi
	callq	_down_read
	jmp	LBB0_1
LBB0_6:
	movq	%r15, %rdi
	callq	_wl_get_wle
	movq	%rax, %rbx
	movq	%r15, %rdi
	movq	%rax, %rsi
	callq	_prot_queue_add
	movq	%r14, %rdi
	callq	_spin_unlock
	movl	(%rbx), %esi
	movq	8(%r15), %rdx
	movq	16(%r15), %rcx
	subq	%rdx, %rcx
	movq	%r15, %rdi
	callq	_ubi_self_check_all_ff
	movl	(%rbx), %ebx
	testl	%eax, %eax
	je	LBB0_8
## %bb.7:
	movl	%eax, %r14d
	leaq	L_.str.1(%rip), %rsi
	movq	%r15, %rdi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_ubi_err
	movl	%r14d, %ebx
	jmp	LBB0_8
LBB0_3:
	leaq	L_.str(%rip), %rsi
	xorl	%ebx, %ebx
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	_ubi_err
	addq	$32, %r15
	movq	%r15, %rdi
	callq	_list_empty
	movl	%eax, %edi
	callq	_ubi_assert
	movq	%r14, %rdi
	callq	_spin_unlock
	movq	_ENOSPC@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
LBB0_8:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"no free eraseblocks"

	.comm	_ENOSPC,4,2                     ## @ENOSPC
L_.str.1:                               ## @.str.1
	.asciz	"new PEB %d does not contain all 0xFF bytes"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ubi_wl_get_peb                 ; -- Begin function ubi_wl_get_peb
	.p2align	2
_ubi_wl_get_peb:                        ; @ubi_wl_get_peb
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	add	x21, x0, #28
	mov	x0, x21
	bl	_down_read
	add	x20, x19, #24
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	bl	_spin_lock
	ldr	w8, [x19, #36]
	cbnz	w8, LBB0_5
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	ldr	x8, [x19]
	cbz	x8, LBB0_7
; %bb.3:                                ;   in Loop: Header=BB0_1 Depth=1
	mov	x0, x19
	bl	_produce_free_peb
	mov	x22, x0
	mov	x0, x20
	bl	_spin_unlock
	tbnz	w22, #31, LBB0_8
; %bb.4:                                ;   in Loop: Header=BB0_1 Depth=1
	mov	x0, x21
	bl	_up_read
	mov	x0, x21
	bl	_down_read
	b	LBB0_1
LBB0_5:
	mov	x0, x19
	bl	_wl_get_wle
	mov	x21, x0
	mov	x0, x19
	mov	x1, x21
	bl	_prot_queue_add
	mov	x0, x20
	bl	_spin_unlock
	ldr	w1, [x21]
	ldp	x2, x8, [x19, #8]
	sub	x3, x8, x2
	mov	x0, x19
	bl	_ubi_self_check_all_ff
	ldr	w22, [x21]
	cbz	w0, LBB0_8
; %bb.6:
	mov	x20, x0
	str	x22, [sp]
Lloh0:
	adrp	x1, l_.str.1@PAGE
Lloh1:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_ubi_err
	mov	x22, x20
	b	LBB0_8
LBB0_7:
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_ubi_err
	add	x0, x19, #32
	bl	_list_empty
	bl	_ubi_assert
	mov	x0, x20
	bl	_spin_unlock
Lloh4:
	adrp	x8, _ENOSPC@GOTPAGE
Lloh5:
	ldr	x8, [x8, _ENOSPC@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_8:
	mov	x0, x22
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"no free eraseblocks"

	.comm	_ENOSPC,4,2                     ; @ENOSPC
l_.str.1:                               ; @.str.1
	.asciz	"new PEB %d does not contain all 0xFF bytes"

.subsections_via_symbols
