	.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, %r13d
	movl	%ecx, %r12d
	movl	%edx, %r15d
	movq	%rsi, -72(%rbp)                 ## 8-byte Spill
	movq	%rdi, %r14
	leaq	L_.str(%rip), %rdi
	xorl	%ebx, %ebx
	movl	%r8d, %esi
	xorl	%eax, %eax
	callq	_dbg_io
	movl	$0, %edi
	testl	%r15d, %r15d
	js	LBB0_2
## %bb.1:
	xorl	%edi, %edi
	cmpl	%r15d, (%r14)
	setg	%dil
LBB0_2:
	callq	_ubi_assert
	testl	%r12d, %r12d
	js	LBB0_4
## %bb.3:
	leal	(%r12,%r13), %eax
	xorl	%ebx, %ebx
	cmpl	4(%r14), %eax
	setle	%bl
LBB0_4:
	movl	%ebx, %edi
	callq	_ubi_assert
	xorl	%edi, %edi
	testl	%r13d, %r13d
	setg	%dil
	callq	_ubi_assert
	movq	%r14, %rdi
	movl	%r15d, %esi
	callq	_paranoid_check_not_bad
	testl	%eax, %eax
	je	LBB0_6
## %bb.5:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%r12d, %r12d
	subl	(%rcx), %r12d
	testl	%eax, %eax
	cmovlel	%eax, %r12d
	jmp	LBB0_19
LBB0_6:
	movq	%r14, %rax
	movl	4(%r14), %r14d
	imull	%r15d, %r14d
	movq	%r12, -64(%rbp)                 ## 8-byte Spill
	addl	%r12d, %r14d
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	movq	8(%rax), %rdi
	leaq	-48(%rbp), %rcx
	movl	%r14d, %esi
	movl	%r13d, %edx
	movq	-72(%rbp), %r8                  ## 8-byte Reload
	callq	*(%rdi)
	movl	%eax, %r12d
	movslq	%r13d, %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	testl	%r12d, %r12d
	je	LBB0_13
## %bb.7:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movq	_EUCLEAN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%r12d, %eax
	je	LBB0_9
## %bb.10:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	-48(%rbp), %r9
	cmpq	-56(%rbp), %r9                  ## 8-byte Folded Reload
	je	LBB0_16
## %bb.11:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	_UBI_IO_RETRIES@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ebx
	jge	LBB0_16
## %bb.12:                              ##   in Loop: Header=BB0_8 Depth=1
	incl	%ebx
	leaq	L_.str.2(%rip), %rdi
	movl	%r12d, %esi
	movl	%r13d, %edx
	movl	%r15d, %ecx
	movq	-64(%rbp), %r8                  ## 8-byte Reload
                                        ## kill: def $r8d killed $r8d killed $r8
	xorl	%eax, %eax
	callq	_dbg_io
	xorl	%eax, %eax
	callq	_yield
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	movq	8(%rax), %rdi
	movl	%r14d, %esi
	movl	%r13d, %edx
	leaq	-48(%rbp), %rcx
	movq	-72(%rbp), %r8                  ## 8-byte Reload
	callq	*(%rdi)
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_8
LBB0_13:
	xorl	%edi, %edi
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	cmpq	%rax, -48(%rbp)
	sete	%dil
	callq	_ubi_assert
	xorl	%r12d, %r12d
	xorl	%eax, %eax
	callq	_ubi_dbg_is_bitflip
	testq	%rax, %rax
	je	LBB0_19
## %bb.14:
	leaq	L_.str.4(%rip), %rdi
	callq	_dbg_gen
	jmp	LBB0_15
LBB0_9:
	leaq	L_.str.1(%rip), %rdi
	movl	%r15d, %esi
	callq	_dbg_msg
	xorl	%edi, %edi
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	cmpq	%rax, -48(%rbp)
	sete	%dil
	callq	_ubi_assert
LBB0_15:
	movq	_UBI_IO_BITFLIPS@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
LBB0_19:
	movl	%r12d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_16:
	leaq	L_.str.3(%rip), %rdi
	movl	%r12d, %esi
	movl	%r13d, %edx
	movl	%r15d, %ecx
	movq	-64(%rbp), %r8                  ## 8-byte Reload
                                        ## kill: def $r8d killed $r8d killed $r8
	callq	_ubi_err
	xorl	%eax, %eax
	callq	_ubi_dbg_dump_stack
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	cmpq	%rax, -48(%rbp)
	je	LBB0_19
## %bb.17:
	movq	_EBADMSG@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%r12d, %eax
	jne	LBB0_19
## %bb.18:
	xorl	%r12d, %r12d
	xorl	%edi, %edi
	callq	_ubi_assert
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %r12d
	jmp	LBB0_19
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"read %d bytes from PEB %d:%d"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_EUCLEAN,4,2                    ## @EUCLEAN
L_.str.1:                               ## @.str.1
	.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.2:                               ## @.str.2
	.asciz	"error %d while reading %d bytes from PEB %d:%d, read only %zd bytes, retry"

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

	.comm	_EBADMSG,4,2                    ## @EBADMSG
	.comm	_EIO,4,2                        ## @EIO
