	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ubi_bitflip_check              ## -- Begin function ubi_bitflip_check
	.p2align	4, 0x90
_ubi_bitflip_check:                     ## @ubi_bitflip_check
	.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
	testl	%esi, %esi
	js	LBB0_2
## %bb.1:
	movl	%esi, %r13d
	movq	%rdi, %r14
	cmpl	%esi, (%rdi)
	jle	LBB0_2
## %bb.3:
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	leaq	4(%r14), %rbx
	movq	%rbx, %rdi
	callq	_down_write
	leaq	8(%r14), %r12
	movq	%r12, %rdi
	callq	_spin_lock
	movq	32(%r14), %rax
	movl	%r13d, %r15d
	movq	(%rax,%r15,8), %rsi
	testq	%rsi, %rsi
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	je	LBB0_4
## %bb.5:
	movq	%r14, %rdi
	callq	_scrub_possible
	movl	%eax, %ebx
	movq	%r12, %rdi
	callq	_spin_unlock
	testl	%ebx, %ebx
	je	LBB0_6
## %bb.7:
	cmpl	$0, -44(%rbp)                   ## 4-byte Folded Reload
	jne	LBB0_9
## %bb.8:
	leaq	40(%r14), %rdi
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	callq	_mutex_lock
	movl	44(%r14), %r8d
	movl	48(%r14), %esi
	xorl	%ebx, %ebx
	movq	%r14, %rdi
	movl	%r13d, %edx
	xorl	%ecx, %ecx
	callq	_ubi_io_read
	movl	%eax, %r13d
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_mutex_unlock
	movq	_UBI_IO_BITFLIPS@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r13d
	jne	LBB0_23
LBB0_9:
	movq	%r12, %rdi
	callq	_spin_lock
	movq	32(%r14), %rax
	movq	(%rax,%r15,8), %r13
	testq	%r13, %r13
	je	LBB0_4
## %bb.10:
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_scrub_possible
	testl	%eax, %eax
	je	LBB0_11
## %bb.12:
	movq	%r14, %rdi
	movq	%r13, %rsi
	callq	_in_pq
	testq	%rax, %rax
	je	LBB0_14
## %bb.13:
	movl	4(%r13), %esi
	movq	%r14, %rdi
	callq	_prot_queue_del
	jmp	LBB0_16
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_24
LBB0_4:
	movq	%r12, %rdi
	callq	_spin_unlock
	movq	_ENOENT@GOTPCREL(%rip), %rax
	jmp	LBB0_22
LBB0_6:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	jmp	LBB0_22
LBB0_11:
	movq	%r12, %rdi
	callq	_spin_unlock
	movq	_EBUSY@GOTPCREL(%rip), %rax
	jmp	LBB0_22
LBB0_14:
	leaq	24(%r14), %rbx
	movq	%r13, %rdi
	movq	%rbx, %rsi
	callq	_in_wl_tree
	testq	%rax, %rax
	je	LBB0_17
## %bb.15:
	movq	%r13, %rdi
	movq	%rbx, %rsi
	callq	_rb_erase
LBB0_16:
	leaq	20(%r14), %rsi
	movq	%r13, %rdi
	callq	_wl_tree_add
	movq	%r12, %rdi
	callq	_spin_unlock
	movq	%r14, %rdi
	movl	$1, %esi
	callq	_ensure_wear_leveling
	movl	%eax, %ebx
	movl	-44(%rbp), %r15d                ## 4-byte Reload
LBB0_20:
	orl	%ebx, %r15d
	jne	LBB0_23
## %bb.21:
	movq	_EUCLEAN@GOTPCREL(%rip), %rax
LBB0_22:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_23:
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_up_write
LBB0_24:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_17:
	leaq	16(%r14), %rbx
	movq	%r13, %rdi
	movq	%rbx, %rsi
	callq	_in_wl_tree
	testq	%rax, %rax
	movl	-44(%rbp), %r15d                ## 4-byte Reload
	je	LBB0_19
## %bb.18:
	xorl	%eax, %eax
	testl	%r15d, %r15d
	sete	%al
	movl	%eax, -56(%rbp)                 ## 4-byte Spill
	movq	%r13, %rdi
	movq	%rbx, %rsi
	callq	_rb_erase
	decl	12(%r14)
	movq	%r12, %rdi
	callq	_spin_unlock
	movq	_UBI_UNKNOWN@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r14, %rdi
	movq	%r13, %rsi
	movl	%ecx, %edx
	movl	-56(%rbp), %r8d                 ## 4-byte Reload
	movl	$1, %r9d
	callq	_schedule_erase
	movl	%eax, %ebx
	jmp	LBB0_20
LBB0_19:
	movq	%r12, %rdi
	callq	_spin_unlock
	movq	_EAGAIN@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_20
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_ENOENT,4,2                     ## @ENOENT
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_UBI_IO_BITFLIPS,4,2            ## @UBI_IO_BITFLIPS
	.comm	_UBI_UNKNOWN,4,2                ## @UBI_UNKNOWN
	.comm	_EAGAIN,4,2                     ## @EAGAIN
	.comm	_EUCLEAN,4,2                    ## @EUCLEAN
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ubi_bitflip_check              ; -- Begin function ubi_bitflip_check
	.p2align	2
