	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function qtnf_ep_fw_load
_qtnf_ep_fw_load:                       ## @qtnf_ep_fw_load
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %ecx
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	movq	_QTN_PCIE_FW_BUFSZ@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	addl	$-4, %edi
	movl	%edx, %eax
	cltd
	movl	%edi, -52(%rbp)                 ## 4-byte Spill
	idivl	%edi
	movl	%eax, %r14d
	xorl	%ebx, %ebx
	testl	%edx, %edx
	setne	%bl
	leaq	L_.str(%rip), %rdi
	movq	%rsi, -80(%rbp)                 ## 8-byte Spill
                                        ## kill: def $esi killed $esi killed $rsi
	movl	%ecx, -72(%rbp)                 ## 4-byte Spill
	movl	%ecx, %edx
	xorl	%eax, %eax
	callq	_pr_debug
	movl	$0, %esi
	addl	%r14d, %ebx
	jle	LBB0_17
## %bb.1:
	leal	-1(%rbx), %eax
	movl	%eax, -56(%rbp)                 ## 4-byte Spill
	xorl	%r14d, %r14d
	movq	-80(%rbp), %r15                 ## 8-byte Reload
	xorl	%r13d, %r13d
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_3 Depth 2
	cmpl	$10001, %r13d                   ## imm = 0x2711
	movl	$10000, %ebx                    ## imm = 0x2710
	cmovgel	%r13d, %ebx
	incl	%ebx
	.p2align	4, 0x90
LBB0_3:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	incl	%r13d
	cmpl	%r13d, %ebx
	je	LBB0_4
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=2
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	8(%rax), %edi
	movl	-72(%rbp), %esi                 ## 4-byte Reload
	movl	%r14d, %edx
	movq	%r15, %rcx
	movq	-80(%rbp), %r8                  ## 8-byte Reload
	callq	_qtnf_ep_fw_send
	testl	%eax, %eax
	jle	LBB0_3
## %bb.7:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	%eax, %r12d
	leal	1(%r14), %esi
	movq	_QTN_PCIE_FW_DLMASK@GOTPCREL(%rip), %rax
	testl	%esi, (%rax)
	je	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_2 Depth=1
	cmpl	-56(%rbp), %r14d                ## 4-byte Folded Reload
	jne	LBB0_20
LBB0_9:                                 ##   in Loop: Header=BB0_2 Depth=1
	movl	%esi, -68(%rbp)                 ## 4-byte Spill
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	movq	(%rbx), %rdi
	addq	$4, %rdi
	movq	_QTN_RC_FW_SYNC@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_qtnf_set_state
	movq	(%rbx), %rdi
	movq	_QTN_EP_FW_SYNC@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	_QTN_FW_DL_TIMEOUT_MS@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_qtnf_poll_state
	testq	%rax, %rax
	jne	LBB0_10
## %bb.11:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rdi
	movl	(%rbx), %esi
	callq	_qtnf_clear_state
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rdi
	movq	_QTN_EP_FW_RETRY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_qtnf_is_state
	testq	%rax, %rax
	je	LBB0_19
## %bb.12:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	_QTN_PCIE_FW_DLMASK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	-56(%rbp), %r14d                ## 4-byte Folded Reload
	jne	LBB0_14
## %bb.13:                              ##   in Loop: Header=BB0_2 Depth=1
	andl	-64(%rbp), %eax                 ## 4-byte Folded Reload
	leal	-1(%rax), %ecx
	imull	-52(%rbp), %ecx                 ## 4-byte Folded Reload
	addl	%r12d, %ecx
	jmp	LBB0_15
LBB0_19:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_qtnf_pearl_data_tx_reclaim
	movl	-68(%rbp), %esi                 ## 4-byte Reload
LBB0_20:                                ##   in Loop: Header=BB0_2 Depth=1
	movl	%r12d, %r12d
	jmp	LBB0_16
LBB0_14:                                ##   in Loop: Header=BB0_2 Depth=1
	movl	%eax, %ecx
	imull	-52(%rbp), %ecx                 ## 4-byte Folded Reload
LBB0_15:                                ##   in Loop: Header=BB0_2 Depth=1
	movslq	%ecx, %r12
	negq	%r12
	subl	%eax, %r14d
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rdi
	movq	_QTN_EP_FW_RETRY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_qtnf_clear_state
	leaq	L_.str.3(%rip), %rdi
	movl	%r14d, %esi
	callq	_pr_warn
	movl	%r14d, %esi
