	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nand_bbm_get_next_page         ## -- Begin function nand_bbm_get_next_page
	.p2align	4, 0x90
_nand_bbm_get_next_page:                ## @nand_bbm_get_next_page
	.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
	movl	%esi, %r14d
	movq	%rdi, %rbx
	callq	_nand_to_mtd
	movl	(%rax), %edx
	subl	4(%rax), %edx
	movb	(%rbx), %cl
	sarl	%cl, %edx
	andl	4(%rbx), %edx
	testl	%r14d, %r14d
	je	LBB0_1
## %bb.2:
	cmpl	$1, %r14d
	jg	LBB0_5
## %bb.3:
	movl	8(%rbx), %ecx
	jmp	LBB0_4
LBB0_1:
	movl	8(%rbx), %ecx
	movq	_NAND_BBM_FIRSTPAGE@GOTPCREL(%rip), %rsi
	xorl	%eax, %eax
	testl	%ecx, (%rsi)
	jne	LBB0_8
LBB0_4:
	movq	_NAND_BBM_SECONDPAGE@GOTPCREL(%rip), %rsi
	movl	$1, %eax
	testl	%ecx, (%rsi)
	jne	LBB0_8
LBB0_5:
	cmpl	%r14d, %edx
	jl	LBB0_7
## %bb.6:
	movq	_NAND_BBM_LASTPAGE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	%edx, %eax
	testl	%ecx, 8(%rbx)
	jne	LBB0_8
LBB0_7:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_8:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_NAND_BBM_FIRSTPAGE,4,2         ## @NAND_BBM_FIRSTPAGE
	.comm	_NAND_BBM_SECONDPAGE,4,2        ## @NAND_BBM_SECONDPAGE
	.comm	_NAND_BBM_LASTPAGE,4,2          ## @NAND_BBM_LASTPAGE
	.comm	_EINVAL,4,2                     ## @EINVAL
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nand_bbm_get_next_page         ; -- Begin function nand_bbm_get_next_page
	.p2align	2
_nand_bbm_get_next_page:                ; @nand_bbm_get_next_page
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x20, x1
	mov	x19, x0
	bl	_nand_to_mtd
	ldp	w10, w11, [x0]
	ldp	w8, w9, [x19]
	cbz	w20, LBB0_3
; %bb.1:
	cmp	w20, #1
	b.gt	LBB0_7
; %bb.2:
	ldr	w12, [x19, #8]
	b	LBB0_5
LBB0_3:
	ldr	w12, [x19, #8]
Lloh0:
	adrp	x13, _NAND_BBM_FIRSTPAGE@GOTPAGE
Lloh1:
	ldr	x13, [x13, _NAND_BBM_FIRSTPAGE@GOTPAGEOFF]
Lloh2:
	ldr	w13, [x13]
	tst	w13, w12
	b.eq	LBB0_5
; %bb.4:
	mov	w0, #0
	b	LBB0_10
LBB0_5:
Lloh3:
	adrp	x13, _NAND_BBM_SECONDPAGE@GOTPAGE
Lloh4:
	ldr	x13, [x13, _NAND_BBM_SECONDPAGE@GOTPAGEOFF]
Lloh5:
	ldr	w13, [x13]
	tst	w13, w12
	b.eq	LBB0_7
; %bb.6:
	mov	w0, #1
	b	LBB0_10
LBB0_7:
	sub	w10, w10, w11
	asr	w8, w10, w8
	and	w0, w8, w9
	cmp	w0, w20
	b.lt	LBB0_9
; %bb.8:
	ldr	w8, [x19, #8]
Lloh6:
	adrp	x9, _NAND_BBM_LASTPAGE@GOTPAGE
Lloh7:
	ldr	x9, [x9, _NAND_BBM_LASTPAGE@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	tst	w9, w8
	b.ne	LBB0_10
LBB0_9:
Lloh9:
	adrp	x8, _EINVAL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_10:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_NAND_BBM_FIRSTPAGE,4,2         ; @NAND_BBM_FIRSTPAGE
	.comm	_NAND_BBM_SECONDPAGE,4,2        ; @NAND_BBM_SECONDPAGE
	.comm	_NAND_BBM_LASTPAGE,4,2          ; @NAND_BBM_LASTPAGE
	.comm	_EINVAL,4,2                     ; @EINVAL
.subsections_via_symbols
