	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sharpsl_nand_hwcontrol
_sharpsl_nand_hwcontrol:                ## @sharpsl_nand_hwcontrol
	.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	%edx, %ebx
	movl	%esi, %r14d
	movq	%rdi, %r12
	callq	_mtd_to_sharpsl
	movq	%rax, %r15
	movq	(%r12), %r12
	movq	_NAND_CTRL_CHANGE@GOTPCREL(%rip), %rax
	testl	%ebx, (%rax)
	je	LBB0_2
## %bb.1:
	movl	%ebx, %eax
	andl	$7, %eax
	shll	$4, %ebx
	andl	$16, %ebx
	orl	%eax, %ebx
	movq	_FLASHCTL@GOTPCREL(%rip), %r13
	movq	(%r13), %rdi
	addq	(%r15), %rdi
	callq	_readb
	andl	$-24, %eax
	orl	%eax, %ebx
	xorl	$17, %ebx
	movq	(%r13), %rsi
	addq	(%r15), %rsi
	movl	%ebx, %edi
	callq	_writeb
LBB0_2:
	movq	_NAND_CMD_NONE@GOTPCREL(%rip), %rax
	cmpl	%r14d, (%rax)
	jne	LBB0_4
## %bb.3:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_4:
	movq	(%r12), %rsi
	movl	%r14d, %edi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_writeb                         ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_NAND_CTRL_CHANGE,4,2           ## @NAND_CTRL_CHANGE
	.comm	_FLASHCTL,8,3                   ## @FLASHCTL
	.comm	_NAND_CMD_NONE,4,2              ## @NAND_CMD_NONE
	.no_dead_strip	_sharpsl_nand_hwcontrol
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sharpsl_nand_hwcontrol
_sharpsl_nand_hwcontrol:                ; @sharpsl_nand_hwcontrol
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x21, x2
	mov	x19, x1
	mov	x22, x0
	bl	_mtd_to_sharpsl
	ldr	x22, [x22]
Lloh0:
	adrp	x8, _NAND_CTRL_CHANGE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _NAND_CTRL_CHANGE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	tst	w8, w21
	b.eq	LBB0_2
; %bb.1:
	mov	x20, x0
	and	w23, w21, #0x7
	bfi	w23, w21, #4, #1
	ldr	x8, [x0]
Lloh3:
	adrp	x21, _FLASHCTL@GOTPAGE
Lloh4:
	ldr	x21, [x21, _FLASHCTL@GOTPAGEOFF]
	ldr	x9, [x21]
	add	x0, x9, x8
	bl	_readb
	mov	w8, #-24
	and	w8, w0, w8
	orr	w8, w23, w8
	mov	w9, #17
	eor	w0, w8, w9
	ldr	x8, [x20]
	ldr	x9, [x21]
	add	x1, x9, x8
	bl	_writeb
LBB0_2:
Lloh5:
	adrp	x8, _NAND_CMD_NONE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _NAND_CMD_NONE@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	cmp	w8, w19
	b.ne	LBB0_4
; %bb.3:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_4:
	ldr	x1, [x22]
	mov	x0, x19
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	b	_writeb
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_NAND_CTRL_CHANGE,4,2           ; @NAND_CTRL_CHANGE
	.comm	_FLASHCTL,8,3                   ; @FLASHCTL
	.comm	_NAND_CMD_NONE,4,2              ; @NAND_CMD_NONE
	.no_dead_strip	_sharpsl_nand_hwcontrol
.subsections_via_symbols
