	.file	"extr_rtc_m41t81.c_m41t81_set_time.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	m41t81_set_time
	.type	m41t81_set_time, @function
m41t81_set_time:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	sub	rsp, 48
	.cfi_def_cfa_offset 64
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 40[rsp], rax
	xor	eax, eax
	mov	rsi, rsp
	call	rtc_time64_to_tm@PLT
	xor	esi, esi
	lea	rdi, rtc_lock[rip]
	call	spin_lock_irqsave@PLT
	mov	edi, DWORD PTR [rsp]
	call	bin2bcd@PLT
	mov	edi, DWORD PTR M41T81REG_SC[rip]
	mov	rsi, rax
	mov	DWORD PTR [rsp], eax
	call	m41t81_write@PLT
	mov	edi, DWORD PTR 4[rsp]
	call	bin2bcd@PLT
	mov	edi, DWORD PTR M41T81REG_MN[rip]
	mov	rsi, rax
	mov	DWORD PTR 4[rsp], eax
	call	m41t81_write@PLT
	mov	edi, DWORD PTR 8[rsp]
	call	bin2bcd@PLT
	mov	edi, DWORD PTR M41T81REG_HR[rip]
	mov	rbx, rax
	mov	DWORD PTR 8[rsp], eax
	call	m41t81_read@PLT
	and	ebx, 63
	mov	edi, DWORD PTR M41T81REG_HR[rip]
	and	eax, 192
	mov	esi, eax
	or	esi, ebx
	mov	DWORD PTR 8[rsp], esi
	call	m41t81_write@PLT
	mov	edi, DWORD PTR 12[rsp]
	test	edi, edi
	jne	.L2
	mov	DWORD PTR 12[rsp], 7
	mov	edi, 7
