	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function r852_cmdctl
_r852_cmdctl:                           ## @r852_cmdctl
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r15d
	movl	%esi, %r14d
	callq	_nand_to_mtd
	movl	%eax, %edi
	callq	_r852_get_dev
	cmpq	$0, 8(%rax)
	jne	LBB0_16
## %bb.1:
	movq	%rax, %rbx
	movq	_NAND_CTRL_CHANGE@GOTPCREL(%rip), %rax
	testl	%r15d, (%rax)
	je	LBB0_12
## %bb.2:
	movq	_R852_CTL_DATA@GOTPCREL(%rip), %rdi
	movq	_R852_CTL_COMMAND@GOTPCREL(%rip), %rdx
	movl	(%rdx), %eax
	orl	(%rdi), %eax
	movq	_R852_CTL_ON@GOTPCREL(%rip), %r8
	orl	(%r8), %eax
	movq	_R852_CTL_CARDENABLE@GOTPCREL(%rip), %rsi
	orl	(%rsi), %eax
	notl	%eax
	andl	(%rbx), %eax
	movl	%eax, (%rbx)
	movq	_NAND_ALE@GOTPCREL(%rip), %rcx
	testl	%r15d, (%rcx)
	je	LBB0_4
## %bb.3:
	orl	(%rdi), %eax
	movl	%eax, (%rbx)
LBB0_4:
	movq	_NAND_CLE@GOTPCREL(%rip), %rcx
	testl	%r15d, (%rcx)
	je	LBB0_6
## %bb.5:
	orl	(%rdx), %eax
	movl	%eax, (%rbx)
LBB0_6:
	movq	_NAND_NCE@GOTPCREL(%rip), %rcx
	testl	%r15d, (%rcx)
	je	LBB0_8
## %bb.7:
	movl	(%r8), %edx
	orl	(%rsi), %edx
	orl	%eax, %edx
	jmp	LBB0_9
LBB0_8:
	movq	_R852_CTL_WRITE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	notl	%ecx
	andl	%ecx, %eax
	movl	%eax, %edx
LBB0_9:
	movl	%edx, (%rbx)
	movq	_NAND_CMD_ERASE1@GOTPCREL(%rip), %rax
	cmpl	%r14d, (%rax)
	jne	LBB0_11
## %bb.10:
	movq	_R852_CTL_WRITE@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	movl	%edx, (%rbx)
LBB0_11:
	movq	_R852_CTL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_r852_write_reg
LBB0_12:
	movq	_NAND_CMD_SEQIN@GOTPCREL(%rip), %rax
	cmpl	%r14d, (%rax)
	jne	LBB0_15
## %bb.13:
	movl	(%rbx), %edx
	movq	_R852_CTL_COMMAND@GOTPCREL(%rip), %rax
	testl	%edx, (%rax)
	je	LBB0_15
## %bb.14:
	movq	_R852_CTL_WRITE@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	movl	%edx, (%rbx)
	movq	_R852_CTL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_r852_write_reg
LBB0_15:
	movq	_NAND_CMD_NONE@GOTPCREL(%rip), %rax
	cmpl	%r14d, (%rax)
	jne	LBB0_17
