	.file	"extr_w1_ds2431.c_eeprom_write.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	eeprom_write, @function
eeprom_write:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rdi, rsi
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	r15
	.cfi_offset 15, -24
	mov	r15, rcx
	push	r14
	push	r13
	push	r12
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	mov	r12, r9
	push	rbx
	.cfi_offset 3, -56
	mov	ebx, r8d
	sub	rsp, 40
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -56[rbp], rax
	xor	eax, eax
	call	kobj_to_w1_slave@PLT
	mov	edx, DWORD PTR W1_F2D_EEPROM_SIZE[rip]
	mov	rsi, r12
	mov	edi, ebx
	mov	QWORD PTR -72[rbp], rax
	mov	r13, rax
	call	w1_f2d_fix_count@PLT
	mov	QWORD PTR -80[rbp], rax
	test	rax, rax
	jne	.L25
.L1:
	mov	rax, QWORD PTR -56[rbp]
	xor	rax, QWORD PTR fs:40
	jne	.L26
	mov	rax, QWORD PTR -80[rbp]
	lea	rsp, -40[rbp]
	pop	rbx
	pop	r12
	pop	r13
	pop	r14
	pop	r15
	pop	rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L25:
	.cfi_restore_state
	mov	rdi, QWORD PTR 0[r13]
	mov	r14, rax
	mov	r13d, r14d
	call	mutex_lock@PLT
	test	r14d, r14d
	jle	.L3
	.p2align 4,,10
	.p2align 3
.L13:
	mov	r12d, DWORD PTR W1_F2D_SCRATCH_SIZE[rip]
	mov	esi, DWORD PTR W1_F2D_SCRATCH_MASK[rip]
	cmp	r12d, r13d
	jg	.L4
	test	ebx, esi
	je	.L5
.L4:
	movsx	rax, r12d
	mov	rcx, rsp
	mov	r14, rsp
	add	rax, 15
	mov	rdx, rax
	and	rax, -4096
	sub	rcx, rax
	and	rdx, -16
	mov	rax, rcx
	cmp	rsp, rax
	je	.L7
.L27:
	sub	rsp, 4096
	or	QWORD PTR 4088[rsp], 0
	cmp	rsp, rax
	jne	.L27
.L7:
	and	edx, 4095
	sub	rsp, rdx
	test	rdx, rdx
	je	.L8
	or	QWORD PTR -8[rsp+rdx], 0
.L8:
	not	esi
	mov	rdi, QWORD PTR -72[rbp]
	mov	rcx, rsp
	mov	edx, r12d
	and	esi, ebx
	call	w1_f2d_readblock@PLT
	test	rax, rax
	jne	.L23
	mov	edi, DWORD PTR W1_F2D_SCRATCH_MASK[rip]
	mov	r12d, DWORD PTR W1_F2D_SCRATCH_SIZE[rip]
	mov	rsi, r15
	and	edi, ebx
	sub	r12d, edi
	movsx	rdi, edi
	cmp	r12d, r13d
	cmovg	r12d, r13d
	add	rdi, rsp
	mov	edx, r12d
	call	memcpy@PLT
	mov	esi, DWORD PTR W1_F2D_SCRATCH_MASK[rip]
	mov	rdi, QWORD PTR -72[rbp]
	mov	rcx, rsp
	mov	edx, DWORD PTR W1_F2D_SCRATCH_SIZE[rip]
	not	esi
	and	esi, ebx
	call	w1_f2d_write@PLT
	test	rax, rax
	js	.L23
	mov	rsp, r14
.L12:
	movsx	rax, r12d
	sub	r13d, r12d
	add	ebx, r12d
	add	r15, rax
	test	r13d, r13d
	jg	.L13
.L3:
	mov	rax, QWORD PTR -72[rbp]
	mov	rdi, QWORD PTR [rax]
	call	mutex_unlock@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L5:
	mov	rdi, QWORD PTR -72[rbp]
	mov	rcx, r15
	mov	edx, r12d
	mov	esi, ebx
	call	w1_f2d_write@PLT
	test	rax, rax
	jns	.L12
	mov	rax, QWORD PTR EIO[rip]
	neg	rax
	mov	QWORD PTR -80[rbp], rax
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L23:
	mov	rax, QWORD PTR EIO[rip]
	neg	rax
	mov	QWORD PTR -80[rbp], rax
	mov	rax, QWORD PTR -72[rbp]
	mov	rsp, r14
	mov	rdi, QWORD PTR [rax]
	call	mutex_unlock@PLT
	jmp	.L1
