	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function brcmnand_cmdfunc
_brcmnand_cmdfunc:                      ## @brcmnand_cmdfunc
	.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	%ecx, %r13d
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	movl	%esi, %r14d
	movq	%rdi, %rbx
	callq	_nand_to_mtd
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rdi
	callq	_nand_get_controller_data
	movq	%rax, %r12
	movq	24(%rax), %r15
	movq	%r14, %rax
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	leal	-130(%r14), %eax
	cmpl	$4, %eax
	ja	LBB0_2
## %bb.1:
	movl	$25, %ecx
	btl	%eax, %ecx
	movl	-44(%rbp), %r14d                ## 4-byte Reload
	jb	LBB0_3
LBB0_2:
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movb	(%rax), %cl
	movl	%r13d, %eax
	shll	%cl, %eax
	xorl	%r14d, %r14d
	testl	%r13d, %r13d
	cmovnsl	%eax, %r14d
LBB0_3:
	movl	16(%r15), %edi
	movslq	%r14d, %r13
	leaq	L_.str(%rip), %rsi
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	movl	%ebx, %edx
	movq	%r13, %rcx
	callq	_dev_dbg
	movl	%ebx, (%r12)
	movq	$0, 16(%r12)
	movl	%r13d, 4(%r12)
	leal	-128(%rbx), %eax
	cmpl	$8, %eax
	ja	LBB0_25
## %bb.4:
	leaq	LJTI0_0(%rip), %rcx
	movslq	(%rcx,%rax,4), %rax
	addq	%rcx, %rax
	jmpq	*%rax
LBB0_5:
	movq	_LL_OP_CMD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
                                        ## kill: def $edx killed $edx killed $rdx
	xorl	%ecx, %ecx
	callq	_brcmnand_low_level_op
	movq	_LL_OP_ADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	xorl	%ecx, %ecx
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_brcmnand_low_level_op          ## TAILCALL
LBB0_6:
	movq	_CMD_STATUS_READ@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_7:
	movq	_CMD_PARAMETER_CHANGE_COL@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movq	_FC_BYTES@GOTPCREL(%rip), %rax
	xorl	%ecx, %ecx
	subl	(%rax), %ecx
	andl	%ecx, %r14d
	movq	%r12, %rdi
	callq	_brcmnand_get_sector_size_1k
	testq	%rax, %rax
	je	LBB0_14
## %bb.8:
	movq	%r12, %rdi
	callq	_brcmnand_get_sector_size_1k
	movq	%rax, 8(%r12)
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_brcmnand_set_sector_size_1k
	testl	%r13d, %r13d
	jne	LBB0_15
	jmp	LBB0_25
LBB0_9:
	movq	_CMD_FLASH_RESET@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_11:
	movq	_CMD_SPARE_AREA_READ@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_12:
	movq	_CMD_DEVICE_ID_READ@GOTPCREL(%rip), %rax
LBB0_10:
	movl	(%rax), %r13d
	testl	%r13d, %r13d
	jne	LBB0_15
	jmp	LBB0_25
LBB0_13:
	movq	_CMD_PARAMETER_READ@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
LBB0_14:
	testl	%r13d, %r13d
	je	LBB0_25
LBB0_15:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%r14d, %esi
	callq	_brcmnand_set_cmd_addr
	movq	%r12, %rdi
	movl	%r13d, %esi
	callq	_brcmnand_send_cmd
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	callq	_brcmnand_waitfunc
	movq	_CMD_PARAMETER_READ@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r13d
	je	LBB0_17
## %bb.16:
	movq	_CMD_PARAMETER_CHANGE_COL@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r13d
	jne	LBB0_22
LBB0_17:
	movq	8(%r15), %r14
	movl	(%r15), %edi
	movl	$1, %esi
	callq	_brcmnand_soc_data_bus_prepare
	movq	_FC_WORDS@GOTPCREL(%rip), %r13
	cmpl	$0, (%r13)
	jle	LBB0_20
## %bb.18:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_19:                                ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_brcmnand_read_fc
	movl	%eax, %edi
	callq	_be32_to_cpu
	movl	%eax, (%r14,%rbx,4)
	incq	%rbx
	movslq	(%r13), %rax
	cmpq	%rax, %rbx
	jl	LBB0_19
