	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function xusbpadctl_attach
_xusbpadctl_attach:                     ## @xusbpadctl_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, %r15d
	callq	_device_get_softc
	movq	%rax, %r14
	movl	%r15d, 16(%rax)
	movl	%r15d, %edi
	callq	_ofw_bus_get_node
	movl	%eax, %r12d
	movl	$0, -44(%rbp)
	movq	_SYS_RES_MEMORY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_RF_ACTIVE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	-44(%rbp), %rdx
	movl	%r15d, %edi
	callq	_bus_alloc_resource_any
	movq	%rax, 8(%r14)
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	leaq	L_.str.1(%rip), %rdx
	movl	%r15d, %edi
	xorl	%esi, %esi
	movq	%r14, %rcx
	callq	_hwreset_get_by_ofw_name
	testl	%eax, %eax
	je	LBB0_6
## %bb.3:
	movl	%eax, %ebx
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_4
LBB0_1:
	leaq	L_.str(%rip), %rsi
	movl	%r15d, %edi
	xorl	%eax, %eax
	callq	_device_printf
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_18
LBB0_6:
	movl	(%r14), %edi
	callq	_hwreset_deassert
	testl	%eax, %eax
	je	LBB0_8
## %bb.7:
	movl	%eax, %ebx
	leaq	L_.str.3(%rip), %rsi
	jmp	LBB0_4
LBB0_8:
	movq	%r14, %rdi
	callq	_load_calibration
	movq	%r14, %rdi
	movl	%r12d, %esi
	callq	_parse_fdt
	testl	%eax, %eax
	je	LBB0_9
## %bb.11:
	movl	%eax, %ebx
	leaq	L_.str.4(%rip), %rsi
LBB0_4:
	movl	%r15d, %edi
	movl	%ebx, %edx
LBB0_5:
	xorl	%eax, %eax
	callq	_device_printf
LBB0_18:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	movq	_ports_tbl@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	callq	_nitems
	testl	%eax, %eax
	jle	LBB0_10
## %bb.12:
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	xorl	%r13d, %r13d
	xorl	%r14d, %r14d
	jmp	LBB0_13
	.p2align	4, 0x90
LBB0_17:                                ##   in Loop: Header=BB0_13 Depth=1
	incq	%r14
	movq	%r12, %rdi
	callq	_nitems
	cltq
	addq	$16, %r13
	xorl	%ebx, %ebx
	cmpq	%rax, %r14
	jge	LBB0_18
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	movq	_ports_tbl@GOTPCREL(%rip), %rax
	movq	(%rax), %r12
	cmpl	$0, 12(%r12,%r13)
	je	LBB0_17
## %bb.14:                              ##   in Loop: Header=BB0_13 Depth=1
	movq	(%r12,%r13), %rcx
	testq	%rcx, %rcx
	je	LBB0_17
## %bb.15:                              ##   in Loop: Header=BB0_13 Depth=1
	leaq	(%r12,%r13), %rsi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	*%rcx
	testl	%eax, %eax
	jne	LBB0_19
## %bb.16:                              ##   in Loop: Header=BB0_13 Depth=1
	movq	_ports_tbl@GOTPCREL(%rip), %rax
	movq	(%rax), %r12
	jmp	LBB0_17
LBB0_10:
	xorl	%ebx, %ebx
	jmp	LBB0_18
LBB0_19:
	movl	%eax, %ebx
	movl	8(%r12,%r13), %edx
	leaq	L_.str.5(%rip), %rsi
	movl	%r15d, %edi
	jmp	LBB0_5
	.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
L_.str.1:                               ## @.str.1
	.asciz	"padctl"

L_.str.2:                               ## @.str.2
	.asciz	"Cannot get 'padctl' reset: %d\n"

L_.str.3:                               ## @.str.3
	.asciz	"Cannot unreset 'padctl' reset: %d\n"

L_.str.4:                               ## @.str.4
	.asciz	"Cannot parse fdt configuration: %d\n"

	.comm	_ports_tbl,8,3                  ## @ports_tbl
