	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function meson_nfc_write_page_sub
_meson_nfc_write_page_sub:              ## @meson_nfc_write_page_sub
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	movl	%esi, %r14d
	movq	%rdi, %rbx
	callq	_nand_to_mtd
	movq	%rax, %r13
	leaq	12(%rbx), %rdi
	callq	_nand_get_sdr_timings
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rdi
	callq	_to_meson_nand
	movq	%rax, %r15
	movq	%rbx, %rdi
	callq	_nand_get_controller_data
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movl	8(%rbx), %esi
	movq	%rbx, %rdi
	callq	_meson_nfc_select_chip
	movl	4(%r13), %r12d
	addl	(%r13), %r12d
	movq	_PER_INFO_BYTE@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	imull	4(%rbx), %r13d
	movq	_DIRWRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_meson_nfc_rw_cmd_prepare_and_execute
	testl	%eax, %eax
	jne	LBB0_6
## %bb.1:
	movl	(%r15), %ecx
	movl	4(%r15), %esi
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %r9d
	movq	%rbx, %rdi
	movl	%r12d, %edx
	movl	%r13d, %r8d
	callq	_meson_nfc_dma_buffer_setup
	testl	%eax, %eax
	jne	LBB0_6
## %bb.2:
	movq	_NAND_NEED_SCRAMBLING@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%rbx)
	je	LBB0_3
## %bb.4:
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_meson_nfc_cmd_seed
	movq	_NFC_CMD_SCRAMBLER_ENABLE@GOTPCREL(%rip), %rax
	jmp	LBB0_5
LBB0_3:
	movq	_NFC_CMD_SCRAMBLER_DISABLE@GOTPCREL(%rip), %rax
	movq	-56(%rbp), %r15                 ## 8-byte Reload
LBB0_5:
	movq	_DIRWRITE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movl	(%rax), %ecx
	movq	%rbx, %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	callq	_meson_nfc_cmd_access
	movq	_NFC_CMD_CLE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	orl	8(%r15), %edi
	movq	_NAND_CMD_PAGEPROG@GOTPCREL(%rip), %rax
	orl	(%rax), %edi
	movq	_NFC_REG_CMD@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%r15), %rsi
	callq	_writel
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edi
	callq	_PSEC_TO_MSEC
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	_meson_nfc_queue_rb
	movq	_DMA_TO_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%rbx, %rdi
	movl	%r12d, %esi
	movl	%r13d, %edx
	callq	_meson_nfc_dma_buffer_release
	xorl	%eax, %eax
