	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function s3fwrn5_firmware_update
_s3fwrn5_firmware_update:               ## @s3fwrn5_firmware_update
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %rbx
	leaq	L_.str(%rip), %rsi
	callq	_s3fwrn5_fw_init
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_s3fwrn5_set_wake
	movq	_S3FWRN5_MODE_FW@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_s3fwrn5_set_mode
	movq	%rbx, %rdi
	callq	_s3fwrn5_fw_setup
	movl	%eax, %r14d
	testl	%eax, %eax
	js	LBB0_6
## %bb.1:
	movq	8(%rbx), %rax
	movl	8(%rax), %esi
	movq	%rbx, %rdi
	callq	_s3fwrn5_fw_check_version
	testl	%eax, %eax
	je	LBB0_5
## %bb.2:
	movq	8(%rbx), %rax
	movq	(%rax), %rdi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_info
	movq	%rbx, %rdi
	callq	_s3fwrn5_fw_download
	testl	%eax, %eax
	js	LBB0_3
## %bb.4:
	movq	_S3FWRN5_MODE_NCI@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_s3fwrn5_set_mode
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_s3fwrn5_set_wake
	leaq	L_.str.2(%rip), %rsi
	movq	%rbx, %rdi
	callq	_s3fwrn5_nci_rf_configure
	movl	%eax, %r14d
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_s3fwrn5_set_wake
	jmp	LBB0_5
LBB0_3:
	movl	%eax, %r14d
LBB0_5:
	movq	_S3FWRN5_MODE_COLD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_s3fwrn5_set_mode
	movq	%rbx, %rdi
	callq	_s3fwrn5_fw_cleanup
LBB0_6:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"sec_s3fwrn5_firmware.bin"

	.comm	_S3FWRN5_MODE_FW,4,2            ## @S3FWRN5_MODE_FW
L_.str.1:                               ## @.str.1
	.asciz	"Detected new firmware version\n"

	.comm	_S3FWRN5_MODE_NCI,4,2           ## @S3FWRN5_MODE_NCI
L_.str.2:                               ## @.str.2
	.asciz	"sec_s3fwrn5_rfreg.bin"

	.comm	_S3FWRN5_MODE_COLD,4,2          ## @S3FWRN5_MODE_COLD
	.no_dead_strip	_s3fwrn5_firmware_update
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function s3fwrn5_firmware_update
_s3fwrn5_firmware_update:               ; @s3fwrn5_firmware_update
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_s3fwrn5_fw_init
	mov	x0, x19
	mov	w1, #0
	bl	_s3fwrn5_set_wake
Lloh2:
	adrp	x8, _S3FWRN5_MODE_FW@GOTPAGE
Lloh3:
	ldr	x8, [x8, _S3FWRN5_MODE_FW@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_s3fwrn5_set_mode
	mov	x0, x19
	bl	_s3fwrn5_fw_setup
	mov	x20, x0
	tbnz	w0, #31, LBB0_6
; %bb.1:
	ldr	x8, [x19, #8]
	ldr	w1, [x8, #8]
	mov	x0, x19
	bl	_s3fwrn5_fw_check_version
	cbz	w0, LBB0_5
; %bb.2:
	ldr	x8, [x19, #8]
	ldr	x0, [x8]
Lloh5:
	adrp	x1, l_.str.1@PAGE
Lloh6:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_info
	mov	x0, x19
	bl	_s3fwrn5_fw_download
	tbnz	w0, #31, LBB0_4
; %bb.3:
Lloh7:
	adrp	x8, _S3FWRN5_MODE_NCI@GOTPAGE
Lloh8:
	ldr	x8, [x8, _S3FWRN5_MODE_NCI@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_s3fwrn5_set_mode
	mov	x0, x19
	mov	w1, #1
	bl	_s3fwrn5_set_wake
Lloh10:
	adrp	x1, l_.str.2@PAGE
Lloh11:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_s3fwrn5_nci_rf_configure
	mov	x20, x0
	mov	x0, x19
	mov	w1, #0
	bl	_s3fwrn5_set_wake
	b	LBB0_5
LBB0_4:
	mov	x20, x0
LBB0_5:
Lloh12:
	adrp	x8, _S3FWRN5_MODE_COLD@GOTPAGE
Lloh13:
	ldr	x8, [x8, _S3FWRN5_MODE_COLD@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_s3fwrn5_set_mode
	mov	x0, x19
	bl	_s3fwrn5_fw_cleanup
LBB0_6:
	mov	x0, x20
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"sec_s3fwrn5_firmware.bin"

	.comm	_S3FWRN5_MODE_FW,4,2            ; @S3FWRN5_MODE_FW
l_.str.1:                               ; @.str.1
	.asciz	"Detected new firmware version\n"

	.comm	_S3FWRN5_MODE_NCI,4,2           ; @S3FWRN5_MODE_NCI
l_.str.2:                               ; @.str.2
	.asciz	"sec_s3fwrn5_rfreg.bin"

	.comm	_S3FWRN5_MODE_COLD,4,2          ; @S3FWRN5_MODE_COLD
	.no_dead_strip	_s3fwrn5_firmware_update
.subsections_via_symbols
