	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sh_dmae_alloc_chan_resources
_sh_dmae_alloc_chan_resources:          ## @sh_dmae_alloc_chan_resources
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	callq	_to_sh_chan
	movq	%rax, %r12
	leaq	8(%rax), %r14
	movq	%r14, %rdi
	callq	_spin_lock_bh
	movq	(%r12), %rax
	movq	_NR_DESCS_PER_CHANNEL@GOTPCREL(%rip), %r13
	cmpq	(%r13), %rax
	jge	LBB0_5
## %bb.1:
	movq	%r12, %r15
	addq	$12, %r15
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	callq	_spin_unlock_bh
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$12, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%rax, %rbx
	movq	%rax, %rdi
	addq	$4, %rdi
	movq	%r15, %rsi
	callq	_dma_async_tx_descriptor_init
	movq	_sh_dmae_tx_submit@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%rbx)
	movq	_DMA_CTRL_ACK@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 4(%rbx)
	movq	%rbx, %rdi
	callq	_INIT_LIST_HEAD
	movq	%r12, %rdi
	movq	%rbx, %rsi
	callq	_sh_dmae_put_desc
	movq	%r14, %rdi
	callq	_spin_lock_bh
	movq	(%r12), %rax
	incq	%rax
	movq	%rax, (%r12)
	cmpq	(%r13), %rax
	jl	LBB0_2
	jmp	LBB0_5
LBB0_3:
	movq	%r14, %rdi
	callq	_spin_lock_bh
LBB0_5:
	movq	%r14, %rdi
	callq	_spin_unlock_bh
	movl	(%r12), %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_NR_DESCS_PER_CHANNEL,8,3       ## @NR_DESCS_PER_CHANNEL
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_sh_dmae_tx_submit,4,2          ## @sh_dmae_tx_submit
	.comm	_DMA_CTRL_ACK,4,2               ## @DMA_CTRL_ACK
	.no_dead_strip	_sh_dmae_alloc_chan_resources
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sh_dmae_alloc_chan_resources
_sh_dmae_alloc_chan_resources:          ; @sh_dmae_alloc_chan_resources
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	bl	_to_sh_chan
	mov	x19, x0
	add	x20, x0, #8
	mov	x0, x20
	bl	_spin_lock_bh
	ldr	x8, [x19]
Lloh0:
	adrp	x23, _NR_DESCS_PER_CHANNEL@GOTPAGE
Lloh1:
	ldr	x23, [x23, _NR_DESCS_PER_CHANNEL@GOTPAGEOFF]
	ldr	x9, [x23]
	cmp	x8, x9
	b.ge	LBB0_5
; %bb.1:
	add	x21, x19, #12
Lloh2:
	adrp	x24, _GFP_KERNEL@GOTPAGE
Lloh3:
	ldr	x24, [x24, _GFP_KERNEL@GOTPAGEOFF]
Lloh4:
	adrp	x25, _sh_dmae_tx_submit@GOTPAGE
Lloh5:
	ldr	x25, [x25, _sh_dmae_tx_submit@GOTPAGEOFF]
Lloh6:
	adrp	x26, _DMA_CTRL_ACK@GOTPAGE
Lloh7:
	ldr	x26, [x26, _DMA_CTRL_ACK@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	bl	_spin_unlock_bh
	ldr	w1, [x24]
	mov	w0, #12
	bl	_kzalloc
	cbz	x0, LBB0_4
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	x22, x0
	add	x0, x0, #4
	mov	x1, x21
	bl	_dma_async_tx_descriptor_init
	ldr	w8, [x25]
	ldr	w9, [x26]
	stp	w9, w8, [x22, #4]
	mov	x0, x22
	bl	_INIT_LIST_HEAD
	mov	x0, x19
	mov	x1, x22
	bl	_sh_dmae_put_desc
	mov	x0, x20
	bl	_spin_lock_bh
	ldr	x8, [x19]
	add	x8, x8, #1
	str	x8, [x19]
	ldr	x9, [x23]
	cmp	x8, x9
	b.lt	LBB0_2
	b	LBB0_5
LBB0_4:
	mov	x0, x20
	bl	_spin_lock_bh
LBB0_5:
	mov	x0, x20
	bl	_spin_unlock_bh
	ldr	w0, [x19]
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
	.comm	_NR_DESCS_PER_CHANNEL,8,3       ; @NR_DESCS_PER_CHANNEL
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_sh_dmae_tx_submit,4,2          ; @sh_dmae_tx_submit
	.comm	_DMA_CTRL_ACK,4,2               ; @DMA_CTRL_ACK
	.no_dead_strip	_sh_dmae_alloc_chan_resources
.subsections_via_symbols