L_.str.5:                               ## @.str.5
	.asciz	"Cannot init port '%s'\n"

	.no_dead_strip	_xusbpadctl_attach
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function xusbpadctl_attach
_xusbpadctl_attach:                     ; @xusbpadctl_attach
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.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
	mov	x19, x0
	bl	_device_get_softc
	mov	x20, x0
	str	w19, [x0, #16]
	mov	x0, x19
	bl	_ofw_bus_get_node
	mov	x22, x0
	str	wzr, [sp, #12]
Lloh0:
	adrp	x8, _SYS_RES_MEMORY@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SYS_RES_MEMORY@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
Lloh3:
	adrp	x8, _RF_ACTIVE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _RF_ACTIVE@GOTPAGEOFF]
Lloh5:
	ldr	w3, [x8]
	add	x2, sp, #12
	mov	x0, x19
	bl	_bus_alloc_resource_any
	str	x0, [x20, #8]
	cbz	x0, LBB0_4
; %bb.1:
Lloh6:
	adrp	x2, l_.str.1@PAGE
Lloh7:
	add	x2, x2, l_.str.1@PAGEOFF
	mov	x0, x19
	mov	w1, #0
	mov	x3, x20
	bl	_hwreset_get_by_ofw_name
	cbz	w0, LBB0_5
; %bb.2:
	mov	x21, x0
	str	x21, [sp]
Lloh8:
	adrp	x1, l_.str.2@PAGE
Lloh9:
	add	x1, x1, l_.str.2@PAGEOFF
LBB0_3:
	mov	x0, x19
	bl	_device_printf
	b	LBB0_10
LBB0_4:
Lloh10:
	adrp	x1, l_.str@PAGE
Lloh11:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_device_printf
Lloh12:
	adrp	x8, _ENXIO@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh14:
	ldr	w21, [x8]
	b	LBB0_10
LBB0_5:
	ldr	w0, [x20]
	bl	_hwreset_deassert
	cbz	w0, LBB0_7
; %bb.6:
	mov	x21, x0
	str	x21, [sp]
Lloh15:
	adrp	x1, l_.str.3@PAGE
Lloh16:
	add	x1, x1, l_.str.3@PAGEOFF
	b	LBB0_9
LBB0_7:
	mov	x0, x20
	bl	_load_calibration
	mov	x0, x20
	mov	x1, x22
	bl	_parse_fdt
	cbz	w0, LBB0_11
; %bb.8:
	mov	x21, x0
	str	x21, [sp]
Lloh17:
	adrp	x1, l_.str.4@PAGE
Lloh18:
	add	x1, x1, l_.str.4@PAGEOFF
LBB0_9:
	mov	x0, x19
	bl	_device_printf
                                        ; kill: def $w21 killed $w21 killed $x21 def $x21
LBB0_10:
	mov	x0, x21
	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
	add	sp, sp, #96
	ret
LBB0_11:
Lloh19:
	adrp	x23, _ports_tbl@GOTPAGE
Lloh20:
	ldr	x23, [x23, _ports_tbl@GOTPAGEOFF]
	ldr	x0, [x23]
	bl	_nitems
	cmp	w0, #1
	b.lt	LBB0_18
; %bb.12:
	mov	x24, #0
	mov	x25, #0
	b	LBB0_14
LBB0_13:                                ;   in Loop: Header=BB0_14 Depth=1
	add	x25, x25, #1
	mov	x0, x22
	bl	_nitems
	mov	w21, #0
	add	x24, x24, #16
	cmp	x25, w0, sxtw
	b.ge	LBB0_10
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	ldr	x22, [x23]
	add	x1, x22, x24
	ldr	w8, [x1, #12]
	cbz	w8, LBB0_13
; %bb.15:                               ;   in Loop: Header=BB0_14 Depth=1
	ldr	x8, [x22, x24]
	cbz	x8, LBB0_13
; %bb.16:                               ;   in Loop: Header=BB0_14 Depth=1
	mov	x0, x20
	blr	x8
	cbnz	w0, LBB0_19
; %bb.17:                               ;   in Loop: Header=BB0_14 Depth=1
	ldr	x22, [x23]
	b	LBB0_13
LBB0_18:
	mov	w21, #0
	b	LBB0_10
LBB0_19:
	mov	x21, x0
	add	x8, x22, x24
	ldr	w8, [x8, #8]
	str	x8, [sp]
Lloh21:
	adrp	x1, l_.str.5@PAGE
Lloh22:
	add	x1, x1, l_.str.5@PAGEOFF
	b	LBB0_3
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.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
l_.str.1:                               ; @.str.1
	.asciz	"padctl"

l_.str.2:                               ; @.str.2
	.asciz	"Cannot get 'padctl' reset: %d\n"

l_.str.3:                               ; @.str.3
	.asciz	"Cannot unreset 'padctl' reset: %d\n"

l_.str.4:                               ; @.str.4
	.asciz	"Cannot parse fdt configuration: %d\n"

	.comm	_ports_tbl,8,3                  ; @ports_tbl
l_.str.5:                               ; @.str.5
	.asciz	"Cannot init port '%s'\n"

	.no_dead_strip	_xusbpadctl_attach
.subsections_via_symbols
