	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sdma_load_firmware
_sdma_load_firmware:                    ## @sdma_load_firmware
	.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	%rsi, %r14
	testq	%rdi, %rdi
	je	LBB0_8
## %bb.1:
	movq	%rdi, %rbx
	movl	(%rdi), %eax
	cmpl	$32, %eax
	jb	LBB0_7
## %bb.2:
	movq	8(%rbx), %r13
	movq	(%r13), %rcx
	movq	_SDMA_FIRMWARE_MAGIC@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	jne	LBB0_7
## %bb.3:
	movslq	8(%r13), %r15
	movl	12(%r13), %ecx
	addl	%r15d, %ecx
	cmpl	%eax, %ecx
	jg	LBB0_7
## %bb.4:
	movl	16(%r13), %eax
	decl	%eax
	cmpl	$4, %eax
	jae	LBB0_5
## %bb.6:
	cltq
	leaq	l_switch.table.sdma_load_firmware(%rip), %rcx
	movq	(%rcx,%rax,8), %rax
	movl	(%rax), %eax
	movl	%eax, 12(%r14)
	movslq	20(%r13), %r12
	leaq	(%r12,%r13), %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	addq	%r13, %r15
	movl	8(%r14), %edi
	callq	_clk_enable
	movl	4(%r14), %edi
	callq	_clk_enable
	movl	12(%r13), %edx
	movl	(%r13,%r12), %ecx
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_sdma_load_script
	movl	8(%r14), %edi
	callq	_clk_disable
	movl	4(%r14), %edi
	callq	_clk_disable
	movq	%r14, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	callq	_sdma_add_scripts
	movl	(%r14), %edi
	movl	16(%r13), %edx
	movl	24(%r13), %ecx
	leaq	L_.str.2(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_info
	jmp	LBB0_7
LBB0_8:
	movl	(%r14), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_dev_info                       ## TAILCALL
LBB0_5:
	movl	(%r14), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_err
LBB0_7:
	movq	%rbx, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_release_firmware               ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"external firmware not found, using ROM firmware\n"

	.comm	_SDMA_FIRMWARE_MAGIC,8,3        ## @SDMA_FIRMWARE_MAGIC
	.comm	_SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1,4,2 ## @SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1
	.comm	_SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V2,4,2 ## @SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V2
	.comm	_SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V3,4,2 ## @SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V3
	.comm	_SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V4,4,2 ## @SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V4
L_.str.1:                               ## @.str.1
	.asciz	"unknown firmware version\n"

L_.str.2:                               ## @.str.2
	.asciz	"loaded firmware %d.%d\n"

	.no_dead_strip	_sdma_load_firmware
	.section	__DATA,__const
	.p2align	3                               ## @switch.table.sdma_load_firmware
l_switch.table.sdma_load_firmware:
	.quad	_SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1
	.quad	_SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V2
	.quad	_SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V3
	.quad	_SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V4

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sdma_load_firmware
_sdma_load_firmware:                    ; @sdma_load_firmware
	.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	x20, x1
	cbz	x0, LBB0_6
; %bb.1:
	mov	x19, x0
	ldr	w9, [x0]
	cmp	w9, #32
	b.lo	LBB0_8
; %bb.2:
	ldr	x23, [x19, #8]
	ldr	x8, [x23]
Lloh0:
	adrp	x10, _SDMA_FIRMWARE_MAGIC@GOTPAGE
Lloh1:
	ldr	x10, [x10, _SDMA_FIRMWARE_MAGIC@GOTPAGEOFF]
Lloh2:
	ldr	x10, [x10]
	cmp	x8, x10
	b.ne	LBB0_8
; %bb.3:
	ldp	w8, w10, [x23, #8]
                                        ; kill: def $w8 killed $w8 def $x8
	sxtw	x8, w8
	add	w10, w10, w8
	cmp	w10, w9
	b.gt	LBB0_8
; %bb.4:
	ldr	w9, [x23, #16]
	sub	w9, w9, #1
	cmp	w9, #4
	b.hs	LBB0_7
; %bb.5:
Lloh3:
	adrp	x10, l_switch.table.sdma_load_firmware@PAGE
Lloh4:
	add	x10, x10, l_switch.table.sdma_load_firmware@PAGEOFF
	ldr	x9, [x10, w9, sxtw #3]
	ldr	w9, [x9]
	str	w9, [x20, #12]
	ldrsw	x9, [x23, #20]
	add	x21, x23, x9
	add	x22, x23, x8
	ldr	w0, [x20, #8]
	bl	_clk_enable
	ldr	w0, [x20, #4]
	bl	_clk_enable
	ldr	w2, [x23, #12]
	ldr	w3, [x21]
	mov	x0, x20
	mov	x1, x22
	bl	_sdma_load_script
	ldr	w0, [x20, #8]
	bl	_clk_disable
	ldr	w0, [x20, #4]
	bl	_clk_disable
	mov	x0, x20
	mov	x1, x21
	bl	_sdma_add_scripts
	ldr	w0, [x20]
	ldr	w8, [x23, #16]
	ldr	w9, [x23, #24]
	stp	x8, x9, [sp]
Lloh5:
	adrp	x1, l_.str.2@PAGE
Lloh6:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_info
	b	LBB0_8
LBB0_6:
	ldr	w0, [x20]
Lloh7:
	adrp	x1, l_.str@PAGE
Lloh8:
	add	x1, x1, l_.str@PAGEOFF
	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
	b	_dev_info
LBB0_7:
	ldr	w0, [x20]
Lloh9:
	adrp	x1, l_.str.1@PAGE
Lloh10:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
LBB0_8:
	mov	x0, 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
	add	sp, sp, #80
	b	_release_firmware
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"external firmware not found, using ROM firmware\n"

	.comm	_SDMA_FIRMWARE_MAGIC,8,3        ; @SDMA_FIRMWARE_MAGIC
	.comm	_SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1,4,2 ; @SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1
	.comm	_SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V2,4,2 ; @SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V2
	.comm	_SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V3,4,2 ; @SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V3
	.comm	_SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V4,4,2 ; @SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V4
l_.str.1:                               ; @.str.1
	.asciz	"unknown firmware version\n"

l_.str.2:                               ; @.str.2
	.asciz	"loaded firmware %d.%d\n"

	.no_dead_strip	_sdma_load_firmware
	.section	__DATA,__const
	.p2align	3                               ; @switch.table.sdma_load_firmware
l_switch.table.sdma_load_firmware:
	.quad	_SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V1
	.quad	_SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V2
	.quad	_SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V3
	.quad	_SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V4

.subsections_via_symbols
