	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function btmrvl_sdio_download_fw
_btmrvl_sdio_download_fw:               ## @btmrvl_sdio_download_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	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	testq	%rdi, %rdi
	je	LBB0_2
## %bb.1:
	movq	%rdi, %r14
	movl	(%rdi), %edi
	testl	%edi, %edi
	je	LBB0_2
## %bb.3:
	callq	_sdio_claim_host
	movq	%r14, %rdi
	movl	$1, %esi
	callq	_btmrvl_sdio_verify_fw_download
	testq	%rax, %rax
	je	LBB0_4
## %bb.5:
	movq	%r14, %rdi
	callq	_btmrvl_sdio_download_helper
	testl	%eax, %eax
	je	LBB0_8
## %bb.6:
	leaq	L_.str.2(%rip), %rdi
	jmp	LBB0_7
LBB0_2:
	leaq	L_.str(%rip), %rdi
	callq	_BT_ERR
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_15
LBB0_4:
	leaq	L_.str.1(%rip), %rdi
	callq	_BT_DBG
	xorl	%ebx, %ebx
	jmp	LBB0_14
LBB0_8:
	movq	%r14, %rdi
	callq	_btmrvl_sdio_download_fw_w_helper
	testq	%rax, %rax
	je	LBB0_10
## %bb.9:
	leaq	L_.str.3(%rip), %rdi
LBB0_7:
	callq	_BT_ERR
	movq	_EIO@GOTPCREL(%rip), %rax
LBB0_13:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_14:
	movl	(%r14), %edi
	callq	_sdio_release_host
LBB0_15:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_10:
	movq	_MAX_POLL_TRIES@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_btmrvl_sdio_verify_fw_download
	testq	%rax, %rax
	je	LBB0_11
## %bb.12:
	leaq	L_.str.4(%rip), %rdi
	callq	_BT_ERR
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
	jmp	LBB0_13
LBB0_11:
	xorl	%ebx, %ebx
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"card or function is NULL!"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"Firmware already downloaded!"

L_.str.2:                               ## @.str.2
	.asciz	"Failed to download helper!"

	.comm	_EIO,4,2                        ## @EIO
L_.str.3:                               ## @.str.3
	.asciz	"Failed to download firmware!"

	.comm	_MAX_POLL_TRIES,4,2             ## @MAX_POLL_TRIES
L_.str.4:                               ## @.str.4
	.asciz	"FW failed to be active in time!"

	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.no_dead_strip	_btmrvl_sdio_download_fw
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function btmrvl_sdio_download_fw
_btmrvl_sdio_download_fw:               ; @btmrvl_sdio_download_fw
	.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
	cbz	x0, LBB0_5
; %bb.1:
	mov	x19, x0
	ldr	w0, [x0]
	cbz	w0, LBB0_5
; %bb.2:
	bl	_sdio_claim_host
	mov	x0, x19
	mov	w1, #1
	bl	_btmrvl_sdio_verify_fw_download
	cbz	x0, LBB0_6
; %bb.3:
	mov	x0, x19
	bl	_btmrvl_sdio_download_helper
	cbz	w0, LBB0_7
; %bb.4:
Lloh0:
	adrp	x0, l_.str.2@PAGE
Lloh1:
	add	x0, x0, l_.str.2@PAGEOFF
	b	LBB0_9
LBB0_5:
Lloh2:
	adrp	x0, l_.str@PAGE
Lloh3:
	add	x0, x0, l_.str@PAGEOFF
	bl	_BT_ERR
Lloh4:
	adrp	x8, _EINVAL@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_12
LBB0_6:
Lloh7:
	adrp	x0, l_.str.1@PAGE
Lloh8:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_BT_DBG
	mov	w20, #0
	b	LBB0_11
LBB0_7:
	mov	x0, x19
	bl	_btmrvl_sdio_download_fw_w_helper
	cbz	x0, LBB0_13
; %bb.8:
Lloh9:
	adrp	x0, l_.str.3@PAGE
Lloh10:
	add	x0, x0, l_.str.3@PAGEOFF
LBB0_9:
	bl	_BT_ERR
Lloh11:
	adrp	x8, _EIO@GOTPAGE
Lloh12:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
LBB0_10:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_11:
	ldr	w0, [x19]
	bl	_sdio_release_host
LBB0_12:
	mov	x0, x20
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_13:
Lloh13:
	adrp	x8, _MAX_POLL_TRIES@GOTPAGE
Lloh14:
	ldr	x8, [x8, _MAX_POLL_TRIES@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_btmrvl_sdio_verify_fw_download
	cbz	x0, LBB0_15
; %bb.14:
Lloh16:
	adrp	x0, l_.str.4@PAGE
Lloh17:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_BT_ERR
Lloh18:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh19:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
	b	LBB0_10
LBB0_15:
	mov	w20, #0
	b	LBB0_11
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpAdd	Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"card or function is NULL!"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"Firmware already downloaded!"

l_.str.2:                               ; @.str.2
	.asciz	"Failed to download helper!"

	.comm	_EIO,4,2                        ; @EIO
l_.str.3:                               ; @.str.3
	.asciz	"Failed to download firmware!"

	.comm	_MAX_POLL_TRIES,4,2             ; @MAX_POLL_TRIES
l_.str.4:                               ; @.str.4
	.asciz	"FW failed to be active in time!"

	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.no_dead_strip	_btmrvl_sdio_download_fw
.subsections_via_symbols
