	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function atc_alloc_chan_resources
_atc_alloc_chan_resources:              ## @atc_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
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	callq	_to_at_dma_chan
	movq	%rax, %r15
	movl	16(%rbx), %edi
	callq	_to_at_dma
	movq	%rax, %r13
	movq	_tmp_list@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_LIST_HEAD
	movq	%rbx, %rdi
	callq	_chan2dev
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edi
	callq	_dev_vdbg
	movq	%r15, %rdi
	callq	_atc_chan_is_enabled
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	%rbx, %rdi
	callq	_chan2dev
	leaq	L_.str.1(%rip), %rsi
	xorl	%ebx, %ebx
	movl	%eax, %edi
	xorl	%eax, %eax
	callq	_dev_dbg
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_16
LBB0_2:
	movq	_ATC_DEFAULT_CFG@GOTPCREL(%rip), %rax
	movq	(%rax), %r12
	movq	8(%rbx), %r14
	testq	%r14, %r14
	je	LBB0_7
## %bb.3:
	movq	(%r14), %rax
	testq	%rax, %rax
	je	LBB0_4
## %bb.5:
	xorl	%edi, %edi
	cmpq	(%r13), %rax
	setne	%dil
	jmp	LBB0_6
LBB0_4:
	movl	$1, %edi
LBB0_6:
	callq	_BUG_ON
	movq	8(%r14), %rax
	testq	%rax, %rax
	cmovneq	%rax, %r12
LBB0_7:
	leaq	12(%r15), %r14
	movq	%r14, %rdi
	callq	_list_empty
	testl	%eax, %eax
	je	LBB0_10
## %bb.8:
	movq	%r13, -48(%rbp)                 ## 8-byte Spill
	movq	_init_nr_desc_per_channel@GOTPCREL(%rip), %r13
	cmpl	$0, (%r13)
	movq	%r15, -72(%rbp)                 ## 8-byte Spill
	movq	%r12, -64(%rbp)                 ## 8-byte Spill
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	jle	LBB0_9
## %bb.11:
	xorl	%r15d, %r15d
	movq	_GFP_KERNEL@GOTPCREL(%rip), %r14
	movq	_tmp_list@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movl	(%r14), %esi
	movq	%rbx, %rdi
	callq	_atc_alloc_descriptor
	testq	%rax, %rax
	je	LBB0_13
## %bb.14:                              ##   in Loop: Header=BB0_12 Depth=1
	movq	%rax, %rdi
	movq	%r12, %rsi
	callq	_list_add_tail
	incl	%r15d
	cmpl	(%r13), %r15d
	jl	LBB0_12
	jmp	LBB0_15
LBB0_10:
	movl	(%r15), %ebx
	jmp	LBB0_16
LBB0_9:
	xorl	%r15d, %r15d
	jmp	LBB0_15
LBB0_13:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rdi
	leaq	L_.str.2(%rip), %rsi
	movl	%r15d, %edx
	callq	_dev_err
