	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rt2800usb_enable_radio
_rt2800usb_enable_radio:                ## @rt2800usb_enable_radio
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %rbx
	movl	$0, -20(%rbp)
	callq	_rt2800_wait_wpdma_ready
	movl	%eax, %edi
	callq	_unlikely
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	_EIO@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_3
LBB0_2:
	movq	_USB_DMA_CFG_PHY_CLEAR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-20(%rbp), %r14
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_rt2x00_set_field32
	movq	_USB_DMA_CFG_RX_BULK_AGG_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_rt2x00_set_field32
	movq	_USB_DMA_CFG_RX_BULK_AGG_TIMEOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	$128, %edx
	callq	_rt2x00_set_field32
	movq	_USB_DMA_CFG_RX_BULK_AGG_LIMIT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	(%rbx), %rax
	movq	_DATA_FRAME_SIZE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	imull	(%rax), %ecx
	leal	1023(%rcx), %edx
	testl	%ecx, %ecx
	cmovnsl	%ecx, %edx
	sarl	$10, %edx
	addl	$-3, %edx
	movq	%r14, %rdi
	callq	_rt2x00_set_field32
	movq	_USB_DMA_CFG_RX_BULK_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	$1, %edx
	callq	_rt2x00_set_field32
	movq	_USB_DMA_CFG_TX_BULK_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movl	$1, %edx
	callq	_rt2x00_set_field32
	movq	_USB_DMA_CFG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	-20(%rbp), %edx
	movq	%rbx, %rdi
	callq	_rt2x00usb_register_write
	movq	%rbx, %rdi
	callq	_rt2800_enable_radio
LBB0_3:
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EIO,4,2                        ## @EIO
	.comm	_USB_DMA_CFG_PHY_CLEAR,4,2      ## @USB_DMA_CFG_PHY_CLEAR
	.comm	_USB_DMA_CFG_RX_BULK_AGG_EN,4,2 ## @USB_DMA_CFG_RX_BULK_AGG_EN
	.comm	_USB_DMA_CFG_RX_BULK_AGG_TIMEOUT,4,2 ## @USB_DMA_CFG_RX_BULK_AGG_TIMEOUT
	.comm	_USB_DMA_CFG_RX_BULK_AGG_LIMIT,4,2 ## @USB_DMA_CFG_RX_BULK_AGG_LIMIT
	.comm	_DATA_FRAME_SIZE,4,2            ## @DATA_FRAME_SIZE
	.comm	_USB_DMA_CFG_RX_BULK_EN,4,2     ## @USB_DMA_CFG_RX_BULK_EN
	.comm	_USB_DMA_CFG_TX_BULK_EN,4,2     ## @USB_DMA_CFG_TX_BULK_EN
	.comm	_USB_DMA_CFG,4,2                ## @USB_DMA_CFG
	.no_dead_strip	_rt2800usb_enable_radio
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rt2800usb_enable_radio
_rt2800usb_enable_radio:                ; @rt2800usb_enable_radio
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	str	wzr, [sp, #12]
	bl	_rt2800_wait_wpdma_ready
	bl	_unlikely
	cbz	x0, LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _EIO@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_3
LBB0_2:
Lloh3:
	adrp	x8, _USB_DMA_CFG_PHY_CLEAR@GOTPAGE
Lloh4:
	ldr	x8, [x8, _USB_DMA_CFG_PHY_CLEAR@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	add	x0, sp, #12
	mov	w2, #0
	bl	_rt2x00_set_field32
Lloh6:
	adrp	x8, _USB_DMA_CFG_RX_BULK_AGG_EN@GOTPAGE
Lloh7:
	ldr	x8, [x8, _USB_DMA_CFG_RX_BULK_AGG_EN@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	add	x0, sp, #12
	mov	w2, #0
	bl	_rt2x00_set_field32
Lloh9:
	adrp	x8, _USB_DMA_CFG_RX_BULK_AGG_TIMEOUT@GOTPAGE
Lloh10:
	ldr	x8, [x8, _USB_DMA_CFG_RX_BULK_AGG_TIMEOUT@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	add	x0, sp, #12
	mov	w2, #128
	bl	_rt2x00_set_field32
Lloh12:
	adrp	x8, _USB_DMA_CFG_RX_BULK_AGG_LIMIT@GOTPAGE
Lloh13:
	ldr	x8, [x8, _USB_DMA_CFG_RX_BULK_AGG_LIMIT@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	ldr	x8, [x19]
	ldr	w8, [x8]
Lloh15:
	adrp	x9, _DATA_FRAME_SIZE@GOTPAGE
Lloh16:
	ldr	x9, [x9, _DATA_FRAME_SIZE@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	mul	w8, w9, w8
	add	w9, w8, #1023
	cmp	w8, #0
	csel	w8, w9, w8, lt
	asr	w8, w8, #10
	sub	w2, w8, #3
	add	x0, sp, #12
	bl	_rt2x00_set_field32
Lloh18:
	adrp	x8, _USB_DMA_CFG_RX_BULK_EN@GOTPAGE
Lloh19:
	ldr	x8, [x8, _USB_DMA_CFG_RX_BULK_EN@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
	add	x0, sp, #12
	mov	w2, #1
	bl	_rt2x00_set_field32
Lloh21:
	adrp	x8, _USB_DMA_CFG_TX_BULK_EN@GOTPAGE
Lloh22:
	ldr	x8, [x8, _USB_DMA_CFG_TX_BULK_EN@GOTPAGEOFF]
Lloh23:
	ldr	w1, [x8]
	add	x0, sp, #12
	mov	w2, #1
	bl	_rt2x00_set_field32
Lloh24:
	adrp	x8, _USB_DMA_CFG@GOTPAGE
Lloh25:
	ldr	x8, [x8, _USB_DMA_CFG@GOTPAGEOFF]
Lloh26:
	ldr	w1, [x8]
	ldr	w2, [sp, #12]
	mov	x0, x19
	bl	_rt2x00usb_register_write
	mov	x0, x19
	bl	_rt2800_enable_radio
LBB0_3:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_EIO,4,2                        ; @EIO
	.comm	_USB_DMA_CFG_PHY_CLEAR,4,2      ; @USB_DMA_CFG_PHY_CLEAR
	.comm	_USB_DMA_CFG_RX_BULK_AGG_EN,4,2 ; @USB_DMA_CFG_RX_BULK_AGG_EN
	.comm	_USB_DMA_CFG_RX_BULK_AGG_TIMEOUT,4,2 ; @USB_DMA_CFG_RX_BULK_AGG_TIMEOUT
	.comm	_USB_DMA_CFG_RX_BULK_AGG_LIMIT,4,2 ; @USB_DMA_CFG_RX_BULK_AGG_LIMIT
	.comm	_DATA_FRAME_SIZE,4,2            ; @DATA_FRAME_SIZE
	.comm	_USB_DMA_CFG_RX_BULK_EN,4,2     ; @USB_DMA_CFG_RX_BULK_EN
	.comm	_USB_DMA_CFG_TX_BULK_EN,4,2     ; @USB_DMA_CFG_TX_BULK_EN
	.comm	_USB_DMA_CFG,4,2                ; @USB_DMA_CFG
	.no_dead_strip	_rt2800usb_enable_radio
.subsections_via_symbols
