	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function brcmnand_waitfunc
_brcmnand_waitfunc:                     ## @brcmnand_waitfunc
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %r14
	callq	_nand_get_controller_data
	movq	(%rax), %rbx
	movl	8(%rbx), %edi
	movq	(%rbx), %rdx
	leaq	L_.str(%rip), %rsi
	callq	_dev_dbg
	cmpq	$0, (%rbx)
	je	LBB0_3
## %bb.1:
	movq	%r14, %rdi
	callq	_brcmstb_nand_wait_for_completion
	testl	%eax, %eax
	je	LBB0_3
## %bb.2:
	movq	_BRCMNAND_CMD_START@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_brcmnand_read_reg
	movl	%eax, %r14d
	movq	%rbx, %rdi
	callq	_brcmnand_cmd_shift
	movl	%eax, %ecx
	sarl	%cl, %r14d
	movl	8(%rbx), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%r14d, %edx
	callq	_dev_err_ratelimited
	movl	8(%rbx), %r14d
	movq	_BRCMNAND_INTFC_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_brcmnand_read_reg
	leaq	L_.str.2(%rip), %rsi
	movl	%r14d, %edi
	movl	%eax, %edx
	callq	_dev_err_ratelimited
LBB0_3:
	movq	$0, (%rbx)
	movq	_BRCMNAND_INTFC_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_brcmnand_read_reg
	movq	_INTFC_FLASH_STATUS@GOTPCREL(%rip), %rcx
	andl	(%rcx), %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"wait on native cmd %d\n"

	.comm	_BRCMNAND_CMD_START,4,2         ## @BRCMNAND_CMD_START
L_.str.1:                               ## @.str.1
	.asciz	"timeout waiting for command %#02x\n"

L_.str.2:                               ## @.str.2
	.asciz	"intfc status %08x\n"

	.comm	_BRCMNAND_INTFC_STATUS,4,2      ## @BRCMNAND_INTFC_STATUS
	.comm	_INTFC_FLASH_STATUS,4,2         ## @INTFC_FLASH_STATUS
	.no_dead_strip	_brcmnand_waitfunc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function brcmnand_waitfunc
_brcmnand_waitfunc:                     ; @brcmnand_waitfunc
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x20, x0
	bl	_nand_get_controller_data
	ldr	x19, [x0]
	ldr	w0, [x19, #8]
	ldr	x2, [x19]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
	ldr	x8, [x19]
Lloh2:
	adrp	x21, _BRCMNAND_INTFC_STATUS@GOTPAGE
Lloh3:
	ldr	x21, [x21, _BRCMNAND_INTFC_STATUS@GOTPAGEOFF]
	cbz	x8, LBB0_3
; %bb.1:
	mov	x0, x20
	bl	_brcmstb_nand_wait_for_completion
	cbz	w0, LBB0_3
; %bb.2:
Lloh4:
	adrp	x8, _BRCMNAND_CMD_START@GOTPAGE
Lloh5:
	ldr	x8, [x8, _BRCMNAND_CMD_START@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_brcmnand_read_reg
	mov	x20, x0
	mov	x0, x19
	bl	_brcmnand_cmd_shift
	asr	w2, w20, w0
	ldr	w0, [x19, #8]
Lloh7:
	adrp	x1, l_.str.1@PAGE
Lloh8:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err_ratelimited
	ldr	w20, [x19, #8]
	ldr	w1, [x21]
	mov	x0, x19
	bl	_brcmnand_read_reg
	mov	x2, x0
Lloh9:
	adrp	x1, l_.str.2@PAGE
Lloh10:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x20
	bl	_dev_err_ratelimited
LBB0_3:
	str	xzr, [x19]
	ldr	w1, [x21]
	mov	x0, x19
	bl	_brcmnand_read_reg
Lloh11:
	adrp	x8, _INTFC_FLASH_STATUS@GOTPAGE
Lloh12:
	ldr	x8, [x8, _INTFC_FLASH_STATUS@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	and	w0, w8, w0
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"wait on native cmd %d\n"

	.comm	_BRCMNAND_CMD_START,4,2         ; @BRCMNAND_CMD_START
l_.str.1:                               ; @.str.1
	.asciz	"timeout waiting for command %#02x\n"

l_.str.2:                               ; @.str.2
	.asciz	"intfc status %08x\n"

	.comm	_BRCMNAND_INTFC_STATUS,4,2      ; @BRCMNAND_INTFC_STATUS
	.comm	_INTFC_FLASH_STATUS,4,2         ; @INTFC_FLASH_STATUS
	.no_dead_strip	_brcmnand_waitfunc
.subsections_via_symbols
