	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mv_ap806_sei_attach
_mv_ap806_sei_attach:                   ## @mv_ap806_sei_attach
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, %ebx
	callq	_device_get_softc
	movq	%rax, %r13
	movl	%ebx, 24(%rax)
	movl	%ebx, %edi
	callq	_ofw_bus_get_node
	movl	%eax, %r15d
	movq	%r13, %rdi
	callq	_MV_AP806_SEI_LOCK_INIT
	movl	$0, -44(%rbp)
	movq	_SYS_RES_MEMORY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_RF_ACTIVE@GOTPCREL(%rip), %r14
	movl	(%r14), %ecx
	leaq	-44(%rbp), %rdx
	movl	%ebx, %edi
	callq	_bus_alloc_resource_any
	movq	%rax, (%r13)
	testq	%rax, %rax
	movl	%ebx, -48(%rbp)                 ## 4-byte Spill
	je	LBB0_1
## %bb.2:
	movl	$0, -44(%rbp)
	movq	_SYS_RES_IRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%r14), %ecx
	leaq	-44(%rbp), %rdx
	movl	%ebx, %edi
	callq	_bus_alloc_resource_any
	movq	%rax, 8(%r13)
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movl	%r15d, -52(%rbp)                ## 4-byte Spill
	movq	_GICP_SEMR0@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	movl	$-1, %edx
	callq	_WR4
	movq	_GICP_SEMR1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	movl	$-1, %edx
	callq	_WR4
	movq	_MV_AP806_SEI_MAX_NIRQS@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	shll	$3, %edi
	movq	_M_DEVBUF@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_M_WAITOK@GOTPCREL(%rip), %rax
	movq	_M_ZERO@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	callq	_malloc
	movq	%rax, 32(%r13)
	movl	24(%r13), %edi
	callq	_device_get_nameunit
	cmpl	$0, (%rbx)
	jle	LBB0_8
## %bb.5:
	movq	%rax, %r12
	movl	$4, %r14d
	xorl	%ebx, %ebx
	leaq	L_.str.2(%rip), %r15
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movq	32(%r13), %rdi
	movl	%ebx, (%rdi,%rbx,8)
	addq	%r14, %rdi
	movl	24(%r13), %esi
	xorl	%edx, %edx
	movq	%r15, %rcx
	movq	%r12, %r8
	movl	%ebx, %r9d
	callq	_intr_isrc_register
	testl	%eax, %eax
	jne	LBB0_13
## %bb.6:                               ##   in Loop: Header=BB0_7 Depth=1
	incq	%rbx
	movq	_MV_AP806_SEI_MAX_NIRQS@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	addq	$8, %r14
	cmpq	%rax, %rbx
	jl	LBB0_7
