	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_wcn36xx_smd_load_nv            ## -- Begin function wcn36xx_smd_load_nv
	.p2align	4, 0x90
_wcn36xx_smd_load_nv:                   ## @wcn36xx_smd_load_nv
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r12
	leaq	16(%rdi), %r14
	movq	16(%rdi), %rax
	testq	%rax, %rax
	je	LBB0_1
LBB0_3:
	movq	8(%rax), %r13
	movq	_WCN36XX_HAL_DOWNLOAD_NV_REQ@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	-48(%rbp), %rax
	movq	%rax, 16(%rsp)
	movups	-64(%rbp), %xmm0
	movups	%xmm0, (%rsp)
	callq	_INIT_HAL_MSG
	movq	_WCN36XX_NV_FRAGMENT_SIZE@GOTPCREL(%rip), %rbx
	movl	(%rbx), %eax
	addl	%eax, -48(%rbp)
	movq	$0, -56(%rbp)
	movq	%r12, %rdi
	callq	_mutex_lock
	movl	(%rbx), %eax
	xorl	%r15d, %r15d
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r14), %rcx
	movl	(%rcx), %ecx
	subl	%r15d, %ecx
	leal	-4(%rcx), %edx
	cmpl	%eax, %edx
	jle	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	movl	$0, -64(%rbp)
	movl	%eax, -60(%rbp)
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_4 Depth=1
	movl	$1, -64(%rbp)
	movl	%edx, -60(%rbp)
	addl	$20, %ecx
	movl	%ecx, -48(%rbp)
LBB0_7:                                 ##   in Loop: Header=BB0_4 Depth=1
	movq	8(%r12), %rdi
	leaq	-64(%rbp), %rsi
	movl	$24, %edx
	callq	_memcpy
	movq	8(%r12), %rdi
	addq	$24, %rdi
	movslq	%r15d, %rax
	leaq	(%rax,%rax,2), %rax
	leaq	(,%rax,8), %rsi
	addq	%r13, %rsi
	movl	-60(%rbp), %edx
	callq	_memcpy
	movl	-48(%rbp), %esi
	movq	%r12, %rdi
	callq	_wcn36xx_smd_send_and_wait
	testl	%eax, %eax
	jne	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	8(%r12), %rdi
	movl	4(%r12), %esi
	callq	_wcn36xx_smd_rsp_status_check
	testl	%eax, %eax
	jne	LBB0_10
## %bb.11:                              ##   in Loop: Header=BB0_4 Depth=1
	incq	-56(%rbp)
	movq	_WCN36XX_NV_FRAGMENT_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%eax, %r15d
	cmpl	$1, -64(%rbp)
	jne	LBB0_4
## %bb.12:
	xorl	%ebx, %ebx
	jmp	LBB0_13
LBB0_1:
	movq	_WLAN_NV_FILE@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movl	24(%r12), %edx
	movq	%r14, %rdi
	callq	_request_firmware
	testl	%eax, %eax
	je	LBB0_2
## %bb.15:
	movl	%eax, %ebx
	movl	(%r15), %esi
	leaq	L_.str(%rip), %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_wcn36xx_err
	jmp	LBB0_14
LBB0_8:
	movl	%eax, %ebx
	jmp	LBB0_13
LBB0_10:
	movl	%eax, %ebx
	leaq	L_.str.1(%rip), %rdi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_wcn36xx_err
LBB0_13:
	movq	%r12, %rdi
	callq	_mutex_unlock
LBB0_14:
	movl	%ebx, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movq	(%r14), %rax
	jmp	LBB0_3
	.cfi_endproc
                                        ## -- End function
	.comm	_WLAN_NV_FILE,4,2               ## @WLAN_NV_FILE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to load nv file %s: %d\n"

	.comm	_WCN36XX_HAL_DOWNLOAD_NV_REQ,4,2 ## @WCN36XX_HAL_DOWNLOAD_NV_REQ
	.comm	_WCN36XX_NV_FRAGMENT_SIZE,4,2   ## @WCN36XX_NV_FRAGMENT_SIZE
L_.str.1:                               ## @.str.1
	.asciz	"hal_load_nv response failed err=%d\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_wcn36xx_smd_load_nv            ; -- Begin function wcn36xx_smd_load_nv
	.p2align	2
