	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_rtw_download_firmware          ## -- Begin function rtw_download_firmware
	.p2align	4, 0x90
_rtw_download_firmware:                 ## @rtw_download_firmware
	.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
	movq	%rsi, %r14
	movq	%rdi, %r15
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_DLFW_RESTORE_REG_NUM@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	shlq	$2, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r12
	movq	(%r14), %rax
	movq	8(%rax), %rbx
	movl	(%rax), %r13d
	movq	%rbx, %rdi
	movl	%r13d, %esi
	callq	_check_firmware_size
	testl	%eax, %eax
	je	LBB0_1
## %bb.3:
	leaq	-52(%rbp), %rdx
	movq	%r15, %rdi
	movl	$56, %esi
	callq	_ltecoex_read_reg
	testl	%eax, %eax
	je	LBB0_4
## %bb.5:
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_wlan_cpu_enable
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_download_firmware_reg_backup
	movq	%r15, %rdi
	callq	_download_firmware_reset_platform
	movq	%r15, %rdi
	movq	%rbx, %rsi
	movl	%r13d, %edx
	callq	_start_download_firmware
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_6
LBB0_9:
	movq	_REG_MCUFW_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_BIT_MCUFWDL_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	callq	_rtw_write8_clr
	movq	_REG_SYS_FUNC_EN@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	incq	%rsi
	movq	_BIT_FEN_CPUEN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	callq	_rtw_write8_set
	jmp	LBB0_10
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_6:
	movq	_DLFW_RESTORE_REG_NUM@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_download_firmware_reg_restore
	movq	%r15, %rdi
	callq	_download_firmware_end_flow
	movq	%r15, %rdi
	movl	$1, %esi
	callq	_wlan_cpu_enable
	movl	-52(%rbp), %edx
	movq	%r15, %rdi
	movl	$56, %esi
	callq	_ltecoex_reg_write
	testl	%eax, %eax
	je	LBB0_4
## %bb.7:
	movq	%r15, %rdi
	callq	_download_firmware_validate
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_9
## %bb.8:
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	_update_firmware_info
	movq	%r15, %rdi
	callq	_rtw_hci_setup
	xorps	%xmm0, %xmm0
	movups	%xmm0, (%r15)
	movq	_RTW_FLAG_FW_RUNNING@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_rtw_flag_set
	xorl	%ebx, %ebx
	jmp	LBB0_10
LBB0_4:
	movq	_EBUSY@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_10:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_12
## %bb.11:
	movl	%ebx, %eax
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_DLFW_RESTORE_REG_NUM,4,2       ## @DLFW_RESTORE_REG_NUM
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_RTW_FLAG_FW_RUNNING,4,2        ## @RTW_FLAG_FW_RUNNING
	.comm	_REG_MCUFW_CTRL,4,2             ## @REG_MCUFW_CTRL
	.comm	_BIT_MCUFWDL_EN,4,2             ## @BIT_MCUFWDL_EN
	.comm	_REG_SYS_FUNC_EN,8,3            ## @REG_SYS_FUNC_EN
	.comm	_BIT_FEN_CPUEN,4,2              ## @BIT_FEN_CPUEN
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_rtw_download_firmware          ; -- Begin function rtw_download_firmware
	.p2align	2
_rtw_download_firmware:                 ; @rtw_download_firmware
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	sub	sp, sp, #16
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-56]
Lloh3:
	adrp	x24, _DLFW_RESTORE_REG_NUM@GOTPAGE
Lloh4:
	ldr	x24, [x24, _DLFW_RESTORE_REG_NUM@GOTPAGEOFF]
	ldr	w8, [x24]
	lsl	x8, x8, #2
	mov	x9, x8
