	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bcm_gpio_attach
_bcm_gpio_attach:                       ## @bcm_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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	_bcm_gpio_sc@GOTPCREL(%rip), %rbx
	cmpq	$0, (%rbx)
	jne	LBB0_5
## %bb.1:
	movl	%edi, %r15d
	callq	_device_get_softc
	movq	%rax, %r12
	movq	%rax, (%rbx)
	movl	%r15d, 32(%rax)
	leaq	4(%rax), %r14
	movq	_MTX_SPIN@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	L_.str(%rip), %rsi
	leaq	L_.str.1(%rip), %rdx
	movq	%r14, %rdi
	callq	_mtx_init
	movq	_bcm_gpio_res_spec@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	8(%r12), %rdx
	movl	%r15d, %edi
	callq	_bus_alloc_resources
	testq	%rax, %rax
	je	LBB0_6
## %bb.2:
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_3
LBB0_6:
	movq	8(%r12), %rax
	movl	(%rax), %edi
	callq	_rman_get_bustag
	movl	%eax, 40(%r12)
	movq	8(%r12), %rax
	movl	(%rax), %edi
	callq	_rman_get_bushandle
	movl	%eax, 36(%r12)
	movl	%r15d, %edi
	callq	_bcm_gpio_intr_attach
	testq	%rax, %rax
	je	LBB0_8
## %bb.7:
	leaq	L_.str.3(%rip), %rsi
LBB0_3:
	movl	%r15d, %edi
	callq	_device_printf
LBB0_4:
	movl	%r15d, %edi
	callq	_bcm_gpio_intr_detach
	movl	(%rbx), %esi
	movq	8(%r12), %rdx
	movl	%r15d, %edi
	callq	_bus_release_resources
	movq	%r14, %rdi
	callq	_mtx_destroy
LBB0_5:
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_16:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movl	32(%r12), %edi
	callq	_ofw_bus_get_node
	leaq	L_.str.4(%rip), %rsi
	movl	%eax, %edi
	callq	_OF_hasprop
	testl	%eax, %eax
	je	LBB0_4
## %bb.9:
	movq	%r12, %rdi
	callq	_bcm_gpio_get_reserved_pins
	cmpl	$-1, %eax
	je	LBB0_4
## %bb.10:
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	movq	_BCM_GPIO_PINS@GOTPCREL(%rip), %r14
	cmpl	$0, (%r14)
	jle	LBB0_11
## %bb.12:
	movq	24(%r12), %rcx
	xorl	%r13d, %r13d
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	movl	12(%rcx,%r13), %edi
	movq	_GPIOMAXNAME@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	leaq	L_.str.5(%rip), %rdx
	movl	%ebx, %ecx
	callq	_snprintf
	movq	%r12, %rdi
	movl	%ebx, %esi
	callq	_bcm_gpio_get_function
	movq	24(%r12), %rcx
	movl	%ebx, (%rcx,%r13)
	movq	_BCM_GPIO_DEFAULT_CAPS@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	movl	%edx, 8(%rcx,%r13)
	movl	%eax, %edi
	callq	_bcm_gpio_func_flag
	movq	24(%r12), %rcx
	movl	%eax, 4(%rcx,%r13)
	incl	%ebx
	addq	$16, %r13
	cmpl	%ebx, (%r14)
	jg	LBB0_13
	jmp	LBB0_14
LBB0_11:
	xorl	%ebx, %ebx
LBB0_14:
	movl	%ebx, (%r12)
	movq	%r12, %rdi
	callq	_bcm_gpio_sysctl_init
	movl	%r15d, %edi
	callq	_gpiobus_attach_bus
	movq	%rax, 16(%r12)
	testq	%rax, %rax
	movq	_bcm_gpio_res_spec@GOTPCREL(%rip), %rbx
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	je	LBB0_4
## %bb.15:
	leaq	L_.str.6(%rip), %rsi
	movl	%r15d, %edi
	callq	_fdt_pinctrl_register
	movl	%r15d, %edi
	callq	_fdt_pinctrl_configure_tree
	xorl	%eax, %eax
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.comm	_bcm_gpio_sc,8,3                ## @bcm_gpio_sc
	.comm	_ENXIO,4,2                      ## @ENXIO
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"bcm gpio"

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

	.comm	_MTX_SPIN,4,2                   ## @MTX_SPIN
	.comm	_bcm_gpio_res_spec,4,2          ## @bcm_gpio_res_spec
