	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_t4_load_cfg                    ## -- Begin function t4_load_cfg
	.p2align	4, 0x90
_t4_load_cfg:                           ## @t4_load_cfg
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r14d
	movq	%rsi, %r12
	movl	4(%rdi), %eax
	xorl	%edx, %edx
	divl	8(%rdi)
	movl	%eax, %r13d
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	callq	_t4_flash_cfg_addr
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_1
## %bb.2:
	movq	_FLASH_CFG_MAX_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	cmpl	%r14d, %ecx
	jae	LBB0_4
## %bb.3:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%r15d, %r15d
	movl	%ecx, %edx
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EFBIG@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
	jmp	LBB0_13
LBB0_1:
	movl	%ebx, %r15d
	jmp	LBB0_13
LBB0_4:
	movq	_SF_SEC_SIZE@GOTPCREL(%rip), %rsi
	xorl	%r15d, %r15d
	movl	%ebx, %eax
	movl	%r14d, -52(%rbp)                ## 4-byte Spill
	xorl	%edx, %edx
	divl	(%rsi)
	movl	%eax, %r14d
	movl	%ecx, %edi
	movl	%r13d, %esi
	callq	_DIV_ROUND_UP
                                        ## kill: def $eax killed $eax def $rax
	leal	(%r14,%rax), %edx
	decl	%edx
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	%r14d, %esi
	callq	_t4_flash_erase_sectors
	movl	-52(%rbp), %ecx                 ## 4-byte Reload
	movl	%eax, %r13d
	testl	%ecx, %ecx
	je	LBB0_11
## %bb.5:
	testl	%r13d, %r13d
	jne	LBB0_11
## %bb.6:
	movq	_SF_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	xorl	%r14d, %r14d
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movl	%ecx, %r15d
	movl	%ecx, %edx
	subl	%r14d, %edx
	cmpl	%eax, %edx
	cmovael	%eax, %edx
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	%ebx, %esi
	movq	%r12, %rcx
	callq	_t4_write_flash
	testl	%eax, %eax
	jne	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_7 Depth=1
	movq	_SF_PAGE_SIZE@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	addl	%eax, %ebx
	leaq	(%r12,%rax,4), %r12
	addl	%eax, %r14d
	cmpl	%r15d, %r14d
	movl	%r15d, %ecx
	jb	LBB0_7
## %bb.10:
	xorl	%r15d, %r15d
	jmp	LBB0_13
LBB0_11:
	testl	%r13d, %r13d
	jne	LBB0_12
	jmp	LBB0_13
LBB0_8:
	movl	%eax, %r13d
	movl	%r15d, %ecx
LBB0_12:
	testl	%ecx, %ecx
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edi
	leaq	L_.str.2(%rip), %rax
	leaq	L_.str.3(%rip), %rdx
	cmoveq	%rax, %rdx
	leaq	L_.str.1(%rip), %rsi
	movl	%r13d, %ecx
	xorl	%eax, %eax
	callq	_dev_err
	movl	%r13d, %r15d
LBB0_13:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SF_SEC_SIZE,4,2                ## @SF_SEC_SIZE
	.comm	_FLASH_CFG_MAX_SIZE,4,2         ## @FLASH_CFG_MAX_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"cfg file too large, max is %u bytes\n"

	.comm	_EFBIG,4,2                      ## @EFBIG
	.comm	_SF_PAGE_SIZE,4,2               ## @SF_PAGE_SIZE
L_.str.1:                               ## @.str.1
	.asciz	"config file %s failed %d\n"

L_.str.2:                               ## @.str.2
	.asciz	"clear"

L_.str.3:                               ## @.str.3
	.asciz	"download"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_t4_load_cfg                    ; -- Begin function t4_load_cfg
	.p2align	2
_t4_load_cfg:                           ; @t4_load_cfg
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	mov	x19, x2
	mov	x22, x1
	mov	x20, x0
	ldp	w23, w24, [x0, #4]
	bl	_t4_flash_cfg_addr
	mov	x21, x0
	tbnz	w0, #31, LBB0_12
; %bb.1:
Lloh0:
	adrp	x8, _FLASH_CFG_MAX_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _FLASH_CFG_MAX_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	cmp	w0, w19
	b.hs	LBB0_3
; %bb.2:
	ldr	w8, [x20]
	str	x0, [sp]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x8
	bl	_dev_err
Lloh5:
	adrp	x8, _EFBIG@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EFBIG@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_12
LBB0_3:
	udiv	w1, w23, w24
Lloh8:
	adrp	x8, _SF_SEC_SIZE@GOTPAGE
Lloh9:
	ldr	x8, [x8, _SF_SEC_SIZE@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	udiv	w23, w21, w8
                                        ; kill: def $w0 killed $w0 killed $x0
	bl	_DIV_ROUND_UP
	add	w8, w23, w0
	sub	w2, w8, #1
	mov	x0, x20
	mov	x1, x23
	bl	_t4_flash_erase_sectors
	mov	x23, x0
	cbz	w19, LBB0_8
; %bb.4:
	cbnz	w23, LBB0_8
; %bb.5:
	mov	w24, #0
Lloh11:
	adrp	x25, _SF_PAGE_SIZE@GOTPAGE
Lloh12:
	ldr	x25, [x25, _SF_PAGE_SIZE@GOTPAGEOFF]
	ldr	w8, [x25]
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	sub	w9, w19, w24
	cmp	w9, w8
	csel	w2, w9, w8, lo
	mov	x0, x20
	mov	x1, x21
	mov	x3, x22
	bl	_t4_write_flash
	cbnz	w0, LBB0_10
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	ldrsw	x8, [x25]
	add	w21, w8, w21
	add	x22, x22, x8, lsl #2
	add	w24, w8, w24
	cmp	w24, w19
	b.lo	LBB0_6
	b	LBB0_9
LBB0_8:
	cbnz	w23, LBB0_11
LBB0_9:
	mov	w21, #0
	b	LBB0_12
LBB0_10:
	mov	x23, x0
LBB0_11:
	ldr	w0, [x20]
Lloh13:
	adrp	x8, l_.str.3@PAGE
Lloh14:
	add	x8, x8, l_.str.3@PAGEOFF
Lloh15:
	adrp	x9, l_.str.2@PAGE
Lloh16:
	add	x9, x9, l_.str.2@PAGEOFF
	cmp	w19, #0
	csel	x8, x9, x8, eq
	stp	x8, x23, [sp]
Lloh17:
	adrp	x1, l_.str.1@PAGE
Lloh18:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
	mov	x21, x23
LBB0_12:
	mov	x0, x21
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_SF_SEC_SIZE,4,2                ; @SF_SEC_SIZE
	.comm	_FLASH_CFG_MAX_SIZE,4,2         ; @FLASH_CFG_MAX_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"cfg file too large, max is %u bytes\n"

	.comm	_EFBIG,4,2                      ; @EFBIG
	.comm	_SF_PAGE_SIZE,4,2               ; @SF_PAGE_SIZE
l_.str.1:                               ; @.str.1
	.asciz	"config file %s failed %d\n"

l_.str.2:                               ; @.str.2
	.asciz	"clear"

l_.str.3:                               ; @.str.3
	.asciz	"download"

.subsections_via_symbols
