	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ns_nand_read_byte
_ns_nand_read_byte:                     ## @ns_nand_read_byte
	.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), %rax
	movq	(%rax), %rbx
	cmpl	$0, 96(%rbx)
	je	LBB0_4
## %bb.1:
	cmpq	$0, 88(%rbx)
	jne	LBB0_3
## %bb.2:
	cmpq	$0, 80(%rbx)
	je	LBB0_7
LBB0_3:
	leaq	L_.str.1(%rip), %rdi
	jmp	LBB0_5
LBB0_4:
	leaq	L_.str(%rip), %rdi
LBB0_5:
	xorl	%r14d, %r14d
	xorl	%esi, %esi
	callq	_NS_ERR
LBB0_6:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_7:
	movl	(%rbx), %edi
	movq	_STATE_DATAOUT_MASK@GOTPCREL(%rip), %rax
	testl	%edi, (%rax)
	je	LBB0_10
## %bb.8:
	callq	_NS_STATE
	movq	_STATE_DATAOUT_STATUS@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_11
## %bb.9:
	movq	24(%rbx), %rsi
	leaq	L_.str.3(%rip), %rdi
	xorl	%eax, %eax
	callq	_NS_DBG
	movl	24(%rbx), %r14d
	jmp	LBB0_6
LBB0_10:
	callq	_get_state_name
	leaq	L_.str.2(%rip), %rdi
	xorl	%r14d, %r14d
	movl	%eax, %esi
	xorl	%edx, %edx
	xorl	%eax, %eax
	callq	_NS_WARN
	jmp	LBB0_6
LBB0_11:
	movq	32(%rbx), %rax
	cmpq	40(%rbx), %rax
	jne	LBB0_13
## %bb.12:
	leaq	L_.str.4(%rip), %rdi
	xorl	%r14d, %r14d
	xorl	%esi, %esi
	xorl	%eax, %eax
	callq	_NS_WARN
	jmp	LBB0_6
LBB0_13:
	movl	(%rbx), %edi
	callq	_NS_STATE
	cmpq	$128, %rax
	je	LBB0_17
## %bb.14:
	cmpq	$129, %rax
	jne	LBB0_19
## %bb.15:
	cmpl	$8, 4(%rbx)
	jne	LBB0_20
## %bb.16:
	movq	32(%rbx), %rax
	movq	64(%rbx), %rcx
	jmp	LBB0_18
LBB0_17:
	movq	32(%rbx), %rsi
	movq	40(%rbx), %rdx
	leaq	L_.str.5(%rip), %rdi
	xorl	%eax, %eax
	callq	_NS_DBG
	movq	8(%rbx), %rcx
	movq	32(%rbx), %rax
LBB0_18:
	movl	(%rcx,%rax,4), %r14d
	incq	%rax
	jmp	LBB0_21
LBB0_19:
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_BUG
	movq	32(%rbx), %rax
	jmp	LBB0_22
LBB0_20:
	movq	32(%rbx), %rax
	movq	72(%rbx), %rcx
	andq	$-2, %rax
	movl	(%rcx,%rax,2), %edi
	callq	_cpu_to_le16
	movl	%eax, %r14d
	movq	32(%rbx), %rax
	addq	$2, %rax
LBB0_21:
	movq	%rax, 32(%rbx)
LBB0_22:
	cmpq	40(%rbx), %rax
	jne	LBB0_6
## %bb.23:
	leaq	L_.str.6(%rip), %rdi
	xorl	%eax, %eax
	callq	_NS_DBG
	movq	_OPT_AUTOINCR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 16(%rbx)
	je	LBB0_28
## %bb.24:
	movl	(%rbx), %edi
	callq	_NS_STATE
	cmpq	$129, %rax
	jne	LBB0_28
## %bb.25:
	movq	$0, 32(%rbx)
	movq	48(%rbx), %rsi
	leaq	1(%rsi), %rax
	cmpq	56(%rbx), %rax
	jge	LBB0_27
## %bb.26:
	movq	%rax, 48(%rbx)
	movq	%rax, %rsi
LBB0_27:
	leaq	L_.str.7(%rip), %rdi
	xorl	%eax, %eax
	callq	_NS_DBG
	movq	_ACTION_CPY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_do_state_action
	jmp	LBB0_6