LBB0_20:
	movl	(%r15), %edi
	movl	$1, %esi
	callq	_brcmnand_soc_data_bus_unprepare
	movq	8(%r12), %rsi
	testq	%rsi, %rsi
	je	LBB0_22
## %bb.21:
	movq	%r12, %rdi
	callq	_brcmnand_set_sector_size_1k
LBB0_22:
	cmpl	$136, -64(%rbp)                 ## 4-byte Folded Reload
	jne	LBB0_25
## %bb.23:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	$1, %esi
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_brcmnand_wp                    ## TAILCALL
LBB0_24:
	movq	_CMD_BLOCK_ERASE@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	xorl	%esi, %esi
	callq	_brcmnand_wp
	testl	%r13d, %r13d
	jne	LBB0_15
LBB0_25:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
	.p2align	2, 0x90
	.data_region jt32
.set L0_0_set_6, LBB0_6-LJTI0_0
.set L0_0_set_5, LBB0_5-LJTI0_0
.set L0_0_set_7, LBB0_7-LJTI0_0
.set L0_0_set_9, LBB0_9-LJTI0_0
.set L0_0_set_11, LBB0_11-LJTI0_0
.set L0_0_set_12, LBB0_12-LJTI0_0
.set L0_0_set_13, LBB0_13-LJTI0_0
.set L0_0_set_24, LBB0_24-LJTI0_0
LJTI0_0:
	.long	L0_0_set_6
	.long	L0_0_set_5
	.long	L0_0_set_7
	.long	L0_0_set_9
	.long	L0_0_set_11
	.long	L0_0_set_12
	.long	L0_0_set_13
	.long	L0_0_set_5
	.long	L0_0_set_24
	.end_data_region
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"cmd 0x%x addr 0x%llx\n"

	.comm	_CMD_FLASH_RESET,4,2            ## @CMD_FLASH_RESET
	.comm	_CMD_STATUS_READ,4,2            ## @CMD_STATUS_READ
	.comm	_CMD_DEVICE_ID_READ,4,2         ## @CMD_DEVICE_ID_READ
	.comm	_CMD_SPARE_AREA_READ,4,2        ## @CMD_SPARE_AREA_READ
	.comm	_CMD_BLOCK_ERASE,4,2            ## @CMD_BLOCK_ERASE
	.comm	_CMD_PARAMETER_READ,4,2         ## @CMD_PARAMETER_READ
	.comm	_LL_OP_CMD,4,2                  ## @LL_OP_CMD
	.comm	_LL_OP_ADDR,4,2                 ## @LL_OP_ADDR
	.comm	_CMD_PARAMETER_CHANGE_COL,4,2   ## @CMD_PARAMETER_CHANGE_COL
	.comm	_FC_BYTES,4,2                   ## @FC_BYTES
	.comm	_FC_WORDS,4,2                   ## @FC_WORDS
	.no_dead_strip	_brcmnand_cmdfunc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function brcmnand_cmdfunc
