	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function aw_rtc_settime
_aw_rtc_settime:                        ## @aw_rtc_settime
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movl	%edi, %r14d
	callq	_device_get_softc
	movq	%rax, %r15
	movq	(%rbx), %rax
	movq	_HALF_OF_SEC_NS@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jl	LBB0_2
## %bb.1:
	incl	8(%rbx)
LBB0_2:
	movq	$0, (%rbx)
	leaq	-104(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_clock_ts_to_ct
	movq	-104(%rbp), %rax
	movq	_YEAR_MIN@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jl	LBB0_17
## %bb.3:
	movq	_YEAR_MAX@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jg	LBB0_17
## %bb.4:
	movl	%r14d, -44(%rbp)                ## 4-byte Spill
	movq	_LOSC_CTRL_REG@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	movq	%r15, %rdi
	callq	_RTC_READ
	movq	_LOSC_BUSY_MASK@GOTPCREL(%rip), %r12
	testl	%eax, (%r12)
	je	LBB0_8
## %bb.5:
	movl	$-1, %ebx
	movq	_RTC_TIMEOUT@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	incl	%ebx
	cmpl	(%r13), %ebx
	jg	LBB0_18
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movl	$1, %edi
	callq	_DELAY
	movl	(%r14), %esi
	movq	%r15, %rdi
	callq	_RTC_READ
	testl	%eax, (%r12)
	jne	LBB0_6
LBB0_8:
	movq	(%r15), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	xorl	%edx, %edx
	callq	_RTC_WRITE
	movl	-80(%rbp), %edi
	callq	_SET_DAY_VALUE
	movl	%eax, -72(%rbp)                 ## 4-byte Spill
	movl	-84(%rbp), %edi
	callq	_SET_MON_VALUE
	movl	%eax, -68(%rbp)                 ## 4-byte Spill
	movq	-104(%rbp), %rdi
	movq	_YEAR_OFFSET@GOTPCREL(%rip), %rax
	subq	(%rax), %rdi
	callq	_SET_YEAR_VALUE
	movl	%eax, -64(%rbp)                 ## 4-byte Spill
	movq	-104(%rbp), %rdi
	callq	_IS_LEAP_YEAR
	movl	%eax, %edi
	callq	_SET_LEAP_VALUE
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	movl	-88(%rbp), %edi
	callq	_SET_SEC_VALUE
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movl	-92(%rbp), %edi
	callq	_SET_MIN_VALUE
	movl	%eax, -56(%rbp)                 ## 4-byte Spill
	movl	-96(%rbp), %edi
	callq	_SET_HOUR_VALUE
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movl	(%r14), %esi
	movq	%r15, %rdi
	callq	_RTC_READ
	testl	%eax, (%r12)
	je	LBB0_12
## %bb.9:
	movl	$-1, %ebx
	movq	_RTC_TIMEOUT@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	incl	%ebx
	cmpl	(%r13), %ebx
	jg	LBB0_19
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=1
	movl	$1, %edi
	callq	_DELAY
	movl	(%r14), %esi
	movq	%r15, %rdi
	callq	_RTC_READ
	testl	%eax, (%r12)
	jne	LBB0_10
LBB0_12:
	movl	-68(%rbp), %eax                 ## 4-byte Reload
	orl	-72(%rbp), %eax                 ## 4-byte Folded Reload
	orl	-60(%rbp), %eax                 ## 4-byte Folded Reload
	movl	-64(%rbp), %edx                 ## 4-byte Reload
	orl	%eax, %edx
	movq	(%r15), %rax
	movl	4(%rax), %esi
	movq	%r15, %rdi
	callq	_RTC_WRITE
	movl	(%r14), %esi
	movq	%r15, %rdi
	callq	_RTC_READ
	testl	%eax, (%r12)
	je	LBB0_16
## %bb.13:
	movl	$-1, %ebx
	movq	_RTC_TIMEOUT@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	incl	%ebx
	cmpl	(%r13), %ebx
	jg	LBB0_18
## %bb.15:                              ##   in Loop: Header=BB0_14 Depth=1
	movl	$1, %edi
	callq	_DELAY
	movl	(%r14), %esi
	movq	%r15, %rdi
	callq	_RTC_READ
	testl	%eax, (%r12)
	jne	LBB0_14
LBB0_16:
	movl	-56(%rbp), %edx                 ## 4-byte Reload
	orl	-52(%rbp), %edx                 ## 4-byte Folded Reload
	orl	-48(%rbp), %edx                 ## 4-byte Folded Reload
	movq	(%r15), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_RTC_WRITE
	movq	_RTC_TIMEOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_DELAY
	xorl	%eax, %eax
	jmp	LBB0_22
LBB0_17:
	leaq	L_.str(%rip), %rsi
	movl	%r14d, %edi
	jmp	LBB0_21
LBB0_18:
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_20
LBB0_19:
	leaq	L_.str.2(%rip), %rsi
LBB0_20:
	movl	-44(%rbp), %edi                 ## 4-byte Reload
LBB0_21:
	callq	_device_printf
	movq	_EINVAL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_22:
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_HALF_OF_SEC_NS,8,3             ## @HALF_OF_SEC_NS
	.comm	_YEAR_MIN,8,3                   ## @YEAR_MIN
	.comm	_YEAR_MAX,8,3                   ## @YEAR_MAX
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"could not set time, year out of range\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_LOSC_CTRL_REG,4,2              ## @LOSC_CTRL_REG
	.comm	_LOSC_BUSY_MASK,4,2             ## @LOSC_BUSY_MASK
	.comm	_RTC_TIMEOUT,4,2                ## @RTC_TIMEOUT
L_.str.1:                               ## @.str.1
	.asciz	"could not set time, RTC busy\n"

	.comm	_YEAR_OFFSET,8,3                ## @YEAR_OFFSET
L_.str.2:                               ## @.str.2
	.asciz	"could not set date, RTC busy\n"

	.no_dead_strip	_aw_rtc_settime
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function aw_rtc_settime
_aw_rtc_settime:                        ; @aw_rtc_settime
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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	x21, x1
	mov	x19, x0
	bl	_device_get_softc
	mov	x20, x0
	ldr	x8, [x21]
Lloh0:
	adrp	x9, _HALF_OF_SEC_NS@GOTPAGE
Lloh1:
	ldr	x9, [x9, _HALF_OF_SEC_NS@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.lt	LBB0_2
; %bb.1:
	ldr	w8, [x21, #8]
	add	w8, w8, #1
	str	w8, [x21, #8]
LBB0_2:
	str	xzr, [x21]
	add	x1, sp, #16
	mov	x0, x21
	bl	_clock_ts_to_ct
	ldr	x8, [sp, #16]
Lloh3:
	adrp	x9, _YEAR_MIN@GOTPAGE
Lloh4:
	ldr	x9, [x9, _YEAR_MIN@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
Lloh6:
	adrp	x10, _YEAR_MAX@GOTPAGE
Lloh7:
	ldr	x10, [x10, _YEAR_MAX@GOTPAGEOFF]
Lloh8:
	ldr	x10, [x10]
	cmp	x8, x9
	ccmp	x8, x10, #0, ge
	b.le	LBB0_4
; %bb.3:
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_19
LBB0_4:
Lloh11:
	adrp	x21, _LOSC_CTRL_REG@GOTPAGE
Lloh12:
	ldr	x21, [x21, _LOSC_CTRL_REG@GOTPAGEOFF]
	ldr	w1, [x21]
	mov	x0, x20
	bl	_RTC_READ
Lloh13:
	adrp	x22, _LOSC_BUSY_MASK@GOTPAGE
Lloh14:
	ldr	x22, [x22, _LOSC_BUSY_MASK@GOTPAGEOFF]
	ldr	w8, [x22]
Lloh15:
	adrp	x28, _RTC_TIMEOUT@GOTPAGE
Lloh16:
	ldr	x28, [x28, _RTC_TIMEOUT@GOTPAGEOFF]
	tst	w8, w0
	b.eq	LBB0_8
; %bb.5:
	mov	w23, #-1
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x28]
	add	w23, w23, #1
	cmp	w23, w8
	b.gt	LBB0_17
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	w0, #1
	bl	_DELAY
	ldr	w1, [x21]
	mov	x0, x20
	bl	_RTC_READ
	ldr	w8, [x22]
	tst	w8, w0
	b.ne	LBB0_6
LBB0_8:
	ldr	x8, [x20]
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #0
	bl	_RTC_WRITE
	ldr	w0, [sp, #40]
	bl	_SET_DAY_VALUE
	mov	x24, x0
	ldr	w0, [sp, #36]
	bl	_SET_MON_VALUE
	mov	x25, x0
	ldr	x8, [sp, #16]
Lloh17:
	adrp	x9, _YEAR_OFFSET@GOTPAGE
Lloh18:
	ldr	x9, [x9, _YEAR_OFFSET@GOTPAGEOFF]
Lloh19:
	ldr	x9, [x9]
	sub	x0, x8, x9
	bl	_SET_YEAR_VALUE
	mov	x26, x0
	ldr	x0, [sp, #16]
	bl	_IS_LEAP_YEAR
	bl	_SET_LEAP_VALUE
	mov	x27, x0
	ldr	w0, [sp, #32]
	bl	_SET_SEC_VALUE
	str	w0, [sp, #12]                   ; 4-byte Folded Spill
	ldr	w0, [sp, #28]
	bl	_SET_MIN_VALUE
	str	w0, [sp, #8]                    ; 4-byte Folded Spill
	ldr	w0, [sp, #24]
	bl	_SET_HOUR_VALUE
	str	w0, [sp, #4]                    ; 4-byte Folded Spill
	ldr	w1, [x21]
	mov	x0, x20
	bl	_RTC_READ
	ldr	w8, [x22]
	tst	w8, w0
	b.eq	LBB0_12
; %bb.9:
	mov	w23, #-1
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x28]
	add	w23, w23, #1
	cmp	w23, w8
	b.gt	LBB0_18
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	mov	w0, #1
	bl	_DELAY
	ldr	w1, [x21]
	mov	x0, x20
	bl	_RTC_READ
	ldr	w8, [x22]
	tst	w8, w0
	b.ne	LBB0_10
LBB0_12:
	orr	w8, w25, w24
	orr	w8, w8, w26
	orr	w2, w8, w27
	ldr	x8, [x20]
	ldr	w1, [x8, #4]
	mov	x0, x20
	bl	_RTC_WRITE
	ldr	w1, [x21]
	mov	x0, x20
	bl	_RTC_READ
	ldr	w8, [x22]
	tst	w8, w0
	b.eq	LBB0_16
; %bb.13:
	mov	w23, #-1
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x28]
	add	w23, w23, #1
	cmp	w23, w8
	b.gt	LBB0_17
; %bb.15:                               ;   in Loop: Header=BB0_14 Depth=1
	mov	w0, #1
	bl	_DELAY
	ldr	w1, [x21]
	mov	x0, x20
	bl	_RTC_READ
	ldr	w8, [x22]
	tst	w8, w0
	b.ne	LBB0_14
LBB0_16:
	ldp	w9, w8, [sp, #8]                ; 8-byte Folded Reload
	orr	w8, w9, w8
	ldr	w9, [sp, #4]                    ; 4-byte Folded Reload
	orr	w2, w8, w9
	ldr	x8, [x20]
	ldr	w1, [x8]
	mov	x0, x20
	bl	_RTC_WRITE
	ldr	w0, [x28]
	bl	_DELAY
	mov	w0, #0
	b	LBB0_20
LBB0_17:
Lloh20:
	adrp	x1, l_.str.1@PAGE
Lloh21:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_19
LBB0_18:
Lloh22:
	adrp	x1, l_.str.2@PAGE
Lloh23:
	add	x1, x1, l_.str.2@PAGEOFF
LBB0_19:
	mov	x0, x19
	bl	_device_printf
Lloh24:
	adrp	x8, _EINVAL@GOTPAGE
Lloh25:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh26:
	ldr	w0, [x8]
LBB0_20:
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_HALF_OF_SEC_NS,8,3             ; @HALF_OF_SEC_NS
	.comm	_YEAR_MIN,8,3                   ; @YEAR_MIN
	.comm	_YEAR_MAX,8,3                   ; @YEAR_MAX
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"could not set time, year out of range\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_LOSC_CTRL_REG,4,2              ; @LOSC_CTRL_REG
	.comm	_LOSC_BUSY_MASK,4,2             ; @LOSC_BUSY_MASK
	.comm	_RTC_TIMEOUT,4,2                ; @RTC_TIMEOUT
l_.str.1:                               ; @.str.1
	.asciz	"could not set time, RTC busy\n"

	.comm	_YEAR_OFFSET,8,3                ; @YEAR_OFFSET
l_.str.2:                               ; @.str.2
	.asciz	"could not set date, RTC busy\n"

	.no_dead_strip	_aw_rtc_settime
.subsections_via_symbols