LBB0_28:
	movl	20(%rbx), %edi
	callq	_NS_STATE
	movq	_STATE_READY@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_6
## %bb.29:
	movq	%rbx, %rdi
	callq	_switch_state
	jmp	LBB0_6
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"read_byte: chip is disabled, return %#x\n"

L_.str.1:                               ## @.str.1
	.asciz	"read_byte: ALE or CLE pin is high, return %#x\n"

	.comm	_STATE_DATAOUT_MASK,4,2         ## @STATE_DATAOUT_MASK
L_.str.2:                               ## @.str.2
	.asciz	"read_byte: unexpected data output cycle, state is %s return %#x\n"

	.comm	_STATE_DATAOUT_STATUS,8,3       ## @STATE_DATAOUT_STATUS
L_.str.3:                               ## @.str.3
	.asciz	"read_byte: return %#x status\n"

L_.str.4:                               ## @.str.4
	.asciz	"read_byte: no more data to output, return %#x\n"

L_.str.5:                               ## @.str.5
	.asciz	"read_byte: read ID byte %d, total = %d\n"

L_.str.6:                               ## @.str.6
	.asciz	"read_byte: all bytes were read\n"

	.comm	_OPT_AUTOINCR,4,2               ## @OPT_AUTOINCR
L_.str.7:                               ## @.str.7
	.asciz	"read_byte: switch to the next page (%#x)\n"

	.comm	_ACTION_CPY,4,2                 ## @ACTION_CPY
	.comm	_STATE_READY,8,3                ## @STATE_READY
	.no_dead_strip	_ns_nand_read_byte
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ns_nand_read_byte
_ns_nand_read_byte:                     ; @ns_nand_read_byte
	.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
	ldr	x8, [x0]
	ldr	x19, [x8]
	ldr	w8, [x19, #96]
	cbz	w8, LBB0_4
; %bb.1:
	ldr	x8, [x19, #88]
	cbnz	x8, LBB0_3
; %bb.2:
	ldr	x8, [x19, #80]
	cbz	x8, LBB0_8
LBB0_3:
Lloh0:
	adrp	x0, l_.str.1@PAGE
Lloh1:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_5
LBB0_4:
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
LBB0_5:
	mov	w1, #0
	bl	_NS_ERR
LBB0_6:
	mov	w20, #0
LBB0_7:
	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
LBB0_8:
	ldr	w0, [x19]
Lloh4:
	adrp	x8, _STATE_DATAOUT_MASK@GOTPAGE
Lloh5:
	ldr	x8, [x8, _STATE_DATAOUT_MASK@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	tst	w8, w0
	b.eq	LBB0_11
; %bb.9:
	bl	_NS_STATE
Lloh7:
	adrp	x8, _STATE_DATAOUT_STATUS@GOTPAGE
Lloh8:
	ldr	x8, [x8, _STATE_DATAOUT_STATUS@GOTPAGEOFF]
Lloh9:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_12
; %bb.10:
	ldr	x8, [x19, #24]
	str	x8, [sp]
Lloh10:
	adrp	x0, l_.str.3@PAGE
Lloh11:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_NS_DBG
	ldr	w20, [x19, #24]
	b	LBB0_7
LBB0_11:
	bl	_get_state_name
	mov	x1, x0
	str	xzr, [sp]
Lloh12:
	adrp	x0, l_.str.2@PAGE
Lloh13:
	add	x0, x0, l_.str.2@PAGEOFF
	b	LBB0_14
LBB0_12:
	ldp	x8, x9, [x19, #32]
	cmp	x8, x9
	b.ne	LBB0_15
; %bb.13:
Lloh14:
	adrp	x0, l_.str.4@PAGE
Lloh15:
	add	x0, x0, l_.str.4@PAGEOFF
	mov	w1, #0
LBB0_14:
	bl	_NS_WARN
	b	LBB0_6
LBB0_15:
	ldr	w0, [x19]
	bl	_NS_STATE
	cmp	x0, #128
	b.eq	LBB0_19
; %bb.16:
	cmp	x0, #129
	b.ne	LBB0_21
; %bb.17:
	ldr	w8, [x19, #4]
	cmp	w8, #8
	b.ne	LBB0_22
; %bb.18:
	ldr	x8, [x19, #64]
	b	LBB0_20
LBB0_19:
	ldp	x8, x9, [x19, #32]
	stp	x8, x9, [sp]
Lloh16:
	adrp	x0, l_.str.5@PAGE
Lloh17:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_NS_DBG
	ldr	x8, [x19, #8]
LBB0_20:
	ldr	x9, [x19, #32]
	ldr	w20, [x8, x9, lsl #2]
	add	x8, x9, #1
	b	LBB0_23
LBB0_21:
	bl	_BUG
	mov	w20, #0
	ldr	x8, [x19, #32]
	b	LBB0_24
LBB0_22:
	ldr	x8, [x19, #72]
	ldr	x9, [x19, #32]
	lsl	x9, x9, #1
	and	x9, x9, #0xfffffffffffffffc
	ldr	w0, [x8, x9]
	bl	_cpu_to_le16
	mov	x20, x0
	ldr	x8, [x19, #32]
	add	x8, x8, #2
LBB0_23:
	str	x8, [x19, #32]
LBB0_24:
	ldr	x9, [x19, #40]
	cmp	x8, x9
	b.ne	LBB0_7
; %bb.25:
Lloh18:
	adrp	x0, l_.str.6@PAGE
Lloh19:
	add	x0, x0, l_.str.6@PAGEOFF
	bl	_NS_DBG
	ldr	w8, [x19, #16]
Lloh20:
	adrp	x9, _OPT_AUTOINCR@GOTPAGE
Lloh21:
	ldr	x9, [x9, _OPT_AUTOINCR@GOTPAGEOFF]
Lloh22:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_30
; %bb.26:
	ldr	w0, [x19]
	bl	_NS_STATE
	cmp	x0, #129
	b.ne	LBB0_30
; %bb.27:
	str	xzr, [x19, #32]
	ldp	x8, x10, [x19, #48]
	add	x9, x8, #1
	cmp	x9, x10
	b.ge	LBB0_29
; %bb.28:
	str	x9, [x19, #48]
	mov	x8, x9
LBB0_29:
	str	x8, [sp]
Lloh23:
	adrp	x0, l_.str.7@PAGE
Lloh24:
	add	x0, x0, l_.str.7@PAGEOFF
	bl	_NS_DBG
Lloh25:
	adrp	x8, _ACTION_CPY@GOTPAGE
Lloh26:
	ldr	x8, [x8, _ACTION_CPY@GOTPAGEOFF]
Lloh27:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_do_state_action
	b	LBB0_7
LBB0_30:
	ldr	w0, [x19, #20]
	bl	_NS_STATE
Lloh28:
	adrp	x8, _STATE_READY@GOTPAGE
Lloh29:
	ldr	x8, [x8, _STATE_READY@GOTPAGEOFF]
Lloh30:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_7
; %bb.31:
	mov	x0, x19
	bl	_switch_state
	b	LBB0_7
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"read_byte: chip is disabled, return %#x\n"

l_.str.1:                               ; @.str.1
	.asciz	"read_byte: ALE or CLE pin is high, return %#x\n"

	.comm	_STATE_DATAOUT_MASK,4,2         ; @STATE_DATAOUT_MASK
l_.str.2:                               ; @.str.2
	.asciz	"read_byte: unexpected data output cycle, state is %s return %#x\n"

	.comm	_STATE_DATAOUT_STATUS,8,3       ; @STATE_DATAOUT_STATUS
l_.str.3:                               ; @.str.3
	.asciz	"read_byte: return %#x status\n"

l_.str.4:                               ; @.str.4
	.asciz	"read_byte: no more data to output, return %#x\n"

l_.str.5:                               ; @.str.5
	.asciz	"read_byte: read ID byte %d, total = %d\n"

l_.str.6:                               ; @.str.6
	.asciz	"read_byte: all bytes were read\n"

	.comm	_OPT_AUTOINCR,4,2               ; @OPT_AUTOINCR
l_.str.7:                               ; @.str.7
	.asciz	"read_byte: switch to the next page (%#x)\n"

	.comm	_ACTION_CPY,4,2                 ; @ACTION_CPY
	.comm	_STATE_READY,8,3                ; @STATE_READY
	.no_dead_strip	_ns_nand_read_byte
.subsections_via_symbols
