	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_s3fwrn5_fw_download            ## -- Begin function s3fwrn5_fw_download
	.p2align	4, 0x90
_s3fwrn5_fw_download:                   ## @s3fwrn5_fw_download
	.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	%rdi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_SHA1_DIGEST_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	shlq	$2, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r13
	movl	40(%r14), %r15d
	imull	(%r14), %r15d
	leaq	L_.str(%rip), %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_crypto_alloc_shash
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	%rbx, %rdi
	callq	_PTR_ERR
	movl	%eax, %r13d
	movq	8(%r14), %rax
	movq	(%rax), %rdi
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_4
LBB0_2:
	movq	_desc@GOTPCREL(%rip), %r12
	movq	(%r12), %rdi
	movq	%rbx, %rsi
	callq	_SHASH_DESC_ON_STACK
	movq	(%r12), %rax
	movq	%rbx, (%rax)
	movq	(%r12), %rdi
	movq	48(%r14), %rsi
	movl	%r15d, %edx
	movq	%r13, -56(%rbp)                 ## 8-byte Spill
	movq	%r13, %rcx
	callq	_crypto_shash_digest
	movl	%eax, %r13d
	movq	(%r12), %rdi
	callq	_shash_desc_zero
	movq	%rbx, %rdi
	callq	_crypto_free_shash
	movq	8(%r14), %rax
	movq	(%rax), %rdi
	testl	%r13d, %r13d
	je	LBB0_5
## %bb.3:
	leaq	L_.str.2(%rip), %rsi
LBB0_4:
	movl	%r13d, %edx
	xorl	%eax, %eax
	callq	_dev_err
