	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function imx51_gpio_attach
_imx51_gpio_attach:                     ## @imx51_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
	movl	%edi, %r12d
	callq	_device_get_softc
	movq	%rax, %rbx
	movl	%r12d, 52(%rax)
	movq	_NGPIO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%rbx)
	leaq	48(%rbx), %r15
	movl	%r12d, %edi
	callq	_device_get_nameunit
	movq	_MTX_SPIN@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	%r15, %rdi
	movl	%eax, %esi
	xorl	%edx, %edx
	callq	_mtx_init
	movq	_imx_gpio_spec@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	movq	32(%rbx), %rdx
	movl	%r12d, %edi
	callq	_bus_alloc_resources
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rsi
	movl	%r12d, %edi
	callq	_device_printf
	movl	(%r14), %esi
	movq	32(%rbx), %rdx
	movl	%r12d, %edi
	callq	_bus_release_resources
	movq	%r15, %rdi
	callq	_mtx_destroy
LBB0_9:
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	jmp	LBB0_10
LBB0_2:
	movq	32(%rbx), %rax
	movl	(%rax), %edi
	callq	_rman_get_bustag
	movl	%eax, 44(%rbx)
	movq	32(%rbx), %rax
	movl	(%rax), %edi
	callq	_rman_get_bushandle
	movl	%eax, 40(%rbx)
	movq	_IMX_GPIO_IMR_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_WRITE4
	movl	%r12d, -44(%rbp)                ## 4-byte Spill
	movl	%r12d, %edi
	callq	_device_get_unit
	cmpl	$0, (%rbx)
	jle	LBB0_7
## %bb.3:
	movl	%eax, %r12d
	incl	%r12d
	xorl	%r14d, %r14d
	leaq	L_.str.1(%rip), %r13
	xorl	%r15d, %r15d
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_4 Depth=1
	movl	(%rax), %eax
	movq	16(%rbx), %rcx
	movl	%eax, 8(%rcx,%r14)
	movl	4(%rcx,%r14), %edi
	movq	_GPIOMAXNAME@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdx
	movl	%r12d, %ecx
	movl	%r15d, %r8d
	callq	_snprintf
	incq	%r15
	movslq	(%rbx), %rax
	addq	$16, %r14
	cmpq	%rax, %r15
	jge	LBB0_7
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movq	16(%rbx), %rax
	movl	%r15d, (%rax,%r14)
	movq	_DEFAULT_CAPS@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, 12(%rax,%r14)
	movq	_IMX_GPIO_OE_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_READ4
	btl	%r15d, %eax
	movq	_GPIO_PIN_OUTPUT@GOTPCREL(%rip), %rax
	jb	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	_GPIO_PIN_INPUT@GOTPCREL(%rip), %rax
	jmp	LBB0_6
LBB0_7:
	movl	-44(%rbp), %r14d                ## 4-byte Reload
	movl	%r14d, %edi
	callq	_gpiobus_attach_bus
	movq	%rax, 8(%rbx)
	testq	%rax, %rax
	movl	$0, %eax
	je	LBB0_8
LBB0_10:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movl	%r14d, %edi
	callq	_imx51_gpio_detach
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.comm	_NGPIO,4,2                      ## @NGPIO
	.comm	_MTX_SPIN,4,2                   ## @MTX_SPIN
	.comm	_imx_gpio_spec,4,2              ## @imx_gpio_spec
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"could not allocate resources\n"

	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_IMX_GPIO_IMR_REG,4,2           ## @IMX_GPIO_IMR_REG
	.comm	_DEFAULT_CAPS,4,2               ## @DEFAULT_CAPS
	.comm	_IMX_GPIO_OE_REG,4,2            ## @IMX_GPIO_OE_REG
	.comm	_GPIO_PIN_OUTPUT,4,2            ## @GPIO_PIN_OUTPUT
	.comm	_GPIO_PIN_INPUT,4,2             ## @GPIO_PIN_INPUT
	.comm	_GPIOMAXNAME,4,2                ## @GPIOMAXNAME