_wcn36xx_smd_load_nv:                   ; @wcn36xx_smd_load_nv
	.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
	mov	x20, x0
	ldr	x8, [x20, #16]!
	cbz	x8, LBB0_9
LBB0_1:
	ldr	x22, [x8, #8]
Lloh0:
	adrp	x8, _WCN36XX_HAL_DOWNLOAD_NV_REQ@GOTPAGE
Lloh1:
	ldr	x8, [x8, _WCN36XX_HAL_DOWNLOAD_NV_REQ@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	add	x0, sp, #8
	bl	_INIT_HAL_MSG
	str	xzr, [sp, #16]
	mov	x0, x19
	bl	_mutex_lock
	mov	w23, #0
Lloh3:
	adrp	x24, _WCN36XX_NV_FRAGMENT_SIZE@GOTPAGE
Lloh4:
	ldr	x24, [x24, _WCN36XX_NV_FRAGMENT_SIZE@GOTPAGEOFF]
	ldr	w8, [x24]
	mov	w25, #24
	mov	w26, #1
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x20]
	ldr	w9, [x9]
	sub	w9, w9, w23
	sub	w10, w9, #4
	cmp	w10, w8
	b.le	LBB0_4
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	stp	wzr, w8, [sp, #8]
	b	LBB0_5
LBB0_4:                                 ;   in Loop: Header=BB0_2 Depth=1
	stp	w26, w10, [sp, #8]
	add	w8, w9, #20
	str	w8, [sp, #24]
LBB0_5:                                 ;   in Loop: Header=BB0_2 Depth=1
	ldr	x0, [x19, #8]
	add	x1, sp, #8
	mov	w2, #24
	bl	_memcpy
	ldr	x8, [x19, #8]
	add	x0, x8, #24
	smaddl	x1, w23, w25, x22
	ldr	w2, [sp, #12]
	bl	_memcpy
	ldr	w1, [sp, #24]
	mov	x0, x19
	bl	_wcn36xx_smd_send_and_wait
	cbnz	w0, LBB0_11
; %bb.6:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x0, [x19, #8]
	ldr	w1, [x19, #4]
	bl	_wcn36xx_smd_rsp_status_check
	cbnz	w0, LBB0_12
; %bb.7:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x8, [sp, #16]
	add	x8, x8, #1
	str	x8, [sp, #16]
	ldr	w8, [x24]
	add	w23, w8, w23
	ldr	w9, [sp, #8]
	cmp	w9, #1
	b.ne	LBB0_2
; %bb.8:
	mov	w21, #0
	b	LBB0_13
LBB0_9:
Lloh5:
	adrp	x22, _WLAN_NV_FILE@GOTPAGE
Lloh6:
	ldr	x22, [x22, _WLAN_NV_FILE@GOTPAGEOFF]
	ldr	w1, [x22]
	ldr	w2, [x19, #24]
	mov	x0, x20
	bl	_request_firmware
	cbz	w0, LBB0_15
; %bb.10:
	mov	x21, x0
	ldr	w1, [x22]
	str	x21, [sp]
Lloh7:
	adrp	x0, l_.str@PAGE
Lloh8:
	add	x0, x0, l_.str@PAGEOFF
	bl	_wcn36xx_err
	b	LBB0_14
LBB0_11:
	mov	x21, x0
	b	LBB0_13
LBB0_12:
	mov	x21, x0
Lloh9:
	adrp	x0, l_.str.1@PAGE
Lloh10:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x21
	bl	_wcn36xx_err
LBB0_13:
	mov	x0, x19
	bl	_mutex_unlock
LBB0_14:
	mov	x0, x21
	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_15:
	ldr	x8, [x20]
	b	LBB0_1
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_WLAN_NV_FILE,4,2               ; @WLAN_NV_FILE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to load nv file %s: %d\n"

	.comm	_WCN36XX_HAL_DOWNLOAD_NV_REQ,4,2 ; @WCN36XX_HAL_DOWNLOAD_NV_REQ
	.comm	_WCN36XX_NV_FRAGMENT_SIZE,4,2   ; @WCN36XX_NV_FRAGMENT_SIZE
l_.str.1:                               ; @.str.1
	.asciz	"hal_load_nv response failed err=%d\n"

.subsections_via_symbols
