	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sdma_init
_sdma_init:                             ## @sdma_init
	.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
	movq	%rdi, %r15
	movl	12(%rdi), %edi
	callq	_clk_enable
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_20
## %bb.1:
	movl	16(%r15), %edi
	callq	_clk_enable
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_8
## %bb.2:
	movq	40(%r15), %rax
	cmpq	$0, 8(%rax)
	je	LBB0_5
## %bb.3:
	movl	16(%r15), %edi
	callq	_clk_get_rate
	movq	%rax, %rbx
	movl	12(%r15), %edi
	callq	_clk_get_rate
	cmpq	%rax, %rbx
	jne	LBB0_5
## %bb.4:
	movl	$1, (%r15)
LBB0_5:
	movq	_SDMA_H_C0PTR@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	32(%r15), %rsi
	xorl	%r14d, %r14d
	xorl	%edi, %edi
	callq	_writel_relaxed
	movl	8(%r15), %edi
	movq	_MAX_DMA_CHANNELS@GOTPCREL(%rip), %r13
	movl	(%r13), %eax
	leal	4(,%rax,4), %esi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	-44(%rbp), %rdx
	callq	_dma_alloc_coherent
	movq	%rax, 48(%r15)
	testq	%rax, %rax
	je	LBB0_6
## %bb.9:
	movslq	(%r13), %rcx
	leaq	(%rax,%rcx,4), %rax
	movq	%rax, 56(%r15)
	leal	(,%rcx,4), %eax
	addl	-44(%rbp), %eax
	movl	%eax, 4(%r15)
	movq	40(%r15), %rax
	cmpl	$0, (%rax)
	jle	LBB0_13
## %bb.10:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	movq	32(%r15), %r14
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_chnenbl_ofs
	addq	%rax, %r14
	xorl	%edi, %edi
	movq	%r14, %rsi
	callq	_writel_relaxed
	incl	%ebx
	movq	40(%r15), %rax
	cmpl	(%rax), %ebx
	jl	LBB0_11
## %bb.12:
	movl	(%r13), %ecx
LBB0_13:
	testl	%ecx, %ecx
	jle	LBB0_16
## %bb.14:
	xorl	%ebx, %ebx
	movq	_SDMA_CHNPRI_0@GOTPCREL(%rip), %r14
	xorl	%r12d, %r12d
	.p2align	4, 0x90
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	movq	32(%r15), %rsi
	addq	(%r14), %rsi
	addq	%rbx, %rsi
	xorl	%edi, %edi
	callq	_writel_relaxed
	incq	%r12
	movslq	(%r13), %rax
	addq	$4, %rbx
	cmpq	%rax, %r12
	jl	LBB0_15
LBB0_16:
	movq	%r15, %rdi
	callq	_sdma_request_channel0
	movl	%eax, %r14d
	testl	%eax, %eax
	jne	LBB0_7
## %bb.17:
	movq	24(%r15), %rdi
	xorl	%r14d, %r14d
	xorl	%esi, %esi
	movl	$1, %edx
	xorl	%ecx, %ecx
	callq	_sdma_config_ownership
	movq	_SDMA_CHN0ADDR@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	32(%r15), %rsi
	movl	$16464, %edi                    ## imm = 0x4050
	callq	_writel_relaxed
	movl	(%r15), %edi
	testl	%edi, %edi
	je	LBB0_19
## %bb.18:
	movq	_SDMA_H_CONFIG_ACR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
LBB0_19:
	movq	_SDMA_H_CONFIG@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	32(%r15), %rsi
	callq	_writel_relaxed
	movl	-44(%rbp), %edi
	movq	_SDMA_H_C0PTR@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	32(%r15), %rsi
	callq	_writel_relaxed
	movq	24(%r15), %rdi
	movl	$7, %esi
	callq	_sdma_set_channel_priority
	movl	12(%r15), %edi
	callq	_clk_disable
	movl	16(%r15), %edi
	callq	_clk_disable
	jmp	LBB0_20
LBB0_6:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
LBB0_7:
	movl	16(%r15), %edi
	callq	_clk_disable
LBB0_8:
	movl	12(%r15), %edi
	callq	_clk_disable
	movl	8(%r15), %edi
	leaq	L_.str(%rip), %rsi
	movl	%r14d, %edx
	callq	_dev_err