_ubi_bitflip_check:                     ; @ubi_bitflip_check
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	tbnz	w1, #31, LBB0_10
; %bb.1:
	mov	x23, x1
	mov	x21, x0
	ldr	w8, [x0]
	cmp	w8, w1
	b.le	LBB0_10
; %bb.2:
	mov	x20, x2
	add	x19, x21, #4
	mov	x0, x19
	bl	_down_write
	add	x22, x21, #8
	mov	x0, x22
	bl	_spin_lock
	ldr	x8, [x21, #32]
	ldr	x1, [x8, w23, uxtw #3]
	cbz	x1, LBB0_11
; %bb.3:
	mov	x0, x21
	bl	_scrub_possible
	mov	x24, x0
	mov	x0, x22
	bl	_spin_unlock
	cbz	w24, LBB0_13
; %bb.4:
	cbnz	w20, LBB0_6
; %bb.5:
	add	x24, x21, #40
	mov	x0, x24
	bl	_mutex_lock
	ldp	w4, w1, [x21, #44]
	mov	x0, x21
	mov	x2, x23
	mov	w3, #0
	bl	_ubi_io_read
	mov	x25, x0
	mov	x0, x24
	bl	_mutex_unlock
	mov	w24, #0
Lloh0:
	adrp	x8, _UBI_IO_BITFLIPS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _UBI_IO_BITFLIPS@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w25, w8
	b.ne	LBB0_15
LBB0_6:
	mov	w23, w23
	mov	x0, x22
	bl	_spin_lock
	ldr	x8, [x21, #32]
	ldr	x23, [x8, x23, lsl #3]
	cbz	x23, LBB0_11
; %bb.7:
	mov	x0, x21
	mov	x1, x23
	bl	_scrub_possible
	cbz	w0, LBB0_12
; %bb.8:
	mov	x0, x21
	mov	x1, x23
	bl	_in_pq
	cbz	x0, LBB0_17
; %bb.9:
	ldr	w1, [x23, #4]
	mov	x0, x21
	bl	_prot_queue_del
	b	LBB0_19
LBB0_10:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w24, w8
	b	LBB0_16
LBB0_11:
	mov	x0, x22
	bl	_spin_unlock
Lloh6:
	adrp	x8, _ENOENT@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ENOENT@GOTPAGEOFF]
	b	LBB0_14
LBB0_12:
	mov	x0, x22
	bl	_spin_unlock
LBB0_13:
Lloh8:
	adrp	x8, _EBUSY@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
LBB0_14:
	ldr	w8, [x8]
	neg	w24, w8
LBB0_15:
	mov	x0, x19
	bl	_up_write
LBB0_16:
	mov	x0, x24
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_17:
	add	x24, x21, #24
	mov	x0, x23
	mov	x1, x24
	bl	_in_wl_tree
	cbz	x0, LBB0_22
; %bb.18:
	mov	x0, x23
	mov	x1, x24
	bl	_rb_erase
LBB0_19:
	add	x1, x21, #20
	mov	x0, x23
	bl	_wl_tree_add
	mov	x0, x22
	bl	_spin_unlock
	mov	x0, x21
	mov	w1, #1
	bl	_ensure_wear_leveling
LBB0_20:
	mov	x24, x0
	orr	w8, w24, w20
	cbnz	w8, LBB0_15
LBB0_21:
Lloh10:
	adrp	x8, _EUCLEAN@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EUCLEAN@GOTPAGEOFF]
	b	LBB0_14
LBB0_22:
	add	x24, x21, #16
	mov	x0, x23
	mov	x1, x24
	bl	_in_wl_tree
	cbz	x0, LBB0_24
; %bb.23:
	cmp	w20, #0
	cset	w25, eq
	mov	x0, x23
	mov	x1, x24
	bl	_rb_erase
	ldr	w8, [x21, #12]
	sub	w8, w8, #1
	str	w8, [x21, #12]
	mov	x0, x22
	bl	_spin_unlock
Lloh12:
	adrp	x8, _UBI_UNKNOWN@GOTPAGE
Lloh13:
	ldr	x8, [x8, _UBI_UNKNOWN@GOTPAGEOFF]
Lloh14:
	ldr	w2, [x8]
	mov	x0, x21
	mov	x1, x23
	mov	x3, x2
	mov	x4, x25
	mov	w5, #1
	bl	_schedule_erase
	b	LBB0_20
LBB0_24:
	mov	x0, x22
	bl	_spin_unlock
Lloh15:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh16:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	neg	w24, w8
	orr	w8, w24, w20
	cbnz	w8, LBB0_15
	b	LBB0_21
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_ENOENT,4,2                     ; @ENOENT
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_UBI_IO_BITFLIPS,4,2            ; @UBI_IO_BITFLIPS
	.comm	_UBI_UNKNOWN,4,2                ; @UBI_UNKNOWN
	.comm	_EAGAIN,4,2                     ; @EAGAIN
	.comm	_EUCLEAN,4,2                    ; @EUCLEAN
.subsections_via_symbols
