	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ubi_io_read                    ## -- Begin function ubi_io_read
	.p2align	4, 0x90
_ubi_io_read:                           ## @ubi_io_read
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%r8d, %r14d
	movl	%ecx, %r13d
	movl	%edx, %r12d
	movq	%rsi, -80(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r15
	leaq	L_.str(%rip), %rdi
	movl	%r8d, %esi
	callq	_dbg_io
	xorl	%ebx, %ebx
	movl	$0, %edi
	testl	%r12d, %r12d
	js	LBB0_2
## %bb.1:
	xorl	%edi, %edi
	cmpl	%r12d, (%r15)
	setg	%dil
LBB0_2:
	callq	_ubi_assert
	testl	%r13d, %r13d
	js	LBB0_4
## %bb.3:
	leal	(%r14,%r13), %eax
	xorl	%ebx, %ebx
	cmpl	4(%r15), %eax
	setle	%bl
LBB0_4:
	movq	%r13, -64(%rbp)                 ## 8-byte Spill
	movl	%ebx, %edi
	callq	_ubi_assert
	xorl	%edi, %edi
	testl	%r14d, %r14d
	setg	%dil
	callq	_ubi_assert
	movq	%r15, %rdi
	movl	%r12d, %esi
	callq	_self_check_not_bad
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_18
## %bb.5:
	movq	-80(%rbp), %r8                  ## 8-byte Reload
	notb	(%r8)
	movl	4(%r15), %esi
	movl	%r12d, -44(%rbp)                ## 4-byte Spill
	imull	%r12d, %esi
	addl	-64(%rbp), %esi                 ## 4-byte Folded Reload
	movl	8(%r15), %edi
	leaq	-56(%rbp), %rcx
	movl	%esi, -68(%rbp)                 ## 4-byte Spill
	movl	%r14d, %edx
	callq	_mtd_read
	testl	%eax, %eax
	je	LBB0_14
## %bb.6:
	movl	%eax, %r13d
	movl	$-1, %r12d
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movl	%r13d, %edi
	callq	_mtd_is_eccerr
	testq	%rax, %rax
	leaq	L_.str.1(%rip), %rbx
	leaq	L_.str.2(%rip), %rax
	cmoveq	%rax, %rbx
	movl	%r13d, %edi
	callq	_mtd_is_bitflip
	testq	%rax, %rax
	jne	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_7 Depth=1
	incl	%r12d
	movq	_UBI_IO_RETRIES@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jge	LBB0_10
## %bb.13:                              ##   in Loop: Header=BB0_7 Depth=1
	movq	%r15, %rdi
	leaq	L_.str.4(%rip), %rsi
	movl	%r13d, %edx
	movq	%rbx, %rcx
	movl	%r14d, %r8d
	movl	-44(%rbp), %r9d                 ## 4-byte Reload
	pushq	-56(%rbp)
	pushq	-64(%rbp)                       ## 8-byte Folded Reload
	callq	_ubi_warn
	addq	$16, %rsp
	xorl	%eax, %eax
	callq	_yield
	movl	8(%r15), %edi
	movl	-68(%rbp), %esi                 ## 4-byte Reload
	movl	%r14d, %edx
	leaq	-56(%rbp), %rcx
	movq	-80(%rbp), %r8                  ## 8-byte Reload
	callq	_mtd_read
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_7
LBB0_14:
	movslq	%r14d, %rax
	xorl	%edi, %edi
	cmpq	%rax, -56(%rbp)
	sete	%dil
	callq	_ubi_assert
	movq	%r15, %rdi
	callq	_ubi_dbg_is_bitflip
	testq	%rax, %rax
	je	LBB0_15
## %bb.16:
	leaq	L_.str.6(%rip), %rdi
	callq	_dbg_gen
	jmp	LBB0_17
LBB0_8:
	leaq	L_.str.3(%rip), %rsi
	movq	%r15, %rdi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	callq	_ubi_msg
	movslq	%r14d, %rax
	xorl	%edi, %edi
	cmpq	%rax, -56(%rbp)
	sete	%dil
	callq	_ubi_assert
LBB0_17:
	movq	_UBI_IO_BITFLIPS@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	jmp	LBB0_18
LBB0_15:
	xorl	%r13d, %r13d
	jmp	LBB0_18
LBB0_10:
	leaq	L_.str.5(%rip), %rsi
	movq	%r15, %rdi
	movl	%r13d, %edx
	movq	%rbx, %rcx
	movl	%r14d, %r8d
	movl	-44(%rbp), %r9d                 ## 4-byte Reload
	pushq	-56(%rbp)
	pushq	-64(%rbp)                       ## 8-byte Folded Reload
	callq	_ubi_err
	addq	$16, %rsp
	xorl	%eax, %eax
	callq	_dump_stack
	movslq	%r14d, %rax
	cmpq	%rax, -56(%rbp)
	je	LBB0_18
## %bb.11:
	movl	%r13d, %edi
	callq	_mtd_is_eccerr
	testq	%rax, %rax
	je	LBB0_18
## %bb.12:
	xorl	%r13d, %r13d
	xorl	%edi, %edi
	callq	_ubi_assert
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %r13d
LBB0_18:
	movl	%r13d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"read %d bytes from PEB %d:%d"

L_.str.1:                               ## @.str.1
	.asciz	" (ECC error)"

L_.str.2:                               ## @.str.2
	.space	1

L_.str.3:                               ## @.str.3
	.asciz	"fixable bit-flip detected at PEB %d"

	.comm	_UBI_IO_BITFLIPS,4,2            ## @UBI_IO_BITFLIPS
	.comm	_UBI_IO_RETRIES,4,2             ## @UBI_IO_RETRIES
L_.str.4:                               ## @.str.4
	.asciz	"error %d%s while reading %d bytes from PEB %d:%d, read only %zd bytes, retry"

L_.str.5:                               ## @.str.5
	.asciz	"error %d%s while reading %d bytes from PEB %d:%d, read %zd bytes"

	.comm	_EIO,4,2                        ## @EIO
L_.str.6:                               ## @.str.6
	.asciz	"bit-flip (emulated)"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ubi_io_read                    ; -- Begin function ubi_io_read
	.p2align	2
_ubi_io_read:                           ; @ubi_io_read
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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, x4
	mov	x22, x3
	mov	x21, x2
	mov	x23, x1
	mov	x20, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x4
	bl	_dbg_io
	tbnz	w21, #31, LBB0_3
; %bb.1:
	ldr	w8, [x20]
	cmp	w8, w21
	cset	w0, gt
	bl	_ubi_assert
	tbnz	w22, #31, LBB0_4
LBB0_2:
	ldr	w8, [x20, #4]
	add	w9, w19, w22
	cmp	w9, w8
	cset	w0, le
	b	LBB0_5
LBB0_3:
	mov	w0, #0
	bl	_ubi_assert
	tbz	w22, #31, LBB0_2
LBB0_4:
	mov	w0, #0
LBB0_5:
	bl	_ubi_assert
	cmp	w19, #0
	cset	w0, gt
	bl	_ubi_assert
	mov	x0, x20
	mov	x1, x21
	bl	_self_check_not_bad
	mov	x24, x0
	cbnz	w0, LBB0_19
; %bb.6:
	ldr	w8, [x23]
	eor	w8, w8, #0xff
	str	w8, [x23]
	ldp	w8, w0, [x20, #4]
	madd	w25, w8, w21, w22
	add	x3, sp, #8
	mov	x1, x25
	mov	x2, x19
	mov	x4, x23
	bl	_mtd_read
	cbz	w0, LBB0_11
; %bb.7:
	mov	x24, x0
	mov	w28, #-1
Lloh2:
	adrp	x26, l_.str.2@PAGE
Lloh3:
	add	x26, x26, l_.str.2@PAGEOFF
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x24
	bl	_mtd_is_eccerr
	cmp	x0, #0
Lloh4:
	adrp	x8, l_.str.1@PAGE
Lloh5:
	add	x8, x8, l_.str.1@PAGEOFF
	csel	x27, x26, x8, eq
	mov	x0, x24
	bl	_mtd_is_bitflip
	cbnz	x0, LBB0_13
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
Lloh6:
	adrp	x8, _UBI_IO_RETRIES@GOTPAGE
Lloh7:
	ldr	x8, [x8, _UBI_IO_RETRIES@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	add	w28, w28, #1
	cmp	w28, w8
	b.ge	LBB0_16
; %bb.10:                               ;   in Loop: Header=BB0_8 Depth=1
	ldr	x7, [sp, #8]
	mov	x0, x20
Lloh9:
	adrp	x1, l_.str.4@PAGE
Lloh10:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x2, x24
	mov	x3, x27
	mov	x4, x19
	mov	x5, x21
	mov	x6, x22
	bl	_ubi_warn
	bl	_yield
	ldr	w0, [x20, #8]
	add	x3, sp, #8
	mov	x1, x25
	mov	x2, x19
	mov	x4, x23
	bl	_mtd_read
	mov	x24, x0
	cbnz	w0, LBB0_8
LBB0_11:
	ldr	x8, [sp, #8]
	cmp	x8, w19, sxtw
	cset	w0, eq
	bl	_ubi_assert
	mov	x0, x20
	bl	_ubi_dbg_is_bitflip
	cbz	x0, LBB0_15
; %bb.12:
Lloh11:
	adrp	x0, l_.str.6@PAGE
Lloh12:
	add	x0, x0, l_.str.6@PAGEOFF
	bl	_dbg_gen
	b	LBB0_14
LBB0_13:
Lloh13:
	adrp	x1, l_.str.3@PAGE
Lloh14:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x20
	mov	x2, x21
	bl	_ubi_msg
	ldr	x8, [sp, #8]
	cmp	x8, w19, sxtw
	cset	w0, eq
	bl	_ubi_assert
LBB0_14:
Lloh15:
	adrp	x8, _UBI_IO_BITFLIPS@GOTPAGE
Lloh16:
	ldr	x8, [x8, _UBI_IO_BITFLIPS@GOTPAGEOFF]
Lloh17:
	ldr	w24, [x8]
	b	LBB0_19
LBB0_15:
	mov	w24, #0
	b	LBB0_19
LBB0_16:
	ldr	x7, [sp, #8]
Lloh18:
	adrp	x1, l_.str.5@PAGE
Lloh19:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	x0, x20
	mov	x2, x24
	mov	x3, x27
	mov	x4, x19
	mov	x5, x21
	mov	x6, x22
	bl	_ubi_err
	bl	_dump_stack
	ldr	x8, [sp, #8]
	cmp	x8, w19, sxtw
	b.eq	LBB0_19
; %bb.17:
	mov	x0, x24
	bl	_mtd_is_eccerr
	cbz	x0, LBB0_19
; %bb.18:
	mov	w0, #0
	bl	_ubi_assert
Lloh20:
	adrp	x8, _EIO@GOTPAGE
Lloh21:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	neg	w24, w8
LBB0_19:
	mov	x0, x24
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"read %d bytes from PEB %d:%d"

l_.str.1:                               ; @.str.1
	.asciz	" (ECC error)"

l_.str.2:                               ; @.str.2
	.space	1

l_.str.3:                               ; @.str.3
	.asciz	"fixable bit-flip detected at PEB %d"

	.comm	_UBI_IO_BITFLIPS,4,2            ; @UBI_IO_BITFLIPS
	.comm	_UBI_IO_RETRIES,4,2             ; @UBI_IO_RETRIES
l_.str.4:                               ; @.str.4
	.asciz	"error %d%s while reading %d bytes from PEB %d:%d, read only %zd bytes, retry"

l_.str.5:                               ; @.str.5
	.asciz	"error %d%s while reading %d bytes from PEB %d:%d, read %zd bytes"

	.comm	_EIO,4,2                        ; @EIO
l_.str.6:                               ; @.str.6
	.asciz	"bit-flip (emulated)"

.subsections_via_symbols