L_.str.1:                               ## @.str.1
	.asciz	"GPIO%d_IO%02d"

	.comm	_INTR_TYPE_CLK,4,2              ## @INTR_TYPE_CLK
	.comm	_gpio_pic_filter,4,2            ## @gpio_pic_filter
	.no_dead_strip	_imx51_gpio_attach
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function imx51_gpio_attach
_imx51_gpio_attach:                     ; @imx51_gpio_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	x22, x0
	bl	_device_get_softc
	mov	x20, x0
	str	w22, [x0, #52]
Lloh0:
	adrp	x8, _NGPIO@GOTPAGE
Lloh1:
	ldr	x8, [x8, _NGPIO@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	str	w8, [x0]
	add	x21, x0, #48
	mov	x0, x22
	bl	_device_get_nameunit
	mov	x1, x0
Lloh3:
	adrp	x8, _MTX_SPIN@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MTX_SPIN@GOTPAGEOFF]
Lloh5:
	ldr	w3, [x8]
	mov	x0, x21
	mov	x2, #0
	bl	_mtx_init
Lloh6:
	adrp	x19, _imx_gpio_spec@GOTPAGE
Lloh7:
	ldr	x19, [x19, _imx_gpio_spec@GOTPAGEOFF]
	ldr	w1, [x19]
	ldr	x2, [x20, #32]
	mov	x0, x22
	bl	_bus_alloc_resources
	cbz	x0, LBB0_3
; %bb.1:
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x22
	bl	_device_printf
	ldr	w1, [x19]
	ldr	x2, [x20, #32]
	mov	x0, x22
	bl	_bus_release_resources
	mov	x0, x21
	bl	_mtx_destroy
LBB0_2:
Lloh10:
	adrp	x8, _ENXIO@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh12:
	ldr	w0, [x8]
	b	LBB0_8
LBB0_3:
	ldr	x8, [x20, #32]
	ldr	w0, [x8]
	bl	_rman_get_bustag
	str	w0, [x20, #44]
	ldr	x8, [x20, #32]
	ldr	w0, [x8]
	bl	_rman_get_bushandle
	str	w0, [x20, #40]
Lloh13:
	adrp	x8, _IMX_GPIO_IMR_REG@GOTPAGE
Lloh14:
	ldr	x8, [x8, _IMX_GPIO_IMR_REG@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #0
	bl	_WRITE4
	str	w22, [sp, #12]                  ; 4-byte Folded Spill
	mov	x0, x22
	bl	_device_get_unit
	ldr	w8, [x20]
	cmp	w8, #1
	b.lt	LBB0_6
; %bb.4:
	mov	x24, #0
	mov	x21, #0
	add	w22, w0, #1
Lloh16:
	adrp	x25, _DEFAULT_CAPS@GOTPAGE
Lloh17:
	ldr	x25, [x25, _DEFAULT_CAPS@GOTPAGEOFF]
Lloh18:
	adrp	x26, _IMX_GPIO_OE_REG@GOTPAGE
Lloh19:
	ldr	x26, [x26, _IMX_GPIO_OE_REG@GOTPAGEOFF]
Lloh20:
	adrp	x27, _GPIO_PIN_OUTPUT@GOTPAGE
Lloh21:
	ldr	x27, [x27, _GPIO_PIN_OUTPUT@GOTPAGEOFF]
Lloh22:
	adrp	x28, _GPIO_PIN_INPUT@GOTPAGE
Lloh23:
	ldr	x28, [x28, _GPIO_PIN_INPUT@GOTPAGEOFF]
Lloh24:
	adrp	x19, _GPIOMAXNAME@GOTPAGE
Lloh25:
	ldr	x19, [x19, _GPIOMAXNAME@GOTPAGEOFF]
Lloh26:
	adrp	x23, l_.str.1@PAGE
Lloh27:
	add	x23, x23, l_.str.1@PAGEOFF
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x20, #16]
	add	x8, x8, x24
	str	w21, [x8]
	ldr	w9, [x25]
	str	w9, [x8, #12]
	ldr	w1, [x26]
	mov	x0, x20
	bl	_READ4
	lsr	w8, w0, w21
	tst	w8, #0x1
	csel	x8, x28, x27, eq
	ldr	w8, [x8]
	ldr	x9, [x20, #16]
	add	x9, x9, x24
	str	w8, [x9, #8]
	ldr	w0, [x9, #4]
	ldr	w1, [x19]
	mov	x2, x23
	mov	x3, x22
	mov	x4, x21
	bl	_snprintf
	add	x21, x21, #1
	ldrsw	x8, [x20]
	add	x24, x24, #16
	cmp	x21, x8
	b.lt	LBB0_5
LBB0_6:
	ldr	w19, [sp, #12]                  ; 4-byte Folded Reload
	mov	x0, x19
	bl	_gpiobus_attach_bus
	str	x0, [x20, #8]
	cbz	x0, LBB0_9
; %bb.7:
	mov	w0, #0
LBB0_8:
	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_9:
	mov	x0, x19
	bl	_imx51_gpio_detach
	b	LBB0_2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_NGPIO,4,2                      ; @NGPIO
	.comm	_MTX_SPIN,4,2                   ; @MTX_SPIN
	.comm	_imx_gpio_spec,4,2              ; @imx_gpio_spec
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"could not allocate resources\n"

	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_IMX_GPIO_IMR_REG,4,2           ; @IMX_GPIO_IMR_REG
	.comm	_DEFAULT_CAPS,4,2               ; @DEFAULT_CAPS
	.comm	_IMX_GPIO_OE_REG,4,2            ; @IMX_GPIO_OE_REG
	.comm	_GPIO_PIN_OUTPUT,4,2            ; @GPIO_PIN_OUTPUT
	.comm	_GPIO_PIN_INPUT,4,2             ; @GPIO_PIN_INPUT
	.comm	_GPIOMAXNAME,4,2                ; @GPIOMAXNAME
l_.str.1:                               ; @.str.1
	.asciz	"GPIO%d_IO%02d"

	.comm	_INTR_TYPE_CLK,4,2              ; @INTR_TYPE_CLK
	.comm	_gpio_pic_filter,4,2            ; @gpio_pic_filter
	.no_dead_strip	_imx51_gpio_attach
.subsections_via_symbols
