	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_nor_write_buffer
_mtk_nor_write_buffer:                  ## @mtk_nor_write_buffer
	.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
	movq	%rdx, %r12
	movq	%rdi, %r14
	callq	_mtk_nor_set_addr
	movq	_SFLASH_WRBUF_SIZE@GOTPCREL(%rip), %r15
	cmpl	$0, (%r15)
	jle	LBB0_3
## %bb.1:
	xorl	%ebx, %ebx
	movq	_MTK_NOR_PP_DATA_REG@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movl	12(%r12,%rbx,4), %eax
	shll	$24, %eax
	movl	4(%r12,%rbx,4), %edi
	movl	8(%r12,%rbx,4), %ecx
	shll	$16, %ecx
	orl	%eax, %ecx
	shll	$8, %edi
	orl	%ecx, %edi
	orl	(%r12,%rbx,4), %edi
	addq	$4, %rbx
	movq	(%r13), %rsi
	addq	(%r14), %rsi
	callq	_writel
	cmpl	%ebx, (%r15)
	jg	LBB0_2
LBB0_3:
	movq	_MTK_NOR_WR_CMD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_mtk_nor_execute_cmd            ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_SFLASH_WRBUF_SIZE,4,2          ## @SFLASH_WRBUF_SIZE
	.comm	_MTK_NOR_PP_DATA_REG,8,3        ## @MTK_NOR_PP_DATA_REG
	.comm	_MTK_NOR_WR_CMD,4,2             ## @MTK_NOR_WR_CMD
	.no_dead_strip	_mtk_nor_write_buffer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_nor_write_buffer
_mtk_nor_write_buffer:                  ; @mtk_nor_write_buffer
	.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	x20, x2
	mov	x19, x0
	bl	_mtk_nor_set_addr
Lloh0:
	adrp	x21, _SFLASH_WRBUF_SIZE@GOTPAGE
Lloh1:
	ldr	x21, [x21, _SFLASH_WRBUF_SIZE@GOTPAGEOFF]
	ldr	w8, [x21]
	cmp	w8, #1
	b.lt	LBB0_3
; %bb.1:
	mov	x22, #0
Lloh2:
	adrp	x23, _MTK_NOR_PP_DATA_REG@GOTPAGE
Lloh3:
	ldr	x23, [x23, _MTK_NOR_PP_DATA_REG@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	add	x8, x20, x22, lsl #2
	ldp	w10, w9, [x8, #8]
	lsl	w10, w10, #16
	orr	w9, w10, w9, lsl #24
	ldp	w8, w10, [x8]
	orr	w9, w9, w10, lsl #8
	orr	w0, w9, w8
	add	x22, x22, #4
	ldr	x8, [x19]
	ldr	x9, [x23]
	add	x1, x9, x8
	bl	_writel
	ldr	w8, [x21]
	cmp	w8, w22
	b.gt	LBB0_2
LBB0_3:
Lloh4:
	adrp	x8, _MTK_NOR_WR_CMD@GOTPAGE
Lloh5:
	ldr	x8, [x8, _MTK_NOR_WR_CMD@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
	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	_mtk_nor_execute_cmd
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.cfi_endproc
                                        ; -- End function
	.comm	_SFLASH_WRBUF_SIZE,4,2          ; @SFLASH_WRBUF_SIZE
	.comm	_MTK_NOR_PP_DATA_REG,8,3        ; @MTK_NOR_PP_DATA_REG
	.comm	_MTK_NOR_WR_CMD,4,2             ; @MTK_NOR_WR_CMD
	.no_dead_strip	_mtk_nor_write_buffer
.subsections_via_symbols