LBB0_6:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PER_INFO_BYTE,4,2              ## @PER_INFO_BYTE
	.comm	_DIRWRITE,4,2                   ## @DIRWRITE
	.comm	_DMA_TO_DEVICE,4,2              ## @DMA_TO_DEVICE
	.comm	_NAND_NEED_SCRAMBLING,4,2       ## @NAND_NEED_SCRAMBLING
	.comm	_NFC_CMD_SCRAMBLER_ENABLE,4,2   ## @NFC_CMD_SCRAMBLER_ENABLE
	.comm	_NFC_CMD_SCRAMBLER_DISABLE,4,2  ## @NFC_CMD_SCRAMBLER_DISABLE
	.comm	_NFC_CMD_CLE,4,2                ## @NFC_CMD_CLE
	.comm	_NAND_CMD_PAGEPROG,4,2          ## @NAND_CMD_PAGEPROG
	.comm	_NFC_REG_CMD,8,3                ## @NFC_REG_CMD
	.no_dead_strip	_meson_nfc_write_page_sub
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function meson_nfc_write_page_sub
_meson_nfc_write_page_sub:              ; @meson_nfc_write_page_sub
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x22, x2
	mov	x25, x1
	mov	x19, x0
	bl	_nand_to_mtd
	mov	x23, x0
	add	x0, x19, #12
	bl	_nand_get_sdr_timings
	str	x0, [sp, #8]                    ; 8-byte Folded Spill
	mov	x0, x19
	bl	_to_meson_nand
	mov	x26, x0
	mov	x0, x19
	bl	_nand_get_controller_data
	mov	x21, x0
	ldr	w1, [x19, #8]
	mov	x0, x19
	bl	_meson_nfc_select_chip
	ldp	w24, w23, [x23]
	ldr	w28, [x19, #4]
Lloh0:
	adrp	x8, _PER_INFO_BYTE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PER_INFO_BYTE@GOTPAGEOFF]
Lloh2:
	ldr	w20, [x8]
Lloh3:
	adrp	x27, _DIRWRITE@GOTPAGE
Lloh4:
	ldr	x27, [x27, _DIRWRITE@GOTPAGEOFF]
	ldr	w2, [x27]
	mov	x0, x19
	mov	x1, x25
	bl	_meson_nfc_rw_cmd_prepare_and_execute
	cbnz	w0, LBB0_6
; %bb.1:
	add	w23, w23, w24
	mul	w24, w20, w28
	ldp	w3, w1, [x26]
Lloh5:
	adrp	x26, _DMA_TO_DEVICE@GOTPAGE
Lloh6:
	ldr	x26, [x26, _DMA_TO_DEVICE@GOTPAGEOFF]
	ldr	w5, [x26]
	mov	x0, x19
	mov	x2, x23
	mov	x4, x24
	bl	_meson_nfc_dma_buffer_setup
	cbnz	w0, LBB0_6
; %bb.2:
	ldr	w8, [x19]
Lloh7:
	adrp	x9, _NAND_NEED_SCRAMBLING@GOTPAGE
Lloh8:
	ldr	x9, [x9, _NAND_NEED_SCRAMBLING@GOTPAGEOFF]
Lloh9:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_4
; %bb.3:
	mov	x0, x21
	mov	x1, x25
	bl	_meson_nfc_cmd_seed
Lloh10:
	adrp	x8, _NFC_CMD_SCRAMBLER_ENABLE@GOTPAGE
Lloh11:
	ldr	x8, [x8, _NFC_CMD_SCRAMBLER_ENABLE@GOTPAGEOFF]
	b	LBB0_5
LBB0_4:
Lloh12:
	adrp	x8, _NFC_CMD_SCRAMBLER_DISABLE@GOTPAGE
Lloh13:
	ldr	x8, [x8, _NFC_CMD_SCRAMBLER_DISABLE@GOTPAGEOFF]
LBB0_5:
	ldr	w2, [x27]
	ldr	w3, [x8]
	mov	x0, x19
	mov	x1, x22
	bl	_meson_nfc_cmd_access
Lloh14:
	adrp	x8, _NFC_CMD_CLE@GOTPAGE
Lloh15:
	ldr	x8, [x8, _NFC_CMD_CLE@GOTPAGEOFF]
	ldr	w9, [x21, #8]
Lloh16:
	ldr	w8, [x8]
	orr	w8, w8, w9
Lloh17:
	adrp	x9, _NAND_CMD_PAGEPROG@GOTPAGE
Lloh18:
	ldr	x9, [x9, _NAND_CMD_PAGEPROG@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	orr	w0, w8, w9
	ldr	x8, [x21]
Lloh20:
	adrp	x9, _NFC_REG_CMD@GOTPAGE
Lloh21:
	ldr	x9, [x9, _NFC_REG_CMD@GOTPAGEOFF]
Lloh22:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel
	ldr	x8, [sp, #8]                    ; 8-byte Folded Reload
	ldr	w0, [x8]
	bl	_PSEC_TO_MSEC
	mov	x1, x0
	mov	x0, x21
	bl	_meson_nfc_queue_rb
	ldr	w3, [x26]
	mov	x0, x19
	mov	x1, x23
	mov	x2, x24
	bl	_meson_nfc_dma_buffer_release
	mov	w0, #0
LBB0_6:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_PER_INFO_BYTE,4,2              ; @PER_INFO_BYTE
	.comm	_DIRWRITE,4,2                   ; @DIRWRITE
	.comm	_DMA_TO_DEVICE,4,2              ; @DMA_TO_DEVICE
	.comm	_NAND_NEED_SCRAMBLING,4,2       ; @NAND_NEED_SCRAMBLING
	.comm	_NFC_CMD_SCRAMBLER_ENABLE,4,2   ; @NFC_CMD_SCRAMBLER_ENABLE
	.comm	_NFC_CMD_SCRAMBLER_DISABLE,4,2  ; @NFC_CMD_SCRAMBLER_DISABLE
	.comm	_NFC_CMD_CLE,4,2                ; @NFC_CMD_CLE
	.comm	_NAND_CMD_PAGEPROG,4,2          ; @NAND_CMD_PAGEPROG
	.comm	_NFC_REG_CMD,8,3                ; @NFC_REG_CMD
	.no_dead_strip	_meson_nfc_write_page_sub
.subsections_via_symbols
