	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function brcmnand_read_by_pio
_brcmnand_read_by_pio:                  ## @brcmnand_read_by_pio
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r9, %r15
	movq	%r8, %rbx
	movl	%ecx, %r12d
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	movq	%rdi, -72(%rbp)                 ## 8-byte Spill
	movq	%rsi, -88(%rbp)                 ## 8-byte Spill
	movq	%rsi, %rdi
	callq	_nand_get_controller_data
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	8(%rax), %r14
	movq	%r14, %rdi
	callq	_brcmnand_clear_ecc_addr
	testl	%r12d, %r12d
	je	LBB0_1
## %bb.2:
	movl	%r12d, %eax
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	xorl	%ecx, %ecx
	movq	_FC_WORDS@GOTPCREL(%rip), %r12
	xorl	%r13d, %r13d
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movl	-44(%rbp), %r15d                ## 4-byte Reload
	jmp	LBB0_3
LBB0_14:                                ##   in Loop: Header=BB0_3 Depth=1
	negl	%ecx
	.p2align	4, 0x90
LBB0_17:                                ##   in Loop: Header=BB0_3 Depth=1
	incl	%r13d
	movq	_FC_BYTES@GOTPCREL(%rip), %rax
	addl	(%rax), %r15d
	movl	-48(%rbp), %eax                 ## 4-byte Reload
	cmpl	%eax, %r13d
	je	LBB0_18
LBB0_3:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_6 Depth 2
	movq	%rcx, -80(%rbp)                 ## 8-byte Spill
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	movl	%r15d, %esi
	callq	_brcmnand_set_cmd_addr
	movq	_CMD_PAGE_READ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_brcmnand_send_cmd
	movq	-88(%rbp), %rdi                 ## 8-byte Reload
	callq	_brcmnand_waitfunc
	movq	%rbx, %rdi
	callq	_likely
	testq	%rax, %rax
	movl	%r15d, -44(%rbp)                ## 4-byte Spill
	je	LBB0_8
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	(%r14), %edi
	xorl	%esi, %esi
	callq	_brcmnand_soc_data_bus_prepare
	cmpl	$0, (%r12)
	jle	LBB0_7
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	xorl	%r15d, %r15d
	.p2align	4, 0x90
LBB0_6:                                 ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	%r14, %rdi
	movl	%r15d, %esi
	callq	_brcmnand_read_fc
	movl	%eax, (%rbx)
	incl	%r15d
	addq	$4, %rbx
	cmpl	(%r12), %r15d
	jl	LBB0_6
LBB0_7:                                 ##   in Loop: Header=BB0_3 Depth=1
	movl	(%r14), %edi
	xorl	%esi, %esi
	callq	_brcmnand_soc_data_bus_unprepare
LBB0_8:                                 ##   in Loop: Header=BB0_3 Depth=1
	movl	-48(%rbp), %ecx                 ## 4-byte Reload
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	testq	%r15, %r15
	je	LBB0_9
## %bb.10:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %eax
	xorl	%edx, %edx
	divl	%ecx
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movl	(%rcx), %r8d
	movq	%r14, %rdi
	movl	%r13d, %esi
	movq	%r15, %rdx
	movl	%eax, %ecx
	callq	_read_oob_from_regs
	cltq
	leaq	(%r15,%rax,4), %r15
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	jmp	LBB0_11
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_3 Depth=1
	xorl	%eax, %eax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
LBB0_11:                                ##   in Loop: Header=BB0_3 Depth=1
	movl	-44(%rbp), %r15d                ## 4-byte Reload
	movq	-80(%rbp), %rcx                 ## 8-byte Reload
	testl	%ecx, %ecx
	jne	LBB0_17
## %bb.12:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	%r14, %rdi
	callq	_brcmnand_get_uncorrecc_addr
	movq	16(%rbp), %rcx
	movl	%eax, (%rcx)
	testl	%eax, %eax
	je	LBB0_15
## %bb.13:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	_EBADMSG@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	testl	%ecx, %ecx
	jne	LBB0_14
LBB0_15:                                ##   in Loop: Header=BB0_3 Depth=1
	movq	%r14, %rdi
	callq	_brcmnand_get_correcc_addr
	movq	16(%rbp), %rcx
	movl	%eax, (%rcx)
	xorl	%ecx, %ecx
	testl	%eax, %eax
	je	LBB0_17
## %bb.16:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	_EUCLEAN@GOTPCREL(%rip), %rax
	subl	(%rax), %ecx
	jmp	LBB0_17
LBB0_1:
	xorl	%ecx, %ecx