LBB0_16:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	leaq	(%r15,%r12,4), %r15
	movl	%esi, %r14d
	cmpl	%ebx, %esi
	jl	LBB0_2
LBB0_17:
	leaq	L_.str.4(%rip), %rdi
	xorl	%eax, %eax
	callq	_pr_debug
	xorl	%eax, %eax
	jmp	LBB0_18
LBB0_4:
	leaq	L_.str.1(%rip), %rdi
LBB0_5:
	callq	_pr_err
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_18:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	leaq	L_.str.2(%rip), %rdi
	jmp	LBB0_5
	.cfi_endproc
                                        ## -- End function
	.comm	_QTN_PCIE_FW_BUFSZ,4,2          ## @QTN_PCIE_FW_BUFSZ
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"FW upload started: fw_addr=0x%p size=%d\n"

L_.str.1:                               ## @.str.1
	.asciz	"FW upload failed: too many retries\n"

	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.comm	_QTN_PCIE_FW_DLMASK,4,2         ## @QTN_PCIE_FW_DLMASK
	.comm	_QTN_RC_FW_SYNC,4,2             ## @QTN_RC_FW_SYNC
	.comm	_QTN_EP_FW_SYNC,4,2             ## @QTN_EP_FW_SYNC
	.comm	_QTN_FW_DL_TIMEOUT_MS,4,2       ## @QTN_FW_DL_TIMEOUT_MS
L_.str.2:                               ## @.str.2
	.asciz	"FW upload failed: SYNC timed out\n"

	.comm	_QTN_EP_FW_RETRY,4,2            ## @QTN_EP_FW_RETRY
L_.str.3:                               ## @.str.3
	.asciz	"FW upload retry: block #%d\n"

L_.str.4:                               ## @.str.4
	.asciz	"FW upload completed: totally sent %d blocks\n"

	.no_dead_strip	_qtnf_ep_fw_load
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function qtnf_ep_fw_load
_qtnf_ep_fw_load:                       ; @qtnf_ep_fw_load
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x2
	mov	x20, x1
	mov	x21, x0
Lloh0:
	adrp	x8, _QTN_PCIE_FW_BUFSZ@GOTPAGE