LBB0_8:
	movl	-52(%rbp), %edi                 ## 4-byte Reload
	callq	_OF_xref_from_node
	movl	%eax, %r15d
	movl	-48(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, %edi
	movl	%eax, %esi
	callq	_intr_pic_register
	testq	%rax, %rax
	je	LBB0_9
## %bb.10:
	movq	_INTR_TYPE_MISC@GOTPCREL(%rip), %rax
	movq	_INTR_MPSAFE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	orl	(%rax), %edx
	movq	8(%r13), %rsi
	movq	_mv_ap806_sei_intr@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r13, %rax
	addq	$16, %rax
	movq	%rax, (%rsp)
	xorl	%r14d, %r14d
	movl	%ebx, %edi
	xorl	%r8d, %r8d
	movq	%r13, %r9
	callq	_bus_setup_intr
	testq	%rax, %rax
	je	LBB0_21
## %bb.11:
	leaq	L_.str.4(%rip), %rsi
	jmp	LBB0_12
LBB0_1:
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_12
LBB0_3:
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_12
LBB0_9:
	leaq	L_.str.3(%rip), %rsi
LBB0_12:
	movl	%ebx, %edi
	callq	_device_printf
LBB0_13:
	movq	16(%r13), %rdx
	testq	%rdx, %rdx
	movl	-48(%rbp), %ebx                 ## 4-byte Reload
	je	LBB0_15
## %bb.14:
	movq	8(%r13), %rsi
	movl	%ebx, %edi
	callq	_bus_teardown_intr
LBB0_15:
	movq	8(%r13), %rcx
	testq	%rcx, %rcx
	je	LBB0_17
## %bb.16:
	movq	_SYS_RES_IRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ebx, %edi
	xorl	%edx, %edx
	callq	_bus_release_resource
LBB0_17:
	movq	(%r13), %rcx
	testq	%rcx, %rcx
	je	LBB0_19
## %bb.18:
	movq	_SYS_RES_MEMORY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ebx, %edi
	xorl	%edx, %edx
	callq	_bus_release_resource
LBB0_19:
	movq	%r13, %rdi
	callq	_MV_AP806_SEI_LOCK_DESTROY
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
LBB0_20:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_21:
	movl	%r15d, %edi
	movl	%ebx, %esi
	callq	_OF_device_register_xref
	jmp	LBB0_20
	.cfi_endproc
                                        ## -- End function
	.comm	_SYS_RES_MEMORY,4,2             ## @SYS_RES_MEMORY
	.comm	_RF_ACTIVE,4,2                  ## @RF_ACTIVE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Cannot allocate memory resources\n"

	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_SYS_RES_IRQ,4,2                ## @SYS_RES_IRQ
L_.str.1:                               ## @.str.1
	.asciz	"Cannot allocate IRQ resources\n"

	.comm	_GICP_SEMR0,4,2                 ## @GICP_SEMR0
	.comm	_GICP_SEMR1,4,2                 ## @GICP_SEMR1
	.comm	_MV_AP806_SEI_MAX_NIRQS,4,2     ## @MV_AP806_SEI_MAX_NIRQS
	.comm	_M_DEVBUF,4,2                   ## @M_DEVBUF
	.comm	_M_WAITOK,4,2                   ## @M_WAITOK
	.comm	_M_ZERO,4,2                     ## @M_ZERO
L_.str.2:                               ## @.str.2
	.asciz	"%s,%u"

L_.str.3:                               ## @.str.3
	.asciz	"Cannot register SEI\n"

	.comm	_INTR_TYPE_MISC,4,2             ## @INTR_TYPE_MISC
	.comm	_INTR_MPSAFE,4,2                ## @INTR_MPSAFE
	.comm	_mv_ap806_sei_intr,4,2          ## @mv_ap806_sei_intr
L_.str.4:                               ## @.str.4
	.asciz	"Unable to register interrupt handler\n"

	.no_dead_strip	_mv_ap806_sei_attach
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mv_ap806_sei_attach
_mv_ap806_sei_attach:                   ; @mv_ap806_sei_attach
	.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	x19, x0
	bl	_device_get_softc
	mov	x20, x0
	str	w19, [x0, #24]
	mov	x0, x19
	bl	_ofw_bus_get_node
	mov	x21, x0
	mov	x0, x20
	bl	_MV_AP806_SEI_LOCK_INIT
	str	wzr, [sp, #12]
Lloh0:
	adrp	x25, _SYS_RES_MEMORY@GOTPAGE
Lloh1:
	ldr	x25, [x25, _SYS_RES_MEMORY@GOTPAGEOFF]
	ldr	w1, [x25]
Lloh2:
	adrp	x22, _RF_ACTIVE@GOTPAGE
Lloh3:
	ldr	x22, [x22, _RF_ACTIVE@GOTPAGEOFF]
	ldr	w3, [x22]
	add	x2, sp, #12
	mov	x0, x19
	bl	_bus_alloc_resource_any
	str	x0, [x20]
Lloh4:
	adrp	x26, _SYS_RES_IRQ@GOTPAGE
Lloh5:
	ldr	x26, [x26, _SYS_RES_IRQ@GOTPAGEOFF]
	cbz	x0, LBB0_9
; %bb.1:
	str	wzr, [sp, #12]
	ldr	w1, [x26]
	ldr	w3, [x22]
	add	x2, sp, #12
	mov	x0, x19
	bl	_bus_alloc_resource_any
	str	x0, [x20, #8]
	cbz	x0, LBB0_10
; %bb.2:
Lloh6:
	adrp	x8, _GICP_SEMR0@GOTPAGE
Lloh7:
	ldr	x8, [x8, _GICP_SEMR0@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #-1
	bl	_WR4
Lloh9:
	adrp	x8, _GICP_SEMR1@GOTPAGE
Lloh10:
	ldr	x8, [x8, _GICP_SEMR1@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #-1
	bl	_WR4
Lloh12:
	adrp	x27, _MV_AP806_SEI_MAX_NIRQS@GOTPAGE
Lloh13:
	ldr	x27, [x27, _MV_AP806_SEI_MAX_NIRQS@GOTPAGEOFF]
	ldr	w8, [x27]
	lsl	w0, w8, #3
Lloh14:
	adrp	x8, _M_DEVBUF@GOTPAGE
Lloh15:
	ldr	x8, [x8, _M_DEVBUF@GOTPAGEOFF]
Lloh16:
	adrp	x9, _M_WAITOK@GOTPAGE
Lloh17:
	ldr	x9, [x9, _M_WAITOK@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
Lloh19:
	ldr	w8, [x9]
Lloh20:
	adrp	x9, _M_ZERO@GOTPAGE
Lloh21:
	ldr	x9, [x9, _M_ZERO@GOTPAGEOFF]
Lloh22:
	ldr	w9, [x9]
	orr	w2, w9, w8
	bl	_malloc
	str	x0, [x20, #32]
	ldr	w0, [x20, #24]
	bl	_device_get_nameunit
	ldr	w8, [x27]
	cmp	w8, #1
	b.lt	LBB0_6
; %bb.3:
	mov	x22, x0
	mov	x28, #0
	mov	x23, #0
Lloh23:
	adrp	x24, l_.str.2@PAGE
Lloh24:
	add	x24, x24, l_.str.2@PAGEOFF
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x20, #32]
	add	x0, x8, x28
	str	w23, [x0], #4
	ldr	w1, [x20, #24]
	mov	w2, #0
	mov	x3, x24
	mov	x4, x22
	mov	x5, x23
	bl	_intr_isrc_register
	cbnz	w0, LBB0_13
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	add	x23, x23, #1
	ldrsw	x8, [x27]
	add	x28, x28, #8
	cmp	x23, x8
	b.lt	LBB0_4
LBB0_6:
	mov	x0, x21
	bl	_OF_xref_from_node
	mov	x21, x0
	mov	x0, x19
	mov	x1, x21
	bl	_intr_pic_register
	cbz	x0, LBB0_11
; %bb.7:
	ldr	x1, [x20, #8]
Lloh25:
	adrp	x8, _INTR_TYPE_MISC@GOTPAGE
Lloh26:
	ldr	x8, [x8, _INTR_TYPE_MISC@GOTPAGEOFF]
Lloh27:
	ldr	w8, [x8]
Lloh28:
	adrp	x9, _INTR_MPSAFE@GOTPAGE
Lloh29:
	ldr	x9, [x9, _INTR_MPSAFE@GOTPAGEOFF]
Lloh30:
	ldr	w9, [x9]
	orr	w2, w9, w8
Lloh31:
	adrp	x8, _mv_ap806_sei_intr@GOTPAGE
Lloh32:
	ldr	x8, [x8, _mv_ap806_sei_intr@GOTPAGEOFF]
Lloh33:
	ldr	w3, [x8]
	add	x6, x20, #16
	mov	x0, x19
	mov	x4, #0
	mov	x5, x20
	bl	_bus_setup_intr
	cbz	x0, LBB0_21
; %bb.8:
Lloh34:
	adrp	x1, l_.str.4@PAGE
Lloh35:
	add	x1, x1, l_.str.4@PAGEOFF
	b	LBB0_12
LBB0_9:
Lloh36:
	adrp	x1, l_.str@PAGE
Lloh37:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_12
LBB0_10:
Lloh38:
	adrp	x1, l_.str.1@PAGE
Lloh39:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_12
LBB0_11:
Lloh40:
	adrp	x1, l_.str.3@PAGE
Lloh41:
	add	x1, x1, l_.str.3@PAGEOFF
LBB0_12:
	mov	x0, x19
	bl	_device_printf
LBB0_13:
	ldr	x2, [x20, #16]
	cbz	x2, LBB0_15
; %bb.14:
	ldr	x1, [x20, #8]
	mov	x0, x19
	bl	_bus_teardown_intr
LBB0_15:
	ldr	x3, [x20, #8]
	cbz	x3, LBB0_17
; %bb.16:
	ldr	w1, [x26]
	mov	x0, x19
	mov	w2, #0
	bl	_bus_release_resource
LBB0_17:
	ldr	x3, [x20]
	cbz	x3, LBB0_19
; %bb.18:
	ldr	w1, [x25]
	mov	x0, x19
	mov	w2, #0
	bl	_bus_release_resource
LBB0_19:
	mov	x0, x20
	bl	_MV_AP806_SEI_LOCK_DESTROY
Lloh42:
	adrp	x8, _ENXIO@GOTPAGE
Lloh43:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh44:
	ldr	w0, [x8]
LBB0_20:
	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
LBB0_21:
	mov	x0, x21
	mov	x1, x19
	bl	_OF_device_register_xref
	mov	w0, #0
	b	LBB0_20
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh18
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpAdd	Lloh34, Lloh35
	.loh AdrpAdd	Lloh36, Lloh37
	.loh AdrpAdd	Lloh38, Lloh39
	.loh AdrpAdd	Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh44
	.cfi_endproc
                                        ; -- End function
	.comm	_SYS_RES_MEMORY,4,2             ; @SYS_RES_MEMORY
	.comm	_RF_ACTIVE,4,2                  ; @RF_ACTIVE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Cannot allocate memory resources\n"

	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_SYS_RES_IRQ,4,2                ; @SYS_RES_IRQ
l_.str.1:                               ; @.str.1
	.asciz	"Cannot allocate IRQ resources\n"

	.comm	_GICP_SEMR0,4,2                 ; @GICP_SEMR0
	.comm	_GICP_SEMR1,4,2                 ; @GICP_SEMR1
	.comm	_MV_AP806_SEI_MAX_NIRQS,4,2     ; @MV_AP806_SEI_MAX_NIRQS
	.comm	_M_DEVBUF,4,2                   ; @M_DEVBUF
	.comm	_M_WAITOK,4,2                   ; @M_WAITOK
	.comm	_M_ZERO,4,2                     ; @M_ZERO
l_.str.2:                               ; @.str.2
	.asciz	"%s,%u"

l_.str.3:                               ; @.str.3
	.asciz	"Cannot register SEI\n"

	.comm	_INTR_TYPE_MISC,4,2             ; @INTR_TYPE_MISC
	.comm	_INTR_MPSAFE,4,2                ; @INTR_MPSAFE
	.comm	_mv_ap806_sei_intr,4,2          ; @mv_ap806_sei_intr
l_.str.4:                               ; @.str.4
	.asciz	"Unable to register interrupt handler\n"

	.no_dead_strip	_mv_ap806_sei_attach
.subsections_via_symbols
