	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sst_write
_sst_write:                             ## @sst_write
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, %r13
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	movq	%rdx, %r12
	movl	%esi, %ebx
	callq	_mtd_to_spi_nor
	movq	%rax, %r15
	movl	16(%rax), %edi
	leaq	L_.str(%rip), %rsi
	movl	%ebx, %edx
	movq	%r12, %rcx
	callq	_dev_dbg
	movq	_SPI_NOR_OPS_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_spi_nor_lock_and_prep
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_19
## %bb.1:
	movq	%r12, -72(%rbp)                 ## 8-byte Spill
	movq	%r13, -64(%rbp)                 ## 8-byte Spill
	movq	%r15, %rdi
	callq	_write_enable
	movl	$0, (%r15)
	movl	%ebx, %eax
	shrl	$31, %eax
	addl	%ebx, %eax
	andl	$-2, %eax
	movl	%ebx, %ecx
	subl	%eax, %ecx
	movslq	%ecx, %rcx
	testl	%ecx, %ecx
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	je	LBB0_5
## %bb.2:
	movq	%rcx, %r13
	movq	_SPINOR_OP_BP@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 8(%r15)
	movq	%r15, %rdi
	movl	%ebx, %esi
	movl	$1, %edx
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	callq	_spi_nor_write_data
	movl	%eax, %r14d
	testl	%eax, %eax
	js	LBB0_12
## %bb.3:
	xorl	%edi, %edi
	cmpl	$1, %r14d
	setne	%dil
	leaq	L_.str.1(%rip), %rsi
	movl	%r14d, %edx
	callq	_WARN
	movq	%r15, %rdi
	callq	_spi_nor_wait_till_ready
	testl	%eax, %eax
	movq	%r13, %rcx
	je	LBB0_5
## %bb.4:
	movl	%eax, %r14d
	jmp	LBB0_18
LBB0_5:
	movq	%r15, %r13
	addl	%ecx, %ebx
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	leaq	-1(%rax), %r15
	cmpq	%rcx, %r15
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	jbe	LBB0_10
## %bb.6:
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	leaq	(%rax,%rcx,4), %r12
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	_SPINOR_OP_AAI_WP@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 8(%r13)
	movq	%r13, %rdi
	movl	%ebx, %esi
	movl	$2, %edx
	movq	%r12, %rcx
	callq	_spi_nor_write_data
	movl	%eax, %r14d
	testl	%eax, %eax
	js	LBB0_16
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	xorl	%edi, %edi
	cmpl	$2, %r14d
	setne	%dil
	leaq	L_.str.2(%rip), %rsi
	movl	%r14d, %edx
	callq	_WARN
	movq	%r13, %rdi
	callq	_spi_nor_wait_till_ready
	testl	%eax, %eax
	jne	LBB0_15
## %bb.9:                               ##   in Loop: Header=BB0_7 Depth=1
	addl	$2, %ebx
	movl	$1, (%r13)
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	addq	$2, %rax
	addq	$8, %r12
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	cmpq	%r15, %rax
	jb	LBB0_7
LBB0_10:
	movl	$0, (%r13)
	movq	%r13, %rdi
	callq	_write_disable
	movq	%r13, %rdi
	callq	_spi_nor_wait_till_ready
	testl	%eax, %eax
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	movq	%r13, %r15
	je	LBB0_13
LBB0_11:
	movl	%eax, %r14d
	jmp	LBB0_17
LBB0_12:
	movq	%r13, %rcx
	jmp	LBB0_18
LBB0_13:
	xorl	%r14d, %r14d
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	cmpq	%rax, %rcx
	jne	LBB0_20
## %bb.14:
	movq	%rax, %rcx
	jmp	LBB0_18
LBB0_15:
	movl	%eax, %r14d
LBB0_16:
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	movq	%r13, %r15
LBB0_17:
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
LBB0_18:
	addq	%rcx, (%r12)
	movq	_SPI_NOR_OPS_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_spi_nor_unlock_and_unprep
