	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function aml8726_rtc_attach
_aml8726_rtc_attach:                    ## @aml8726_rtc_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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, %r14d
	callq	_device_get_softc
	movq	%rax, %rbx
	movl	%r14d, 16(%rax)
	movq	_aml8726_soc_hw_rev@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	$-128, %eax
	cmpl	$4, %eax
	jae	LBB0_1
## %bb.4:
	cltq
	leaq	L_switch.table.aml8726_rtc_attach(%rip), %rcx
	movl	(%rcx,%rax,4), %ecx
	leaq	L_switch.table.aml8726_rtc_attach.3(%rip), %rdx
	movl	(%rdx,%rax,4), %edx
	leaq	L_switch.table.aml8726_rtc_attach.4(%rip), %rsi
	movl	(%rsi,%rax,4), %eax
	movl	%ecx, 4(%rbx)
	movl	%edx, 8(%rbx)
	movl	%eax, 12(%rbx)
	movq	_aml8726_rtc_spec@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movl	(%rbx), %edx
	movl	%r14d, %edi
	callq	_bus_alloc_resources
	testq	%rax, %rax
	je	LBB0_6
## %bb.5:
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_2
LBB0_1:
	leaq	L_.str(%rip), %rsi
LBB0_2:
	movl	%r14d, %edi
	callq	_device_printf
LBB0_3:
	movq	_ENXIO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_9:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movq	%rbx, %rdi
	callq	_aml8726_rtc_initialize
	movq	%rbx, %rdi
	callq	_aml8726_rtc_check_xo
	testq	%rax, %rax
	je	LBB0_8
## %bb.7:
	leaq	L_.str.2(%rip), %rsi
	movl	%r14d, %edi
	callq	_device_printf
	movl	(%r15), %esi
	movl	(%rbx), %edx
	movl	%r14d, %edi
	callq	_bus_release_resources
	jmp	LBB0_3
LBB0_8:
	movq	%rbx, %rdi
	callq	_AML_RTC_LOCK_INIT
	movl	%r14d, %edi
	movl	$1000000, %esi                  ## imm = 0xF4240
	callq	_clock_register
	xorl	%eax, %eax
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.comm	_aml8726_soc_hw_rev,4,2         ## @aml8726_soc_hw_rev
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"unsupported SoC\n"

	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_aml8726_rtc_spec,4,2           ## @aml8726_rtc_spec
L_.str.1:                               ## @.str.1
	.asciz	"can not allocate resources for device\n"

L_.str.2:                               ## @.str.2
	.asciz	"crystal oscillator check failed\n"

	.no_dead_strip	_aml8726_rtc_attach
	.section	__TEXT,__literal16,16byte_literals
	.p2align	2                               ## @switch.table.aml8726_rtc_attach
L_switch.table.aml8726_rtc_attach:
	.long	0                               ## 0x0
	.long	0                               ## 0x0
	.long	0                               ## 0x0
	.long	1                               ## 0x1

	.p2align	2                               ## @switch.table.aml8726_rtc_attach.3
L_switch.table.aml8726_rtc_attach.3:
	.long	6154                            ## 0x180a
	.long	6154                            ## 0x180a
	.long	6154                            ## 0x180a
	.long	15370                           ## 0x3c0a

	.p2align	2                               ## @switch.table.aml8726_rtc_attach.4