LBB0_16:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_17:
	movq	_R852_DATALINE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	movl	%r14d, %edx
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_r852_write_reg                 ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_NAND_CTRL_CHANGE,4,2           ## @NAND_CTRL_CHANGE
	.comm	_R852_CTL_DATA,4,2              ## @R852_CTL_DATA
	.comm	_R852_CTL_COMMAND,4,2           ## @R852_CTL_COMMAND
	.comm	_R852_CTL_ON,4,2                ## @R852_CTL_ON
	.comm	_R852_CTL_CARDENABLE,4,2        ## @R852_CTL_CARDENABLE
	.comm	_NAND_ALE,4,2                   ## @NAND_ALE
	.comm	_NAND_CLE,4,2                   ## @NAND_CLE
	.comm	_NAND_NCE,4,2                   ## @NAND_NCE
	.comm	_R852_CTL_WRITE,4,2             ## @R852_CTL_WRITE
	.comm	_NAND_CMD_ERASE1,4,2            ## @NAND_CMD_ERASE1
	.comm	_R852_CTL,4,2                   ## @R852_CTL
	.comm	_NAND_CMD_SEQIN,4,2             ## @NAND_CMD_SEQIN
	.comm	_NAND_CMD_NONE,4,2              ## @NAND_CMD_NONE
	.comm	_R852_DATALINE,4,2              ## @R852_DATALINE
	.no_dead_strip	_r852_cmdctl
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function r852_cmdctl
_r852_cmdctl:                           ; @r852_cmdctl
	.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	x21, x2
	mov	x19, x1
	bl	_nand_to_mtd
	bl	_r852_get_dev
	ldr	x8, [x0, #8]
	cbnz	x8, LBB0_16
; %bb.1:
	mov	x20, x0
Lloh0:
	adrp	x8, _NAND_CTRL_CHANGE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _NAND_CTRL_CHANGE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x22, _R852_CTL_COMMAND@GOTPAGE
Lloh4:
	ldr	x22, [x22, _R852_CTL_COMMAND@GOTPAGEOFF]
	tst	w8, w21
	b.eq	LBB0_12
; %bb.2:
Lloh5:
	adrp	x11, _R852_CTL_DATA@GOTPAGE
Lloh6:
	ldr	x11, [x11, _R852_CTL_DATA@GOTPAGEOFF]
	ldr	w8, [x11]
	ldr	w9, [x22]
	orr	w9, w9, w8
Lloh7:
	adrp	x8, _R852_CTL_ON@GOTPAGE
Lloh8:
	ldr	x8, [x8, _R852_CTL_ON@GOTPAGEOFF]
	ldr	w10, [x8]
	orr	w9, w9, w10
Lloh9:
	adrp	x10, _R852_CTL_CARDENABLE@GOTPAGE
Lloh10:
	ldr	x10, [x10, _R852_CTL_CARDENABLE@GOTPAGEOFF]
	ldr	w12, [x10]
	orr	w9, w9, w12
	ldr	w12, [x20]
	bic	w9, w12, w9
	str	w9, [x20]
Lloh11:
	adrp	x12, _NAND_ALE@GOTPAGE
Lloh12:
	ldr	x12, [x12, _NAND_ALE@GOTPAGEOFF]
Lloh13:
	ldr	w12, [x12]
	tst	w12, w21
	b.eq	LBB0_4
; %bb.3:
	ldr	w11, [x11]
	orr	w9, w11, w9
	str	w9, [x20]
LBB0_4:
Lloh14:
	adrp	x11, _NAND_CLE@GOTPAGE
Lloh15:
	ldr	x11, [x11, _NAND_CLE@GOTPAGEOFF]
Lloh16:
	ldr	w11, [x11]
	tst	w11, w21
	b.eq	LBB0_6
; %bb.5:
	ldr	w11, [x22]
	orr	w9, w9, w11
	str	w9, [x20]
LBB0_6:
Lloh17:
	adrp	x11, _NAND_NCE@GOTPAGE
Lloh18:
	ldr	x11, [x11, _NAND_NCE@GOTPAGEOFF]
Lloh19:
	ldr	w11, [x11]
	tst	w11, w21
	b.eq	LBB0_8
; %bb.7:
	ldr	w10, [x10]
	ldr	w8, [x8]
	orr	w8, w8, w10
	orr	w2, w8, w9
	b	LBB0_9
LBB0_8:
Lloh20:
	adrp	x8, _R852_CTL_WRITE@GOTPAGE
Lloh21:
	ldr	x8, [x8, _R852_CTL_WRITE@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	bic	w2, w9, w8
LBB0_9:
	str	w2, [x20]
Lloh23:
	adrp	x8, _NAND_CMD_ERASE1@GOTPAGE
Lloh24:
	ldr	x8, [x8, _NAND_CMD_ERASE1@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	cmp	w8, w19
	b.ne	LBB0_11
; %bb.10:
Lloh26:
	adrp	x8, _R852_CTL_WRITE@GOTPAGE
Lloh27:
	ldr	x8, [x8, _R852_CTL_WRITE@GOTPAGEOFF]
Lloh28:
	ldr	w8, [x8]
	orr	w2, w8, w2
	str	w2, [x20]
LBB0_11:
Lloh29:
	adrp	x8, _R852_CTL@GOTPAGE
Lloh30:
	ldr	x8, [x8, _R852_CTL@GOTPAGEOFF]
Lloh31:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_r852_write_reg
LBB0_12:
Lloh32:
	adrp	x8, _NAND_CMD_SEQIN@GOTPAGE
Lloh33:
	ldr	x8, [x8, _NAND_CMD_SEQIN@GOTPAGEOFF]
Lloh34:
	ldr	w8, [x8]
	cmp	w8, w19
	b.ne	LBB0_15
; %bb.13:
	ldr	w8, [x20]
	ldr	w9, [x22]
	tst	w9, w8
	b.eq	LBB0_15
; %bb.14:
Lloh35:
	adrp	x9, _R852_CTL_WRITE@GOTPAGE
Lloh36:
	ldr	x9, [x9, _R852_CTL_WRITE@GOTPAGEOFF]
Lloh37:
	ldr	w9, [x9]
	orr	w2, w9, w8
	str	w2, [x20]
Lloh38:
	adrp	x8, _R852_CTL@GOTPAGE
Lloh39:
	ldr	x8, [x8, _R852_CTL@GOTPAGEOFF]
Lloh40:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_r852_write_reg
LBB0_15:
Lloh41:
	adrp	x8, _NAND_CMD_NONE@GOTPAGE
Lloh42:
	ldr	x8, [x8, _NAND_CMD_NONE@GOTPAGEOFF]
Lloh43:
	ldr	w8, [x8]
	cmp	w8, w19
	b.ne	LBB0_17
LBB0_16:
	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
LBB0_17:
Lloh44:
	adrp	x8, _R852_DATALINE@GOTPAGE
Lloh45:
	ldr	x8, [x8, _R852_DATALINE@GOTPAGEOFF]
Lloh46:
	ldr	w1, [x8]
	mov	x0, x20
	mov	x2, x19
	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
	b	_r852_write_reg
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh41, Lloh42, Lloh43
	.loh AdrpLdrGotLdr	Lloh44, Lloh45, Lloh46
	.cfi_endproc
                                        ; -- End function
	.comm	_NAND_CTRL_CHANGE,4,2           ; @NAND_CTRL_CHANGE
	.comm	_R852_CTL_DATA,4,2              ; @R852_CTL_DATA
	.comm	_R852_CTL_COMMAND,4,2           ; @R852_CTL_COMMAND
	.comm	_R852_CTL_ON,4,2                ; @R852_CTL_ON
	.comm	_R852_CTL_CARDENABLE,4,2        ; @R852_CTL_CARDENABLE
	.comm	_NAND_ALE,4,2                   ; @NAND_ALE
	.comm	_NAND_CLE,4,2                   ; @NAND_CLE
	.comm	_NAND_NCE,4,2                   ; @NAND_NCE
	.comm	_R852_CTL_WRITE,4,2             ; @R852_CTL_WRITE
	.comm	_NAND_CMD_ERASE1,4,2            ; @NAND_CMD_ERASE1
	.comm	_R852_CTL,4,2                   ; @R852_CTL
	.comm	_NAND_CMD_SEQIN,4,2             ; @NAND_CMD_SEQIN
	.comm	_NAND_CMD_NONE,4,2              ; @NAND_CMD_NONE
	.comm	_R852_DATALINE,4,2              ; @R852_DATALINE
	.no_dead_strip	_r852_cmdctl
.subsections_via_symbols