L_.str.2:                               ## @.str.2
	.asciz	"cannot allocate resources\n"

L_.str.3:                               ## @.str.3
	.asciz	"unable to setup the gpio irq handler\n"

L_.str.4:                               ## @.str.4
	.asciz	"gpio-controller"

	.comm	_BCM_GPIO_PINS,4,2              ## @BCM_GPIO_PINS
	.comm	_GPIOMAXNAME,4,2                ## @GPIOMAXNAME
L_.str.5:                               ## @.str.5
	.asciz	"pin %d"

	.comm	_BCM_GPIO_DEFAULT_CAPS,4,2      ## @BCM_GPIO_DEFAULT_CAPS
L_.str.6:                               ## @.str.6
	.asciz	"brcm,pins"

	.no_dead_strip	_bcm_gpio_attach
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bcm_gpio_attach
_bcm_gpio_attach:                       ; @bcm_gpio_attach
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
Lloh0:
	adrp	x20, _bcm_gpio_sc@GOTPAGE
Lloh1:
	ldr	x20, [x20, _bcm_gpio_sc@GOTPAGEOFF]
	ldr	x8, [x20]
	cbnz	x8, LBB0_7
; %bb.1:
	mov	x19, x0
	bl	_device_get_softc
	mov	x21, x0
	str	x0, [x20]
	str	w19, [x0, #32]
	add	x20, x0, #4
Lloh2:
	adrp	x8, _MTX_SPIN@GOTPAGE
Lloh3:
	ldr	x8, [x8, _MTX_SPIN@GOTPAGEOFF]
Lloh4:
	ldr	w3, [x8]
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
Lloh7:
	adrp	x2, l_.str.1@PAGE
Lloh8:
	add	x2, x2, l_.str.1@PAGEOFF
	mov	x0, x20
	bl	_mtx_init
Lloh9:
	adrp	x24, _bcm_gpio_res_spec@GOTPAGE
Lloh10:
	ldr	x24, [x24, _bcm_gpio_res_spec@GOTPAGEOFF]
	ldr	w1, [x24]
	ldr	x2, [x21, #8]
	mov	x0, x19
	bl	_bus_alloc_resources
	cbz	x0, LBB0_3
; %bb.2:
Lloh11:
	adrp	x1, l_.str.2@PAGE
Lloh12:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_5
LBB0_3:
	ldr	x8, [x21, #8]
	ldr	w0, [x8]
	bl	_rman_get_bustag
	str	w0, [x21, #40]
	ldr	x8, [x21, #8]
	ldr	w0, [x8]
	bl	_rman_get_bushandle
	str	w0, [x21, #36]
	mov	x0, x19
	bl	_bcm_gpio_intr_attach
	cbz	x0, LBB0_9
; %bb.4:
Lloh13:
	adrp	x1, l_.str.3@PAGE
Lloh14:
	add	x1, x1, l_.str.3@PAGEOFF
LBB0_5:
	mov	x0, x19
	bl	_device_printf
LBB0_6:
	mov	x0, x19
	bl	_bcm_gpio_intr_detach
	ldr	w1, [x24]
	ldr	x2, [x21, #8]
	mov	x0, x19
	bl	_bus_release_resources
	mov	x0, x20
	bl	_mtx_destroy
LBB0_7:
Lloh15:
	adrp	x8, _ENXIO@GOTPAGE
Lloh16:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh17:
	ldr	w0, [x8]
LBB0_8:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_9:
	ldr	w0, [x21, #32]
	bl	_ofw_bus_get_node
Lloh18:
	adrp	x1, l_.str.4@PAGE
Lloh19:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_OF_hasprop
	cbz	w0, LBB0_6
; %bb.10:
	mov	x0, x21
	bl	_bcm_gpio_get_reserved_pins
	cmn	w0, #1
	b.eq	LBB0_6
; %bb.11:
Lloh20:
	adrp	x25, _BCM_GPIO_PINS@GOTPAGE
Lloh21:
	ldr	x25, [x25, _BCM_GPIO_PINS@GOTPAGEOFF]
	ldr	w8, [x25]
	cmp	w8, #1
	b.lt	LBB0_14
; %bb.12:
	mov	x26, #0
	mov	w22, #0
	ldr	x8, [x21, #24]
Lloh22:
	adrp	x27, _GPIOMAXNAME@GOTPAGE
Lloh23:
	ldr	x27, [x27, _GPIOMAXNAME@GOTPAGEOFF]
Lloh24:
	adrp	x23, l_.str.5@PAGE
Lloh25:
	add	x23, x23, l_.str.5@PAGEOFF
Lloh26:
	adrp	x28, _BCM_GPIO_DEFAULT_CAPS@GOTPAGE
Lloh27:
	ldr	x28, [x28, _BCM_GPIO_DEFAULT_CAPS@GOTPAGEOFF]
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	add	x8, x8, x26
	ldr	w0, [x8, #12]
	ldr	w1, [x27]
	mov	x2, x23
	mov	x3, x22
	bl	_snprintf
	mov	x0, x21
	mov	x1, x22
	bl	_bcm_gpio_get_function
	ldr	x8, [x21, #24]
	add	x8, x8, x26
	str	w22, [x8]
	ldr	w9, [x28]
	str	w9, [x8, #8]
	bl	_bcm_gpio_func_flag
	ldr	x8, [x21, #24]
	add	x9, x8, x26
	str	w0, [x9, #4]
	ldr	w9, [x25]
	add	w22, w22, #1
	add	x26, x26, #16
	cmp	w9, w22
	b.gt	LBB0_13
	b	LBB0_15
LBB0_14:
	mov	w22, #0
LBB0_15:
	str	w22, [x21]
	mov	x0, x21
	bl	_bcm_gpio_sysctl_init
	mov	x0, x19
	bl	_gpiobus_attach_bus
	str	x0, [x21, #16]
	cbz	x0, LBB0_6
; %bb.16:
Lloh28:
	adrp	x1, l_.str.6@PAGE
Lloh29:
	add	x1, x1, l_.str.6@PAGEOFF
	mov	x0, x19
	bl	_fdt_pinctrl_register
	mov	x0, x19
	bl	_fdt_pinctrl_configure_tree
	mov	w0, #0
	b	LBB0_8
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpAdd	Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_bcm_gpio_sc,8,3                ; @bcm_gpio_sc
	.comm	_ENXIO,4,2                      ; @ENXIO
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"bcm gpio"

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

	.comm	_MTX_SPIN,4,2                   ; @MTX_SPIN
	.comm	_bcm_gpio_res_spec,4,2          ; @bcm_gpio_res_spec
l_.str.2:                               ; @.str.2
	.asciz	"cannot allocate resources\n"

l_.str.3:                               ; @.str.3
	.asciz	"unable to setup the gpio irq handler\n"

l_.str.4:                               ; @.str.4
	.asciz	"gpio-controller"

	.comm	_BCM_GPIO_PINS,4,2              ; @BCM_GPIO_PINS
	.comm	_GPIOMAXNAME,4,2                ; @GPIOMAXNAME
l_.str.5:                               ; @.str.5
	.asciz	"pin %d"

	.comm	_BCM_GPIO_DEFAULT_CAPS,4,2      ; @BCM_GPIO_DEFAULT_CAPS
l_.str.6:                               ; @.str.6
	.asciz	"brcm,pins"

	.no_dead_strip	_bcm_gpio_attach
.subsections_via_symbols
