	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function uart_opal_attach
_uart_opal_attach:                      ## @uart_opal_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	%r12
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, %r15d
	callq	_device_get_softc
	movq	%rax, %r12
	movl	%r15d, %edi
	callq	_ofw_bus_get_node
	movl	%eax, 48(%r12)
	movq	%r12, %rdi
	callq	_uart_opal_probe_node
	movl	%r15d, %edi
	callq	_device_get_unit
	movl	%eax, %r14d
	movq	%r12, %rbx
	addq	$44, %rbx
	movl	%r15d, %edi
	callq	_device_get_nameunit
	movq	_MTX_SPIN@GOTPCREL(%rip), %rdx
	movq	_MTX_QUIET@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rdx), %ecx
	movq	_MTX_NOWITNESS@GOTPCREL(%rip), %rdx
	orl	(%rdx), %ecx
	movq	%rbx, %rdi
	movl	%eax, %esi
	xorl	%edx, %edx
	callq	_mtx_init
	movq	_console_sc@GOTPCREL(%rip), %rbx
	movq	(%rbx), %rax
	testq	%rax, %rax
	je	LBB0_3
## %bb.1:
	movq	(%rax), %rax
	cmpq	(%r12), %rax
	jne	LBB0_3
## %bb.2:
	leaq	L_.str(%rip), %rsi
	movl	%r15d, %edi
	callq	_device_printf
	movq	(%rbx), %rsi
	movl	%r15d, %edi
	callq	_device_set_softc
	movq	(%rbx), %r12
	movq	_uart_opal_consdev@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%r14d, %edx
	callq	_sprintf
LBB0_3:
	movq	_uart_opal_tty_class@GOTPCREL(%rip), %rdi
	movq	%r12, %rsi
	callq	_tty_alloc
	movl	%eax, 12(%r12)
	cmpq	%r12, (%rbx)
	jne	LBB0_5
## %bb.4:
	movl	%eax, %edi
	xorl	%esi, %esi
	callq	_tty_init_console
LBB0_5:
	movl	%r15d, 40(%r12)
	leaq	32(%r12), %rdx
	movq	$0, 32(%r12)
	movq	_SYS_RES_IRQ@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	%r15d, %edi
	callq	_bus_alloc_resource_any
	movq	%rax, 24(%r12)
	testq	%rax, %rax
	je	LBB0_7
## %bb.6:
	movq	_INTR_TYPE_TTY@GOTPCREL(%rip), %rcx
	movq	_INTR_MPSAFE@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	(%rcx), %edx
	movq	_uart_opal_intr@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r8d
	leaq	20(%r12), %rcx
	movq	%rcx, (%rsp)
	movl	%r15d, %edi
	movq	%rax, %rsi
	xorl	%ecx, %ecx
	movq	%r12, %r9
	callq	_bus_setup_intr
	jmp	LBB0_10
LBB0_7:
	leaq	16(%r12), %r15
	movq	_CALLOUT_MPSAFE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_callout_init
	movq	_hz@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	$1, %esi
	cmpl	$20, %eax
	jl	LBB0_9
## %bb.8:
	cltq
	imulq	$1717986919, %rax, %rsi         ## imm = 0x66666667
	movq	%rsi, %rax
	shrq	$63, %rax
	sarq	$35, %rsi
	addl	%eax, %esi
LBB0_9:
	movl	%esi, 8(%r12)
	movq	_uart_opal_intr@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
                                        ## kill: def $esi killed $esi killed $rsi
	movq	%r12, %rcx
	callq	_callout_reset
LBB0_10:
	movl	12(%r12), %edi
	leaq	L_.str.2(%rip), %rdx
	xorl	%esi, %esi
	movl	%r14d, %ecx
	callq	_tty_makedev
	xorl	%eax, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MTX_SPIN,4,2                   ## @MTX_SPIN
	.comm	_MTX_QUIET,4,2                  ## @MTX_QUIET
	.comm	_MTX_NOWITNESS,4,2              ## @MTX_NOWITNESS
	.comm	_console_sc,8,3                 ## @console_sc
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"console\n"

	.comm	_uart_opal_consdev,4,2          ## @uart_opal_consdev
