	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mv_gpio_attach
_mv_gpio_attach:                        ## @mv_gpio_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, %r14d
	movq	$0, -48(%rbp)
	callq	_device_get_softc
	testq	%rax, %rax
	je	LBB0_33
## %bb.1:
	movq	%rax, %r13
	movl	%r14d, %edi
	callq	_ofw_bus_get_node
	movl	%eax, %r12d
	movl	%r14d, 80(%r13)
	leaq	L_.str(%rip), %rsi
	leaq	-48(%rbp), %rdx
	movl	%eax, %edi
	movl	$8, %ecx
	callq	_OF_getencprop
	testl	%eax, %eax
	jns	LBB0_3
## %bb.2:
	leaq	L_.str.1(%rip), %rsi
	leaq	-48(%rbp), %rdx
	movl	%r12d, %edi
	movl	$8, %ecx
	callq	_OF_getencprop
	testl	%eax, %eax
	js	LBB0_14
LBB0_3:
	movq	-48(%rbp), %rdi
	movq	_MV_GPIO_MAX_NPINS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_MIN
	movl	%eax, (%r13)
	movq	_bootverbose@GOTPCREL(%rip), %rcx
	cmpq	$0, (%rcx)
	je	LBB0_5
## %bb.4:
	leaq	L_.str.2(%rip), %rsi
	movl	%r14d, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_device_printf
LBB0_5:
	leaq	72(%r13), %rbx
	leaq	L_.str.4(%rip), %rsi
	movl	%r12d, %edi
	movq	%rbx, %rdx
	movl	$8, %ecx
	callq	_OF_getencprop
	cmpl	$-1, %eax
	jne	LBB0_7
## %bb.6:
	movq	$0, (%rbx)
LBB0_7:
	movl	(%r13), %r15d
	testl	%r15d, %r15d
	movl	%r12d, -52(%rbp)                ## 4-byte Spill
	jle	LBB0_10
## %bb.8:
	movq	64(%r13), %rax
	cmpl	$8, %r15d
	jb	LBB0_9
## %bb.11:
	movq	_GPIO_GENERIC_CAP@GOTPCREL(%rip), %r8
	leaq	4(%r8), %rcx
	cmpq	%rcx, %rax
	jae	LBB0_15
## %bb.12:
	leaq	(%rax,%r15,4), %rcx
	cmpq	_GPIO_GENERIC_CAP@GOTPCREL(%rip), %rcx
	jbe	LBB0_15
LBB0_9:
	xorl	%ecx, %ecx
LBB0_21:
	movq	%rcx, %rdx
	notq	%rdx
	addq	%r15, %rdx
	movq	%r15, %rsi
	andq	$3, %rsi
	je	LBB0_24
## %bb.22:
	movq	_GPIO_GENERIC_CAP@GOTPCREL(%rip), %rdi
	.p2align	4, 0x90
LBB0_23:                                ## =>This Inner Loop Header: Depth=1
	movl	(%rdi), %ebx
	movl	%ebx, (%rax,%rcx,4)
	incq	%rcx
	decq	%rsi
	jne	LBB0_23
LBB0_24:
	cmpq	$3, %rdx
	jb	LBB0_27
## %bb.25:
	movq	_GPIO_GENERIC_CAP@GOTPCREL(%rip), %rdx
	.p2align	4, 0x90
LBB0_26:                                ## =>This Inner Loop Header: Depth=1
	movl	(%rdx), %esi
	movl	%esi, (%rax,%rcx,4)
	movl	(%rdx), %esi
	movl	%esi, 4(%rax,%rcx,4)
	movl	(%rdx), %esi
	movl	%esi, 8(%rax,%rcx,4)
	movl	(%rdx), %esi
	movl	%esi, 12(%rax,%rcx,4)
	addq	$4, %rcx
	cmpq	%rcx, %r15
	jne	LBB0_26
	jmp	LBB0_27
LBB0_10:
	xorl	%r15d, %r15d
LBB0_27:
	leaq	24(%r13), %r12
	movl	%r14d, %edi
	callq	_device_get_nameunit
	movq	_MTX_SPIN@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	%r12, %rdi
	movl	%eax, %esi
	xorl	%edx, %edx
	callq	_mtx_init
	movq	%r13, %rdx
	addq	$56, %rdx
	movq	$0, 56(%r13)
	movq	_SYS_RES_MEMORY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_RF_ACTIVE@GOTPCREL(%rip), %rax
	movq	_RF_SHAREABLE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movl	%r14d, %edi
	callq	_bus_alloc_resource_any
	movl	%eax, 40(%r13)
	testl	%eax, %eax
	je	LBB0_31
