	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function dataflash_write
_dataflash_write:                       ## @dataflash_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	$120, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, -128(%rbp)                 ## 8-byte Spill
	movq	%rcx, -152(%rbp)                ## 8-byte Spill
	movq	%rdx, -96(%rbp)                 ## 8-byte Spill
	movq	%rsi, %r12
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	(%rdi), %r13
	movq	24(%r13), %rdi
	xorps	%xmm0, %xmm0
	movaps	%xmm0, -64(%rbp)
	movaps	%xmm0, -80(%rbp)
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
	leal	(%rdx,%rsi), %ecx
	leaq	L_.str(%rip), %rsi
	movq	%rdi, -144(%rbp)                ## 8-byte Spill
	movl	%r12d, %edx
	xorl	%eax, %eax
	callq	_dev_dbg
	leaq	-88(%rbp), %r14
	movq	%r14, %rdi
	callq	_spi_message_init
	movq	(%r13), %rax
	movq	%rax, -120(%rbp)                ## 8-byte Spill
	movq	%rax, -80(%rbp)
	movl	$4, -72(%rbp)
	leaq	-80(%rbp), %rdi
	movq	%r14, %rsi
	callq	_spi_message_add_tail
	movl	8(%r13), %ebx
	leaq	16(%r13), %rdi
	movq	%rdi, -136(%rbp)                ## 8-byte Spill
	callq	_mutex_lock
	movq	-96(%rbp), %rsi                 ## 8-byte Reload
	testq	%rsi, %rsi
	je	LBB0_9
## %bb.1:
	movl	%r12d, %eax
	xorl	%edx, %edx
	divl	%ebx
	movl	%edx, %r12d
	leaq	(%r12,%rsi), %rcx
	movl	%ebx, %r14d
	subl	%edx, %r14d
	cmpq	%rbx, %rcx
	movl	%eax, %ebx
	cmovbel	%esi, %r14d
	movq	%r13, -112(%rbp)                ## 8-byte Spill
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	-112(%rbp), %rax                ## 8-byte Reload
	movq	24(%rax), %rdi
	callq	_dataflash_waitready
LBB0_6:                                 ##   in Loop: Header=BB0_2 Depth=1
	addl	%r12d, %ebx
	movq	_OP_PROGRAM_VIA_BUF1@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	-120(%rbp), %rsi                ## 8-byte Reload
	movl	%edx, (%rsi)
	movl	%ebx, %eax
	shrl	$16, %eax
	movzbl	%al, %ecx
	movl	%ecx, 4(%rsi)
	movzbl	%bh, %eax
	movl	%eax, 8(%rsi)
	movzbl	%bl, %r9d
	movl	%r9d, 12(%rsi)
	movq	%r15, %rdi
	leaq	L_.str.4(%rip), %rsi
	movl	%eax, %r8d
	xorl	%eax, %eax
	callq	_dev_dbg
	movq	-128(%rbp), %r12                ## 8-byte Reload
	movq	%r12, -64(%rbp)
	movl	%r14d, -56(%rbp)
	leaq	-64(%rbp), %rdi
	movq	%r15, %r13
	leaq	-88(%rbp), %r15
	movq	%r15, %rsi
	callq	_spi_message_add_tail
	movq	%r13, %rdi
	movq	%r15, %rsi
	callq	_spi_sync
	movl	%eax, %r15d
	leaq	-64(%rbp), %rdi
	callq	_spi_transfer_del
	testl	%r15d, %r15d
	js	LBB0_7
