	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ath6kl_htc_mbox_wait_target
_ath6kl_htc_mbox_wait_target:           ## @ath6kl_htc_mbox_wait_target
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	callq	_htc_wait_for_ctrl_msg
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r15
	movq	8(%rax), %rbx
	movl	24(%rbx), %edi
	callq	_le16_to_cpu
	movq	_HTC_MSG_READY_ID@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_4
## %bb.3:
	cmpl	$3, (%r15)
	jbe	LBB0_4
## %bb.5:
	movl	20(%rbx), %edi
	testl	%edi, %edi
	je	LBB0_4
## %bb.6:
	cmpl	$0, 16(%rbx)
	je	LBB0_4
## %bb.7:
	callq	_le16_to_cpu
	movq	%rax, (%r14)
	movl	16(%rbx), %edi
	callq	_le16_to_cpu
	movq	%rax, 32(%r14)
	movq	_ATH6KL_DBG_BOOT@GOTPCREL(%rip), %r12
	movl	(%r12), %edi
	movq	(%r14), %rdx
	leaq	L_.str(%rip), %rsi
	movq	%rax, %rcx
	callq	_ath6kl_dbg
	cmpl	$32, (%r15)
	jb	LBB0_9
## %bb.8:
	movq	(%rbx), %rdx
	movq	8(%rbx), %rcx
	movq	_HTC_VERSION_2P0@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	jmp	LBB0_10
LBB0_4:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_14:
	movq	%r15, %rdi
	callq	_htc_rxpkt_reset
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_reclaim_rx_ctrl_buf
	jmp	LBB0_15
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_15:
	movl	%ebx, %eax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	movq	_HTC_VERSION_2P0@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	xorl	%edx, %edx
	movq	%rax, %rcx
LBB0_10:
	movq	%rcx, 24(%r14)
	movq	%rdx, 8(%r14)
	movl	(%r12), %edi
	cmpq	%rax, %rcx
	leaq	L_.str.2(%rip), %rax
	leaq	L_.str.3(%rip), %rdx
	cmoveq	%rax, %rdx
	leaq	L_.str.1(%rip), %rsi
	callq	_ath6kl_dbg
	cmpq	$0, 8(%r14)
	jle	LBB0_12
## %bb.11:
	movq	%r14, %rdi
	callq	_htc_setup_msg_bndl
LBB0_12:
	leaq	-72(%rbp), %r12
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	xorl	%esi, %esi
	movl	$32, %edx
	callq	_memset
	leaq	-104(%rbp), %r13
	movq	%r13, %rdi
	xorl	%esi, %esi
	movl	$32, %edx
	callq	_memset
	movq	_htc_ctrl_rx@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -48(%rbp)
	xorps	%xmm0, %xmm0
	movups	%xmm0, -64(%rbp)
	movq	_NUM_CONTROL_BUFFERS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -68(%rbp)
	movq	_HTC_CTRL_RSVD_SVC@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -72(%rbp)
	movq	%r14, %rdi
	movq	%r12, %rsi
	movq	%r13, %rdx
	callq	_ath6kl_htc_mbox_conn_service
	testl	%eax, %eax
	je	LBB0_14
## %bb.13:
	movl	%eax, %r12d
	movq	16(%r14), %rax
	movl	(%rax), %edi
	callq	_ath6kl_hif_cleanup_scatter
	movl	%r12d, %ebx
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_HTC_MSG_READY_ID,8,3           ## @HTC_MSG_READY_ID
	.comm	_ATH6KL_DBG_BOOT,4,2            ## @ATH6KL_DBG_BOOT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"htc target ready credits %d size %d\n"

	.comm	_HTC_VERSION_2P0,8,3            ## @HTC_VERSION_2P0
L_.str.1:                               ## @.str.1
	.asciz	"htc using protocol %s (%d)\n"

L_.str.2:                               ## @.str.2
	.asciz	"2.0"

L_.str.3:                               ## @.str.3
	.asciz	">= 2.1"

	.comm	_htc_ctrl_rx,4,2                ## @htc_ctrl_rx
	.comm	_NUM_CONTROL_BUFFERS,4,2        ## @NUM_CONTROL_BUFFERS
	.comm	_HTC_CTRL_RSVD_SVC,4,2          ## @HTC_CTRL_RSVD_SVC
	.no_dead_strip	_ath6kl_htc_mbox_wait_target
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ath6kl_htc_mbox_wait_target
_ath6kl_htc_mbox_wait_target:           ; @ath6kl_htc_mbox_wait_target
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	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
	mov	x19, x0
	bl	_htc_wait_for_ctrl_msg
	cbz	x0, LBB0_9
