	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function t3_write_flash
_t3_write_flash:                        ## @t3_write_flash
	.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	$280, %rsp                      ## imm = 0x118
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
                                        ## kill: def $edx killed $edx def $rdx
	movl	%esi, %r15d
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movzbl	%r15b, %esi
	leal	(%rsi,%rdx), %eax
	cmpl	$256, %eax                      ## imm = 0x100
	ja	LBB0_2
## %bb.1:
	movq	%rcx, %rbx
	leal	(%rdx,%r15), %eax
	movq	_SF_SIZE@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	ja	LBB0_2
## %bb.3:
	movq	%rdx, -312(%rbp)                ## 8-byte Spill
	movq	%rsi, -320(%rbp)                ## 8-byte Spill
	movq	%rdi, %r14
	movl	%r15d, %edi
	callq	_swab32
	movl	%eax, %r13d
	movq	_SF_PROG_PAGE@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movq	_SF_WR_ENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r14, %rdi
	movl	$1, %esi
	xorl	%edx, %edx
	callq	_sf1_write
	testl	%eax, %eax
	jne	LBB0_23
## %bb.4:
	orl	%r13d, %r12d
	movq	%r14, %rdi
	movl	$4, %esi
	movl	$1, %edx
	movl	%r12d, %ecx
	callq	_sf1_write
	testl	%eax, %eax
	jne	LBB0_23
## %bb.5:
	movq	-312(%rbp), %rax                ## 8-byte Reload
	testl	%eax, %eax
	je	LBB0_17
## %bb.6:
	movl	%eax, %r13d
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_13 Depth 2
                                        ##     Child Loop BB0_15 Depth 2
	movl	%r13d, %edi
	movl	$4, %esi
	callq	_min
	movl	%eax, %r12d
	testl	%eax, %eax
	je	LBB0_9
## %bb.10:                              ##   in Loop: Header=BB0_8 Depth=1
	leal	-1(%r12), %edx
	movl	%r12d, %eax
	andl	$3, %eax
	xorl	%ecx, %ecx
	cmpl	$3, %edx
	jae	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	%r14, %rdi
	jmp	LBB0_14
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_8 Depth=1
	xorl	%ecx, %ecx
	movq	%r14, %rdi
	jmp	LBB0_16
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_8 Depth=1
	movl	%r12d, %edx
	andl	$-4, %edx
	xorl	%ecx, %ecx
	movq	%r14, %rdi
	.p2align	4, 0x90
LBB0_13:                                ##   Parent Loop BB0_8 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	shll	$8, %ecx
	addl	(%rbx), %ecx
	shll	$8, %ecx
	addl	4(%rbx), %ecx
	shll	$8, %ecx
	addl	8(%rbx), %ecx
	shll	$8, %ecx
	addl	12(%rbx), %ecx
	addq	$16, %rbx
	addl	$-4, %edx
	jne	LBB0_13
LBB0_14:                                ##   in Loop: Header=BB0_8 Depth=1
	testl	%eax, %eax
	je	LBB0_16
	.p2align	4, 0x90
LBB0_15:                                ##   Parent Loop BB0_8 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	shll	$8, %ecx
	addl	(%rbx), %ecx
	addq	$4, %rbx
	decl	%eax
	jne	LBB0_15
LBB0_16:                                ##   in Loop: Header=BB0_8 Depth=1
	xorl	%edx, %edx
	cmpl	%r12d, %r13d
	setne	%dl
	movl	%r12d, %esi
	callq	_sf1_write
	testl	%eax, %eax
	jne	LBB0_23
## %bb.7:                               ##   in Loop: Header=BB0_8 Depth=1
	subl	%r12d, %r13d
	jne	LBB0_8
LBB0_17:
	movq	%r14, %rdi
	movl	$5, %esi
	movl	$1, %edx
	callq	_flash_wait_op
	testl	%eax, %eax
	jne	LBB0_23
## %bb.18:
	andl	$-256, %r15d
	leaq	-304(%rbp), %r12
	movq	%r12, %rdi
	callq	_ARRAY_SIZE
	movq	%r14, %rdi
	movl	%r15d, %esi
	movl	%eax, %edx
	movq	%r12, %rcx
	movl	$1, %r8d
	callq	_t3_read_flash
	testl	%eax, %eax
	jne	LBB0_23
## %bb.19:
	movq	-312(%rbp), %rdx                ## 8-byte Reload
	movl	%edx, %eax
	shlq	$2, %rax
	subq	%rax, %rbx
	movl	-320(%rbp), %eax                ## 4-byte Reload
	leaq	-304(,%rax,4), %rsi
	addq	%rbp, %rsi
	movq	%rbx, %rdi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_memcmp
	testq	%rax, %rax
	je	LBB0_20