L_switch.table.aml8726_rtc_attach.4:
	.long	5242880                         ## 0x500000
	.long	5242880                         ## 0x500000
	.long	5242880                         ## 0x500000
	.long	1048576                         ## 0x100000

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function aml8726_rtc_attach
_aml8726_rtc_attach:                    ; @aml8726_rtc_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	x19, x0
	bl	_device_get_softc
	str	w19, [x0, #16]
Lloh0:
	adrp	x8, _aml8726_soc_hw_rev@GOTPAGE
Lloh1:
	ldr	x8, [x8, _aml8726_soc_hw_rev@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	sub	w8, w8, #128
	cmp	w8, #4
	b.hs	LBB0_3
; %bb.1:
	mov	x20, x0
	sbfiz	x8, x8, #2, #32
Lloh3:
	adrp	x9, l_switch.table.aml8726_rtc_attach@PAGE
Lloh4:
	add	x9, x9, l_switch.table.aml8726_rtc_attach@PAGEOFF
	ldr	w9, [x9, x8]
Lloh5:
	adrp	x10, l_switch.table.aml8726_rtc_attach.3@PAGE
Lloh6:
	add	x10, x10, l_switch.table.aml8726_rtc_attach.3@PAGEOFF
	ldr	w10, [x10, x8]
Lloh7:
	adrp	x11, l_switch.table.aml8726_rtc_attach.4@PAGE
Lloh8:
	add	x11, x11, l_switch.table.aml8726_rtc_attach.4@PAGEOFF
	ldr	w8, [x11, x8]
	stp	w9, w10, [x0, #4]
	str	w8, [x0, #12]
Lloh9:
	adrp	x21, _aml8726_rtc_spec@GOTPAGE
Lloh10:
	ldr	x21, [x21, _aml8726_rtc_spec@GOTPAGEOFF]
	ldr	w1, [x21]
	ldr	w2, [x0]
	mov	x0, x19
	bl	_bus_alloc_resources
	cbz	x0, LBB0_7
; %bb.2:
Lloh11:
	adrp	x1, l_.str.1@PAGE
Lloh12:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_4
LBB0_3:
Lloh13:
	adrp	x1, l_.str@PAGE
Lloh14:
	add	x1, x1, l_.str@PAGEOFF
LBB0_4:
	mov	x0, x19
	bl	_device_printf
LBB0_5:
Lloh15:
	adrp	x8, _ENXIO@GOTPAGE
Lloh16:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh17:
	ldr	w0, [x8]
LBB0_6:
	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
LBB0_7:
	mov	x0, x20
	bl	_aml8726_rtc_initialize
	mov	x0, x20
	bl	_aml8726_rtc_check_xo
	cbz	x0, LBB0_9
; %bb.8:
Lloh18:
	adrp	x1, l_.str.2@PAGE
Lloh19:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_device_printf
	ldr	w1, [x21]
	ldr	w2, [x20]
	mov	x0, x19
	bl	_bus_release_resources
	b	LBB0_5
LBB0_9:
	mov	x0, x20
	bl	_AML_RTC_LOCK_INIT
	mov	x0, x19
	mov	w1, #16960
	movk	w1, #15, lsl #16
	bl	_clock_register
	mov	w0, #0
	b	LBB0_6
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_aml8726_soc_hw_rev,4,2         ; @aml8726_soc_hw_rev
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"unsupported SoC\n"

	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_aml8726_rtc_spec,4,2           ; @aml8726_rtc_spec
l_.str.1:                               ; @.str.1
	.asciz	"can not allocate resources for device\n"

l_.str.2:                               ; @.str.2
	.asciz	"crystal oscillator check failed\n"

	.no_dead_strip	_aml8726_rtc_attach
	.section	__TEXT,__literal16,16byte_literals
	.p2align	2                               ; @switch.table.aml8726_rtc_attach
l_switch.table.aml8726_rtc_attach:
	.long	0                               ; 0x0
	.long	0                               ; 0x0
	.long	0                               ; 0x0
	.long	1                               ; 0x1

	.p2align	2                               ; @switch.table.aml8726_rtc_attach.3
l_switch.table.aml8726_rtc_attach.3:
	.long	6154                            ; 0x180a
	.long	6154                            ; 0x180a
	.long	6154                            ; 0x180a
	.long	15370                           ; 0x3c0a

	.p2align	2                               ; @switch.table.aml8726_rtc_attach.4
l_switch.table.aml8726_rtc_attach.4:
	.long	5242880                         ; 0x500000
	.long	5242880                         ; 0x500000
	.long	5242880                         ; 0x500000
	.long	1048576                         ; 0x100000

.subsections_via_symbols
