	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function a10_aintc_attach
_a10_aintc_attach:                      ## @a10_aintc_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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, %r14d
	callq	_device_get_softc
	movq	%rax, %rbx
	movl	$0, -28(%rbp)
	movl	%r14d, 16(%rax)
	movq	_SYS_RES_MEMORY@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movq	_RF_ACTIVE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	-28(%rbp), %rdx
	movl	%r14d, %edi
	callq	_bus_alloc_resource_any
	movl	%eax, (%rbx)
	testl	%eax, %eax
	je	LBB0_1
## %bb.2:
	movl	%eax, %edi
	callq	_rman_get_bustag
	movl	%eax, 12(%rbx)
	movl	(%rbx), %edi
	callq	_rman_get_bushandle
	movl	%eax, 8(%rbx)
	movq	%rbx, %rdi
	addq	$4, %rdi
	movq	_MTX_SPIN@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	L_.str.1(%rip), %rsi
	leaq	L_.str.2(%rip), %rdx
	callq	_mtx_init
	xorl	%r15d, %r15d
	xorl	%edi, %edi
	callq	_SW_INT_ENABLE_REG
	movq	%rbx, %rdi
	movl	%eax, %esi
	xorl	%edx, %edx
	callq	_aintc_write_4
	xorl	%edi, %edi
	callq	_SW_INT_MASK_REG
	movq	%rbx, %rdi
	movl	%eax, %esi
	movl	$-1, %edx
	callq	_aintc_write_4
	movl	$1, %edi
	callq	_SW_INT_ENABLE_REG
	movq	%rbx, %rdi
	movl	%eax, %esi
	xorl	%edx, %edx
	callq	_aintc_write_4
	movl	$1, %edi
	callq	_SW_INT_MASK_REG
	movq	%rbx, %rdi
	movl	%eax, %esi
	movl	$-1, %edx
	callq	_aintc_write_4
	movl	$2, %edi
	callq	_SW_INT_ENABLE_REG
	movq	%rbx, %rdi
	movl	%eax, %esi
	xorl	%edx, %edx
	callq	_aintc_write_4
	movl	$2, %edi
	callq	_SW_INT_MASK_REG
	movq	%rbx, %rdi
	movl	%eax, %esi
	movl	$-1, %edx
	callq	_aintc_write_4
	movq	_SW_INT_PROTECTION_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	movl	$1, %edx
	callq	_aintc_write_4
	movq	_SW_INT_NMI_CTRL_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_aintc_write_4
	movq	%rbx, %rdi
	callq	_a10_intr_pic_attach
	testq	%rax, %rax
	je	LBB0_5
## %bb.3:
	leaq	L_.str.3(%rip), %rsi
	movl	%r14d, %edi
	callq	_device_printf
	jmp	LBB0_4
LBB0_1:
	leaq	L_.str(%rip), %rsi
	movl	%r14d, %edi
	callq	_device_printf
	movl	(%r15), %esi
	movl	-28(%rbp), %edx
	movl	(%rbx), %ecx
	movl	%r14d, %edi
	callq	_bus_release_resource
LBB0_4:
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %r15d
LBB0_5:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.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	"could not allocate resource\n"

L_.str.1:                               ## @.str.1
	.asciz	"A10 AINTC lock"

L_.str.2:                               ## @.str.2
	.space	1

	.comm	_MTX_SPIN,4,2                   ## @MTX_SPIN
	.comm	_SW_INT_PROTECTION_REG,4,2      ## @SW_INT_PROTECTION_REG
	.comm	_SW_INT_NMI_CTRL_REG,4,2        ## @SW_INT_NMI_CTRL_REG