LBB0_8:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	-112(%rbp), %r13                ## 8-byte Reload
	movq	24(%r13), %rdi
	callq	_dataflash_waitready
	movl	%r14d, %eax
	movq	-96(%rbp), %rsi                 ## 8-byte Reload
	subq	%rax, %rsi
	movl	-100(%rbp), %ebx                ## 4-byte Reload
	incl	%ebx
	movq	-152(%rbp), %rcx                ## 8-byte Reload
	addq	%rax, (%rcx)
	movl	8(%r13), %ecx
	cmpq	%rcx, %rsi
	movl	%esi, %r14d
	cmoval	%ecx, %r14d
	leaq	(%r12,%rax,4), %r12
	movq	%r12, -128(%rbp)                ## 8-byte Spill
	xorl	%r12d, %r12d
	testq	%rsi, %rsi
	je	LBB0_9
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rsi, -96(%rbp)                 ## 8-byte Spill
	movq	-144(%rbp), %r15                ## 8-byte Reload
	movq	%r15, %rdi
	leaq	L_.str.1(%rip), %rsi
	movl	%ebx, %edx
	movl	%r12d, %ecx
	movl	%r14d, %r8d
	xorl	%eax, %eax
	callq	_dev_dbg
	movzbl	12(%r13), %ecx
	movl	%ebx, -100(%rbp)                ## 4-byte Spill
	shll	%cl, %ebx
	cmpl	8(%r13), %r14d
	je	LBB0_6
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	_OP_TRANSFER_BUF1@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	-120(%rbp), %rsi                ## 8-byte Reload
	movl	%edx, (%rsi)
	movl	%ebx, %eax
	shrl	$16, %eax
	movzbl	%al, %ecx
	movl	%ecx, 4(%rsi)
	movzbl	%bh, %eax
	movl	%eax, 8(%rsi)
	movl	$0, 12(%rsi)
	movq	%r15, %rdi
	leaq	L_.str.2(%rip), %rsi
	movl	%eax, %r8d
	xorl	%r9d, %r9d
	xorl	%eax, %eax
	callq	_dev_dbg
	movq	%r15, %rdi
	leaq	-88(%rbp), %rsi
	callq	_spi_sync
	testl	%eax, %eax
	jns	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%r15, %rdi
	leaq	L_.str.3(%rip), %rsi
	movl	%ebx, %edx
	movl	%eax, %ecx
	xorl	%eax, %eax
	callq	_dev_dbg
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	%r13, %rdi
	leaq	L_.str.5(%rip), %rsi
	movl	%ebx, %edx
	movl	%r14d, %ecx
	movl	%r15d, %r8d
	xorl	%eax, %eax
	callq	_dev_dbg
	jmp	LBB0_8
LBB0_9:
	movq	-136(%rbp), %rdi                ## 8-byte Reload
	callq	_mutex_unlock
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_11
## %bb.10:
	movl	%r15d, %eax
	addq	$120, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_11:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"write 0x%x..0x%x\n"

L_.str.1:                               ## @.str.1
	.asciz	"write @ %i:%i len=%i\n"

	.comm	_OP_TRANSFER_BUF1,4,2           ## @OP_TRANSFER_BUF1
L_.str.2:                               ## @.str.2
	.asciz	"TRANSFER: (%x) %x %x %x\n"

L_.str.3:                               ## @.str.3
	.asciz	"xfer %u -> %d\n"

	.comm	_OP_PROGRAM_VIA_BUF1,4,2        ## @OP_PROGRAM_VIA_BUF1
L_.str.4:                               ## @.str.4
	.asciz	"PROGRAM: (%x) %x %x %x\n"

L_.str.5:                               ## @.str.5
	.asciz	"pgm %u/%u -> %d\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_OP_COMPARE_BUF1,4,2            ## @OP_COMPARE_BUF1
	.no_dead_strip	_dataflash_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function dataflash_write