L_.str.4:                               ## @.str.4
	.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, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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	x21, x4
	mov	x20, x3
	mov	x19, x2
	mov	x22, x1
	mov	x23, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x4
	bl	_dbg_io
	tbnz	w19, #31, LBB0_3
; %bb.1:
	ldr	w8, [x23]
	cmp	w8, w19
	cset	w0, gt
	bl	_ubi_assert
	tbnz	w20, #31, LBB0_4
LBB0_2:
	ldr	w8, [x23, #4]
	add	w9, w21, w20
	cmp	w9, w8
	cset	w0, le
	b	LBB0_5
LBB0_3:
	mov	w0, #0
	bl	_ubi_assert
	tbz	w20, #31, LBB0_2
LBB0_4:
	mov	w0, #0
LBB0_5:
	bl	_ubi_assert
	cmp	w21, #0
	cset	w0, gt
	bl	_ubi_assert
	mov	x0, x23
	mov	x1, x19
	bl	_paranoid_check_not_bad
	cbz	w0, LBB0_7
; %bb.6:
Lloh2:
	adrp	x8, _EINVAL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	cmp	w0, #0
	csneg	w24, w0, w8, le
	b	LBB0_20
LBB0_7:
	ldr	w8, [x23, #4]
	madd	w25, w8, w19, w20
	ldr	x0, [x23, #8]
	ldr	x8, [x0]
	add	x3, sp, #24
	mov	x1, x25
	mov	x2, x21
	mov	x4, x22
	blr	x8
	sxtw	x27, w21
	cbz	w0, LBB0_12
; %bb.8:
	mov	x24, x0
	mov	w28, #0
Lloh5:
	adrp	x26, _EUCLEAN@GOTPAGE
Lloh6:
	ldr	x26, [x26, _EUCLEAN@GOTPAGEOFF]
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x26]
	cmn	w24, w8
	b.eq	LBB0_14
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
	ldr	x5, [sp, #24]
Lloh7:
	adrp	x8, _UBI_IO_RETRIES@GOTPAGE
Lloh8:
	ldr	x8, [x8, _UBI_IO_RETRIES@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	cmp	x5, x27
	ccmp	w28, w8, #0, ne
	b.ge	LBB0_17
; %bb.11:                               ;   in Loop: Header=BB0_9 Depth=1
	add	w28, w28, #1
	stp	x20, x5, [sp]
Lloh10:
	adrp	x0, l_.str.2@PAGE
Lloh11:
	add	x0, x0, l_.str.2@PAGEOFF
	mov	x1, x24
	mov	x2, x21
	mov	x3, x19
	bl	_dbg_io
	bl	_yield
	ldr	x0, [x23, #8]
	ldr	x8, [x0]
	add	x3, sp, #24
	mov	x1, x25
	mov	x2, x21
	mov	x4, x22
	blr	x8
	mov	x24, x0
	cbnz	w0, LBB0_9
LBB0_12:
	ldr	x8, [sp, #24]
	cmp	x8, x27
	cset	w0, eq
	bl	_ubi_assert
	bl	_ubi_dbg_is_bitflip
	cbz	x0, LBB0_16
; %bb.13:
Lloh12:
	adrp	x0, l_.str.4@PAGE
Lloh13:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_dbg_gen
	b	LBB0_15
LBB0_14:
Lloh14:
	adrp	x0, l_.str.1@PAGE
Lloh15:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x19
	bl	_dbg_msg
	ldr	x8, [sp, #24]
	cmp	x8, x27
	cset	w0, eq
	bl	_ubi_assert
LBB0_15:
Lloh16:
	adrp	x8, _UBI_IO_BITFLIPS@GOTPAGE
Lloh17:
	ldr	x8, [x8, _UBI_IO_BITFLIPS@GOTPAGEOFF]
Lloh18:
	ldr	w24, [x8]
	b	LBB0_20
LBB0_16:
	mov	w24, #0
	b	LBB0_20
LBB0_17:
Lloh19:
	adrp	x0, l_.str.3@PAGE
Lloh20:
	add	x0, x0, l_.str.3@PAGEOFF
	mov	x1, x24
	mov	x2, x21
	mov	x3, x19
	mov	x4, x20
	bl	_ubi_err
	bl	_ubi_dbg_dump_stack
	ldr	x8, [sp, #24]
	cmp	x8, x27
	b.eq	LBB0_20
; %bb.18:
Lloh21:
	adrp	x8, _EBADMSG@GOTPAGE
Lloh22:
	ldr	x8, [x8, _EBADMSG@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	cmn	w24, w8
	b.ne	LBB0_20
; %bb.19:
	mov	w0, #0
	bl	_ubi_assert
Lloh24:
	adrp	x8, _EIO@GOTPAGE
Lloh25:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh26:
	ldr	w8, [x8]
	neg	w24, w8
LBB0_20:
	mov	x0, x24
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"read %d bytes from PEB %d:%d"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_EUCLEAN,4,2                    ; @EUCLEAN
l_.str.1:                               ; @.str.1
	.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.2:                               ; @.str.2
	.asciz	"error %d while reading %d bytes from PEB %d:%d, read only %zd bytes, retry"

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

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

.subsections_via_symbols