.L2:
	call	bin2bcd@PLT
	mov	edi, DWORD PTR M41T81REG_DY[rip]
	mov	rsi, rax
	mov	DWORD PTR 12[rsp], eax
	call	m41t81_write@PLT
	mov	edi, DWORD PTR 16[rsp]
	call	bin2bcd@PLT
	mov	edi, DWORD PTR M41T81REG_DT[rip]
	mov	rsi, rax
	mov	DWORD PTR 16[rsp], eax
	call	m41t81_write@PLT
	mov	eax, DWORD PTR 20[rsp]
	lea	edi, 1[rax]
	mov	DWORD PTR 20[rsp], edi
	call	bin2bcd@PLT
	mov	edi, DWORD PTR M41T81REG_MO[rip]
	mov	rsi, rax
	mov	DWORD PTR 20[rsp], eax
	call	m41t81_write@PLT
	movsx	rdi, DWORD PTR 24[rsp]
	mov	rax, rdi
	imul	rdi, rdi, 1374389535
	cdq
	sar	rdi, 37
	sub	edi, edx
	imul	edi, edi, 100
	sub	eax, edi
	mov	edi, eax
	mov	DWORD PTR 24[rsp], eax
	call	bin2bcd@PLT
	mov	edi, DWORD PTR M41T81REG_YR[rip]
	mov	rsi, rax
	mov	DWORD PTR 24[rsp], eax
	call	m41t81_write@PLT
	xor	esi, esi
	lea	rdi, rtc_lock[rip]
	call	spin_unlock_irqrestore@PLT
	mov	rax, QWORD PTR 40[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L6
	add	rsp, 48
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	xor	eax, eax
	pop	rbx
	.cfi_def_cfa_offset 8
	ret
.L6:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	m41t81_set_time, .-m41t81_set_time
	.comm	rtc_lock,4,4
	.comm	M41T81REG_YR,4,4
	.comm	M41T81REG_SC,4,4
	.comm	M41T81REG_MO,4,4
	.comm	M41T81REG_MN,4,4
	.comm	M41T81REG_HR,4,4
	.comm	M41T81REG_DY,4,4
	.comm	M41T81REG_DT,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_rtc_m41t81.c_m41t81_set_time.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	m41t81_set_time
	.syntax unified
	.arm
	.fpu softvfp
	.type	m41t81_set_time, %function
m41t81_set_time:
	@ args = 0, pretend = 0, frame = 32
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, lr}
	ldr	r3, .L7
	sub	sp, sp, #36
	mov	r1, sp
	ldr	r3, [r3]
	str	r3, [sp, #28]
	mov	r3,#0
	bl	rtc_time64_to_tm
	mov	r1, #0
	ldr	r0, .L7+4
	bl	spin_lock_irqsave
	ldr	r0, [sp]
	bl	bin2bcd
	mov	r1, r0
	ldr	r3, .L7+8
	str	r1, [sp]
	ldr	r0, [r3]
	bl	m41t81_write
	ldr	r0, [sp, #4]
	bl	bin2bcd
	mov	r1, r0
	ldr	r3, .L7+12
	str	r1, [sp, #4]
	ldr	r0, [r3]
	bl	m41t81_write
	ldr	r0, [sp, #8]
	bl	bin2bcd
	ldr	r5, .L7+16
	mov	r4, r0
	str	r0, [sp, #8]
	ldr	r0, [r5]
	bl	m41t81_read
	and	r4, r4, #63
	and	r1, r0, #192
	orr	r1, r4, r1
	ldr	r0, [r5]
	str	r1, [sp, #8]
	bl	m41t81_write
	ldr	r0, [sp, #12]
	cmp	r0, #0
	moveq	r3, #7
	moveq	r0, r3
	streq	r3, [sp, #12]
	bl	bin2bcd
	mov	r1, r0
	ldr	r3, .L7+20
	str	r1, [sp, #12]
	ldr	r0, [r3]
	bl	m41t81_write
	ldr	r0, [sp, #16]
	bl	bin2bcd
	mov	r1, r0
	ldr	r3, .L7+24
	str	r1, [sp, #16]
	ldr	r0, [r3]
	bl	m41t81_write
	ldr	r0, [sp, #20]
	add	r0, r0, #1
	str	r0, [sp, #20]
	bl	bin2bcd
	mov	r1, r0
	ldr	r3, .L7+28
	str	r1, [sp, #20]
	ldr	r0, [r3]
	bl	m41t81_write
	ldr	r3, [sp, #24]
	ldr	r2, .L7+32
	asr	r0, r3, #31
	smull	r1, r2, r3, r2
	rsb	r0, r0, r2, asr #5
	add	r0, r0, r0, lsl #2
	add	r0, r0, r0, lsl #2
	sub	r0, r3, r0, lsl #2
	str	r0, [sp, #24]
	bl	bin2bcd
	mov	r1, r0
	ldr	r3, .L7+36
	str	r1, [sp, #24]
	ldr	r0, [r3]
	bl	m41t81_write
	mov	r1, #0
	ldr	r0, .L7+4
	bl	spin_unlock_irqrestore
	ldr	r3, .L7
	ldr	r2, [r3]
	ldr	r3, [sp, #28]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L6
	mov	r0, #0
	add	sp, sp, #36
	@ sp needed
	pop	{r4, r5, pc}
.L6:
	bl	__stack_chk_fail
.L8:
	.align	2
.L7:
	.word	.LC0
	.word	rtc_lock
	.word	M41T81REG_SC
	.word	M41T81REG_MN
	.word	M41T81REG_HR
	.word	M41T81REG_DY
	.word	M41T81REG_DT
	.word	M41T81REG_MO
	.word	1374389535
	.word	M41T81REG_YR
	.size	m41t81_set_time, .-m41t81_set_time
	.comm	rtc_lock,4,4
	.comm	M41T81REG_YR,4,4
	.comm	M41T81REG_SC,4,4
	.comm	M41T81REG_MO,4,4
	.comm	M41T81REG_MN,4,4
	.comm	M41T81REG_HR,4,4
	.comm	M41T81REG_DY,4,4
	.comm	M41T81REG_DT,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
