	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function t4_write_flash
_t4_write_flash:                        ## @t4_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	$296, %rsp                      ## imm = 0x128
	.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
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	cmpl	%esi, 4(%rdi)
	jbe	LBB0_2
## %bb.1:
	movq	%rcx, %rbx
	movq	%rdi, %r12
	movzbl	%sil, %edi
	leal	(%rdi,%rdx), %eax
	movq	_SF_PAGE_SIZE@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jbe	LBB0_4
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_3:
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_19
LBB0_4:
	movq	%rdi, -328(%rbp)                ## 8-byte Spill
	movq	%rdx, -320(%rbp)                ## 8-byte Spill
	movl	%esi, -308(%rbp)                ## 4-byte Spill
	movl	%esi, %edi
	callq	_swab32
	movl	%eax, %r13d
	movq	_SF_PROG_PAGE@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movq	_SF_WR_ENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	%r12, %rdi
	movl	$1, %esi
	xorl	%edx, %edx
	movl	$1, %ecx
	callq	_sf1_write
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_18
## %bb.5:
	orl	%r13d, %r15d
	movq	%r12, %rdi
	movl	$4, %esi
	movl	$1, %edx
	movl	$1, %ecx
	movl	%r15d, %r8d
	callq	_sf1_write
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_18
## %bb.6:
	movq	-320(%rbp), %rax                ## 8-byte Reload
	testl	%eax, %eax
	je	LBB0_21
## %bb.7:
	movl	%eax, %r13d
	.p2align	4, 0x90
LBB0_9:                                 ## =>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, %r15d
	testl	%eax, %eax
	je	LBB0_10
## %bb.11:                              ##   in Loop: Header=BB0_9 Depth=1
	leal	-1(%r15), %ecx
	movl	%r15d, %eax
	andl	$3, %eax
	xorl	%r8d, %r8d
	cmpl	$3, %ecx
	jb	LBB0_14
## %bb.12:                              ##   in Loop: Header=BB0_9 Depth=1
	movl	%r15d, %ecx
	andl	$-4, %ecx
	xorl	%r8d, %r8d
	.p2align	4, 0x90
LBB0_13:                                ##   Parent Loop BB0_9 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	shll	$8, %r8d
	addl	(%rbx), %r8d
	shll	$8, %r8d
	addl	4(%rbx), %r8d
	shll	$8, %r8d
	addl	8(%rbx), %r8d
	shll	$8, %r8d
	addl	12(%rbx), %r8d
	addq	$16, %rbx
	addl	$-4, %ecx
	jne	LBB0_13
LBB0_14:                                ##   in Loop: Header=BB0_9 Depth=1
	testl	%eax, %eax
	je	LBB0_16
	.p2align	4, 0x90
LBB0_15:                                ##   Parent Loop BB0_9 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	shll	$8, %r8d
	addl	(%rbx), %r8d
	addq	$4, %rbx
	decl	%eax
	jne	LBB0_15
	jmp	LBB0_16
LBB0_10:                                ##   in Loop: Header=BB0_9 Depth=1
	xorl	%r8d, %r8d
LBB0_16:                                ##   in Loop: Header=BB0_9 Depth=1
	xorl	%edx, %edx
	cmpl	%r15d, %r13d
	setne	%dl
	movq	%r12, %rdi
	movl	%r15d, %esi
	movl	$1, %ecx
	callq	_sf1_write
	testl	%eax, %eax
	jne	LBB0_17
## %bb.8:                               ##   in Loop: Header=BB0_9 Depth=1
	subl	%r15d, %r13d
	jne	LBB0_9