LBB0_19:
	movl	%r14d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_20:
	movq	%r15, %rdi
	movq	%rcx, %r13
	callq	_write_enable
	movq	_SPINOR_OP_BP@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 8(%r15)
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	leaq	(%rax,%r13,4), %rcx
	movq	%r15, %rdi
	movl	%ebx, %esi
	movl	$1, %edx
	callq	_spi_nor_write_data
	testl	%eax, %eax
	js	LBB0_11
## %bb.21:
	xorl	%edi, %edi
	cmpl	$1, %eax
	setne	%dil
	leaq	L_.str.1(%rip), %rsi
	movl	%eax, %edx
	callq	_WARN
	movq	%r15, %rdi
	callq	_spi_nor_wait_till_ready
	testl	%eax, %eax
	jne	LBB0_11
## %bb.22:
	movq	%r15, %rdi
	callq	_write_disable
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	incq	%rcx
	jmp	LBB0_18
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"to 0x%08x, len %zd\n"

	.comm	_SPI_NOR_OPS_WRITE,4,2          ## @SPI_NOR_OPS_WRITE
	.comm	_SPINOR_OP_BP,8,3               ## @SPINOR_OP_BP
L_.str.1:                               ## @.str.1
	.asciz	"While writing 1 byte written %i bytes\n"

	.comm	_SPINOR_OP_AAI_WP,8,3           ## @SPINOR_OP_AAI_WP
L_.str.2:                               ## @.str.2
	.asciz	"While writing 2 bytes written %i bytes\n"

	.no_dead_strip	_sst_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sst_write