## %bb.21:
	movq	_EIO@GOTPCREL(%rip), %rcx
	jmp	LBB0_22
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
LBB0_22:
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_23:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_25
## %bb.24:
	addq	$280, %rsp                      ## imm = 0x118
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_20:
	xorl	%eax, %eax
	jmp	LBB0_23
LBB0_25:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_SF_SIZE,4,2                    ## @SF_SIZE
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_SF_PROG_PAGE,4,2               ## @SF_PROG_PAGE
	.comm	_SF_WR_ENABLE,4,2               ## @SF_WR_ENABLE
	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_t3_write_flash
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function t3_write_flash
_t3_write_flash:                        ; @t3_write_flash
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #352
	.cfi_def_cfa_offset 352
	stp	x26, x25, [sp, #272]            ; 16-byte Folded Spill
	stp	x24, x23, [sp, #288]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #304]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #320]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #336]            ; 16-byte Folded Spill
	add	x29, sp, #336
	.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
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-72]
	and	w25, w1, #0xff
	add	w8, w2, w1
Lloh3:
	adrp	x9, _SF_SIZE@GOTPAGE
Lloh4:
	ldr	x9, [x9, _SF_SIZE@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	add	w10, w25, w2
	cmp	w10, #256
	ccmp	w8, w9, #2, ls
	b.ls	LBB0_3
; %bb.1:
Lloh6:
	adrp	x8, _EINVAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_2:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_15
LBB0_3:
	mov	x20, x3
	mov	x19, x2
	mov	x22, x1
	mov	x21, x0
	mov	x0, x1
	bl	_swab32
	mov	x23, x0
Lloh8:
	adrp	x8, _SF_PROG_PAGE@GOTPAGE
Lloh9:
	ldr	x8, [x8, _SF_PROG_PAGE@GOTPAGEOFF]
Lloh10:
	ldr	w24, [x8]
Lloh11:
	adrp	x8, _SF_WR_ENABLE@GOTPAGE
Lloh12:
	ldr	x8, [x8, _SF_WR_ENABLE@GOTPAGEOFF]
Lloh13:
	ldr	w3, [x8]
	mov	x0, x21
	mov	w1, #1
	mov	w2, #0
	bl	_sf1_write
	cbnz	w0, LBB0_15
; %bb.4:
	orr	w3, w24, w23
	mov	x0, x21
	mov	w1, #4
	mov	w2, #1
	bl	_sf1_write
	cbnz	w0, LBB0_15
; %bb.5:
	cbz	w19, LBB0_13
; %bb.6:
	mov	x23, x19
LBB0_7:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_9 Depth 2
	mov	x0, x23
	mov	w1, #4
	bl	_min
	mov	x24, x0
	mov	w3, #0
	cbz	w0, LBB0_11
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	sub	w8, w24, #1
	mov	x9, x24
	mov	x10, x20
LBB0_9:                                 ;   Parent Loop BB0_7 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w11, [x10], #4
	add	w3, w11, w3, lsl #8
	subs	w9, w9, #1
	b.ne	LBB0_9
; %bb.10:                               ;   in Loop: Header=BB0_7 Depth=1
	add	x8, x20, x8, lsl #2
	add	x20, x8, #4
LBB0_11:                                ;   in Loop: Header=BB0_7 Depth=1
	cmp	w23, w24
	cset	w2, ne
	mov	x0, x21
	mov	x1, x24
	bl	_sf1_write
	cbnz	w0, LBB0_15
; %bb.12:                               ;   in Loop: Header=BB0_7 Depth=1
	subs	w23, w23, w24
	b.ne	LBB0_7
LBB0_13:
	mov	x0, x21
	mov	w1, #5
	mov	w2, #1
	bl	_flash_wait_op
	cbnz	w0, LBB0_15
; %bb.14:
	and	w22, w22, #0xffffff00
	add	x23, sp, #8
	add	x0, sp, #8
	bl	_ARRAY_SIZE
	mov	x2, x0
	add	x3, sp, #8
	mov	x0, x21
	mov	x1, x22
	mov	w4, #1
	bl	_t3_read_flash
	cbz	w0, LBB0_17
LBB0_15:
	ldur	x8, [x29, #-72]
Lloh14:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh15:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_19
; %bb.16:
	ldp	x29, x30, [sp, #336]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #320]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #304]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #288]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #272]            ; 16-byte Folded Reload
	add	sp, sp, #352
	ret
LBB0_17:
	sub	x0, x20, w19, uxtw #2
	add	x1, x23, w25, uxtw #2
	mov	x2, x19
	bl	_memcmp
	cbz	x0, LBB0_15
; %bb.18:
Lloh17:
	adrp	x8, _EIO@GOTPAGE
Lloh18:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_2
LBB0_19:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_SF_SIZE,4,2                    ; @SF_SIZE
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_SF_PROG_PAGE,4,2               ; @SF_PROG_PAGE
	.comm	_SF_WR_ENABLE,4,2               ; @SF_WR_ENABLE
	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_t3_write_flash
.subsections_via_symbols