LBB0_21:
	movq	%r12, %rdi
	movl	$8, %esi
	movl	$1, %edx
	callq	_flash_wait_op
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_18
## %bb.22:
	movq	_SF_OP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	xorl	%edx, %edx
	callq	_t4_write_reg
	movl	-308(%rbp), %r13d               ## 4-byte Reload
	movl	%r13d, %r14d
	andl	$-256, %r14d
	leaq	-304(%rbp), %r15
	movq	%r15, %rdi
	callq	_ARRAY_SIZE
	movq	%r12, %rdi
	movl	%r14d, %esi
	movl	%eax, %edx
	movq	%r15, %rcx
	movl	$1, %r8d
	callq	_t4_read_flash
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_19
## %bb.23:
	movq	-320(%rbp), %rdx                ## 8-byte Reload
	movl	%edx, %eax
	shlq	$2, %rax
	subq	%rax, %rbx
	movl	-328(%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
	movl	$0, %r14d
	testq	%rax, %rax
	je	LBB0_19
## %bb.24:
	movl	(%r12), %edi
	leaq	L_.str(%rip), %rsi
	movl	%r13d, %edx
	callq	_dev_err
	movq	_EIO@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_17:
	movl	%eax, %r14d
LBB0_18:
	movq	_SF_OP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	xorl	%edx, %edx
	callq	_t4_write_reg
LBB0_19:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_20
## %bb.25:
	movl	%r14d, %eax
	addq	$296, %rsp                      ## imm = 0x128
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_20:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_SF_PAGE_SIZE,4,2               ## @SF_PAGE_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	_SF_OP,4,2                      ## @SF_OP
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed to correctly write the flash page at %#x\n"

	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_t4_write_flash
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function t4_write_flash
_t4_write_flash:                        ; @t4_write_flash
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #368
	.cfi_def_cfa_offset 368
	stp	x28, x27, [sp, #272]            ; 16-byte Folded Spill
	stp	x26, x25, [sp, #288]            ; 16-byte Folded Spill
	stp	x24, x23, [sp, #304]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #320]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #336]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #352]            ; 16-byte Folded Spill
	add	x29, sp, #352
	.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
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-88]
	ldr	w8, [x0, #4]
	cmp	w8, w1
	b.ls	LBB0_2
; %bb.1:
	mov	x21, x2
	mov	x20, x1
	and	w26, w1, #0xff
Lloh3:
	adrp	x8, _SF_PAGE_SIZE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _SF_PAGE_SIZE@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	add	w9, w26, w2
	cmp	w9, w8
	b.ls	LBB0_4
LBB0_2:
Lloh6:
	adrp	x8, _EINVAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_3:
	ldr	w8, [x8]
	neg	w24, w8
	b	LBB0_20
LBB0_4:
	mov	x22, x3
	mov	x19, x0
	mov	x0, x20
	bl	_swab32
	mov	x23, x0
Lloh8:
	adrp	x8, _SF_PROG_PAGE@GOTPAGE
Lloh9:
	ldr	x8, [x8, _SF_PROG_PAGE@GOTPAGEOFF]
Lloh10:
	ldr	w25, [x8]
Lloh11:
	adrp	x8, _SF_WR_ENABLE@GOTPAGE
Lloh12:
	ldr	x8, [x8, _SF_WR_ENABLE@GOTPAGEOFF]
Lloh13:
	ldr	w4, [x8]
	mov	x0, x19
	mov	w1, #1
	mov	w2, #0
	mov	w3, #1
	bl	_sf1_write
	mov	x24, x0
	cbnz	w0, LBB0_19
; %bb.5:
	orr	w4, w25, w23
	mov	x0, x19
	mov	w1, #4
	mov	w2, #1
	mov	w3, #1
	bl	_sf1_write
	mov	x24, x0
	cbnz	w0, LBB0_19
; %bb.6:
	cbz	w21, LBB0_14
; %bb.7:
	mov	x23, x21
LBB0_8:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_10 Depth 2
	mov	x0, x23
	mov	w1, #4
	bl	_min
	mov	x25, x0
	mov	w4, #0
	cbz	w0, LBB0_12
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	sub	w8, w25, #1
	mov	x9, x25
	mov	x10, x22
LBB0_10:                                ;   Parent Loop BB0_8 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w11, [x10], #4
	add	w4, w11, w4, lsl #8
	subs	w9, w9, #1
	b.ne	LBB0_10
; %bb.11:                               ;   in Loop: Header=BB0_8 Depth=1
	add	x8, x22, x8, lsl #2
	add	x22, x8, #4
LBB0_12:                                ;   in Loop: Header=BB0_8 Depth=1
	cmp	w23, w25
	cset	w2, ne
	mov	x0, x19
	mov	x1, x25
	mov	w3, #1
	bl	_sf1_write
	cbnz	w0, LBB0_18
; %bb.13:                               ;   in Loop: Header=BB0_8 Depth=1
	subs	w23, w23, w25
	b.ne	LBB0_8
LBB0_14:
	mov	x0, x19
	mov	w1, #8
	mov	w2, #1
	bl	_flash_wait_op
	mov	x24, x0
	cbnz	w0, LBB0_19
; %bb.15:
Lloh14:
	adrp	x8, _SF_OP@GOTPAGE
Lloh15:
	ldr	x8, [x8, _SF_OP@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_t4_write_reg
	and	w23, w20, #0xffffff00
	add	x25, sp, #8
	add	x0, sp, #8
	bl	_ARRAY_SIZE
	mov	x2, x0
	add	x3, sp, #8
	mov	x0, x19
	mov	x1, x23
	mov	w4, #1
	bl	_t4_read_flash
	mov	x24, x0
	cbnz	w0, LBB0_20
; %bb.16:
	sub	x0, x22, w21, uxtw #2
	add	x1, x25, w26, uxtw #2
	mov	x2, x21
	bl	_memcmp
	cbz	x0, LBB0_22
; %bb.17:
	ldr	w0, [x19]
Lloh17:
	adrp	x1, l_.str@PAGE
Lloh18:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x20
	bl	_dev_err
Lloh19:
	adrp	x8, _EIO@GOTPAGE
Lloh20:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_3
LBB0_18:
	mov	x24, x0
LBB0_19:
Lloh21:
	adrp	x8, _SF_OP@GOTPAGE
Lloh22:
	ldr	x8, [x8, _SF_OP@GOTPAGEOFF]
Lloh23:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_t4_write_reg
LBB0_20:
	ldur	x8, [x29, #-88]
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_23
; %bb.21:
	mov	x0, x24
	ldp	x29, x30, [sp, #352]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #336]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #320]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #304]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #288]            ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #272]            ; 16-byte Folded Reload
	add	sp, sp, #368
	ret
LBB0_22:
	mov	w24, #0
	b	LBB0_20
LBB0_23:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_SF_PAGE_SIZE,4,2               ; @SF_PAGE_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	_SF_OP,4,2                      ; @SF_OP
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed to correctly write the flash page at %#x\n"

	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_t4_write_flash
.subsections_via_symbols