_dataflash_write:                       ; @dataflash_write
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #176
	.cfi_def_cfa_offset 176
	stp	x28, x27, [sp, #80]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #96]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #112]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #128]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #144]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #160]            ; 16-byte Folded Spill
	add	x29, sp, #160
	.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	x19, x4
	str	x3, [sp, #24]                   ; 8-byte Folded Spill
	mov	x21, x2
	mov	x23, x1
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #72]
	ldr	x27, [x0]
	ldr	x22, [x27, #24]
	stp	xzr, xzr, [sp, #48]
	str	xzr, [sp, #64]
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh5:
	ldr	w24, [x8]
	add	w3, w21, w23
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x22
	mov	x2, x23
	bl	_dev_dbg
	add	x0, sp, #32
	bl	_spi_message_init
	ldr	x20, [x27]
	str	x20, [sp, #40]
	mov	w8, #4
	str	w8, [sp, #48]
	add	x25, sp, #40
	add	x0, sp, #40
	add	x1, sp, #32
	bl	_spi_message_add_tail
	ldr	w26, [x27, #8]
	add	x28, x27, #16
	mov	x0, x28
	bl	_mutex_lock
	cbz	x21, LBB0_10
; %bb.1:
	str	x28, [sp, #16]                  ; 8-byte Folded Spill
	udiv	w24, w23, w26
	msub	w28, w24, w26, w23
	sub	w8, w26, w28
	add	x9, x28, x21
	cmp	x9, x26
	csel	w23, w8, w21, hi
	add	x25, x25, #16
	b	LBB0_5
LBB0_2:                                 ;   in Loop: Header=BB0_5 Depth=1
	ldr	x0, [x27, #24]
	bl	_dataflash_waitready
LBB0_3:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	w28, w26, w28
Lloh8:
	adrp	x8, _OP_PROGRAM_VIA_BUF1@GOTPAGE
Lloh9:
	ldr	x8, [x8, _OP_PROGRAM_VIA_BUF1@GOTPAGEOFF]
Lloh10:
	ldr	w2, [x8]
	ubfx	w3, w28, #16, #8
	stp	w2, w3, [x20]
	ubfx	w8, w28, #8, #8
	and	w9, w28, #0xff
	stp	w8, w9, [x20, #8]
	stp	x8, x9, [sp]
	mov	x0, x22
Lloh11:
	adrp	x1, l_.str.4@PAGE
Lloh12:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_dev_dbg
	str	x19, [sp, #56]
	str	w23, [sp, #64]
	add	x1, sp, #32
	mov	x0, x25
	bl	_spi_message_add_tail
	add	x1, sp, #32
	mov	x0, x22
	bl	_spi_sync
	mov	x26, x0
	mov	x0, x25
	bl	_spi_transfer_del
	tbnz	w26, #31, LBB0_8
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	ldr	x0, [x27, #24]
	bl	_dataflash_waitready
	mov	w28, #0
	mov	w8, w23
	add	w24, w24, #1
	add	x19, x19, w23, uxtw #2
	ldr	x10, [sp, #24]                  ; 8-byte Folded Reload
	ldr	x9, [x10]
	add	x9, x9, x8
	str	x9, [x10]
	ldr	w9, [x27, #8]
	sub	x21, x21, x8
	cmp	x21, x9
	csel	w23, w9, w21, hi
	cbz	x21, LBB0_9
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	str	x23, [sp]
	mov	x0, x22
Lloh13:
	adrp	x1, l_.str.1@PAGE
Lloh14:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x24
	mov	x3, x28
	bl	_dev_dbg
	ldp	w9, w8, [x27, #8]
	lsl	w26, w24, w8
	cmp	w23, w9
	b.eq	LBB0_3
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
Lloh15:
	adrp	x8, _OP_TRANSFER_BUF1@GOTPAGE
Lloh16:
	ldr	x8, [x8, _OP_TRANSFER_BUF1@GOTPAGEOFF]
Lloh17:
	ldr	w2, [x8]
	ubfx	w3, w26, #16, #8
	stp	w2, w3, [x20]
	ubfx	w8, w26, #8, #8
	stp	w8, wzr, [x20, #8]
	stp	x8, xzr, [sp]
	mov	x0, x22
Lloh18:
	adrp	x1, l_.str.2@PAGE
Lloh19:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_dbg
	add	x1, sp, #32
	mov	x0, x22
	bl	_spi_sync
	tbz	w0, #31, LBB0_2
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x3, x0
	mov	x0, x22
Lloh20:
	adrp	x1, l_.str.3@PAGE
Lloh21:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x2, x26
	bl	_dev_dbg
	b	LBB0_2
LBB0_8:                                 ;   in Loop: Header=BB0_5 Depth=1
	str	x26, [sp]
	mov	x0, x22
Lloh22:
	adrp	x1, l_.str.5@PAGE
Lloh23:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	x2, x28
	mov	x3, x23
	bl	_dev_dbg
	b	LBB0_4
LBB0_9:
	ldr	x28, [sp, #16]                  ; 8-byte Folded Reload
	b	LBB0_11
LBB0_10:
	neg	w26, w24
LBB0_11:
	mov	x0, x28
	bl	_mutex_unlock
	ldr	x8, [sp, #72]
Lloh24:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh25:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh26:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_13
; %bb.12:
	mov	x0, x26
	ldp	x29, x30, [sp, #160]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #144]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #128]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #112]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #96]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #80]             ; 16-byte Folded Reload
	add	sp, sp, #176
	ret
LBB0_13:
	bl	___stack_chk_fail
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"write 0x%x..0x%x\n"

l_.str.1:                               ; @.str.1
	.asciz	"write @ %i:%i len=%i\n"

	.comm	_OP_TRANSFER_BUF1,4,2           ; @OP_TRANSFER_BUF1
l_.str.2:                               ; @.str.2
	.asciz	"TRANSFER: (%x) %x %x %x\n"

l_.str.3:                               ; @.str.3
	.asciz	"xfer %u -> %d\n"

	.comm	_OP_PROGRAM_VIA_BUF1,4,2        ; @OP_PROGRAM_VIA_BUF1
l_.str.4:                               ; @.str.4
	.asciz	"PROGRAM: (%x) %x %x %x\n"

l_.str.5:                               ; @.str.5
	.asciz	"pgm %u/%u -> %d\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_OP_COMPARE_BUF1,4,2            ; @OP_COMPARE_BUF1
	.no_dead_strip	_dataflash_write
.subsections_via_symbols