_sst_write:                             ; @sst_write
	.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	x25, x4
	mov	x19, x3
	mov	x22, x2
	mov	x24, x1
	bl	_mtd_to_spi_nor
	mov	x20, x0
	ldr	w0, [x0, #16]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x24
	mov	x3, x22
	bl	_dev_dbg
Lloh2:
	adrp	x21, _SPI_NOR_OPS_WRITE@GOTPAGE
Lloh3:
	ldr	x21, [x21, _SPI_NOR_OPS_WRITE@GOTPAGEOFF]
	ldr	w1, [x21]
	mov	x0, x20
	bl	_spi_nor_lock_and_prep
	mov	x23, x0
	cbnz	w0, LBB0_16
; %bb.1:
	mov	x0, x20
	bl	_write_enable
	str	wzr, [x20]
	and	w8, w24, #0x1
	cmp	w24, #0
	cneg	w8, w8, lt
	sxtw	x28, w8
	cbz	w8, LBB0_4
; %bb.2:
Lloh4:
	adrp	x8, _SPINOR_OP_BP@GOTPAGE
Lloh5:
	ldr	x8, [x8, _SPINOR_OP_BP@GOTPAGEOFF]
Lloh6:
	ldr	x8, [x8]
	str	x8, [x20, #8]
	mov	x0, x20
	mov	x1, x24
	mov	w2, #1
	mov	x3, x25
	bl	_spi_nor_write_data
	mov	x23, x0
	tbnz	w0, #31, LBB0_15
; %bb.3:
	cmp	w23, #1
	cset	w0, ne
Lloh7:
	adrp	x1, l_.str.1@PAGE
Lloh8:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x23
	bl	_WARN
	mov	x0, x20
	bl	_spi_nor_wait_till_ready
	cbnz	w0, LBB0_10
LBB0_4:
	add	w24, w28, w24
	sub	x27, x22, #1
	cmp	x27, x28
	stp	x25, x19, [sp]                  ; 16-byte Folded Spill
	b.ls	LBB0_9
; %bb.5:
	add	x25, x25, x28, lsl #2
Lloh9:
	adrp	x19, _SPINOR_OP_AAI_WP@GOTPAGE
Lloh10:
	ldr	x19, [x19, _SPINOR_OP_AAI_WP@GOTPAGEOFF]
	mov	w21, #1
Lloh11:
	adrp	x26, l_.str.2@PAGE
Lloh12:
	add	x26, x26, l_.str.2@PAGEOFF
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19]
	str	x8, [x20, #8]
	mov	x0, x20
	mov	x1, x24
	mov	w2, #2
	mov	x3, x25
	bl	_spi_nor_write_data
	mov	x23, x0
	tbnz	w0, #31, LBB0_14
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	cmp	w23, #2
	cset	w0, ne
	mov	x1, x26
	mov	x2, x23
	bl	_WARN
	mov	x0, x20
	bl	_spi_nor_wait_till_ready
	cbnz	w0, LBB0_13
; %bb.8:                                ;   in Loop: Header=BB0_6 Depth=1
	add	w24, w24, #2
	str	w21, [x20]
	add	x28, x28, #2
	add	x25, x25, #8
	cmp	x28, x27
	b.lo	LBB0_6
LBB0_9:
	str	wzr, [x20]
	mov	x0, x20
	bl	_write_disable
	mov	x0, x20
	bl	_spi_nor_wait_till_ready
	ldr	x19, [sp, #8]                   ; 8-byte Folded Reload
Lloh13:
	adrp	x21, _SPI_NOR_OPS_WRITE@GOTPAGE
Lloh14:
	ldr	x21, [x21, _SPI_NOR_OPS_WRITE@GOTPAGEOFF]
	cbz	w0, LBB0_11
LBB0_10:
	mov	x23, x0
	b	LBB0_15
LBB0_11:
	cmp	x28, x22
	b.ne	LBB0_17
; %bb.12:
	mov	w23, #0
	mov	x28, x22
	b	LBB0_15
LBB0_13:
	mov	x23, x0
LBB0_14:
	ldr	x19, [sp, #8]                   ; 8-byte Folded Reload
Lloh15:
	adrp	x21, _SPI_NOR_OPS_WRITE@GOTPAGE
Lloh16:
	ldr	x21, [x21, _SPI_NOR_OPS_WRITE@GOTPAGEOFF]
LBB0_15:
	ldr	x8, [x19]
	add	x8, x8, x28
	str	x8, [x19]
	ldr	w1, [x21]
	mov	x0, x20
	bl	_spi_nor_unlock_and_unprep
LBB0_16:
	mov	x0, x23
	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
LBB0_17:
	mov	x0, x20
	bl	_write_enable
Lloh17:
	adrp	x8, _SPINOR_OP_BP@GOTPAGE
Lloh18:
	ldr	x8, [x8, _SPINOR_OP_BP@GOTPAGEOFF]
Lloh19:
	ldr	x8, [x8]
	str	x8, [x20, #8]
	ldr	x8, [sp]                        ; 8-byte Folded Reload
	add	x3, x8, x28, lsl #2
	mov	x0, x20
	mov	x1, x24
	mov	w2, #1
	bl	_spi_nor_write_data
	mov	x23, x0
	tbnz	w0, #31, LBB0_15
; %bb.18:
	cmp	w23, #1
	cset	w0, ne
Lloh20:
	adrp	x1, l_.str.1@PAGE
Lloh21:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x23
	bl	_WARN
	mov	x0, x20
	bl	_spi_nor_wait_till_ready
	mov	x23, x0
	cbnz	w0, LBB0_15
; %bb.19:
	mov	x0, x20
	bl	_write_disable
	add	x28, x28, #1
	b	LBB0_15
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"to 0x%08x, len %zd\n"

	.comm	_SPI_NOR_OPS_WRITE,4,2          ; @SPI_NOR_OPS_WRITE
	.comm	_SPINOR_OP_BP,8,3               ; @SPINOR_OP_BP
l_.str.1:                               ; @.str.1
	.asciz	"While writing 1 byte written %i bytes\n"

	.comm	_SPINOR_OP_AAI_WP,8,3           ; @SPINOR_OP_AAI_WP
l_.str.2:                               ; @.str.2
	.asciz	"While writing 2 bytes written %i bytes\n"

	.no_dead_strip	_sst_write
.subsections_via_symbols