LBB0_15:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_18
## %bb.16:
	movl	%r13d, %eax
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movl	32(%r14), %edx
	leaq	L_.str.3(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_info
	movq	_SHA1_DIGEST_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	24(%r14), %r8d
	movl	28(%r14), %ecx
	movq	%r14, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	callq	_s3fwrn5_fw_enter_update_mode
	testl	%eax, %eax
	js	LBB0_17
## %bb.6:
	testl	%r15d, %r15d
	jle	LBB0_11
## %bb.7:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movslq	%ebx, %rdx
	movq	16(%r14), %rsi
	addq	%rdx, %rsi
	addq	48(%r14), %rdx
	movq	%r14, %rdi
	callq	_s3fwrn5_fw_update_sector
	testl	%eax, %eax
	js	LBB0_9
## %bb.10:                              ##   in Loop: Header=BB0_8 Depth=1
	addl	(%r14), %ebx
	cmpl	%r15d, %ebx
	jl	LBB0_8
LBB0_11:
	movq	%r14, %rdi
	callq	_s3fwrn5_fw_complete_update_mode
	movl	%eax, %r13d
	movq	8(%r14), %rax
	movq	(%rax), %rdi
	testl	%r13d, %r13d
	js	LBB0_12
## %bb.14:
	leaq	L_.str.7(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_info
	jmp	LBB0_15
LBB0_17:
	movl	%eax, %r13d
	movq	8(%r14), %rax
	movq	(%rax), %rdi
	leaq	L_.str.4(%rip), %rsi
	jmp	LBB0_13
LBB0_9:
	movl	%eax, %r13d
	movq	8(%r14), %rax
	movq	(%rax), %rdi
	leaq	L_.str.5(%rip), %rsi
	jmp	LBB0_4
LBB0_12:
	leaq	L_.str.6(%rip), %rsi
LBB0_13:
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_15
LBB0_18:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_SHA1_DIGEST_SIZE,4,2           ## @SHA1_DIGEST_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"sha1"

L_.str.1:                               ## @.str.1
	.asciz	"Cannot allocate shash (code=%d)\n"

	.comm	_desc,8,3                       ## @desc
L_.str.2:                               ## @.str.2
	.asciz	"Cannot compute hash (code=%d)\n"

L_.str.3:                               ## @.str.3
	.asciz	"Firmware update: %s\n"

L_.str.4:                               ## @.str.4
	.asciz	"Unable to enter update mode\n"

L_.str.5:                               ## @.str.5
	.asciz	"Firmware update error (code=%d)\n"

L_.str.6:                               ## @.str.6
	.asciz	"Unable to complete update mode\n"

L_.str.7:                               ## @.str.7
	.asciz	"Firmware update: success\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_s3fwrn5_fw_download            ; -- Begin function s3fwrn5_fw_download
	.p2align	2
_s3fwrn5_fw_download:                   ; @s3fwrn5_fw_download
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	sub	sp, sp, #16
	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, #-72]
Lloh3:
	adrp	x24, _SHA1_DIGEST_SIZE@GOTPAGE
Lloh4:
	ldr	x24, [x24, _SHA1_DIGEST_SIZE@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	w20, [x0]
	ldr	w23, [x0, #40]
Lloh7:
	adrp	x0, l_.str@PAGE
Lloh8:
	add	x0, x0, l_.str@PAGEOFF
	mov	w1, #0
	mov	w2, #0
	bl	_crypto_alloc_shash
	mov	x22, x0
	bl	_IS_ERR
	cbz	x0, LBB0_2
; %bb.1:
	mov	x0, x22
	bl	_PTR_ERR
	mov	x21, x0
	ldr	x8, [x19, #8]
	ldr	x0, [x8]
	str	x21, [sp, #-16]!
Lloh9:
	adrp	x1, l_.str.1@PAGE
Lloh10:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
	add	sp, sp, #16
	b	LBB0_4
LBB0_2:
	mul	w20, w23, w20
Lloh11:
	adrp	x25, _desc@GOTPAGE
Lloh12:
	ldr	x25, [x25, _desc@GOTPAGEOFF]
	ldr	x0, [x25]
	mov	x1, x22
	bl	_SHASH_DESC_ON_STACK
	ldr	x8, [x25]
	str	x22, [x8]
	ldr	x0, [x25]
	ldr	x1, [x19, #48]
	mov	x2, x20
	mov	x3, x21
	bl	_crypto_shash_digest
	mov	x23, x0
	ldr	x0, [x25]
	bl	_shash_desc_zero
	mov	x0, x22
	bl	_crypto_free_shash
	ldr	x8, [x19, #8]
	ldr	x0, [x8]
	cbz	w23, LBB0_6
; %bb.3:
	str	x23, [sp, #-16]!
Lloh13:
	adrp	x1, l_.str.2@PAGE
Lloh14:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_err
	add	sp, sp, #16
	mov	x21, x23
LBB0_4:
	ldur	x8, [x29, #-72]
Lloh15:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh16:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh17:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_16
; %bb.5:
	mov	x0, x21
	sub	sp, x29, #64
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_6:
	ldr	w8, [x19, #32]
	str	x8, [sp, #-16]!
Lloh18:
	adrp	x1, l_.str.3@PAGE
Lloh19:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_info
	add	sp, sp, #16
	ldr	w2, [x24]
	ldp	w4, w3, [x19, #24]
	mov	x0, x19
	mov	x1, x21
	bl	_s3fwrn5_fw_enter_update_mode
	tbnz	w0, #31, LBB0_13
; %bb.7:
	cmp	w20, #1
	b.lt	LBB0_11
; %bb.8:
	mov	w22, #0
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19, #16]
	sxtw	x9, w22
	add	x1, x8, x9
	ldr	x8, [x19, #48]
	add	x2, x8, x9
	mov	x0, x19
	bl	_s3fwrn5_fw_update_sector
	tbnz	w0, #31, LBB0_14
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
	ldr	w8, [x19]
	add	w22, w8, w22
	cmp	w22, w20
	b.lt	LBB0_9
LBB0_11:
	mov	x0, x19
	bl	_s3fwrn5_fw_complete_update_mode
	mov	x21, x0
	ldr	x8, [x19, #8]
	ldr	x0, [x8]
	tbnz	w21, #31, LBB0_15
; %bb.12:
Lloh20:
	adrp	x1, l_.str.7@PAGE
Lloh21:
	add	x1, x1, l_.str.7@PAGEOFF
	bl	_dev_info
	b	LBB0_4
LBB0_13:
	mov	x21, x0
	ldr	x8, [x19, #8]
	ldr	x0, [x8]
Lloh22:
	adrp	x1, l_.str.4@PAGE
Lloh23:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_dev_err
	b	LBB0_4
LBB0_14:
	mov	x21, x0
	ldr	x8, [x19, #8]
	ldr	x0, [x8]
	str	x21, [sp, #-16]!
Lloh24:
	adrp	x1, l_.str.5@PAGE
Lloh25:
	add	x1, x1, l_.str.5@PAGEOFF
	bl	_dev_err
	add	sp, sp, #16
                                        ; kill: def $w21 killed $w21 killed $x21 def $x21
	b	LBB0_4
LBB0_15:
Lloh26:
	adrp	x1, l_.str.6@PAGE
Lloh27:
	add	x1, x1, l_.str.6@PAGEOFF
	bl	_dev_err
	b	LBB0_4
LBB0_16:
	bl	___stack_chk_fail
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_SHA1_DIGEST_SIZE,4,2           ; @SHA1_DIGEST_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"sha1"

l_.str.1:                               ; @.str.1
	.asciz	"Cannot allocate shash (code=%d)\n"

	.comm	_desc,8,3                       ; @desc
l_.str.2:                               ; @.str.2
	.asciz	"Cannot compute hash (code=%d)\n"

l_.str.3:                               ; @.str.3
	.asciz	"Firmware update: %s\n"

l_.str.4:                               ; @.str.4
	.asciz	"Unable to enter update mode\n"

l_.str.5:                               ; @.str.5
	.asciz	"Firmware update error (code=%d)\n"

l_.str.6:                               ; @.str.6
	.asciz	"Unable to complete update mode\n"

l_.str.7:                               ; @.str.7
	.asciz	"Firmware update: success\n"

.subsections_via_symbols
