	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtdswap_readsect
_mtdswap_readsect:                      ## @mtdswap_readsect
	.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
	movq	%rdx, -48(%rbp)                 ## 8-byte Spill
	movq	%rsi, %r15
	callq	_MTDSWAP_MBD_TO_MTDSWAP
	movq	%rax, %rbx
	movq	48(%rax), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	incl	40(%rbx)
	movq	_header@GOTPCREL(%rip), %rax
	cmpq	$0, (%rax)
	je	LBB0_3
## %bb.1:
	xorl	%edi, %edi
	testq	%r15, %r15
	sete	%dil
	callq	_unlikely
	testq	%rax, %rax
	je	LBB0_2
## %bb.14:
	movq	%rbx, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_mtdswap_auto_header            ## TAILCALL
LBB0_2:
	decq	%r15
LBB0_3:
	movq	(%rbx), %rax
	movl	(%rax,%r15,4), %r12d
	movq	_BLOCK_MAX@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jbe	LBB0_5
## %bb.4:
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	xorl	%r15d, %r15d
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	xorl	%esi, %esi
	callq	_memset
	movq	_BLOCK_UNDEF@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jne	LBB0_10
	jmp	LBB0_13
LBB0_5:
	movl	%r12d, %eax
	xorl	%edx, %edx
	divl	8(%rbx)
	movl	%eax, %r13d
	shlq	$2, %r13
	addq	32(%rbx), %r13
	xorl	%r14d, %r14d
	movq	16(%rbx), %rax
	movq	(%rax,%r12,8), %rax
	movq	_PAGE_UNDEF@GOTPCREL(%rip), %rcx
	xorl	%edi, %edi
	cmpq	(%rcx), %rax
	sete	%dil
	callq	_BUG_ON
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	shll	%cl, %r12d
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%r12d, %esi
	leaq	-64(%rbp), %rcx
	movq	-48(%rbp), %r8                  ## 8-byte Reload
	callq	_mtd_read
	movl	%eax, %r15d
	incl	28(%rbx)
	movl	%eax, %edi
	callq	_mtd_is_bitflip
	testq	%rax, %rax
	jne	LBB0_7
## %bb.11:                              ##   in Loop: Header=BB0_6 Depth=1
	testl	%r15d, %r15d
	jns	LBB0_8
## %bb.12:                              ##   in Loop: Header=BB0_6 Depth=1
	movl	24(%rbx), %edi
	movslq	%r15d, %rdx
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	movq	_EBLOCK_READERR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, (%r13)
	movq	_MTDSWAP_FAILING@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	movq	%r13, %rsi
	callq	_mtdswap_rb_add
	incl	%r14d
	movq	_MTDSWAP_IO_RETRIES@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r14d
	jb	LBB0_6
	jmp	LBB0_13
LBB0_7:
	movq	_EBLOCK_BITFLIP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, (%r13)
	movq	_MTDSWAP_BITFLIP@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	movq	%r13, %rsi
	callq	_mtdswap_rb_add
LBB0_8:
	movq	-64(%rbp), %rdx
	xorl	%r15d, %r15d
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rdx
	je	LBB0_13
## %bb.9:
	movl	24(%rbx), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_err
LBB0_10:
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
LBB0_13:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_header,8,3                     ## @header
	.comm	_BLOCK_MAX,4,2                  ## @BLOCK_MAX
	.comm	_PAGE_SIZE,8,3                  ## @PAGE_SIZE
	.comm	_BLOCK_UNDEF,4,2                ## @BLOCK_UNDEF
	.comm	_EIO,4,2                        ## @EIO
	.comm	_PAGE_UNDEF,8,3                 ## @PAGE_UNDEF
	.comm	_PAGE_SHIFT,4,2                 ## @PAGE_SHIFT
	.comm	_EBLOCK_BITFLIP,4,2             ## @EBLOCK_BITFLIP
	.comm	_MTDSWAP_BITFLIP,4,2            ## @MTDSWAP_BITFLIP
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Read error %d\n"

	.comm	_EBLOCK_READERR,4,2             ## @EBLOCK_READERR
	.comm	_MTDSWAP_FAILING,4,2            ## @MTDSWAP_FAILING
	.comm	_MTDSWAP_IO_RETRIES,4,2         ## @MTDSWAP_IO_RETRIES