LBB0_15:
	movq	-72(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %r12
	addq	$8, %r12
	movq	%r12, %rdi
	callq	_spin_lock_bh
	movl	%r15d, (%r14)
	movq	_tmp_list@GOTPCREL(%rip), %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	callq	_list_splice
	movl	$1, (%rbx)
	movl	$1, 4(%r14)
	movq	%r12, %rdi
	callq	_spin_unlock_bh
	movq	_CFG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	callq	_channel_writel
	movq	%rbx, %rdi
	callq	_chan2dev
	movl	(%r14), %edx
	leaq	L_.str.3(%rip), %rsi
	movl	%eax, %edi
	xorl	%eax, %eax
	callq	_dev_dbg
	movl	(%r14), %ebx
LBB0_16:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_tmp_list,4,2                   ## @tmp_list
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"alloc_chan_resources\n"

L_.str.1:                               ## @.str.1
	.asciz	"DMA channel not idle ?\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_ATC_DEFAULT_CFG,8,3            ## @ATC_DEFAULT_CFG
	.comm	_init_nr_desc_per_channel,4,2   ## @init_nr_desc_per_channel
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
L_.str.2:                               ## @.str.2
	.asciz	"Only %d initial descriptors\n"

	.comm	_CFG,4,2                        ## @CFG
L_.str.3:                               ## @.str.3
	.asciz	"alloc_chan_resources: allocated %d descriptors\n"

	.no_dead_strip	_atc_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 atc_alloc_chan_resources
_atc_alloc_chan_resources:              ; @atc_alloc_chan_resources
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x0
	bl	_to_at_dma_chan
	mov	x19, x0
	ldr	w0, [x20, #16]
	bl	_to_at_dma
	mov	x22, x0
Lloh0:
	adrp	x8, _tmp_list@GOTPAGE
Lloh1:
	ldr	x8, [x8, _tmp_list@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	bl	_LIST_HEAD
	mov	x0, x20
	bl	_chan2dev
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_vdbg
	mov	x0, x19
	bl	_atc_chan_is_enabled
	cbz	x0, LBB0_2
; %bb.1:
	mov	x0, x20
	bl	_chan2dev
Lloh5:
	adrp	x1, l_.str.1@PAGE
Lloh6:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_dbg
Lloh7:
	adrp	x8, _EIO@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_16
LBB0_2:
Lloh10:
	adrp	x8, _ATC_DEFAULT_CFG@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ATC_DEFAULT_CFG@GOTPAGEOFF]
Lloh12:
	ldr	x21, [x8]
	ldr	x23, [x20, #8]
	cbz	x23, LBB0_7
; %bb.3:
	ldr	x8, [x23]
	cbz	x8, LBB0_5
; %bb.4:
	ldr	x9, [x22]
	cmp	x8, x9
	cset	w0, ne
	b	LBB0_6
LBB0_5:
	mov	w0, #1
LBB0_6:
	bl	_BUG_ON
	ldr	x8, [x23, #8]
	cmp	x8, #0
	csel	x21, x21, x8, eq
LBB0_7:
	add	x23, x19, #12
	mov	x0, x23
	bl	_list_empty
	cbz	w0, LBB0_15
; %bb.8:
Lloh13:
	adrp	x26, _init_nr_desc_per_channel@GOTPAGE
Lloh14:
	ldr	x26, [x26, _init_nr_desc_per_channel@GOTPAGEOFF]
	ldr	w8, [x26]
	cmp	w8, #1
	b.lt	LBB0_12
; %bb.9:
	mov	w24, #0
Lloh15:
	adrp	x27, _GFP_KERNEL@GOTPAGE
Lloh16:
	ldr	x27, [x27, _GFP_KERNEL@GOTPAGEOFF]
Lloh17:
	adrp	x25, _tmp_list@GOTPAGE
Lloh18:
	ldr	x25, [x25, _tmp_list@GOTPAGEOFF]
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x27]
	mov	x0, x20
	bl	_atc_alloc_descriptor
	cbz	x0, LBB0_13
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	mov	x1, x25
	bl	_list_add_tail
	add	w24, w24, #1
	ldr	w8, [x26]
	cmp	w24, w8
	b.lt	LBB0_10
	b	LBB0_14
LBB0_12:
	mov	w24, #0
	b	LBB0_14
LBB0_13:
	ldr	x0, [x22]
Lloh19:
	adrp	x1, l_.str.2@PAGE
Lloh20:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x2, x24
	bl	_dev_err
LBB0_14:
	add	x22, x19, #8
	mov	x0, x22
	bl	_spin_lock_bh
	str	w24, [x19]
Lloh21:
	adrp	x0, _tmp_list@GOTPAGE
Lloh22:
	ldr	x0, [x0, _tmp_list@GOTPAGEOFF]
	mov	x1, x23
	bl	_list_splice
	mov	w8, #1
	str	w8, [x20]
	str	w8, [x19, #4]
	mov	x0, x22
	bl	_spin_unlock_bh
Lloh23:
	adrp	x8, _CFG@GOTPAGE
Lloh24:
	ldr	x8, [x8, _CFG@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x21
	bl	_channel_writel
	mov	x0, x20
	bl	_chan2dev
	ldr	w8, [x19]
	str	x8, [sp]
Lloh26:
	adrp	x1, l_.str.3@PAGE
Lloh27:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_dbg
LBB0_15:
	ldr	w0, [x19]
LBB0_16:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_tmp_list,4,2                   ; @tmp_list
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"alloc_chan_resources\n"

l_.str.1:                               ; @.str.1
	.asciz	"DMA channel not idle ?\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_ATC_DEFAULT_CFG,8,3            ; @ATC_DEFAULT_CFG
	.comm	_init_nr_desc_per_channel,4,2   ; @init_nr_desc_per_channel
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
l_.str.2:                               ; @.str.2
	.asciz	"Only %d initial descriptors\n"

	.comm	_CFG,4,2                        ; @CFG
l_.str.3:                               ; @.str.3
	.asciz	"alloc_chan_resources: allocated %d descriptors\n"

	.no_dead_strip	_atc_alloc_chan_resources
.subsections_via_symbols