Lloh1:
	ldr	x8, [x8, _QTN_PCIE_FW_BUFSZ@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	sub	w26, w8, #4
	sdiv	w8, w2, w26
	msub	w9, w8, w26, w2
	cmp	w9, #0
	cinc	w27, w8, ne
	str	x19, [sp]
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_debug
	subs	w8, w27, #1
	str	w8, [sp, #12]                   ; 4-byte Folded Spill
	mov	w22, #0
	b.lt	LBB0_12
; %bb.1:
	mov	w24, #0
	mov	w8, #10000
	mov	x23, x20
LBB0_2:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_3 Depth 2
	cmp	w24, w8
	mov	w8, #10000
	csel	w8, w24, w8, gt
	add	w28, w8, #1
LBB0_3:                                 ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	add	w24, w24, #1
	cmp	w28, w24
	b.eq	LBB0_13
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=2
	ldr	w0, [x21, #8]
	mov	x1, x19
	mov	x2, x22
	mov	x3, x23
	mov	x4, x20
	bl	_qtnf_ep_fw_send
	cmp	w0, #1
	b.lt	LBB0_3
; %bb.5:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	x25, x0
	add	w28, w22, #1
Lloh5:
	adrp	x8, _QTN_PCIE_FW_DLMASK@GOTPAGE
Lloh6:
	ldr	x8, [x8, _QTN_PCIE_FW_DLMASK@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	and	w8, w8, w28
	cmp	w8, #0
	ldr	w8, [sp, #12]                   ; 4-byte Folded Reload
	ccmp	w22, w8, #4, ne
	b.ne	LBB0_10
; %bb.6:                                ;   in Loop: Header=BB0_2 Depth=1
	str	w27, [sp, #8]                   ; 4-byte Folded Spill
	ldr	x8, [x21]
	add	x0, x8, #4
Lloh8:
	adrp	x8, _QTN_RC_FW_SYNC@GOTPAGE
Lloh9:
	ldr	x8, [x8, _QTN_RC_FW_SYNC@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	bl	_qtnf_set_state
	ldr	x0, [x21]
Lloh11:
	adrp	x27, _QTN_EP_FW_SYNC@GOTPAGE
Lloh12:
	ldr	x27, [x27, _QTN_EP_FW_SYNC@GOTPAGEOFF]
	ldr	w1, [x27]
Lloh13:
	adrp	x8, _QTN_FW_DL_TIMEOUT_MS@GOTPAGE
Lloh14:
	ldr	x8, [x8, _QTN_FW_DL_TIMEOUT_MS@GOTPAGEOFF]
Lloh15:
	ldr	w2, [x8]
	bl	_qtnf_poll_state
	cbnz	x0, LBB0_16
; %bb.7:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x0, [x21]
	ldr	w1, [x27]
	bl	_qtnf_clear_state
	ldr	x0, [x21]
Lloh16:
	adrp	x27, _QTN_EP_FW_RETRY@GOTPAGE
Lloh17:
	ldr	x27, [x27, _QTN_EP_FW_RETRY@GOTPAGEOFF]
	ldr	w1, [x27]
	bl	_qtnf_is_state
	cbz	x0, LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	x8, #0
Lloh18:
	adrp	x9, _QTN_PCIE_FW_DLMASK@GOTPAGE
Lloh19:
	ldr	x9, [x9, _QTN_PCIE_FW_DLMASK@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	mul	w10, w9, w26
	mov	x14, x27
	ldp	w27, w13, [sp, #8]              ; 8-byte Folded Reload
	and	w11, w9, w27
	sub	w12, w11, #1
	madd	w12, w12, w26, w25
	cmp	w22, w13
	csel	w9, w9, w11, ne
	csel	w10, w10, w12, ne
	sub	x25, x8, w10, sxtw
	sub	w22, w22, w9
	ldr	x0, [x21]
	ldr	w1, [x14]
	bl	_qtnf_clear_state
Lloh21:
	adrp	x0, l_.str.3@PAGE
Lloh22:
	add	x0, x0, l_.str.3@PAGEOFF
	mov	x1, x22
	bl	_pr_warn
	b	LBB0_11
LBB0_9:                                 ;   in Loop: Header=BB0_2 Depth=1
	mov	x0, x21
	bl	_qtnf_pearl_data_tx_reclaim
	ldr	w27, [sp, #8]                   ; 4-byte Folded Reload
LBB0_10:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	w25, w25
	mov	x22, x28
LBB0_11:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	w8, #10000
	add	x23, x23, x25, lsl #2
	cmp	w22, w27
	b.lt	LBB0_2
LBB0_12:
Lloh23:
	adrp	x0, l_.str.4@PAGE
Lloh24:
	add	x0, x0, l_.str.4@PAGEOFF
	mov	x1, x22
	bl	_pr_debug
	mov	w0, #0
	b	LBB0_15
LBB0_13:
Lloh25:
	adrp	x0, l_.str.1@PAGE
Lloh26:
	add	x0, x0, l_.str.1@PAGEOFF
LBB0_14:
	bl	_pr_err
Lloh27:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh28:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
Lloh29:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_15:
	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
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_16:
Lloh30:
	adrp	x0, l_.str.2@PAGE
Lloh31:
	add	x0, x0, l_.str.2@PAGEOFF
	b	LBB0_14
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpAdd	Lloh30, Lloh31
	.cfi_endproc
                                        ; -- End function
	.comm	_QTN_PCIE_FW_BUFSZ,4,2          ; @QTN_PCIE_FW_BUFSZ
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"FW upload started: fw_addr=0x%p size=%d\n"

l_.str.1:                               ; @.str.1
	.asciz	"FW upload failed: too many retries\n"

	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.comm	_QTN_PCIE_FW_DLMASK,4,2         ; @QTN_PCIE_FW_DLMASK
	.comm	_QTN_RC_FW_SYNC,4,2             ; @QTN_RC_FW_SYNC
	.comm	_QTN_EP_FW_SYNC,4,2             ; @QTN_EP_FW_SYNC
	.comm	_QTN_FW_DL_TIMEOUT_MS,4,2       ; @QTN_FW_DL_TIMEOUT_MS
l_.str.2:                               ; @.str.2
	.asciz	"FW upload failed: SYNC timed out\n"

	.comm	_QTN_EP_FW_RETRY,4,2            ; @QTN_EP_FW_RETRY
l_.str.3:                               ; @.str.3
	.asciz	"FW upload retry: block #%d\n"

l_.str.4:                               ; @.str.4
	.asciz	"FW upload completed: totally sent %d blocks\n"

	.no_dead_strip	_qtnf_ep_fw_load
.subsections_via_symbols
