	.file	"extr_global2.c_mv88e6xxx_g2_set_eeprom16.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	mv88e6xxx_g2_set_eeprom16
	.type	mv88e6xxx_g2_set_eeprom16, @function
mv88e6xxx_g2_set_eeprom16:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	mov	r13, rdi
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	rbp, rsi
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	rbx, rdx
	sub	rsp, 40
	.cfi_def_cfa_offset 96
	mov	r14d, DWORD PTR [rsi]
	mov	r15d, DWORD PTR 4[rsi]
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 24[rsp], rax
	xor	eax, eax
	mov	esi, DWORD PTR MV88E6XXX_G2_EEPROM_CMD[rip]
	lea	rax, 20[rsp]
	mov	rdx, rax
	mov	QWORD PTR [rsp], rax
	call	mv88e6xxx_g2_read@PLT
	mov	r12d, eax
	test	eax, eax
	jne	.L1
	mov	eax, DWORD PTR 20[rsp]
	test	DWORD PTR MV88E6XXX_G2_EEPROM_CMD_WRITE_EN[rip], eax
	je	.L21
	mov	DWORD PTR 4[rbp], 0
	test	r14b, 1
	je	.L19
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L6:
	mov	eax, DWORD PTR [rbx]
	mov	edx, DWORD PTR 4[rbx]
	mov	esi, r14d
	mov	rdi, r13
	shr	esi
	add	rbx, 8
	sal	edx, 8
	or	edx, eax
	mov	DWORD PTR 20[rsp], edx
	call	mv88e6xxx_g2_eeprom_write16@PLT
	test	eax, eax
	jne	.L10
	add	DWORD PTR 4[rbp], 2
	add	r14d, 2
	sub	r15d, 2
.L19:
	cmp	r15d, 1
	ja	.L6
	test	r15d, r15d
	je	.L1
	mov	rdx, QWORD PTR [rsp]
	shr	r14d
	mov	rdi, r13
	mov	esi, r14d
	call	mv88e6xxx_g2_eeprom_read16@PLT
	mov	r12d, eax
	test	eax, eax
	je	.L23
	.p2align 4,,10
	.p2align 3