_brcmnand_cmdfunc:                      ; @brcmnand_cmdfunc
	.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
	mov	x26, x3
	mov	x25, x2
	mov	x19, x1
	mov	x23, x0
	bl	_nand_to_mtd
	mov	x20, x0
	mov	x0, x23
	bl	_nand_get_controller_data
	mov	x21, x0
	ldr	x22, [x0, #24]
	sub	w8, w19, #130
	cmp	w8, #4
	b.hi	LBB0_2
; %bb.1:
	mov	w9, #1
	lsl	w8, w9, w8
	mov	w9, #25
	mov	x24, x25
	tst	w8, w9
	b.ne	LBB0_3
LBB0_2:
	ldr	w8, [x23]
	lsl	w8, w26, w8
	cmp	w26, #0
	csel	w24, wzr, w8, lt
LBB0_3:
	ldr	w0, [x22, #16]
	sxtw	x3, w24
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x19
	bl	_dev_dbg
	str	xzr, [x21, #16]
	stp	w19, w24, [x21]
	sub	w8, w19, #128
	cmp	w8, #8
	b.hi	LBB0_23
; %bb.4:
Lloh2:
	adrp	x9, lJTI0_0@PAGE
Lloh3:
	add	x9, x9, lJTI0_0@PAGEOFF
	adr	x10, LBB0_5
	ldrb	w11, [x9, x8]
	add	x10, x10, x11, lsl #2
	br	x10
LBB0_5:
Lloh4:
	adrp	x8, _LL_OP_CMD@GOTPAGE
Lloh5:
	ldr	x8, [x8, _LL_OP_CMD@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
	mov	x0, x21
	mov	x2, x19
	mov	w3, #0
	bl	_brcmnand_low_level_op
Lloh7:
	adrp	x8, _LL_OP_ADDR@GOTPAGE
Lloh8:
	ldr	x8, [x8, _LL_OP_ADDR@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	mov	x0, x21
	mov	x2, x25
	mov	w3, #0
	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
	b	_brcmnand_low_level_op
LBB0_6:
Lloh10:
	adrp	x8, _CMD_STATUS_READ@GOTPAGE
Lloh11:
	ldr	x8, [x8, _CMD_STATUS_READ@GOTPAGEOFF]
Lloh12:
	ldr	w25, [x8]
	cbnz	w25, LBB0_14
	b	LBB0_23
LBB0_7:
Lloh13:
	adrp	x8, _CMD_PARAMETER_CHANGE_COL@GOTPAGE
Lloh14:
	ldr	x8, [x8, _CMD_PARAMETER_CHANGE_COL@GOTPAGEOFF]
Lloh15:
	ldr	w25, [x8]
Lloh16:
	adrp	x8, _FC_BYTES@GOTPAGE
Lloh17:
	ldr	x8, [x8, _FC_BYTES@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	neg	w8, w8
	and	w24, w24, w8
	mov	x0, x21
	bl	_brcmnand_get_sector_size_1k
	cbz	x0, LBB0_13
; %bb.8:
	mov	x0, x21
	bl	_brcmnand_get_sector_size_1k
	str	x0, [x21, #8]
	mov	x0, x21
	mov	x1, #0
	bl	_brcmnand_set_sector_size_1k
	cbnz	w25, LBB0_14
	b	LBB0_23
LBB0_9:
Lloh19:
	adrp	x8, _CMD_FLASH_RESET@GOTPAGE
Lloh20:
	ldr	x8, [x8, _CMD_FLASH_RESET@GOTPAGEOFF]
Lloh21:
	ldr	w25, [x8]
	cbnz	w25, LBB0_14
	b	LBB0_23
LBB0_10:
Lloh22:
	adrp	x8, _CMD_SPARE_AREA_READ@GOTPAGE
Lloh23:
	ldr	x8, [x8, _CMD_SPARE_AREA_READ@GOTPAGEOFF]
Lloh24:
	ldr	w25, [x8]
	cbnz	w25, LBB0_14
	b	LBB0_23
LBB0_11:
Lloh25:
	adrp	x8, _CMD_DEVICE_ID_READ@GOTPAGE
Lloh26:
	ldr	x8, [x8, _CMD_DEVICE_ID_READ@GOTPAGEOFF]
Lloh27:
	ldr	w25, [x8]
	cbnz	w25, LBB0_14
	b	LBB0_23
LBB0_12:
Lloh28:
	adrp	x8, _CMD_PARAMETER_READ@GOTPAGE
Lloh29:
	ldr	x8, [x8, _CMD_PARAMETER_READ@GOTPAGEOFF]
Lloh30:
	ldr	w25, [x8]
LBB0_13:
	cbz	w25, LBB0_23
LBB0_14:
	mov	x0, x20
	mov	x1, x24
	bl	_brcmnand_set_cmd_addr
	mov	x0, x21
	mov	x1, x25
	bl	_brcmnand_send_cmd
	mov	x0, x23
	bl	_brcmnand_waitfunc
Lloh31:
	adrp	x8, _CMD_PARAMETER_READ@GOTPAGE
Lloh32:
	ldr	x8, [x8, _CMD_PARAMETER_READ@GOTPAGEOFF]
Lloh33:
	ldr	w8, [x8]
Lloh34:
	adrp	x9, _CMD_PARAMETER_CHANGE_COL@GOTPAGE
Lloh35:
	ldr	x9, [x9, _CMD_PARAMETER_CHANGE_COL@GOTPAGEOFF]
Lloh36:
	ldr	w9, [x9]
	cmp	w25, w8
	ccmp	w25, w9, #4, ne
	b.ne	LBB0_20
; %bb.15:
	ldr	x24, [x22, #8]
	ldr	w0, [x22]
	mov	w1, #1
	bl	_brcmnand_soc_data_bus_prepare
Lloh37:
	adrp	x25, _FC_WORDS@GOTPAGE
Lloh38:
	ldr	x25, [x25, _FC_WORDS@GOTPAGEOFF]
	ldr	w8, [x25]
	cmp	w8, #1
	b.lt	LBB0_18
; %bb.16:
	mov	x23, #0
LBB0_17:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x22
	mov	x1, x23
	bl	_brcmnand_read_fc
	bl	_be32_to_cpu
	str	w0, [x24, x23, lsl #2]
	add	x23, x23, #1
	ldrsw	x8, [x25]
	cmp	x23, x8
	b.lt	LBB0_17
LBB0_18:
	ldr	w0, [x22]
	mov	w1, #1
	bl	_brcmnand_soc_data_bus_unprepare
	ldr	x1, [x21, #8]
	cbz	x1, LBB0_20
; %bb.19:
	mov	x0, x21
	bl	_brcmnand_set_sector_size_1k
LBB0_20:
	cmp	w19, #136
	b.ne	LBB0_23
; %bb.21:
	mov	x0, x20
	mov	w1, #1
	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
	b	_brcmnand_wp
LBB0_22:
Lloh39:
	adrp	x8, _CMD_BLOCK_ERASE@GOTPAGE
Lloh40:
	ldr	x8, [x8, _CMD_BLOCK_ERASE@GOTPAGEOFF]
Lloh41:
	ldr	w25, [x8]
	mov	x0, x20
	mov	w1, #0
	bl	_brcmnand_wp
	cbnz	w25, LBB0_14
LBB0_23:
	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
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGot	Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.cfi_endproc
	.section	__TEXT,__const
lJTI0_0:
	.byte	(LBB0_6-LBB0_5)>>2
	.byte	(LBB0_5-LBB0_5)>>2
	.byte	(LBB0_7-LBB0_5)>>2
	.byte	(LBB0_9-LBB0_5)>>2
	.byte	(LBB0_10-LBB0_5)>>2
	.byte	(LBB0_11-LBB0_5)>>2
	.byte	(LBB0_12-LBB0_5)>>2
	.byte	(LBB0_5-LBB0_5)>>2
	.byte	(LBB0_22-LBB0_5)>>2
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"cmd 0x%x addr 0x%llx\n"

	.comm	_CMD_FLASH_RESET,4,2            ; @CMD_FLASH_RESET
	.comm	_CMD_STATUS_READ,4,2            ; @CMD_STATUS_READ
	.comm	_CMD_DEVICE_ID_READ,4,2         ; @CMD_DEVICE_ID_READ
	.comm	_CMD_SPARE_AREA_READ,4,2        ; @CMD_SPARE_AREA_READ
	.comm	_CMD_BLOCK_ERASE,4,2            ; @CMD_BLOCK_ERASE
	.comm	_CMD_PARAMETER_READ,4,2         ; @CMD_PARAMETER_READ
	.comm	_LL_OP_CMD,4,2                  ; @LL_OP_CMD
	.comm	_LL_OP_ADDR,4,2                 ; @LL_OP_ADDR
	.comm	_CMD_PARAMETER_CHANGE_COL,4,2   ; @CMD_PARAMETER_CHANGE_COL
	.comm	_FC_BYTES,4,2                   ; @FC_BYTES
	.comm	_FC_WORDS,4,2                   ; @FC_WORDS
	.no_dead_strip	_brcmnand_cmdfunc
.subsections_via_symbols
