	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function set_addr
_set_addr:                              ## @set_addr
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r14d
	movl	%esi, %r12d
	callq	_mtd_to_nand
	movq	%rax, %r15
	movq	%rax, %rdi
	callq	_nand_get_controller_data
	movq	%rax, %rbx
	movl	(%rax), %edi
	movl	$0, 4(%rax)
	movq	8(%rax), %rax
	movq	$0, (%rax)
	cmpl	$-1, %r12d
	je	LBB0_4
## %bb.1:
	movq	_NAND_BUSWIDTH_16@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%r15)
	je	LBB0_3
## %bb.2:
	callq	_nand_opcode_8bits
	testl	%eax, %eax
	sete	%cl
	sarl	%cl, %r12d
	movq	8(%rbx), %rax
LBB0_3:
	movzwl	%r12w, %ecx
	movl	%ecx, (%rax)
	movl	$2, 4(%rbx)
LBB0_4:
	cmpl	$-1, %r14d
	je	LBB0_7
## %bb.5:
	movzwl	%r14w, %edx
	movb	4(%rbx), %cl
	shlb	$3, %cl
	shll	%cl, %edx
	orl	%edx, (%rax)
	movl	4(%rbx), %ecx
	leal	2(%rcx), %edx
	movl	%edx, 4(%rbx)
	movq	_NAND_ROW_ADDR_3@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	testl	%edx, (%r15)
	je	LBB0_7
## %bb.6:
	addl	$3, %ecx
	movl	%ecx, 4(%rbx)
	movl	(%rbx), %ecx
	movq	_NAND_CMD_ERASE1@GOTPCREL(%rip), %rdx
	movl	%r14d, %esi
	shrl	$16, %esi
	andl	$16711680, %r14d                ## imm = 0xFF0000
	xorl	%edi, %edi
	cmpl	(%rdx), %ecx
	movzbl	%sil, %ecx
	cmovel	%r14d, %ecx
	setne	%dil
	orl	%ecx, (%rax,%rdi,4)
LBB0_7:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_NAND_BUSWIDTH_16,4,2           ## @NAND_BUSWIDTH_16
	.comm	_NAND_ROW_ADDR_3,4,2            ## @NAND_ROW_ADDR_3
	.comm	_NAND_CMD_ERASE1,4,2            ## @NAND_CMD_ERASE1
	.no_dead_strip	_set_addr
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function set_addr
_set_addr:                              ; @set_addr
	.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	x19, x2
	mov	x22, x1
	bl	_mtd_to_nand
	mov	x21, x0
	bl	_nand_get_controller_data
	mov	x20, x0
	ldr	w0, [x0]
	str	wzr, [x20, #4]
	ldr	x8, [x20, #8]
	str	xzr, [x8]
	cmn	w22, #1
	b.eq	LBB0_4
; %bb.1:
	ldr	w9, [x21]
Lloh0:
	adrp	x10, _NAND_BUSWIDTH_16@GOTPAGE
Lloh1:
	ldr	x10, [x10, _NAND_BUSWIDTH_16@GOTPAGEOFF]
Lloh2:
	ldr	w10, [x10]
	tst	w10, w9
	b.eq	LBB0_3
; %bb.2:
	bl	_nand_opcode_8bits
	cmp	w0, #0
	cset	w8, eq
	asr	w22, w22, w8
	ldr	x8, [x20, #8]
LBB0_3:
	and	w9, w22, #0xffff
	str	w9, [x8]
	mov	w9, #2
	str	w9, [x20, #4]
LBB0_4:
	cmn	w19, #1
	b.eq	LBB0_7
; %bb.5:
	and	w9, w19, #0xffff
	ldr	w10, [x20, #4]
	lsl	w10, w10, #3
	lsl	w9, w9, w10
	ldr	w10, [x8]
	orr	w9, w10, w9
	str	w9, [x8]
	ldr	w9, [x20, #4]
	add	w10, w9, #2
	str	w10, [x20, #4]
	ldr	w10, [x21]
Lloh3:
	adrp	x11, _NAND_ROW_ADDR_3@GOTPAGE
Lloh4:
	ldr	x11, [x11, _NAND_ROW_ADDR_3@GOTPAGEOFF]
Lloh5:
	ldr	w11, [x11]
	tst	w11, w10
	b.eq	LBB0_7
; %bb.6:
	add	w9, w9, #3
	str	w9, [x20, #4]
	ldr	w9, [x20]
Lloh6:
	adrp	x10, _NAND_CMD_ERASE1@GOTPAGE
Lloh7:
	ldr	x10, [x10, _NAND_CMD_ERASE1@GOTPAGEOFF]
Lloh8:
	ldr	w10, [x10]
	ubfx	w11, w19, #16, #8
	and	w12, w19, #0xff0000
	cmp	w9, w10
	csel	w9, w12, w11, eq
	cset	w10, ne
	lsl	x10, x10, #2
	ldr	w11, [x8, x10]
	orr	w9, w11, w9
	str	w9, [x8, x10]
LBB0_7:
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_NAND_BUSWIDTH_16,4,2           ; @NAND_BUSWIDTH_16
	.comm	_NAND_ROW_ADDR_3,4,2            ; @NAND_ROW_ADDR_3
	.comm	_NAND_CMD_ERASE1,4,2            ; @NAND_CMD_ERASE1
	.no_dead_strip	_set_addr
.subsections_via_symbols
