	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_wlcore_boot_upload_nvs         ## -- Begin function wlcore_boot_upload_nvs
	.p2align	4, 0x90
_wlcore_boot_upload_nvs:                ## @wlcore_boot_upload_nvs
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r12
	movq	48(%rdi), %rdi
	callq	_dev_get_platdata
	movq	(%r12), %rbx
	testq	%rbx, %rbx
	je	LBB0_12
## %bb.1:
	leaq	L_.str(%rip), %rsi
	testq	%rax, %rax
	je	LBB0_4
## %bb.2:
	movq	(%rax), %rax
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	movq	(%rax), %rsi
LBB0_4:
	movq	_WLCORE_QUIRK_LEGACY_NVS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	12(%r12), %edx
	testl	%eax, 8(%r12)
	je	LBB0_13
## %bb.5:
	movq	_WL1271_INI_LEGACY_NVS_FILE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	$16, %edx
	je	LBB0_7
## %bb.6:
	cmpl	%eax, %edx
	jne	LBB0_9
LBB0_7:
	cmpq	$0, 8(%rbx)
	je	LBB0_9
## %bb.8:
	movl	$1, 16(%r12)
LBB0_9:
	cmpl	$16, %edx
	je	LBB0_16
## %bb.10:
	cmpl	%eax, %edx
	jne	LBB0_24
## %bb.11:
	cmpl	$0, 16(%r12)
	jne	LBB0_24
	jmp	LBB0_16
LBB0_12:
	leaq	L_.str.1(%rip), %rdi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_wl1271_error
	movq	_ENODEV@GOTPCREL(%rip), %rax
	jmp	LBB0_32
LBB0_13:
	cmpl	$16, %edx
	jne	LBB0_24
## %bb.14:
	cmpq	$0, 8(%rbx)
	je	LBB0_16
## %bb.15:
	movl	$1, 16(%r12)
LBB0_16:
	movq	(%rbx), %rdi
	movq	40(%r12), %rax
	movq	(%rax), %rax
	movq	(%rax), %rcx
	movq	%rcx, 88(%rdi)
	movq	8(%rax), %rcx
	movq	%rcx, 80(%rdi)
	movq	16(%rax), %rcx
	movq	%rcx, 48(%rdi)
	movq	24(%rax), %rcx
	movq	%rcx, 40(%rdi)
	movq	32(%rax), %rcx
	movq	%rcx, 32(%rdi)
	movq	40(%rax), %rax
	movq	%rax, 24(%rdi)
LBB0_17:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_20 Depth 2
	movq	(%rdi), %r15
	testq	%r15, %r15
	je	LBB0_26
## %bb.18:                              ##   in Loop: Header=BB0_17 Depth=1
	leaq	48(%rdi), %r14
	addq	$64, %rbx
	cmpq	%rbx, %r14
	jae	LBB0_30
## %bb.19:                              ##   in Loop: Header=BB0_17 Depth=1
	movq	8(%rdi), %r13
	movq	16(%rdi), %rax
	shlq	$8, %rax
	andl	$254, %r13d
	orq	%rax, %r13
	addq	32(%r12), %r13
	.p2align	4, 0x90
LBB0_20:                                ##   Parent Loop BB0_17 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	-16(%r14), %rax
	movq	-8(%r14), %rcx
	shlq	$8, %rax
	orq	-24(%r14), %rax
	shlq	$16, %rcx
	movq	(%r14), %rbx
	shlq	$24, %rbx
	orq	%rcx, %rbx
	orq	%rax, %rbx
	movq	_DEBUG_BOOT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.3(%rip), %rsi
	movq	%r13, %rdx
	movq	%rbx, %rcx
	callq	_wl1271_debug
	movq	%r12, %rdi
	movq	%r13, %rsi
	movq	%rbx, %rdx
	callq	_wlcore_write32
	testl	%eax, %eax
	js	LBB0_25
## %bb.21:                              ##   in Loop: Header=BB0_20 Depth=2
	decq	%r15
	je	LBB0_23
## %bb.22:                              ##   in Loop: Header=BB0_20 Depth=2
	addq	$32, %r14
	addq	$4, %r13
	movq	(%r12), %rax
	addq	$64, %rax
	cmpq	%rax, %r14
	jb	LBB0_20
	jmp	LBB0_30
