	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function idmac_alloc_chan_resources
_idmac_alloc_chan_resources:            ## @idmac_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	callq	_to_idmac_chan
	movq	%rax, %r12
	movl	24(%r14), %edi
	callq	_to_idmac
	movq	%rax, %r15
	xorl	%edi, %edi
	cmpl	$2, (%r14)
	setge	%dil
	callq	_BUG_ON
	movq	(%r12), %rax
	movq	_IPU_CHANNEL_FREE@GOTPCREL(%rip), %rcx
	xorl	%edi, %edi
	cmpq	(%rcx), %rax
	setne	%dil
	callq	_WARN_ON
	movl	$1, 4(%r14)
	movq	_ENXIO@GOTPCREL(%rip), %rax
	xorl	%ecx, %ecx
	subl	(%rax), %ecx
	movl	%ecx, 24(%r12)
	movl	8(%r14), %edi
	callq	_ipu_irq_map
	movq	%rax, %rbx
	testl	%ebx, %ebx
	js	LBB0_7
## %bb.1:
	movl	%ebx, 8(%r12)
	movq	%r15, %rdi
	movq	%r12, %rsi
	movl	$1, %edx
	callq	_ipu_disable_channel
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_ipu_init_channel
	testl	%eax, %eax
	js	LBB0_2
## %bb.3:
	movl	8(%r12), %edi
	movq	_idmac_interrupt@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	16(%r12), %rcx
	xorl	%edx, %edx
	movq	%r12, %r8
	callq	_request_irq
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_5
## %bb.4:
	movq	_IPU_CHANNEL_INITIALIZED@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%r12)
	movq	16(%r14), %rdi
	movslq	8(%r14), %rdx
	movl	8(%r12), %ecx
	leaq	L_.str(%rip), %rsi
	callq	_dev_dbg
	jmp	LBB0_7
LBB0_2:
	movl	%eax, %ebx
	jmp	LBB0_6
LBB0_5:
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_ipu_uninit_channel
LBB0_6:
	movslq	8(%r14), %rdi
	callq	_ipu_irq_unmap
LBB0_7:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_IPU_CHANNEL_FREE,8,3           ## @IPU_CHANNEL_FREE
	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_idmac_interrupt,4,2            ## @idmac_interrupt
	.comm	_IPU_CHANNEL_INITIALIZED,8,3    ## @IPU_CHANNEL_INITIALIZED
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Found channel 0x%x, irq %d\n"

	.comm	_IDMAC_IC_7,8,3                 ## @IDMAC_IC_7
	.comm	_ic_eof,4,2                     ## @ic_eof
	.comm	_ic_eof_irq,4,2                 ## @ic_eof_irq
	.comm	_ic_sof,4,2                     ## @ic_sof
	.comm	_ic_sof_irq,4,2                 ## @ic_sof_irq
	.no_dead_strip	_idmac_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 idmac_alloc_chan_resources
_idmac_alloc_chan_resources:            ; @idmac_alloc_chan_resources
	.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
	mov	x19, x0
	bl	_to_idmac_chan
	mov	x20, x0
	ldr	w0, [x19, #24]
	bl	_to_idmac
	mov	x21, x0
	ldr	w8, [x19]
	cmp	w8, #1
	cset	w0, gt
	bl	_BUG_ON
	ldr	x8, [x20]
Lloh0:
	adrp	x9, _IPU_CHANNEL_FREE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _IPU_CHANNEL_FREE@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	cset	w0, ne
	bl	_WARN_ON
	mov	w8, #1
	str	w8, [x19, #4]
Lloh3:
	adrp	x8, _ENXIO@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w8, w8
	str	w8, [x20, #24]
	ldr	w0, [x19, #8]
	bl	_ipu_irq_map
	mov	x22, x0
	tbnz	w22, #31, LBB0_7
; %bb.1:
	str	w22, [x20, #8]
	mov	x0, x21
	mov	x1, x20
	mov	w2, #1
	bl	_ipu_disable_channel
	mov	x0, x21
	mov	x1, x20
	bl	_ipu_init_channel
	tbnz	w0, #31, LBB0_4
; %bb.2:
	ldr	w0, [x20, #8]
Lloh6:
	adrp	x8, _idmac_interrupt@GOTPAGE
Lloh7:
	ldr	x8, [x8, _idmac_interrupt@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	ldr	x3, [x20, #16]
	mov	w2, #0
	mov	x4, x20
	bl	_request_irq
	mov	x22, x0
	tbnz	w0, #31, LBB0_5
; %bb.3:
Lloh9:
	adrp	x8, _IPU_CHANNEL_INITIALIZED@GOTPAGE
Lloh10:
	ldr	x8, [x8, _IPU_CHANNEL_INITIALIZED@GOTPAGEOFF]
Lloh11:
	ldr	x8, [x8]
	str	x8, [x20]
	ldr	x0, [x19, #16]
	ldrsw	x2, [x19, #8]
	ldr	w3, [x20, #8]
Lloh12:
	adrp	x1, l_.str@PAGE
Lloh13:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
	b	LBB0_7
LBB0_4:
	mov	x22, x0
	b	LBB0_6
LBB0_5:
	mov	x0, x21
	mov	x1, x20
	bl	_ipu_uninit_channel
LBB0_6:
	ldrsw	x0, [x19, #8]
	bl	_ipu_irq_unmap
LBB0_7:
	mov	x0, x22
	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 AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_IPU_CHANNEL_FREE,8,3           ; @IPU_CHANNEL_FREE
	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_idmac_interrupt,4,2            ; @idmac_interrupt
	.comm	_IPU_CHANNEL_INITIALIZED,8,3    ; @IPU_CHANNEL_INITIALIZED
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Found channel 0x%x, irq %d\n"

	.comm	_IDMAC_IC_7,8,3                 ; @IDMAC_IC_7
	.comm	_ic_eof,4,2                     ; @ic_eof
	.comm	_ic_eof_irq,4,2                 ; @ic_eof_irq
	.comm	_ic_sof,4,2                     ; @ic_sof
	.comm	_ic_sof_irq,4,2                 ; @ic_sof_irq
	.no_dead_strip	_idmac_alloc_chan_resources
.subsections_via_symbols
