	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_as3722_rtc_settime             ## -- Begin function as3722_rtc_settime
	.p2align	4, 0x90
_as3722_rtc_settime:                    ## @as3722_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	%r14
	pushq	%rbx
	subq	$80, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rsi, %rbx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -24(%rbp)
	callq	_device_get_softc
	movq	%rax, %r14
	leaq	-96(%rbp), %rsi
	movq	%rbx, %rdi
	callq	_clock_ts_to_ct
	movq	-96(%rbp), %rax
	movq	_AS3722_RTC_START_YEAR@GOTPCREL(%rip), %rbx
	cmpq	(%rbx), %rax
	jge	LBB0_2
## %bb.1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	jmp	LBB0_5
LBB0_2:
	movq	-88(%rbp), %rdi
	callq	_bin2bcd
	movl	%eax, -48(%rbp)
	movq	-80(%rbp), %rdi
	callq	_bin2bcd
	movl	%eax, -44(%rbp)
	movq	-72(%rbp), %rdi
	callq	_bin2bcd
	movl	%eax, -40(%rbp)
	movq	-64(%rbp), %rdi
	callq	_bin2bcd
	movl	%eax, -36(%rbp)
	movq	-56(%rbp), %rdi
	callq	_bin2bcd
	movl	%eax, -32(%rbp)
	movq	-96(%rbp), %rdi
	subq	(%rbx), %rdi
	callq	_bin2bcd
	movl	%eax, -28(%rbp)
	movq	_AS3722_RTC_SECOND@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-48(%rbp), %rdx
	movq	%r14, %rdi
	movl	$6, %ecx
	callq	_as3722_write_buf
	testl	%eax, %eax
	je	LBB0_3
## %bb.4:
	movl	%eax, %ebx
	movl	(%r14), %edi
	leaq	L_.str(%rip), %rsi
	callq	_device_printf
	jmp	LBB0_5
LBB0_3:
	xorl	%ebx, %ebx
LBB0_5:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-24(%rbp), %rax
	jne	LBB0_7
## %bb.6:
	movl	%ebx, %eax
	addq	$80, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_7:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_AS3722_RTC_START_YEAR,8,3      ## @AS3722_RTC_START_YEAR
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_AS3722_RTC_SECOND,4,2          ## @AS3722_RTC_SECOND
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to write RTC data\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_as3722_rtc_settime             ; -- Begin function as3722_rtc_settime
	.p2align	2
_as3722_rtc_settime:                    ; @as3722_rtc_settime
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	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
	mov	x20, x1
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-24]
	bl	_device_get_softc
	mov	x19, x0
	mov	x1, sp
	mov	x0, x20
	bl	_clock_ts_to_ct
	ldr	x8, [sp]
Lloh3:
	adrp	x20, _AS3722_RTC_START_YEAR@GOTPAGE
Lloh4:
	ldr	x20, [x20, _AS3722_RTC_START_YEAR@GOTPAGEOFF]
	ldr	x9, [x20]
	cmp	x8, x9
	b.ge	LBB0_2
; %bb.1:
Lloh5:
	adrp	x8, _EINVAL@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh7:
	ldr	w20, [x8]
	b	LBB0_4
LBB0_2:
	ldr	x0, [sp, #8]
	bl	_bin2bcd
	str	w0, [sp, #48]
	ldr	x0, [sp, #16]
	bl	_bin2bcd
	str	w0, [sp, #52]
	ldr	x0, [sp, #24]
	bl	_bin2bcd
	str	w0, [sp, #56]
	ldr	x0, [sp, #32]
	bl	_bin2bcd
	str	w0, [sp, #60]
	ldr	x0, [sp, #40]
	bl	_bin2bcd
	str	w0, [sp, #64]
	ldr	x8, [sp]
	ldr	x9, [x20]
	sub	x0, x8, x9
	bl	_bin2bcd
	str	w0, [sp, #68]
Lloh8:
	adrp	x8, _AS3722_RTC_SECOND@GOTPAGE
Lloh9:
	ldr	x8, [x8, _AS3722_RTC_SECOND@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	add	x2, sp, #48
	mov	x0, x19
	mov	w3, #6
	bl	_as3722_write_buf
	mov	x20, x0
	cbz	w0, LBB0_4
; %bb.3:
	ldr	w0, [x19]
Lloh11:
	adrp	x1, l_.str@PAGE
Lloh12:
	add	x1, x1, l_.str@PAGEOFF
	bl	_device_printf
LBB0_4:
	ldur	x8, [x29, #-24]
Lloh13:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh14:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh15:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_6
; %bb.5:
	mov	x0, x20
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_6:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_AS3722_RTC_START_YEAR,8,3      ; @AS3722_RTC_START_YEAR
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_AS3722_RTC_SECOND,4,2          ; @AS3722_RTC_SECOND
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to write RTC data\n"

.subsections_via_symbols