LBB0_23:                                ##   in Loop: Header=BB0_17 Depth=1
	movq	(%r12), %rbx
	leaq	64(%rbx), %rax
	addq	$8, %r14
	movq	%r14, %rdi
	cmpq	%rax, %r14
	jb	LBB0_17
	jmp	LBB0_30
LBB0_24:
	leaq	L_.str.2(%rip), %rdi
	xorl	%ebx, %ebx
	movl	$16, %ecx
	xorl	%eax, %eax
	callq	_wl1271_error
	movq	(%r12), %rdi
	callq	_kfree
	movq	$0, (%r12)
	movl	$0, 12(%r12)
	jmp	LBB0_31
LBB0_26:
	subq	%rbx, %rdi
	shrq	$3, %rdi
	addl	$7, %edi
                                        ## kill: def $edi killed $edi killed $rdi
	movl	$4, %esi
	callq	_ALIGN
	cltq
	leaq	(%rbx,%rax,8), %r15
	movq	(%r12), %r14
	leaq	64(%r14), %rax
	cmpq	%rax, %r15
	jae	LBB0_30
## %bb.27:
	movq	_PART_WORK@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	shlq	$2, %rsi
	addq	24(%r12), %rsi
	movq	%r12, %r13
	movq	%r12, %rdi
	callq	_wlcore_set_partition
	testl	%eax, %eax
	js	LBB0_25
## %bb.28:
	movq	%r15, %rax
	subq	%r14, %rax
	sarq	$3, %rax
	movl	$8, %r14d
	subq	%rax, %r14
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_kmemdup
	testq	%rax, %rax
	je	LBB0_36
## %bb.29:
	movq	%rax, %rbx
	movq	_REG_CMD_MBOX_ADDRESS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	movq	%rbx, %rdx
	movq	%r14, %rcx
	xorl	%r8d, %r8d
	callq	_wlcore_write_data
	movl	%eax, %r14d
	movq	%rbx, %rdi
	callq	_kfree
	movl	%r14d, %eax
	jmp	LBB0_34
LBB0_30:
	leaq	L_.str.4(%rip), %rdi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_wl1271_error
LBB0_31:
	movq	_EILSEQ@GOTPCREL(%rip), %rax
LBB0_32:
	subl	(%rax), %ebx
LBB0_33:
	movl	%ebx, %eax
LBB0_34:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_25:
	movl	%eax, %ebx
	jmp	LBB0_33
LBB0_36:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	jmp	LBB0_32
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"unknown"

L_.str.1:                               ## @.str.1
	.asciz	"NVS file is needed during boot"

	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_WLCORE_QUIRK_LEGACY_NVS,4,2    ## @WLCORE_QUIRK_LEGACY_NVS
	.comm	_WL1271_INI_LEGACY_NVS_FILE_SIZE,4,2 ## @WL1271_INI_LEGACY_NVS_FILE_SIZE
L_.str.2:                               ## @.str.2
	.asciz	"%s size is not as expected: %zu != %zu"

	.comm	_EILSEQ,4,2                     ## @EILSEQ
	.comm	_DEBUG_BOOT,4,2                 ## @DEBUG_BOOT
L_.str.3:                               ## @.str.3
	.asciz	"nvs burst write 0x%x: 0x%x"

	.comm	_PART_WORK,8,3                  ## @PART_WORK
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_REG_CMD_MBOX_ADDRESS,4,2       ## @REG_CMD_MBOX_ADDRESS
L_.str.4:                               ## @.str.4
	.asciz	"nvs data is malformed"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_wlcore_boot_upload_nvs         ; -- Begin function wlcore_boot_upload_nvs
	.p2align	2