## %bb.28:
	movl	%eax, %edi
	callq	_rman_get_bustag
	movl	%eax, 48(%r13)
	movl	40(%r13), %edi
	callq	_rman_get_bushandle
	movl	%eax, 44(%r13)
	movq	%r13, %rdi
	movl	-52(%rbp), %esi                 ## 4-byte Reload
	callq	_mv_gpio_setup_interrupts
	testl	%eax, %eax
	jne	LBB0_34
## %bb.29:
	movl	%r14d, %edi
	callq	_gpiobus_attach_bus
	movq	%rax, %rcx
	movq	%rax, 32(%r13)
	xorl	%eax, %eax
	testq	%rcx, %rcx
	jne	LBB0_34
## %bb.30:
	movq	%r12, %rdi
	callq	_mtx_destroy
	movq	_SYS_RES_IRQ@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	8(%r13), %rax
	movq	16(%r13), %rcx
	movl	(%rcx,%r15,4), %edx
	movl	(%rax,%r15,4), %ecx
	movl	%r14d, %edi
	callq	_bus_release_resource
	jmp	LBB0_33
LBB0_31:
	movq	%r12, %rdi
	callq	_mtx_destroy
	leaq	L_.str.5(%rip), %rsi
	jmp	LBB0_32
LBB0_14:
	leaq	L_.str.3(%rip), %rsi
LBB0_32:
	movl	%r14d, %edi
	xorl	%eax, %eax
	callq	_device_printf
LBB0_33:
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_34:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_15:
	movl	%r15d, %ecx
	andl	$-8, %ecx
	leaq	-8(%rcx), %rsi
	movq	%rsi, %rdx
	shrq	$3, %rdx
	incq	%rdx
	testq	%rsi, %rsi
	je	LBB0_35
## %bb.16:
	movq	%rdx, %rsi
	andq	$-2, %rsi
	movd	(%r8), %xmm0                    ## xmm0 = mem[0],zero,zero,zero
	pshufd	$0, %xmm0, %xmm0                ## xmm0 = xmm0[0,0,0,0]
	xorl	%edi, %edi
	.p2align	4, 0x90
LBB0_17:                                ## =>This Inner Loop Header: Depth=1
	movdqu	%xmm0, (%rax,%rdi,4)
	movdqu	%xmm0, 16(%rax,%rdi,4)
	movdqu	%xmm0, 32(%rax,%rdi,4)
	movdqu	%xmm0, 48(%rax,%rdi,4)
	addq	$16, %rdi
	addq	$-2, %rsi
	jne	LBB0_17
## %bb.18:
	testb	$1, %dl
	je	LBB0_20
LBB0_19:
	movd	(%r8), %xmm0                    ## xmm0 = mem[0],zero,zero,zero
	pshufd	$0, %xmm0, %xmm0                ## xmm0 = xmm0[0,0,0,0]
	movdqu	%xmm0, (%rax,%rdi,4)
	movdqu	%xmm0, 16(%rax,%rdi,4)
LBB0_20:
	cmpq	%r15, %rcx
	je	LBB0_27
	jmp	LBB0_21
LBB0_35:
	xorl	%edi, %edi
	testb	$1, %dl
	jne	LBB0_19
	jmp	LBB0_20
	.cfi_endproc
                                        ## -- End function
	.comm	_ENXIO,4,2                      ## @ENXIO
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"pin-count"

L_.str.1:                               ## @.str.1
	.asciz	"ngpios"

	.comm	_MV_GPIO_MAX_NPINS,4,2          ## @MV_GPIO_MAX_NPINS
	.comm	_bootverbose,8,3                ## @bootverbose
L_.str.2:                               ## @.str.2
	.asciz	"%d pins available\n"

L_.str.3:                               ## @.str.3
	.asciz	"ERROR: no pin-count or ngpios entry found!\n"

