	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nand_update_bbt
_nand_update_bbt:                       ## @nand_update_bbt
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	%rdi, %rbx
	callq	_nand_to_mtd
	cmpl	$0, 12(%rbx)
	je	LBB0_2
## %bb.1:
	movq	24(%rbx), %r15
	testq	%r15, %r15
	je	LBB0_2
## %bb.4:
	movb	(%rbx), %cl
	movl	$1, %edx
	shll	%cl, %edx
	movb	4(%rbx), %cl
	movl	%edx, %edi
	sarl	%cl, %edi
	imull	(%rax), %edi
	movq	16(%rbx), %r13
	addl	%edx, %edi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_kmalloc
	testq	%rax, %rax
	je	LBB0_5
## %bb.6:
	movq	%rax, %rdx
	movq	_NAND_BBT_PERCHIP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r15)
	je	LBB0_7
## %bb.8:
	movb	8(%rbx), %cl
	sarl	%cl, %r14d
	movslq	%r14d, %rax
	jmp	LBB0_9
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_5:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
LBB0_3:
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
	jmp	LBB0_22
LBB0_7:
	movl	$-1, %r14d
	xorl	%eax, %eax
LBB0_9:
	movq	8(%r15), %rcx
	incl	(%rcx,%rax,4)
	testq	%r13, %r13
	je	LBB0_12
## %bb.10:
	movq	8(%r13), %rcx
	incl	(%rcx,%rax,4)
	movq	_NAND_BBT_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r15)
	je	LBB0_11
## %bb.15:
	movq	%rbx, %rdi
	movq	%rdx, -48(%rbp)                 ## 8-byte Spill
	movq	%rdx, %rsi
	movq	%r15, %rdx
	movq	%r13, %rcx
	movl	%r14d, %r8d
	callq	_write_bbt
	movl	%eax, %r12d
	testl	%eax, %eax
	js	LBB0_16
## %bb.17:
	movq	_NAND_BBT_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	testl	%eax, (%r13)
	jne	LBB0_19
	jmp	LBB0_21
LBB0_12:
	movq	_NAND_BBT_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r15)
	je	LBB0_13
## %bb.14:
	movq	%rbx, %rdi
	movq	%rdx, %rbx
	movq	%rdx, %rsi
	movq	%r15, %rdx
	xorl	%ecx, %ecx
	jmp	LBB0_20
LBB0_11:
	xorl	%r12d, %r12d
	testl	%eax, (%r13)
	je	LBB0_21
LBB0_19:
	movq	%rbx, %rdi
	movq	%rdx, %rbx
	movq	%rdx, %rsi
	movq	%r13, %rdx
	movq	%r15, %rcx
LBB0_20:
	movl	%r14d, %r8d
	callq	_write_bbt
	movq	%rbx, %rdx
	movl	%eax, %r12d
	jmp	LBB0_21
LBB0_16:
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	jmp	LBB0_21
LBB0_13:
	xorl	%r12d, %r12d
LBB0_21:
	movq	%rdx, %rdi
	callq	_kfree
LBB0_22:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_NAND_BBT_PERCHIP,4,2           ## @NAND_BBT_PERCHIP
	.comm	_NAND_BBT_WRITE,4,2             ## @NAND_BBT_WRITE
	.no_dead_strip	_nand_update_bbt
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nand_update_bbt
_nand_update_bbt:                       ; @nand_update_bbt
	.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	x23, x1
	mov	x19, x0
	bl	_nand_to_mtd
	ldr	x20, [x19, #24]
	ldr	w8, [x19, #12]
	cmp	w8, #0
	ccmp	x20, #0, #4, ne
	b.ne	LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_6
LBB0_2:
	ldr	x22, [x19, #16]
	mov	w8, #1
	ldp	w9, w10, [x19]
	lsl	w8, w8, w9
	asr	w9, w8, w10
	ldr	w10, [x0]
	madd	w0, w9, w10, w8
Lloh2:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	bl	_kmalloc
	cbz	x0, LBB0_5
; %bb.3:
	mov	x21, x0
	ldr	w8, [x20]
Lloh5:
	adrp	x9, _NAND_BBT_PERCHIP@GOTPAGE
Lloh6:
	ldr	x9, [x9, _NAND_BBT_PERCHIP@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_7
; %bb.4:
	ldr	w8, [x19, #8]
	asr	w23, w23, w8
	sxtw	x8, w23
	b	LBB0_8
LBB0_5:
Lloh8:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_6:
	ldr	w8, [x8]
	neg	w24, w8
	b	LBB0_20
LBB0_7:
	mov	x8, #0
	mov	w23, #-1
LBB0_8:
	ldr	x9, [x20, #8]
	lsl	x8, x8, #2
	ldr	w10, [x9, x8]
	add	w10, w10, #1
	str	w10, [x9, x8]
	cbz	x22, LBB0_12
; %bb.9:
	ldr	x9, [x22, #8]
	ldr	w10, [x9, x8]
	add	w10, w10, #1
	str	w10, [x9, x8]
	ldr	w9, [x20]
Lloh10:
	adrp	x25, _NAND_BBT_WRITE@GOTPAGE
Lloh11:
	ldr	x25, [x25, _NAND_BBT_WRITE@GOTPAGEOFF]
	ldr	w8, [x25]
	tst	w8, w9
	b.eq	LBB0_14
; %bb.10:
	mov	x0, x19
	mov	x1, x21
	mov	x2, x20
	mov	x3, x22
	mov	x4, x23
	bl	_write_bbt
	mov	x24, x0
	tbnz	w0, #31, LBB0_19
; %bb.11:
	ldr	w8, [x25]
	b	LBB0_15
LBB0_12:
	ldr	w8, [x20]
Lloh12:
	adrp	x9, _NAND_BBT_WRITE@GOTPAGE
Lloh13:
	ldr	x9, [x9, _NAND_BBT_WRITE@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_18
; %bb.13:
	mov	x0, x19
	mov	x1, x21
	mov	x2, x20
	mov	x3, #0
	b	LBB0_17
LBB0_14:
	mov	w24, #0
LBB0_15:
	ldr	w9, [x22]
	tst	w8, w9
	b.eq	LBB0_19
; %bb.16:
	mov	x0, x19
	mov	x1, x21
	mov	x2, x22
	mov	x3, x20
LBB0_17:
	mov	x4, x23
	bl	_write_bbt
	mov	x24, x0
	b	LBB0_19
LBB0_18:
	mov	w24, #0
LBB0_19:
	mov	x0, x21
	bl	_kfree
LBB0_20:
	mov	x0, x24
	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 AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_NAND_BBT_PERCHIP,4,2           ; @NAND_BBT_PERCHIP
	.comm	_NAND_BBT_WRITE,4,2             ; @NAND_BBT_WRITE
	.no_dead_strip	_nand_update_bbt
.subsections_via_symbols