_wlcore_boot_upload_nvs:                ; @wlcore_boot_upload_nvs
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	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
	mov	x19, x0
	ldr	x0, [x0, #48]
	bl	_dev_get_platdata
	ldr	x21, [x19]
	cbz	x21, LBB0_14
; %bb.1:
	cbz	x0, LBB0_4
; %bb.2:
	ldr	x8, [x0]
	cbz	x8, LBB0_4
; %bb.3:
	ldr	x8, [x8]
	b	LBB0_5
LBB0_4:
Lloh0:
	adrp	x8, l_.str@PAGE
Lloh1:
	add	x8, x8, l_.str@PAGEOFF
LBB0_5:
Lloh2:
	adrp	x9, _WLCORE_QUIRK_LEGACY_NVS@GOTPAGE
Lloh3:
	ldr	x9, [x9, _WLCORE_QUIRK_LEGACY_NVS@GOTPAGEOFF]
Lloh4:
	ldr	w10, [x9]
	ldp	w11, w9, [x19, #8]
	tst	w10, w11
	b.eq	LBB0_15
; %bb.6:
Lloh5:
	adrp	x10, _WL1271_INI_LEGACY_NVS_FILE_SIZE@GOTPAGE
Lloh6:
	ldr	x10, [x10, _WL1271_INI_LEGACY_NVS_FILE_SIZE@GOTPAGEOFF]
Lloh7:
	ldr	w10, [x10]
	cmp	w9, #16
	b.eq	LBB0_8
; %bb.7:
	cmp	w9, w10
	b.ne	LBB0_10
LBB0_8:
	ldr	x11, [x21, #8]
	cbz	x11, LBB0_10
; %bb.9:
	mov	w11, #1
	str	w11, [x19, #16]
LBB0_10:
	cmp	w9, #16
	b.eq	LBB0_18
; %bb.11:
	cmp	w9, w10
	b.ne	LBB0_13
; %bb.12:
	ldr	w10, [x19, #16]
	cbz	w10, LBB0_18
LBB0_13:
	mov	w10, #16
	str	x10, [sp, #16]
	b	LBB0_27
LBB0_14:
Lloh8:
	adrp	x0, l_.str.1@PAGE
Lloh9:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_wl1271_error
Lloh10:
	adrp	x8, _ENODEV@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
	b	LBB0_34
LBB0_15:
	cmp	w9, #16
	b.ne	LBB0_26
; %bb.16:
	ldr	x8, [x21, #8]
	cbz	x8, LBB0_18
; %bb.17:
	mov	w8, #1
	str	w8, [x19, #16]
LBB0_18:
	ldr	x23, [x21]
	ldr	x8, [x19, #40]
	ldr	x8, [x8]
	ldr	x9, [x8]
	str	x9, [x23, #88]
	ldr	x9, [x8, #8]
	str	x9, [x23, #80]
	ldr	x9, [x8, #16]
	str	x9, [x23, #48]
	ldr	x9, [x8, #24]
	str	x9, [x23, #40]
	ldr	x9, [x8, #32]
	str	x9, [x23, #32]
	ldr	x8, [x8, #40]
	str	x8, [x23, #24]
Lloh12:
	adrp	x24, _DEBUG_BOOT@GOTPAGE
Lloh13:
	ldr	x24, [x24, _DEBUG_BOOT@GOTPAGEOFF]
Lloh14:
	adrp	x20, l_.str.3@PAGE
Lloh15:
	add	x20, x20, l_.str.3@PAGEOFF
LBB0_19:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_22 Depth 2
	ldr	x25, [x23]
	cbz	x25, LBB0_28
; %bb.20:                               ;   in Loop: Header=BB0_19 Depth=1
	add	x8, x23, #48
	add	x9, x21, #64
	cmp	x8, x9
	b.hs	LBB0_32
; %bb.21:                               ;   in Loop: Header=BB0_19 Depth=1
	ldp	x9, x8, [x23, #8]
	and	x9, x9, #0xfe
	bfi	x9, x8, #8, #56
	ldr	x8, [x19, #32]
	add	x21, x9, x8
	add	x23, x23, #56
LBB0_22:                                ;   Parent Loop BB0_19 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldp	x8, x9, [x23, #-32]
	orr	x8, x8, x9, lsl #8
	ldp	x9, x10, [x23, #-16]
	orr	x8, x8, x9, lsl #16
	orr	x22, x8, x10, lsl #24
	ldr	w0, [x24]
	mov	x1, x20
	mov	x2, x21
	mov	x3, x22
	bl	_wl1271_debug
	mov	x0, x19
	mov	x1, x21
	mov	x2, x22
	bl	_wlcore_write32
	tbnz	w0, #31, LBB0_35
; %bb.23:                               ;   in Loop: Header=BB0_22 Depth=2
	subs	x25, x25, #1
	b.eq	LBB0_25
; %bb.24:                               ;   in Loop: Header=BB0_22 Depth=2
	add	x23, x23, #32
	add	x21, x21, #4
	ldr	x8, [x19]
	sub	x9, x23, #8
	add	x8, x8, #64
	cmp	x9, x8
	b.lo	LBB0_22
	b	LBB0_32
LBB0_25:                                ;   in Loop: Header=BB0_19 Depth=1
	ldr	x21, [x19]
	add	x8, x21, #64
	cmp	x23, x8
	b.lo	LBB0_19
	b	LBB0_32
LBB0_26:
	mov	w10, #16
	str	x10, [sp, #16]
                                        ; kill: def $w9 killed $w9 killed $x9 def $x9
LBB0_27:
	stp	x8, x9, [sp]
Lloh16:
	adrp	x0, l_.str.2@PAGE
Lloh17:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_wl1271_error
	ldr	x0, [x19]
	bl	_kfree
	str	xzr, [x19]
	str	wzr, [x19, #12]
	b	LBB0_33
LBB0_28:
	sub	x8, x23, x21
	lsr	x8, x8, #3
	add	w0, w8, #7
	mov	w1, #4
	bl	_ALIGN
	add	x20, x21, w0, sxtw #3
	ldr	x21, [x19]
	add	x8, x21, #64
	cmp	x20, x8
	b.hs	LBB0_32
; %bb.29:
	ldr	x8, [x19, #24]
Lloh18:
	adrp	x9, _PART_WORK@GOTPAGE
Lloh19:
	ldr	x9, [x9, _PART_WORK@GOTPAGEOFF]
Lloh20:
	ldr	x9, [x9]
	add	x1, x8, x9, lsl #2
	mov	x0, x19
	bl	_wlcore_set_partition
	tbnz	w0, #31, LBB0_35
; %bb.30:
	sub	x8, x20, x21
	mov	w9, #8
	sub	x21, x9, x8, asr #3
Lloh21:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh22:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh23:
	ldr	w2, [x8]
	mov	x0, x20
	mov	x1, x21
	bl	_kmemdup
	cbz	x0, LBB0_36
; %bb.31:
	mov	x20, x0
Lloh24:
	adrp	x8, _REG_CMD_MBOX_ADDRESS@GOTPAGE
Lloh25:
	ldr	x8, [x8, _REG_CMD_MBOX_ADDRESS@GOTPAGEOFF]
Lloh26:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x20
	mov	x3, x21
	mov	w4, #0
	bl	_wlcore_write_data
	mov	x19, x0
	mov	x0, x20
	bl	_kfree
	mov	x0, x19
	b	LBB0_35
LBB0_32:
Lloh27:
	adrp	x0, l_.str.4@PAGE
Lloh28:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_wl1271_error
LBB0_33:
Lloh29:
	adrp	x8, _EILSEQ@GOTPAGE
Lloh30:
	ldr	x8, [x8, _EILSEQ@GOTPAGEOFF]
LBB0_34:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_35:
	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
	add	sp, sp, #112
	ret
LBB0_36:
Lloh31:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh32:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_34
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh31, Lloh32
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"unknown"

l_.str.1:                               ; @.str.1
	.asciz	"NVS file is needed during boot"

	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_WLCORE_QUIRK_LEGACY_NVS,4,2    ; @WLCORE_QUIRK_LEGACY_NVS
	.comm	_WL1271_INI_LEGACY_NVS_FILE_SIZE,4,2 ; @WL1271_INI_LEGACY_NVS_FILE_SIZE
l_.str.2:                               ; @.str.2
	.asciz	"%s size is not as expected: %zu != %zu"

	.comm	_EILSEQ,4,2                     ; @EILSEQ
	.comm	_DEBUG_BOOT,4,2                 ; @DEBUG_BOOT
l_.str.3:                               ; @.str.3
	.asciz	"nvs burst write 0x%x: 0x%x"

	.comm	_PART_WORK,8,3                  ; @PART_WORK
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_REG_CMD_MBOX_ADDRESS,4,2       ; @REG_CMD_MBOX_ADDRESS
l_.str.4:                               ; @.str.4
	.asciz	"nvs data is malformed"

.subsections_via_symbols
