	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function icn8505_upload_fw
_icn8505_upload_fw:                     ## @icn8505_upload_fw
	.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, %r15
	movq	8(%rdi), %r14
	movl	(%rdi), %esi
	leaq	-48(%rbp), %rdi
	movq	%r14, %rdx
	callq	_request_firmware
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movl	%eax, %r13d
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_9
LBB0_2:
	movq	%r15, %rdi
	movl	$10, %esi
	callq	_icn8505_read_reg_silent
	xorl	%r13d, %r13d
	cmpl	$133, %eax
	je	LBB0_8
## %bb.3:
	movq	_MAX_FW_UPLOAD_TRIES@GOTPCREL(%rip), %r12
	cmpl	$0, (%r12)
	jle	LBB0_8
## %bb.4:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	-48(%rbp), %rsi
	movq	%r15, %rdi
	callq	_icn8505_try_fw_upload
	testl	%eax, %eax
	je	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	%eax, %r13d
	incl	%ebx
	movl	(%r12), %r8d
	movq	%r14, %rdi
	leaq	L_.str.1(%rip), %rsi
	movl	%eax, %edx
	movl	%ebx, %ecx
	xorl	%eax, %eax
	callq	_dev_err
	movl	$2000, %edi                     ## imm = 0x7D0
	movl	$5000, %esi                     ## imm = 0x1388
	callq	_usleep_range
	cmpl	(%r12), %ebx
	jl	LBB0_5
	jmp	LBB0_8
LBB0_6:
	xorl	%r13d, %r13d
LBB0_8:
	movq	-48(%rbp), %rdi
	callq	_release_firmware
LBB0_9:
	movl	%r13d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Firmware request error %d\n"

	.comm	_MAX_FW_UPLOAD_TRIES,4,2        ## @MAX_FW_UPLOAD_TRIES
L_.str.1:                               ## @.str.1
	.asciz	"Failed to upload firmware: %d (attempt %d/%d)\n"

	.no_dead_strip	_icn8505_upload_fw
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function icn8505_upload_fw
_icn8505_upload_fw:                     ; @icn8505_upload_fw
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	mov	x20, x0
	ldr	x19, [x0, #8]
	ldr	w1, [x0]
	add	x0, sp, #24
	mov	x2, x19
	bl	_request_firmware
	mov	x21, x0
	cbz	w0, LBB0_2
; %bb.1:
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	mov	x2, x21
	bl	_dev_err
	b	LBB0_8
LBB0_2:
	mov	x0, x20
	mov	w1, #10
	bl	_icn8505_read_reg_silent
	cmp	w0, #133
	b.eq	LBB0_7
; %bb.3:
Lloh2:
	adrp	x23, _MAX_FW_UPLOAD_TRIES@GOTPAGE
Lloh3:
	ldr	x23, [x23, _MAX_FW_UPLOAD_TRIES@GOTPAGEOFF]
	ldr	w8, [x23]
	cmp	w8, #1
	b.lt	LBB0_7
; %bb.4:
	mov	w24, #0
Lloh4:
	adrp	x22, l_.str.1@PAGE
Lloh5:
	add	x22, x22, l_.str.1@PAGEOFF
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x1, [sp, #24]
	mov	x0, x20
	bl	_icn8505_try_fw_upload
	mov	x21, x0
	cbz	w0, LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	add	w24, w24, #1
	ldr	w8, [x23]
	stp	x24, x8, [sp]
	mov	x0, x19
	mov	x1, x22
	mov	x2, x21
	bl	_dev_err
	mov	w0, #2000
	mov	w1, #5000
	bl	_usleep_range
	ldr	w8, [x23]
	cmp	w24, w8
	b.lt	LBB0_5
LBB0_7:
	ldr	x0, [sp, #24]
	bl	_release_firmware
LBB0_8:
	mov	x0, x21
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Firmware request error %d\n"

	.comm	_MAX_FW_UPLOAD_TRIES,4,2        ; @MAX_FW_UPLOAD_TRIES
l_.str.1:                               ; @.str.1
	.asciz	"Failed to upload firmware: %d (attempt %d/%d)\n"

	.no_dead_strip	_icn8505_upload_fw
.subsections_via_symbols
