	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bcm_dma_allocate               ## -- Begin function bcm_dma_allocate
	.p2align	4, 0x90
_bcm_dma_allocate:                      ## @bcm_dma_allocate
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_BCM_DMA_CH_INVALID@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
	movq	_BCM_DMA_CH_MAX@GOTPCREL(%rip), %r12
	cmpl	%edi, (%r12)
	jle	LBB0_10
## %bb.1:
	movl	%edi, %ebx
	movq	_bcm_dma_sc@GOTPCREL(%rip), %rax
	movq	(%rax), %r14
	movq	%r14, %rdi
	callq	_mtx_lock
	testl	%ebx, %ebx
	js	LBB0_2
## %bb.6:
	movq	8(%r14), %rax
	movl	%ebx, %edx
	movl	(%rax,%rdx,4), %ecx
	movq	_BCM_DMA_CH_FREE@GOTPCREL(%rip), %rsi
	movl	(%rsi), %esi
	testl	%ecx, %esi
	je	LBB0_9
## %bb.7:
	leaq	(%rax,%rdx,4), %rax
LBB0_8:
	notl	%esi
	andl	%esi, %ecx
	movl	%ecx, (%rax)
	movq	_BCM_DMA_CH_USED@GOTPCREL(%rip), %rdx
	orl	(%rdx), %ecx
	movl	%ecx, (%rax)
	movl	%ebx, %r15d
	jmp	LBB0_9
LBB0_2:
	movl	(%r12), %edx
	testl	%edx, %edx
	jle	LBB0_9
## %bb.3:
	movq	8(%r14), %rax
	movq	_BCM_DMA_CH_FREE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%rax), %ecx
	testl	%ecx, %esi
	jne	LBB0_8
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	incq	%rbx
	addq	$4, %rax
	cmpq	%rbx, %rdx
	jne	LBB0_4
LBB0_9:
	movq	%r14, %rdi
	callq	_mtx_unlock
LBB0_10:
	movl	%r15d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_bcm_dma_sc,8,3                 ## @bcm_dma_sc
	.comm	_BCM_DMA_CH_INVALID,4,2         ## @BCM_DMA_CH_INVALID
	.comm	_BCM_DMA_CH_MAX,4,2             ## @BCM_DMA_CH_MAX
	.comm	_BCM_DMA_CH_FREE,4,2            ## @BCM_DMA_CH_FREE
	.comm	_BCM_DMA_CH_USED,4,2            ## @BCM_DMA_CH_USED
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bcm_dma_allocate               ; -- Begin function bcm_dma_allocate
	.p2align	2
_bcm_dma_allocate:                      ; @bcm_dma_allocate
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w21, -40
	.cfi_offset w22, -48
Lloh0:
	adrp	x8, _BCM_DMA_CH_INVALID@GOTPAGE
Lloh1:
	ldr	x8, [x8, _BCM_DMA_CH_INVALID@GOTPAGEOFF]
Lloh2:
	ldr	w21, [x8]
Lloh3:
	adrp	x22, _BCM_DMA_CH_MAX@GOTPAGE
Lloh4:
	ldr	x22, [x22, _BCM_DMA_CH_MAX@GOTPAGEOFF]
	ldr	w8, [x22]
	cmp	w8, w0
	b.le	LBB0_11
; %bb.1:
	mov	x20, x0
Lloh5:
	adrp	x8, _bcm_dma_sc@GOTPAGE
Lloh6:
	ldr	x8, [x8, _bcm_dma_sc@GOTPAGEOFF]
Lloh7:
	ldr	x19, [x8]
	mov	x0, x19
	bl	_mtx_lock
	tbnz	w20, #31, LBB0_4
; %bb.2:
	ldr	x8, [x19, #8]
	add	x8, x8, w20, uxtw #2
	ldr	w9, [x8]
Lloh8:
	adrp	x10, _BCM_DMA_CH_FREE@GOTPAGE
Lloh9:
	ldr	x10, [x10, _BCM_DMA_CH_FREE@GOTPAGEOFF]
Lloh10:
	ldr	w10, [x10]
	tst	w10, w9
	b.eq	LBB0_10
; %bb.3:
	bic	w9, w9, w10
	b	LBB0_9
LBB0_4:
	ldr	w9, [x22]
	cmp	w9, #1
	b.lt	LBB0_10
; %bb.5:
	mov	x20, #0
	ldr	x8, [x19, #8]
Lloh11:
	adrp	x10, _BCM_DMA_CH_FREE@GOTPAGE
Lloh12:
	ldr	x10, [x10, _BCM_DMA_CH_FREE@GOTPAGEOFF]
Lloh13:
	ldr	w10, [x10]
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w11, [x8]
	tst	w10, w11
	b.ne	LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	add	x20, x20, #1
	add	x8, x8, #4
	cmp	x9, x20
	b.ne	LBB0_6
	b	LBB0_10
LBB0_8:
	bic	w9, w11, w10
LBB0_9:
	str	w9, [x8]
Lloh14:
	adrp	x10, _BCM_DMA_CH_USED@GOTPAGE
Lloh15:
	ldr	x10, [x10, _BCM_DMA_CH_USED@GOTPAGEOFF]
Lloh16:
	ldr	w10, [x10]
	orr	w9, w10, w9
	str	w9, [x8]
	mov	x21, x20
LBB0_10:
	mov	x0, x19
	bl	_mtx_unlock
LBB0_11:
	mov	x0, x21
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_bcm_dma_sc,8,3                 ; @bcm_dma_sc
	.comm	_BCM_DMA_CH_INVALID,4,2         ; @BCM_DMA_CH_INVALID
	.comm	_BCM_DMA_CH_MAX,4,2             ; @BCM_DMA_CH_MAX
	.comm	_BCM_DMA_CH_FREE,4,2            ; @BCM_DMA_CH_FREE
	.comm	_BCM_DMA_CH_USED,4,2            ; @BCM_DMA_CH_USED
.subsections_via_symbols