L_.str.1:                               ## @.str.1
	.asciz	"Short read %zd\n"

	.no_dead_strip	_mtdswap_readsect
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtdswap_readsect
_mtdswap_readsect:                      ; @mtdswap_readsect
	.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	x20, x2
	mov	x22, x1
	bl	_MTDSWAP_MBD_TO_MTDSWAP
	mov	x19, x0
	ldr	x21, [x0, #48]
	ldr	w8, [x0, #40]
	add	w8, w8, #1
	str	w8, [x0, #40]
Lloh0:
	adrp	x8, _header@GOTPAGE
Lloh1:
	ldr	x8, [x8, _header@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cbz	x8, LBB0_4
; %bb.1:
	cmp	x22, #0
	cset	w0, eq
	bl	_unlikely
	cbz	x0, LBB0_3
; %bb.2:
	mov	x0, x19
	mov	x1, x20
	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
	b	_mtdswap_auto_header
LBB0_3:
	sub	x22, x22, #1
LBB0_4:
	ldr	x8, [x19]
	ldr	w23, [x8, x22, lsl #2]
Lloh3:
	adrp	x8, _BLOCK_MAX@GOTPAGE
Lloh4:
	ldr	x8, [x8, _BLOCK_MAX@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w23, w8
	b.ls	LBB0_6
; %bb.5:
Lloh6:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh8:
	ldr	x2, [x8]
	mov	x0, x20
	mov	w1, #0
	bl	_memset
	mov	w24, #0
Lloh9:
	adrp	x8, _BLOCK_UNDEF@GOTPAGE
Lloh10:
	ldr	x8, [x8, _BLOCK_UNDEF@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	cmp	w23, w8
	b.ne	LBB0_14
	b	LBB0_15
LBB0_6:
	ldr	x8, [x19, #32]
	ldr	w9, [x19, #8]
	udiv	w9, w23, w9
	ldr	x10, [x19, #16]
	ldr	x10, [x10, x23, lsl #3]
	add	x22, x8, w9, uxtw #2
Lloh12:
	adrp	x8, _PAGE_UNDEF@GOTPAGE
Lloh13:
	ldr	x8, [x8, _PAGE_UNDEF@GOTPAGEOFF]
Lloh14:
	ldr	x8, [x8]
	cmp	x10, x8
	cset	w0, eq
	bl	_BUG_ON
	mov	w27, #0
Lloh15:
	adrp	x8, _PAGE_SHIFT@GOTPAGE
Lloh16:
	ldr	x8, [x8, _PAGE_SHIFT@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	lsl	w23, w23, w8
Lloh18:
	adrp	x28, _EBLOCK_READERR@GOTPAGE
Lloh19:
	ldr	x28, [x28, _EBLOCK_READERR@GOTPAGEOFF]
Lloh20:
	adrp	x26, _MTDSWAP_FAILING@GOTPAGE
Lloh21:
	ldr	x26, [x26, _MTDSWAP_FAILING@GOTPAGEOFF]
Lloh22:
	adrp	x25, _MTDSWAP_IO_RETRIES@GOTPAGE
Lloh23:
	ldr	x25, [x25, _MTDSWAP_IO_RETRIES@GOTPAGEOFF]
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
Lloh24:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh25:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh26:
	ldr	x2, [x8]
	add	x3, sp, #8
	mov	x0, x21
	mov	x1, x23
	mov	x4, x20
	bl	_mtd_read
	mov	x24, x0
	ldr	w8, [x19, #28]
	add	w8, w8, #1
	str	w8, [x19, #28]
	bl	_mtd_is_bitflip
	cbnz	x0, LBB0_10
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	tbz	w24, #31, LBB0_11
; %bb.9:                                ;   in Loop: Header=BB0_7 Depth=1
	ldr	w0, [x19, #24]
	sxtw	x2, w24
Lloh27:
	adrp	x1, l_.str@PAGE
Lloh28:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	ldr	w8, [x28]
	ldr	w9, [x22]
	orr	w8, w9, w8
	str	w8, [x22]
	ldr	w2, [x26]
	mov	x0, x19
	mov	x1, x22
	bl	_mtdswap_rb_add
	add	w27, w27, #1
	ldr	w8, [x25]
	cmp	w27, w8
	b.lo	LBB0_7
	b	LBB0_15
LBB0_10:
Lloh29:
	adrp	x8, _EBLOCK_BITFLIP@GOTPAGE
Lloh30:
	ldr	x8, [x8, _EBLOCK_BITFLIP@GOTPAGEOFF]
Lloh31:
	ldr	w8, [x8]
	ldr	w9, [x22]
	orr	w8, w9, w8
	str	w8, [x22]
Lloh32:
	adrp	x8, _MTDSWAP_BITFLIP@GOTPAGE
Lloh33:
	ldr	x8, [x8, _MTDSWAP_BITFLIP@GOTPAGEOFF]
Lloh34:
	ldr	w2, [x8]
	mov	x0, x19
	mov	x1, x22
	bl	_mtdswap_rb_add
LBB0_11:
	ldr	x2, [sp, #8]
Lloh35:
	adrp	x8, _PAGE_SIZE@GOTPAGE
Lloh36:
	ldr	x8, [x8, _PAGE_SIZE@GOTPAGEOFF]
Lloh37:
	ldr	x8, [x8]
	cmp	x2, x8
	b.ne	LBB0_13
; %bb.12:
	mov	w24, #0
	b	LBB0_15
LBB0_13:
	ldr	w0, [x19, #24]
Lloh38:
	adrp	x1, l_.str.1@PAGE
Lloh39:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
LBB0_14:
Lloh40:
	adrp	x8, _EIO@GOTPAGE
Lloh41:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh42:
	ldr	w8, [x8]
	neg	w24, w8
LBB0_15:
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpAdd	Lloh38, Lloh39
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.cfi_endproc
                                        ; -- End function
	.comm	_header,8,3                     ; @header
	.comm	_BLOCK_MAX,4,2                  ; @BLOCK_MAX
	.comm	_PAGE_SIZE,8,3                  ; @PAGE_SIZE
	.comm	_BLOCK_UNDEF,4,2                ; @BLOCK_UNDEF
	.comm	_EIO,4,2                        ; @EIO
	.comm	_PAGE_UNDEF,8,3                 ; @PAGE_UNDEF
	.comm	_PAGE_SHIFT,4,2                 ; @PAGE_SHIFT
	.comm	_EBLOCK_BITFLIP,4,2             ; @EBLOCK_BITFLIP
	.comm	_MTDSWAP_BITFLIP,4,2            ; @MTDSWAP_BITFLIP
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Read error %d\n"

	.comm	_EBLOCK_READERR,4,2             ; @EBLOCK_READERR
	.comm	_MTDSWAP_FAILING,4,2            ; @MTDSWAP_FAILING
	.comm	_MTDSWAP_IO_RETRIES,4,2         ; @MTDSWAP_IO_RETRIES
l_.str.1:                               ; @.str.1
	.asciz	"Short read %zd\n"

	.no_dead_strip	_mtdswap_readsect
.subsections_via_symbols