Lloh5:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh6:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0x7fffffff0
	sub	x21, x9, x8
	mov	sp, x21
	ldr	x8, [x1]
	ldr	x22, [x8, #8]
	ldr	w23, [x8]
	mov	x0, x22
	mov	x1, x23
	bl	_check_firmware_size
	cbz	w0, LBB0_4
; %bb.1:
	sub	x2, x29, #60
	mov	x0, x19
	mov	w1, #56
	bl	_ltecoex_read_reg
	cbz	w0, LBB0_8
; %bb.2:
	mov	x0, x19
	mov	w1, #0
	bl	_wlan_cpu_enable
	mov	x0, x19
	mov	x1, x21
	bl	_download_firmware_reg_backup
	mov	x0, x19
	bl	_download_firmware_reset_platform
	mov	x0, x19
	mov	x1, x22
	mov	x2, x23
	bl	_start_download_firmware
	mov	x22, x0
	cbz	w0, LBB0_5
LBB0_3:
Lloh7:
	adrp	x8, _REG_MCUFW_CTRL@GOTPAGE
Lloh8:
	ldr	x8, [x8, _REG_MCUFW_CTRL@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
Lloh10:
	adrp	x8, _BIT_MCUFWDL_EN@GOTPAGE
Lloh11:
	ldr	x8, [x8, _BIT_MCUFWDL_EN@GOTPAGEOFF]
Lloh12:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_rtw_write8_clr
Lloh13:
	adrp	x8, _REG_SYS_FUNC_EN@GOTPAGE
Lloh14:
	ldr	x8, [x8, _REG_SYS_FUNC_EN@GOTPAGEOFF]
Lloh15:
	ldr	x8, [x8]
	add	x1, x8, #1
Lloh16:
	adrp	x8, _BIT_FEN_CPUEN@GOTPAGE
Lloh17:
	ldr	x8, [x8, _BIT_FEN_CPUEN@GOTPAGEOFF]
Lloh18:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_rtw_write8_set
	b	LBB0_10
LBB0_4:
Lloh19:
	adrp	x8, _EINVAL@GOTPAGE
Lloh20:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_9
LBB0_5:
	ldr	w2, [x24]
	mov	x0, x19
	mov	x1, x21
	bl	_download_firmware_reg_restore
	mov	x0, x19
	bl	_download_firmware_end_flow
	mov	x0, x19
	mov	w1, #1
	bl	_wlan_cpu_enable
	ldur	w2, [x29, #-60]
	mov	x0, x19
	mov	w1, #56
	bl	_ltecoex_reg_write
	cbz	w0, LBB0_8
; %bb.6:
	mov	x0, x19
	bl	_download_firmware_validate
	mov	x22, x0
	cbnz	w0, LBB0_3
; %bb.7:
	mov	x0, x19
	mov	x1, x20
	bl	_update_firmware_info
	mov	x0, x19
	bl	_rtw_hci_setup
	stp	xzr, xzr, [x19]
Lloh21:
	adrp	x8, _RTW_FLAG_FW_RUNNING@GOTPAGE
Lloh22:
	ldr	x8, [x8, _RTW_FLAG_FW_RUNNING@GOTPAGEOFF]
Lloh23:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_rtw_flag_set
	b	LBB0_10
LBB0_8:
Lloh24:
	adrp	x8, _EBUSY@GOTPAGE
Lloh25:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
LBB0_9:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_10:
	ldur	x8, [x29, #-56]
Lloh26:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh27:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh28:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_12
; %bb.11:
	mov	x0, x22
	sub	sp, x29, #48
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_12:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.comm	_DLFW_RESTORE_REG_NUM,4,2       ; @DLFW_RESTORE_REG_NUM
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_RTW_FLAG_FW_RUNNING,4,2        ; @RTW_FLAG_FW_RUNNING
	.comm	_REG_MCUFW_CTRL,4,2             ; @REG_MCUFW_CTRL
	.comm	_BIT_MCUFWDL_EN,4,2             ; @BIT_MCUFWDL_EN
	.comm	_REG_SYS_FUNC_EN,8,3            ; @REG_SYS_FUNC_EN
	.comm	_BIT_FEN_CPUEN,4,2              ; @BIT_FEN_CPUEN
.subsections_via_symbols