LBB0_18:
	movl	%ecx, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CMD_PAGE_READ,4,2              ## @CMD_PAGE_READ
	.comm	_FC_WORDS,4,2                   ## @FC_WORDS
	.comm	_EBADMSG,4,2                    ## @EBADMSG
	.comm	_EUCLEAN,4,2                    ## @EUCLEAN
	.comm	_FC_BYTES,8,3                   ## @FC_BYTES
	.no_dead_strip	_brcmnand_read_by_pio
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function brcmnand_read_by_pio
_brcmnand_read_by_pio:                  ; @brcmnand_read_by_pio
	.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
	str	x6, [sp, #8]                    ; 8-byte Folded Spill
	mov	x23, x5
	mov	x20, x4
	mov	x21, x3
	mov	x22, x2
	mov	x24, x0
	str	x1, [sp, #24]                   ; 8-byte Folded Spill
	mov	x0, x1
	bl	_nand_get_controller_data
	mov	x26, x0
	ldr	x27, [x0, #8]
	mov	x0, x27
	bl	_brcmnand_clear_ecc_addr
	mov	w19, #0
	cbz	w21, LBB0_17
; %bb.1:
	mov	w28, #0
Lloh0:
	adrp	x25, _FC_WORDS@GOTPAGE
Lloh1:
	ldr	x25, [x25, _FC_WORDS@GOTPAGEOFF]
	str	x24, [sp, #16]                  ; 8-byte Folded Spill
	b	LBB0_6
LBB0_2:                                 ;   in Loop: Header=BB0_6 Depth=1
	mov	x0, x27
	bl	_brcmnand_get_correcc_addr
	ldr	x8, [sp, #8]                    ; 8-byte Folded Reload
	str	w0, [x8]
	cbz	w0, LBB0_16
; %bb.3:                                ;   in Loop: Header=BB0_6 Depth=1
Lloh2:
	adrp	x8, _EUCLEAN@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EUCLEAN@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
LBB0_4:                                 ;   in Loop: Header=BB0_6 Depth=1
	neg	w19, w8
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	add	w28, w28, #1
Lloh5:
	adrp	x8, _FC_BYTES@GOTPAGE
Lloh6:
	ldr	x8, [x8, _FC_BYTES@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	add	w22, w22, w8
	cmp	w28, w21
	b.eq	LBB0_17
LBB0_6:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_9 Depth 2
	mov	x0, x24
	mov	x1, x22
	bl	_brcmnand_set_cmd_addr
Lloh8:
	adrp	x8, _CMD_PAGE_READ@GOTPAGE
Lloh9:
	ldr	x8, [x8, _CMD_PAGE_READ@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	mov	x0, x26
	bl	_brcmnand_send_cmd
	ldr	x0, [sp, #24]                   ; 8-byte Folded Reload
	bl	_brcmnand_waitfunc
	mov	x0, x20
	bl	_likely
	cbz	x0, LBB0_11
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	w0, [x27]
	mov	w1, #0
	bl	_brcmnand_soc_data_bus_prepare
	ldr	w8, [x25]
	cmp	w8, #1
	b.lt	LBB0_10
; %bb.8:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	w24, #0
LBB0_9:                                 ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	mov	x0, x27
	mov	x1, x24
	bl	_brcmnand_read_fc
	str	w0, [x20], #4
	add	w24, w24, #1
	ldr	w8, [x25]
	cmp	w24, w8
	b.lt	LBB0_9
LBB0_10:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	w0, [x27]
	mov	w1, #0
	bl	_brcmnand_soc_data_bus_unprepare
	ldr	x24, [sp, #16]                  ; 8-byte Folded Reload
LBB0_11:                                ;   in Loop: Header=BB0_6 Depth=1
	cbz	x23, LBB0_13
; %bb.12:                               ;   in Loop: Header=BB0_6 Depth=1
	ldr	w8, [x24]
	ldr	w4, [x26]
	udiv	w3, w8, w21
	mov	x0, x27
	mov	x1, x28
	mov	x2, x23
	bl	_read_oob_from_regs
	add	x23, x23, w0, sxtw #2
LBB0_13:                                ;   in Loop: Header=BB0_6 Depth=1
	cbnz	w19, LBB0_5
; %bb.14:                               ;   in Loop: Header=BB0_6 Depth=1
	mov	x0, x27
	bl	_brcmnand_get_uncorrecc_addr
	ldr	x8, [sp, #8]                    ; 8-byte Folded Reload
	str	w0, [x8]
	cbz	w0, LBB0_2
; %bb.15:                               ;   in Loop: Header=BB0_6 Depth=1
Lloh11:
	adrp	x8, _EBADMSG@GOTPAGE
Lloh12:
	ldr	x8, [x8, _EBADMSG@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	cbnz	w8, LBB0_4
	b	LBB0_2
LBB0_16:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	w19, #0
	b	LBB0_5
LBB0_17:
	mov	x0, x19
	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 AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_CMD_PAGE_READ,4,2              ; @CMD_PAGE_READ
	.comm	_FC_WORDS,4,2                   ; @FC_WORDS
	.comm	_EBADMSG,4,2                    ; @EBADMSG
	.comm	_EUCLEAN,4,2                    ; @EUCLEAN
	.comm	_FC_BYTES,8,3                   ; @FC_BYTES
	.no_dead_strip	_brcmnand_read_by_pio
.subsections_via_symbols