.L26:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	eeprom_write, .-eeprom_write
	.comm	W1_F2D_SCRATCH_SIZE,4,4
	.comm	W1_F2D_SCRATCH_MASK,4,4
	.comm	W1_F2D_EEPROM_SIZE,4,4
	.comm	EIO,8,8
	.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_w1_ds2431.c_eeprom_write.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	eeprom_write, %function
eeprom_write:
	@ args = 8, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	add	fp, sp, #32
	sub	sp, sp, #20
	mov	r7, r3
	ldr	r3, .L21
	mov	r0, r1
	ldr	r3, [r3]
	str	r3, [fp, #-40]
	mov	r3,#0
	ldr	r6, [fp, #4]
	bl	kobj_to_w1_slave
	ldr	r3, .L21+4
	mov	r8, r0
	ldr	r2, [r3]
	mov	r0, r6
	ldr	r1, [fp, #8]
	bl	w1_f2d_fix_count
	subs	r3, r0, #0
	str	r3, [fp, #-52]
	bne	.L19
.L1:
	ldr	r3, .L21
	ldr	r2, [r3]
	ldr	r3, [fp, #-40]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L20
	ldr	r0, [fp, #-52]
	sub	sp, fp, #32
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L19:
	mov	r4, r3
	ldr	r0, [r8]
	bl	mutex_lock
	cmp	r4, #0
	mov	r5, r4
	bgt	.L10
	b	.L3
.L4:
	add	r3, r4, #7
	bic	r3, r3, #7
	mov	r9, sp
	sub	sp, sp, r3
	mov	r2, r4
	mov	r3, sp
	mov	r0, r8
	bic	r1, r6, r1
	bl	w1_f2d_readblock
	cmp	r0, #0
	bne	.L17
	ldr	r3, .L21+8
	ldr	r2, .L21+12
	ldr	r3, [r3]
	ldr	r10, [r2]
	and	r0, r3, r6
	sub	r4, r10, r0
	cmp	r4, r5
	movge	r4, r5
	mov	r1, r7
	mov	r2, r4
	add	r0, sp, r0
	str	r3, [fp, #-48]
	bl	memcpy
	ldr	r1, [fp, #-48]
	mov	r3, sp
	mov	r2, r10
	mov	r0, r8
	bic	r1, r6, r1
	bl	w1_f2d_write
	cmp	r0, #0
	blt	.L17
	mov	sp, r9
.L9:
	sub	r5, r5, r4
	cmp	r5, #0
	add	r7, r7, r4
	add	r6, r6, r4
	ble	.L3
.L10:
	ldr	r3, .L21+12
	ldr	r4, [r3]
	ldr	r3, .L21+8
	cmp	r4, r5
	ldr	r1, [r3]
	bgt	.L4
	tst	r6, r1
	bne	.L4
	mov	r3, r7
	mov	r2, r4
	mov	r1, r6
	mov	r0, r8
	bl	w1_f2d_write
	cmp	r0, #0
	bge	.L9
	ldr	r3, .L21+16
	ldr	r3, [r3]
	rsb	r3, r3, #0
	str	r3, [fp, #-52]
.L3:
	ldr	r0, [r8]
	bl	mutex_unlock
	b	.L1
.L17:
	ldr	r3, .L21+16
	ldr	r0, [r3]
	rsb	r3, r0, #0
	str	r3, [fp, #-52]
	mov	sp, r9
	ldr	r0, [r8]
	bl	mutex_unlock
	b	.L1
.L20:
	bl	__stack_chk_fail
.L22:
	.align	2
.L21:
	.word	.LC0
	.word	W1_F2D_EEPROM_SIZE
	.word	W1_F2D_SCRATCH_MASK
	.word	W1_F2D_SCRATCH_SIZE
	.word	EIO
	.size	eeprom_write, .-eeprom_write
	.comm	W1_F2D_SCRATCH_SIZE,4,4
	.comm	W1_F2D_SCRATCH_MASK,4,4
	.comm	W1_F2D_EEPROM_SIZE,4,4
	.comm	EIO,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