.L1:
	mov	rax, QWORD PTR 24[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L24
	add	rsp, 40
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	eax, r12d
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L21:
	.cfi_restore_state
	mov	r12d, DWORD PTR EROFS[rip]
	neg	r12d
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L22:
	mov	esi, r14d
	mov	rdx, QWORD PTR [rsp]
	mov	rdi, r13
	shr	esi
	mov	DWORD PTR 12[rsp], esi
	call	mv88e6xxx_g2_eeprom_read16@PLT
	test	eax, eax
	jne	.L10
	mov	edx, DWORD PTR [rbx]
	movzx	eax, BYTE PTR 20[rsp]
	mov	rdi, r13
	mov	esi, DWORD PTR 12[rsp]
	sal	edx, 8
	or	edx, eax
	mov	DWORD PTR 20[rsp], edx
	call	mv88e6xxx_g2_eeprom_write16@PLT
	test	eax, eax
	je	.L25
	.p2align 4,,10
	.p2align 3
.L10:
	mov	r12d, eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L25:
	add	DWORD PTR 4[rbp], 1
	add	rbx, 4
	add	r14d, 1
	sub	r15d, 1
	jmp	.L19
.L23:
	mov	edx, DWORD PTR 20[rsp]
	mov	esi, r14d
	mov	rdi, r13
	and	edx, 65280
	or	edx, DWORD PTR [rbx]
	mov	DWORD PTR 20[rsp], edx
	call	mv88e6xxx_g2_eeprom_write16@PLT
	mov	r12d, eax
	test	eax, eax
	jne	.L1
	add	DWORD PTR 4[rbp], 1
	jmp	.L1
.L24:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	mv88e6xxx_g2_set_eeprom16, .-mv88e6xxx_g2_set_eeprom16
	.comm	MV88E6XXX_G2_EEPROM_CMD_WRITE_EN,4,4
	.comm	MV88E6XXX_G2_EEPROM_CMD,4,4
	.comm	EROFS,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_global2.c_mv88e6xxx_g2_set_eeprom16.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	mv88e6xxx_g2_set_eeprom16
	.syntax unified
	.arm
	.fpu softvfp
	.type	mv88e6xxx_g2_set_eeprom16, %function
mv88e6xxx_g2_set_eeprom16:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	mov	r5, r1
	ldr	r3, .L24
	sub	sp, sp, #8
	ldr	r1, [r3]
	ldr	r3, .L24+4
	mov	r10, r2
	ldm	r5, {r6, r9}
	mov	r2, sp
	ldr	r3, [r3]
	str	r3, [sp, #4]
	mov	r3,#0
	mov	r8, r0
	bl	mv88e6xxx_g2_read
	subs	r7, r0, #0
	bne	.L1
	ldr	r3, .L24+8
	ldr	r2, [sp]
	ldr	r3, [r3]
	tst	r2, r3
	beq	.L20
	tst	r6, #1
	str	r7, [r5, #4]
	bne	.L21
.L4:
	cmp	r9, #1
	bls	.L5
	add	r4, r10, #8
	b	.L6
.L22:
	ldr	r3, [r5, #4]
	sub	r9, r9, #2
	add	r3, r3, #2
	cmp	r9, #1
	add	r6, r6, #2
	add	r4, r4, #8
	str	r3, [r5, #4]
	bls	.L5
.L6:
	ldmdb	r4, {r2, r3}
	mov	r0, r8
	orr	r2, r2, r3, lsl #8
	lsr	r1, r6, #1
	str	r2, [sp]
	bl	mv88e6xxx_g2_eeprom_write16
	cmp	r0, #0
	mov	r10, r4
	beq	.L22
.L10:
	mov	r7, r0
.L1:
	ldr	r3, .L24+4
	ldr	r2, [r3]
	ldr	r3, [sp, #4]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L23
	mov	r0, r7
	add	sp, sp, #8
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L20:
	ldr	r3, .L24+12
	ldr	r7, [r3]
	rsb	r7, r7, #0
	b	.L1
.L5:
	cmp	r9, #0
	beq	.L1
	lsr	r6, r6, #1
	mov	r2, sp
	mov	r1, r6
	mov	r0, r8
	bl	mv88e6xxx_g2_eeprom_read16
	subs	r7, r0, #0
	bne	.L1
	ldr	r2, [sp]
	ldr	r3, [r10]
	and	r2, r2, #65280
	orr	r2, r2, r3
	mov	r1, r6
	mov	r0, r8
	str	r2, [sp]
	bl	mv88e6xxx_g2_eeprom_write16
	subs	r7, r0, #0
	ldreq	r3, [r5, #4]
	addeq	r3, r3, #1
	streq	r3, [r5, #4]
	b	.L1
.L21:
	lsr	r4, r6, #1
	mov	r1, r4
	mov	r2, sp
	mov	r0, r8
	bl	mv88e6xxx_g2_eeprom_read16
	cmp	r0, #0
	bne	.L10
	ldrb	r2, [sp]	@ zero_extendqisi2
	ldr	r3, [r10]
	mov	r1, r4
	orr	r2, r2, r3, lsl #8
	mov	r0, r8
	str	r2, [sp]
	bl	mv88e6xxx_g2_eeprom_write16
	cmp	r0, #0
	bne	.L10
	ldr	r3, [r5, #4]
	add	r10, r10, #4
	add	r3, r3, #1
	add	r6, r6, #1
	sub	r9, r9, #1
	str	r3, [r5, #4]
	b	.L4
.L23:
	bl	__stack_chk_fail
.L25:
	.align	2
.L24:
	.word	MV88E6XXX_G2_EEPROM_CMD
	.word	.LC0
	.word	MV88E6XXX_G2_EEPROM_CMD_WRITE_EN
	.word	EROFS
	.size	mv88e6xxx_g2_set_eeprom16, .-mv88e6xxx_g2_set_eeprom16
	.comm	MV88E6XXX_G2_EEPROM_CMD_WRITE_EN,4,4
	.comm	MV88E6XXX_G2_EEPROM_CMD,4,4
	.comm	EROFS,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