L_.str.4:                               ## @.str.4
	.asciz	"offset"

	.comm	_GPIO_GENERIC_CAP,4,2           ## @GPIO_GENERIC_CAP
	.comm	_MTX_SPIN,4,2                   ## @MTX_SPIN
	.comm	_SYS_RES_MEMORY,4,2             ## @SYS_RES_MEMORY
	.comm	_RF_ACTIVE,4,2                  ## @RF_ACTIVE
	.comm	_RF_SHAREABLE,4,2               ## @RF_SHAREABLE
L_.str.5:                               ## @.str.5
	.asciz	"could not allocate memory window\n"

	.comm	_SYS_RES_IRQ,4,2                ## @SYS_RES_IRQ
	.no_dead_strip	_mv_gpio_attach
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mv_gpio_attach
_mv_gpio_attach:                        ; @mv_gpio_attach
	.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
	str	xzr, [sp, #8]
	bl	_device_get_softc
	cbz	x0, LBB0_22
; %bb.1:
	mov	x20, x0
	mov	x0, x19
	bl	_ofw_bus_get_node
	mov	x21, x0
	str	w19, [x20, #80]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	add	x2, sp, #8
	mov	w3, #8
	bl	_OF_getencprop
	tbz	w0, #31, LBB0_3
; %bb.2:
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	add	x2, sp, #8
	mov	x0, x21
	mov	w3, #8
	bl	_OF_getencprop
	tbnz	w0, #31, LBB0_20
LBB0_3:
	ldr	x0, [sp, #8]
Lloh4:
	adrp	x8, _MV_GPIO_MAX_NPINS@GOTPAGE
Lloh5:
	ldr	x8, [x8, _MV_GPIO_MAX_NPINS@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
	bl	_MIN
                                        ; kill: def $w0 killed $w0 def $x0
	str	w0, [x20]
Lloh7:
	adrp	x8, _bootverbose@GOTPAGE
Lloh8:
	ldr	x8, [x8, _bootverbose@GOTPAGEOFF]
Lloh9:
	ldr	x8, [x8]
	cbz	x8, LBB0_5
; %bb.4:
	str	x0, [sp]
Lloh10:
	adrp	x1, l_.str.2@PAGE
Lloh11:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_device_printf
LBB0_5:
	add	x22, x20, #72
Lloh12:
	adrp	x1, l_.str.4@PAGE
Lloh13:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x0, x21
	mov	x2, x22
	mov	w3, #8
	bl	_OF_getencprop
	cmn	w0, #1
	b.ne	LBB0_7
; %bb.6:
	str	xzr, [x22]
LBB0_7:
	ldr	w24, [x20]
	cmp	w24, #1
	b.lt	LBB0_14
; %bb.8:
	ldr	x9, [x20, #64]
Lloh14:
	adrp	x8, _GPIO_GENERIC_CAP@GOTPAGE
Lloh15:
	ldr	x8, [x8, _GPIO_GENERIC_CAP@GOTPAGEOFF]
	cmp	w24, #16
	b.lo	LBB0_11
; %bb.9:
	add	x10, x8, #4
	cmp	x9, x10
	b.hs	LBB0_24
; %bb.10:
	add	x10, x9, x24, lsl #2
	cmp	x10, x8
	b.ls	LBB0_24
LBB0_11:
	mov	x10, #0
LBB0_12:
	add	x9, x9, x10, lsl #2
	sub	x10, x24, x10
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	ldr	w11, [x8]
	str	w11, [x9], #4
	subs	x10, x10, #1
	b.ne	LBB0_13
	b	LBB0_15
LBB0_14:
	mov	x24, #0
LBB0_15:
	add	x22, x20, #24
	mov	x0, x19
	bl	_device_get_nameunit
	mov	x1, x0
Lloh16:
	adrp	x8, _MTX_SPIN@GOTPAGE
Lloh17:
	ldr	x8, [x8, _MTX_SPIN@GOTPAGEOFF]
Lloh18:
	ldr	w3, [x8]
	mov	x0, x22
	mov	x2, #0
	bl	_mtx_init
	mov	x23, x20
	str	xzr, [x23, #56]!
Lloh19:
	adrp	x8, _SYS_RES_MEMORY@GOTPAGE
Lloh20:
	ldr	x8, [x8, _SYS_RES_MEMORY@GOTPAGEOFF]
Lloh21:
	adrp	x9, _RF_ACTIVE@GOTPAGE
Lloh22:
	ldr	x9, [x9, _RF_ACTIVE@GOTPAGEOFF]
Lloh23:
	ldr	w1, [x8]
Lloh24:
	ldr	w8, [x9]
Lloh25:
	adrp	x9, _RF_SHAREABLE@GOTPAGE
Lloh26:
	ldr	x9, [x9, _RF_SHAREABLE@GOTPAGEOFF]
Lloh27:
	ldr	w9, [x9]
	orr	w3, w9, w8
	mov	x0, x19
	mov	x2, x23
	bl	_bus_alloc_resource_any
	stur	w0, [x23, #-16]
	cbz	w0, LBB0_19
; %bb.16:
	bl	_rman_get_bustag
	str	w0, [x20, #48]
	ldr	w0, [x20, #40]
	bl	_rman_get_bushandle
	str	w0, [x20, #44]
	mov	x0, x20
	mov	x1, x21
	bl	_mv_gpio_setup_interrupts
	cbnz	w0, LBB0_23
; %bb.17:
	mov	x0, x19
	bl	_gpiobus_attach_bus
	str	x0, [x20, #32]
	cbz	x0, LBB0_27
; %bb.18:
	mov	w0, #0
	b	LBB0_23
LBB0_19:
	mov	x0, x22
	bl	_mtx_destroy
Lloh28:
	adrp	x1, l_.str.5@PAGE
Lloh29:
	add	x1, x1, l_.str.5@PAGEOFF
	b	LBB0_21
LBB0_20:
Lloh30:
	adrp	x1, l_.str.3@PAGE
Lloh31:
	add	x1, x1, l_.str.3@PAGEOFF
LBB0_21:
	mov	x0, x19
	bl	_device_printf
LBB0_22:
Lloh32:
	adrp	x8, _ENXIO@GOTPAGE
Lloh33:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh34:
	ldr	w0, [x8]
LBB0_23:
	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
LBB0_24:
	and	x10, x24, #0xfffffff0
	ld1r.4s	{ v0 }, [x8]
	add	x11, x9, #32
	mov	x12, x10
LBB0_25:                                ; =>This Inner Loop Header: Depth=1
	stp	q0, q0, [x11, #-32]
	stp	q0, q0, [x11], #64
	subs	x12, x12, #16
	b.ne	LBB0_25
; %bb.26:
	cmp	x10, x24
	b.eq	LBB0_15
	b	LBB0_12
LBB0_27:
	mov	x0, x22
	bl	_mtx_destroy
Lloh35:
	adrp	x8, _SYS_RES_IRQ@GOTPAGE
Lloh36:
	ldr	x8, [x8, _SYS_RES_IRQ@GOTPAGEOFF]
Lloh37:
	ldr	w1, [x8]
	lsl	x8, x24, #2
	ldp	x10, x9, [x20, #8]
	ldr	w2, [x9, x8]
	ldr	w3, [x10, x8]
	mov	x0, x19
	bl	_bus_release_resource
	b	LBB0_22
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh23
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.cfi_endproc
                                        ; -- End function
	.comm	_ENXIO,4,2                      ; @ENXIO
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"pin-count"

l_.str.1:                               ; @.str.1
	.asciz	"ngpios"

	.comm	_MV_GPIO_MAX_NPINS,4,2          ; @MV_GPIO_MAX_NPINS
	.comm	_bootverbose,8,3                ; @bootverbose
l_.str.2:                               ; @.str.2
	.asciz	"%d pins available\n"

l_.str.3:                               ; @.str.3
	.asciz	"ERROR: no pin-count or ngpios entry found!\n"

l_.str.4:                               ; @.str.4
	.asciz	"offset"

	.comm	_GPIO_GENERIC_CAP,4,2           ; @GPIO_GENERIC_CAP
	.comm	_MTX_SPIN,4,2                   ; @MTX_SPIN
	.comm	_SYS_RES_MEMORY,4,2             ; @SYS_RES_MEMORY
	.comm	_RF_ACTIVE,4,2                  ; @RF_ACTIVE
	.comm	_RF_SHAREABLE,4,2               ; @RF_SHAREABLE
l_.str.5:                               ; @.str.5
	.asciz	"could not allocate memory window\n"

	.comm	_SYS_RES_IRQ,4,2                ; @SYS_RES_IRQ
	.no_dead_strip	_mv_gpio_attach
.subsections_via_symbols