LBB0_20:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SDMA_H_C0PTR,8,3               ## @SDMA_H_C0PTR
	.comm	_MAX_DMA_CHANNELS,4,2           ## @MAX_DMA_CHANNELS
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_SDMA_CHNPRI_0,8,3              ## @SDMA_CHNPRI_0
	.comm	_SDMA_CHN0ADDR,8,3              ## @SDMA_CHN0ADDR
	.comm	_SDMA_H_CONFIG_ACR,4,2          ## @SDMA_H_CONFIG_ACR
	.comm	_SDMA_H_CONFIG,8,3              ## @SDMA_H_CONFIG
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"initialisation failed with %d\n"

	.no_dead_strip	_sdma_init
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sdma_init
_sdma_init:                             ; @sdma_init
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
	mov	x19, x0
	ldr	w0, [x0, #12]
	bl	_clk_enable
	mov	x20, x0
	cbnz	w0, LBB0_18
; %bb.1:
	ldr	w0, [x19, #16]
	bl	_clk_enable
	mov	x20, x0
	cbnz	w0, LBB0_17
; %bb.2:
	ldr	x8, [x19, #40]
	ldr	x8, [x8, #8]
	cbz	x8, LBB0_5
; %bb.3:
	ldr	w0, [x19, #16]
	bl	_clk_get_rate
	mov	x20, x0
	ldr	w0, [x19, #12]
	bl	_clk_get_rate
	cmp	x20, x0
	b.ne	LBB0_5
; %bb.4:
	mov	w8, #1
	str	w8, [x19]
LBB0_5:
	ldr	x8, [x19, #32]
Lloh0:
	adrp	x21, _SDMA_H_C0PTR@GOTPAGE
Lloh1:
	ldr	x21, [x21, _SDMA_H_C0PTR@GOTPAGEOFF]
	ldr	x9, [x21]
	add	x1, x9, x8
	mov	w0, #0
	bl	_writel_relaxed
	ldr	w0, [x19, #8]
Lloh2:
	adrp	x22, _MAX_DMA_CHANNELS@GOTPAGE
Lloh3:
	ldr	x22, [x22, _MAX_DMA_CHANNELS@GOTPAGEOFF]
	ldr	w8, [x22]
	lsl	w8, w8, #2
	add	w1, w8, #4
Lloh4:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh5:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh6:
	ldr	w3, [x8]
	add	x2, sp, #12
	bl	_dma_alloc_coherent
	str	x0, [x19, #48]
	cbz	x0, LBB0_15
; %bb.6:
	ldrsw	x8, [x22]
	add	x9, x0, x8, lsl #2
	str	x9, [x19, #56]
	ldr	w9, [sp, #12]
	add	w9, w9, w8, lsl #2
	str	w9, [x19, #4]
	ldr	x9, [x19, #40]
	ldr	w9, [x9]
	cmp	w9, #1
	b.lt	LBB0_10
; %bb.7:
	mov	w20, #0
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x23, [x19, #32]
	mov	x0, x19
	mov	x1, x20
	bl	_chnenbl_ofs
	add	x1, x0, x23
	mov	w0, #0
	bl	_writel_relaxed
	add	w20, w20, #1
	ldr	x8, [x19, #40]
	ldr	w8, [x8]
	cmp	w20, w8
	b.lt	LBB0_8
; %bb.9:
	ldr	w8, [x22]
LBB0_10:
	cmp	w8, #1
	b.lt	LBB0_13
; %bb.11:
	mov	x20, #0
	mov	x23, #0
Lloh7:
	adrp	x24, _SDMA_CHNPRI_0@GOTPAGE
Lloh8:
	ldr	x24, [x24, _SDMA_CHNPRI_0@GOTPAGEOFF]
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19, #32]
	ldr	x9, [x24]
	add	x8, x8, x9
	add	x1, x20, x8
	mov	w0, #0
	bl	_writel_relaxed
	add	x23, x23, #1
	ldrsw	x8, [x22]
	add	x20, x20, #4
	cmp	x23, x8
	b.lt	LBB0_12
LBB0_13:
	mov	x0, x19
	bl	_sdma_request_channel0
	mov	x20, x0
	cbnz	w0, LBB0_16
; %bb.14:
	ldr	x0, [x19, #24]
	mov	w1, #0
	mov	w2, #1
	mov	w3, #0
	bl	_sdma_config_ownership
	ldr	x8, [x19, #32]
Lloh9:
	adrp	x9, _SDMA_CHN0ADDR@GOTPAGE
Lloh10:
	ldr	x9, [x9, _SDMA_CHN0ADDR@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	w0, #16464
	bl	_writel_relaxed
	ldr	w8, [x19]
Lloh12:
	adrp	x9, _SDMA_H_CONFIG_ACR@GOTPAGE
Lloh13:
	ldr	x9, [x9, _SDMA_H_CONFIG_ACR@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	cmp	w8, #0
	csel	w0, wzr, w9, eq
	ldr	x8, [x19, #32]
Lloh15:
	adrp	x9, _SDMA_H_CONFIG@GOTPAGE
Lloh16:
	ldr	x9, [x9, _SDMA_H_CONFIG@GOTPAGEOFF]
Lloh17:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_writel_relaxed
	ldr	w0, [sp, #12]
	ldr	x8, [x19, #32]
	ldr	x9, [x21]
	add	x1, x9, x8
	bl	_writel_relaxed
	ldr	x0, [x19, #24]
	mov	w1, #7
	bl	_sdma_set_channel_priority
	ldr	w0, [x19, #12]
	bl	_clk_disable
	ldr	w0, [x19, #16]
	bl	_clk_disable
	b	LBB0_18
LBB0_15:
Lloh18:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh19:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_16:
	ldr	w0, [x19, #16]
	bl	_clk_disable
LBB0_17:
	ldr	w0, [x19, #12]
	bl	_clk_disable
	ldr	w0, [x19, #8]
Lloh21:
	adrp	x1, l_.str@PAGE
Lloh22:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x20
	bl	_dev_err
LBB0_18:
	mov	x0, x20
	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
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_SDMA_H_C0PTR,8,3               ; @SDMA_H_C0PTR
	.comm	_MAX_DMA_CHANNELS,4,2           ; @MAX_DMA_CHANNELS
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_SDMA_CHNPRI_0,8,3              ; @SDMA_CHNPRI_0
	.comm	_SDMA_CHN0ADDR,8,3              ; @SDMA_CHN0ADDR
	.comm	_SDMA_H_CONFIG_ACR,4,2          ; @SDMA_H_CONFIG_ACR
	.comm	_SDMA_H_CONFIG,8,3              ; @SDMA_H_CONFIG
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"initialisation failed with %d\n"

	.no_dead_strip	_sdma_init
.subsections_via_symbols