; %bb.1:
	mov	x20, x0
	ldr	x21, [x0, #8]
	ldr	w0, [x21, #24]
	bl	_le16_to_cpu
Lloh0:
	adrp	x8, _HTC_MSG_READY_ID@GOTPAGE
Lloh1:
	ldr	x8, [x8, _HTC_MSG_READY_ID@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_7
; %bb.2:
	ldr	w8, [x20]
	cmp	w8, #3
	b.ls	LBB0_7
; %bb.3:
	ldr	w0, [x21, #20]
	cbz	w0, LBB0_7
; %bb.4:
	ldr	w8, [x21, #16]
	cbz	w8, LBB0_7
; %bb.5:
	bl	_le16_to_cpu
	str	x0, [x19]
	ldr	w0, [x21, #16]
	bl	_le16_to_cpu
	mov	x3, x0
	str	x0, [x19, #32]
Lloh3:
	adrp	x22, _ATH6KL_DBG_BOOT@GOTPAGE
Lloh4:
	ldr	x22, [x22, _ATH6KL_DBG_BOOT@GOTPAGEOFF]
	ldr	w0, [x22]
	ldr	x2, [x19]
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	bl	_ath6kl_dbg
	ldr	w8, [x20]
	cmp	w8, #32
	b.lo	LBB0_11
; %bb.6:
	ldp	x8, x3, [x21]
Lloh7:
	adrp	x9, _HTC_VERSION_2P0@GOTPAGE
Lloh8:
	ldr	x9, [x9, _HTC_VERSION_2P0@GOTPAGEOFF]
Lloh9:
	ldr	x9, [x9]
	b	LBB0_12
LBB0_7:
Lloh10:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_8:
	mov	x0, x20
	bl	_htc_rxpkt_reset
	mov	x0, x19
	mov	x1, x20
	bl	_reclaim_rx_ctrl_buf
	b	LBB0_10
LBB0_9:
Lloh13:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_10:
	mov	x0, x21
	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
	add	sp, sp, #112
	ret
LBB0_11:
	mov	x8, #0
Lloh16:
	adrp	x9, _HTC_VERSION_2P0@GOTPAGE
Lloh17:
	ldr	x9, [x9, _HTC_VERSION_2P0@GOTPAGEOFF]
Lloh18:
	ldr	x9, [x9]
	mov	x3, x9
LBB0_12:
	str	x3, [x19, #24]
	str	x8, [x19, #8]
	ldr	w0, [x22]
Lloh19:
	adrp	x8, l_.str.3@PAGE
Lloh20:
	add	x8, x8, l_.str.3@PAGEOFF
Lloh21:
	adrp	x10, l_.str.2@PAGE
Lloh22:
	add	x10, x10, l_.str.2@PAGEOFF
	cmp	x3, x9
	csel	x2, x10, x8, eq
Lloh23:
	adrp	x1, l_.str.1@PAGE
Lloh24:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_ath6kl_dbg
	ldr	x8, [x19, #8]
	cmp	x8, #1
	b.lt	LBB0_14
; %bb.13:
	mov	x0, x19
	bl	_htc_setup_msg_bndl
LBB0_14:
	add	x0, sp, #32
	mov	w1, #0
	mov	w2, #32
	bl	_memset
	mov	x0, sp
	mov	w1, #0
	mov	w2, #32
	bl	_memset
Lloh25:
	adrp	x8, _htc_ctrl_rx@GOTPAGE
Lloh26:
	ldr	x8, [x8, _htc_ctrl_rx@GOTPAGEOFF]
Lloh27:
	ldr	w8, [x8]
	str	w8, [sp, #56]
	stp	xzr, xzr, [sp, #40]
Lloh28:
	adrp	x8, _NUM_CONTROL_BUFFERS@GOTPAGE
Lloh29:
	ldr	x8, [x8, _NUM_CONTROL_BUFFERS@GOTPAGEOFF]
Lloh30:
	ldr	w8, [x8]
Lloh31:
	adrp	x9, _HTC_CTRL_RSVD_SVC@GOTPAGE
Lloh32:
	ldr	x9, [x9, _HTC_CTRL_RSVD_SVC@GOTPAGEOFF]
Lloh33:
	ldr	w9, [x9]
	stp	w9, w8, [sp, #32]
	add	x1, sp, #32
	mov	x2, sp
	mov	x0, x19
	bl	_ath6kl_htc_mbox_conn_service
	mov	x21, x0
	cbz	w0, LBB0_8
; %bb.15:
	ldr	x8, [x19, #16]
	ldr	w0, [x8]
	bl	_ath6kl_hif_cleanup_scatter
	b	LBB0_8
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_HTC_MSG_READY_ID,8,3           ; @HTC_MSG_READY_ID
	.comm	_ATH6KL_DBG_BOOT,4,2            ; @ATH6KL_DBG_BOOT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"htc target ready credits %d size %d\n"

	.comm	_HTC_VERSION_2P0,8,3            ; @HTC_VERSION_2P0
l_.str.1:                               ; @.str.1
	.asciz	"htc using protocol %s (%d)\n"

l_.str.2:                               ; @.str.2
	.asciz	"2.0"

l_.str.3:                               ; @.str.3
	.asciz	">= 2.1"

	.comm	_htc_ctrl_rx,4,2                ; @htc_ctrl_rx
	.comm	_NUM_CONTROL_BUFFERS,4,2        ; @NUM_CONTROL_BUFFERS
	.comm	_HTC_CTRL_RSVD_SVC,4,2          ; @HTC_CTRL_RSVD_SVC
	.no_dead_strip	_ath6kl_htc_mbox_wait_target
.subsections_via_symbols