L_.str.3:                               ## @.str.3
	.asciz	"could not attach PIC\n"

	.comm	_ENXIO,4,2                      ## @ENXIO
	.no_dead_strip	_a10_aintc_attach
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function a10_aintc_attach
_a10_aintc_attach:                      ; @a10_aintc_attach
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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	_device_get_softc
	mov	x20, x0
	str	wzr, [sp, #12]
	str	w19, [x0, #16]
Lloh0:
	adrp	x21, _SYS_RES_MEMORY@GOTPAGE
Lloh1:
	ldr	x21, [x21, _SYS_RES_MEMORY@GOTPAGEOFF]
	ldr	w1, [x21]
Lloh2:
	adrp	x8, _RF_ACTIVE@GOTPAGE
Lloh3:
	ldr	x8, [x8, _RF_ACTIVE@GOTPAGEOFF]
Lloh4:
	ldr	w3, [x8]
	add	x2, sp, #12
	mov	x0, x19
	bl	_bus_alloc_resource_any
	str	w0, [x20]
	cbz	w0, LBB0_3
; %bb.1:
	bl	_rman_get_bustag
	str	w0, [x20, #12]
	ldr	w0, [x20]
	bl	_rman_get_bushandle
	str	w0, [x20, #8]
	add	x0, x20, #4
Lloh5:
	adrp	x8, _MTX_SPIN@GOTPAGE
Lloh6:
	ldr	x8, [x8, _MTX_SPIN@GOTPAGEOFF]
Lloh7:
	ldr	w3, [x8]
Lloh8:
	adrp	x1, l_.str.1@PAGE
Lloh9:
	add	x1, x1, l_.str.1@PAGEOFF
Lloh10:
	adrp	x2, l_.str.2@PAGE
Lloh11:
	add	x2, x2, l_.str.2@PAGEOFF
	bl	_mtx_init
	mov	w0, #0
	bl	_SW_INT_ENABLE_REG
	mov	x1, x0
	mov	x0, x20
	mov	w2, #0
	bl	_aintc_write_4
	mov	w0, #0
	bl	_SW_INT_MASK_REG
	mov	x1, x0
	mov	x0, x20
	mov	w2, #-1
	bl	_aintc_write_4
	mov	w0, #1
	bl	_SW_INT_ENABLE_REG
	mov	x1, x0
	mov	x0, x20
	mov	w2, #0
	bl	_aintc_write_4
	mov	w0, #1
	bl	_SW_INT_MASK_REG
	mov	x1, x0
	mov	x0, x20
	mov	w2, #-1
	bl	_aintc_write_4
	mov	w0, #2
	bl	_SW_INT_ENABLE_REG
	mov	x1, x0
	mov	x0, x20
	mov	w2, #0
	bl	_aintc_write_4
	mov	w0, #2
	bl	_SW_INT_MASK_REG
	mov	x1, x0
	mov	x0, x20
	mov	w2, #-1
	bl	_aintc_write_4
Lloh12:
	adrp	x8, _SW_INT_PROTECTION_REG@GOTPAGE
Lloh13:
	ldr	x8, [x8, _SW_INT_PROTECTION_REG@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #1
	bl	_aintc_write_4
Lloh15:
	adrp	x8, _SW_INT_NMI_CTRL_REG@GOTPAGE
Lloh16:
	ldr	x8, [x8, _SW_INT_NMI_CTRL_REG@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #0
	bl	_aintc_write_4
	mov	x0, x20
	bl	_a10_intr_pic_attach
	cbz	x0, LBB0_5
; %bb.2:
Lloh18:
	adrp	x1, l_.str.3@PAGE
Lloh19:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x19
	bl	_device_printf
	b	LBB0_4
LBB0_3:
Lloh20:
	adrp	x1, l_.str@PAGE
Lloh21:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_device_printf
	ldr	w1, [x21]
	ldr	w2, [sp, #12]
	ldr	w3, [x20]
	mov	x0, x19
	bl	_bus_release_resource
LBB0_4:
Lloh22:
	adrp	x8, _ENXIO@GOTPAGE
Lloh23:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh24:
	ldr	w0, [x8]
LBB0_5:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.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	"could not allocate resource\n"

l_.str.1:                               ; @.str.1
	.asciz	"A10 AINTC lock"

l_.str.2:                               ; @.str.2
	.space	1

	.comm	_MTX_SPIN,4,2                   ; @MTX_SPIN
	.comm	_SW_INT_PROTECTION_REG,4,2      ; @SW_INT_PROTECTION_REG
	.comm	_SW_INT_NMI_CTRL_REG,4,2        ; @SW_INT_NMI_CTRL_REG
l_.str.3:                               ; @.str.3
	.asciz	"could not attach PIC\n"

	.comm	_ENXIO,4,2                      ; @ENXIO
	.no_dead_strip	_a10_aintc_attach
.subsections_via_symbols
