	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function doc_write_erase_wait_status
_doc_write_erase_wait_status:           ## @doc_write_erase_wait_status
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	callq	_doc_is_ready
	testl	%eax, %eax
	jne	LBB0_4
## %bb.1:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movl	$20, %edi
	callq	_msleep
	movq	%r15, %rdi
	callq	_doc_is_ready
	testl	%eax, %eax
	jne	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	leal	1(%rbx), %eax
	cmpl	$4, %ebx
	movl	%eax, %ebx
	jb	LBB0_2
LBB0_4:
	movq	%r15, %rdi
	callq	_doc_is_ready
	testl	%eax, %eax
	je	LBB0_5
## %bb.6:
	movq	%r15, %rdi
	callq	_doc_get_op_status
	movq	_DOC_PLANES_STATUS_FAIL@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_7
## %bb.8:
	leaq	L_.str.1(%rip), %rdi
	xorl	%r14d, %r14d
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_doc_dbg
	movq	_EIO@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_5:
	leaq	L_.str(%rip), %rdi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_doc_dbg
	movq	_EAGAIN@GOTPCREL(%rip), %rax
LBB0_9:
	subl	(%rax), %r14d
	jmp	LBB0_10
LBB0_7:
	xorl	%r14d, %r14d
LBB0_10:
	movq	%r15, %rdi
	callq	_doc_page_finish
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Timeout reached and the chip is still not ready\n"

	.comm	_EAGAIN,4,2                     ## @EAGAIN
	.comm	_DOC_PLANES_STATUS_FAIL,4,2     ## @DOC_PLANES_STATUS_FAIL
L_.str.1:                               ## @.str.1
	.asciz	"Erase/Write failed on (a) plane(s), status = %x\n"

	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_doc_write_erase_wait_status
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function doc_write_erase_wait_status
_doc_write_erase_wait_status:           ; @doc_write_erase_wait_status
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.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
	mov	x19, x0
	bl	_doc_is_ready
	cbnz	w0, LBB0_6
; %bb.1:
	mov	w0, #20
	bl	_msleep
	mov	x0, x19
	bl	_doc_is_ready
	cbnz	w0, LBB0_6
; %bb.2:
	mov	w0, #20
	bl	_msleep
	mov	x0, x19
	bl	_doc_is_ready
	cbnz	w0, LBB0_6
; %bb.3:
	mov	w0, #20
	bl	_msleep
	mov	x0, x19
	bl	_doc_is_ready
	cbnz	w0, LBB0_6
; %bb.4:
	mov	w0, #20
	bl	_msleep
	mov	x0, x19
	bl	_doc_is_ready
	cbnz	w0, LBB0_6
; %bb.5:
	mov	w0, #20
	bl	_msleep
	mov	x0, x19
	bl	_doc_is_ready
LBB0_6:
	mov	x0, x19
	bl	_doc_is_ready
	cbz	w0, LBB0_9
; %bb.7:
	mov	x0, x19
	bl	_doc_get_op_status
                                        ; kill: def $w0 killed $w0 def $x0
Lloh0:
	adrp	x8, _DOC_PLANES_STATUS_FAIL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _DOC_PLANES_STATUS_FAIL@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	tst	w8, w0
	b.eq	LBB0_11
; %bb.8:
	str	x0, [sp]
Lloh3:
	adrp	x0, l_.str.1@PAGE
Lloh4:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_doc_dbg
Lloh5:
	adrp	x8, _EIO@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_10
LBB0_9:
Lloh7:
	adrp	x0, l_.str@PAGE
Lloh8:
	add	x0, x0, l_.str@PAGEOFF
	bl	_doc_dbg
Lloh9:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
LBB0_10:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_12
LBB0_11:
	mov	w20, #0
LBB0_12:
	mov	x0, x19
	bl	_doc_page_finish
	mov	x0, x20
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpAdd	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Timeout reached and the chip is still not ready\n"

	.comm	_EAGAIN,4,2                     ; @EAGAIN
	.comm	_DOC_PLANES_STATUS_FAIL,4,2     ; @DOC_PLANES_STATUS_FAIL
l_.str.1:                               ; @.str.1
	.asciz	"Erase/Write failed on (a) plane(s), status = %x\n"

	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_doc_write_erase_wait_status
.subsections_via_symbols