L_.str.1:                               ## @.str.1
	.asciz	"ttyu%r"

	.comm	_uart_opal_tty_class,4,2        ## @uart_opal_tty_class
	.comm	_SYS_RES_IRQ,4,2                ## @SYS_RES_IRQ
	.comm	_RF_ACTIVE,4,2                  ## @RF_ACTIVE
	.comm	_RF_SHAREABLE,4,2               ## @RF_SHAREABLE
	.comm	_INTR_TYPE_TTY,4,2              ## @INTR_TYPE_TTY
	.comm	_INTR_MPSAFE,4,2                ## @INTR_MPSAFE
	.comm	_uart_opal_intr,4,2             ## @uart_opal_intr
	.comm	_CALLOUT_MPSAFE,4,2             ## @CALLOUT_MPSAFE
	.comm	_hz,4,2                         ## @hz
L_.str.2:                               ## @.str.2
	.asciz	"u%r"

	.no_dead_strip	_uart_opal_attach
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function uart_opal_attach
_uart_opal_attach:                      ; @uart_opal_attach
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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	x21, x0
	bl	_device_get_softc
	mov	x20, x0
	mov	x0, x21
	bl	_ofw_bus_get_node
	str	w0, [x20, #48]
	mov	x0, x20
	bl	_uart_opal_probe_node
	mov	x0, x21
	bl	_device_get_unit
	mov	x19, x0
	add	x22, x20, #44
	mov	x0, x21
	bl	_device_get_nameunit
	mov	x1, x0
Lloh0:
	adrp	x8, _MTX_SPIN@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MTX_SPIN@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _MTX_QUIET@GOTPAGE
Lloh4:
	ldr	x9, [x9, _MTX_QUIET@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh6:
	adrp	x9, _MTX_NOWITNESS@GOTPAGE
Lloh7:
	ldr	x9, [x9, _MTX_NOWITNESS@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	orr	w3, w8, w9
	mov	x0, x22
	mov	x2, #0
	bl	_mtx_init
Lloh9:
	adrp	x22, _console_sc@GOTPAGE
Lloh10:
	ldr	x22, [x22, _console_sc@GOTPAGEOFF]
	ldr	x8, [x22]
	cbz	x8, LBB0_3
; %bb.1:
	ldr	x8, [x8]
	ldr	x9, [x20]
	cmp	x8, x9
	b.ne	LBB0_3
; %bb.2:
Lloh11:
	adrp	x1, l_.str@PAGE
Lloh12:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	bl	_device_printf
	ldr	x1, [x22]
	mov	x0, x21
	bl	_device_set_softc
	ldr	x20, [x22]
Lloh13:
	adrp	x8, _uart_opal_consdev@GOTPAGE
Lloh14:
	ldr	x8, [x8, _uart_opal_consdev@GOTPAGEOFF]
Lloh15:
	ldr	w0, [x8]
Lloh16:
	adrp	x1, l_.str.1@PAGE
Lloh17:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x19
	bl	_sprintf
LBB0_3:
Lloh18:
	adrp	x0, _uart_opal_tty_class@GOTPAGE
Lloh19:
	ldr	x0, [x0, _uart_opal_tty_class@GOTPAGEOFF]
	mov	x1, x20
	bl	_tty_alloc
	str	w0, [x20, #12]
	ldr	x8, [x22]
	cmp	x8, x20
	b.ne	LBB0_5
; %bb.4:
	mov	w1, #0
	bl	_tty_init_console
LBB0_5:
	mov	x22, x20
	str	xzr, [x22, #32]!
	str	w21, [x22, #8]
Lloh20:
	adrp	x8, _SYS_RES_IRQ@GOTPAGE
Lloh21:
	ldr	x8, [x8, _SYS_RES_IRQ@GOTPAGEOFF]
Lloh22:
	adrp	x9, _RF_ACTIVE@GOTPAGE
Lloh23:
	ldr	x9, [x9, _RF_ACTIVE@GOTPAGEOFF]
Lloh24:
	ldr	w1, [x8]
Lloh25:
	ldr	w8, [x9]
Lloh26:
	adrp	x9, _RF_SHAREABLE@GOTPAGE
Lloh27:
	ldr	x9, [x9, _RF_SHAREABLE@GOTPAGEOFF]
Lloh28:
	ldr	w9, [x9]
	orr	w3, w9, w8
	mov	x0, x21
	mov	x2, x22
	bl	_bus_alloc_resource_any
	stur	x0, [x22, #-8]
	cbz	x0, LBB0_7
; %bb.6:
	mov	x1, x0
Lloh29:
	adrp	x8, _INTR_TYPE_TTY@GOTPAGE
Lloh30:
	ldr	x8, [x8, _INTR_TYPE_TTY@GOTPAGEOFF]
Lloh31:
	ldr	w8, [x8]
Lloh32:
	adrp	x9, _INTR_MPSAFE@GOTPAGE
Lloh33:
	ldr	x9, [x9, _INTR_MPSAFE@GOTPAGEOFF]
Lloh34:
	ldr	w9, [x9]
	orr	w2, w9, w8
Lloh35:
	adrp	x8, _uart_opal_intr@GOTPAGE
Lloh36:
	ldr	x8, [x8, _uart_opal_intr@GOTPAGEOFF]
Lloh37:
	ldr	w4, [x8]
	add	x6, x20, #20
	mov	x0, x21
	mov	x3, #0
	mov	x5, x20
	bl	_bus_setup_intr
	b	LBB0_8
LBB0_7:
	add	x21, x20, #16
Lloh38:
	adrp	x8, _CALLOUT_MPSAFE@GOTPAGE
Lloh39:
	ldr	x8, [x8, _CALLOUT_MPSAFE@GOTPAGEOFF]
Lloh40:
	ldr	w1, [x8]
	mov	x0, x21
	bl	_callout_init
Lloh41:
	adrp	x8, _hz@GOTPAGE
Lloh42:
	ldr	x8, [x8, _hz@GOTPAGEOFF]
Lloh43:
	ldrsw	x8, [x8]
	mov	w9, #26215
	movk	w9, #26214, lsl #16
	mul	x9, x8, x9
	lsr	x10, x9, #63
	asr	x9, x9, #35
	add	w9, w9, w10
	cmp	w8, #20
	csinc	w1, w9, wzr, ge
	str	w1, [x20, #8]
Lloh44:
	adrp	x8, _uart_opal_intr@GOTPAGE
Lloh45:
	ldr	x8, [x8, _uart_opal_intr@GOTPAGEOFF]
Lloh46:
	ldr	w2, [x8]
	mov	x0, x21
	mov	x3, x20
	bl	_callout_reset
LBB0_8:
	ldr	w0, [x20, #12]
Lloh47:
	adrp	x2, l_.str.2@PAGE
Lloh48:
	add	x2, x2, l_.str.2@PAGEOFF
	mov	x1, #0
	mov	x3, x19
	bl	_tty_makedev
	mov	w0, #0
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh24
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh44, Lloh45, Lloh46
	.loh AdrpLdrGotLdr	Lloh41, Lloh42, Lloh43
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpAdd	Lloh47, Lloh48
	.cfi_endproc
                                        ; -- End function
	.comm	_MTX_SPIN,4,2                   ; @MTX_SPIN
	.comm	_MTX_QUIET,4,2                  ; @MTX_QUIET
	.comm	_MTX_NOWITNESS,4,2              ; @MTX_NOWITNESS
	.comm	_console_sc,8,3                 ; @console_sc
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"console\n"

	.comm	_uart_opal_consdev,4,2          ; @uart_opal_consdev
l_.str.1:                               ; @.str.1
	.asciz	"ttyu%r"

	.comm	_uart_opal_tty_class,4,2        ; @uart_opal_tty_class
	.comm	_SYS_RES_IRQ,4,2                ; @SYS_RES_IRQ
	.comm	_RF_ACTIVE,4,2                  ; @RF_ACTIVE
	.comm	_RF_SHAREABLE,4,2               ; @RF_SHAREABLE
	.comm	_INTR_TYPE_TTY,4,2              ; @INTR_TYPE_TTY
	.comm	_INTR_MPSAFE,4,2                ; @INTR_MPSAFE
	.comm	_uart_opal_intr,4,2             ; @uart_opal_intr
	.comm	_CALLOUT_MPSAFE,4,2             ; @CALLOUT_MPSAFE
	.comm	_hz,4,2                         ; @hz
l_.str.2:                               ; @.str.2
	.asciz	"u%r"

	.no_dead_strip	_uart_opal_attach
.subsections_via_symbols
