	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bcm_dma_free                   ## -- Begin function bcm_dma_free
	.p2align	4, 0x90
_bcm_dma_free:                          ## @bcm_dma_free
	.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
	movl	$-1, %eax
	testl	%edi, %edi
	js	LBB0_5
## %bb.1:
	movl	%edi, %ebx
	movq	_BCM_DMA_CH_MAX@GOTPCREL(%rip), %rcx
	cmpl	%edi, (%rcx)
	jle	LBB0_5
## %bb.2:
	movq	_bcm_dma_sc@GOTPCREL(%rip), %rax
	movq	(%rax), %r14
	movq	%r14, %rdi
	callq	_mtx_lock
	movq	8(%r14), %rax
	movl	%ebx, %ecx
	leaq	(%rcx,%rcx,2), %rcx
	movl	(%rax,%rcx,8), %edx
	movq	_BCM_DMA_CH_USED@GOTPCREL(%rip), %r8
	testl	%edx, (%r8)
	je	LBB0_4
## %bb.3:
	leaq	(%rax,%rcx,8), %rdi
	movq	_BCM_DMA_CH_FREE@GOTPCREL(%rip), %rsi
	orl	(%rsi), %edx
	movl	%edx, (%rdi)
	movl	(%r8), %esi
	notl	%esi
	andl	%edx, %esi
	movl	%esi, (%rdi)
	xorps	%xmm0, %xmm0
	movups	%xmm0, 8(%rax,%rcx,8)
	movl	4(%r14), %edi
	movl	%ebx, %esi
	callq	_bcm_dma_reset
LBB0_4:
	movq	%r14, %rdi
	callq	_mtx_unlock
	xorl	%eax, %eax
LBB0_5:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_bcm_dma_sc,8,3                 ## @bcm_dma_sc
	.comm	_BCM_DMA_CH_MAX,4,2             ## @BCM_DMA_CH_MAX
	.comm	_BCM_DMA_CH_USED,4,2            ## @BCM_DMA_CH_USED
	.comm	_BCM_DMA_CH_FREE,4,2            ## @BCM_DMA_CH_FREE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bcm_dma_free                   ; -- Begin function bcm_dma_free
	.p2align	2
_bcm_dma_free:                          ; @bcm_dma_free
	.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
	mov	x19, x0
	mov	w0, #-1
	tbnz	w19, #31, LBB0_5
; %bb.1:
Lloh0:
	adrp	x8, _BCM_DMA_CH_MAX@GOTPAGE
Lloh1:
	ldr	x8, [x8, _BCM_DMA_CH_MAX@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w19
	b.le	LBB0_5
; %bb.2:
Lloh3:
	adrp	x8, _bcm_dma_sc@GOTPAGE
Lloh4:
	ldr	x8, [x8, _bcm_dma_sc@GOTPAGEOFF]
Lloh5:
	ldr	x20, [x8]
	mov	x0, x20
	bl	_mtx_lock
	ldr	x8, [x20, #8]
	mov	w9, #24
	umaddl	x9, w19, w9, x8
	ldr	w11, [x9]
Lloh6:
	adrp	x10, _BCM_DMA_CH_USED@GOTPAGE
Lloh7:
	ldr	x10, [x10, _BCM_DMA_CH_USED@GOTPAGEOFF]
	ldr	w12, [x10]
	tst	w12, w11
	b.eq	LBB0_4
; %bb.3:
Lloh8:
	adrp	x12, _BCM_DMA_CH_FREE@GOTPAGE
Lloh9:
	ldr	x12, [x12, _BCM_DMA_CH_FREE@GOTPAGEOFF]
	mov	w13, w19
Lloh10:
	ldr	w12, [x12]
	orr	w11, w12, w11
	str	w11, [x9]
	ldr	w10, [x10]
	bic	w10, w11, w10
	str	w10, [x9]
	mov	w9, #24
	madd	x8, x13, x9, x8
	stp	xzr, xzr, [x8, #8]
	ldr	w0, [x20, #4]
	mov	x1, x19
	bl	_bcm_dma_reset
LBB0_4:
	mov	x0, x20
	bl	_mtx_unlock
	mov	w0, #0
LBB0_5:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_bcm_dma_sc,8,3                 ; @bcm_dma_sc
	.comm	_BCM_DMA_CH_MAX,4,2             ; @BCM_DMA_CH_MAX
	.comm	_BCM_DMA_CH_USED,4,2            ; @BCM_DMA_CH_USED
	.comm	_BCM_DMA_CH_FREE,4,2            ; @BCM_DMA_CH_FREE
.subsections_via_symbols
