	.file	"extr_ksz8795.c_ksz8795_w_phy.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	ksz8795_w_phy, @function
ksz8795_w_phy:
.LFB0:
	.cfi_startproc
	endbr64
	push	r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	movsx	r12, esi
	push	rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	mov	ebx, ecx
	sub	rsp, 32
	.cfi_def_cfa_offset 64
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 24[rsp], rax
	xor	eax, eax
	cmp	edx, 128
	je	.L2
	cmp	edx, 129
	jne	.L1
	mov	edx, DWORD PTR P_LOCAL_CTRL[rip]
	lea	rcx, 16[rsp]
	mov	rsi, r12
	call	ksz_pread8@PLT
	mov	r9, QWORD PTR PORT_AUTO_NEG_SYM_PAUSE[rip]
	mov	r8, QWORD PTR PORT_AUTO_NEG_100BTX_FD[rip]
	mov	rsi, QWORD PTR PORT_AUTO_NEG_100BTX[rip]
	mov	rdx, QWORD PTR PORT_AUTO_NEG_10BT_FD[rip]
	mov	rcx, r9
	mov	rax, QWORD PTR PORT_AUTO_NEG_10BT[rip]
	mov	rdi, QWORD PTR 16[rsp]
	or	rcx, r8
	or	rcx, rsi
	or	rcx, rdx
	or	rcx, rax
	not	rcx
	and	rcx, rdi
	or	r9, rcx
	test	DWORD PTR PHY_AUTO_NEG_SYM_PAUSE[rip], ebx
	cmovne	rcx, r9
	or	r8, rcx
	test	DWORD PTR PHY_AUTO_NEG_100BTX_FD[rip], ebx
	cmovne	rcx, r8
	or	rsi, rcx
	test	DWORD PTR PHY_AUTO_NEG_100BTX[rip], ebx
	cmovne	rcx, rsi
	or	rdx, rcx
	test	DWORD PTR PHY_AUTO_NEG_10BT_FD[rip], ebx
	cmovne	rcx, rdx
	or	rax, rcx
	test	DWORD PTR PHY_AUTO_NEG_10BT[rip], ebx
	cmovne	rcx, rax
	cmp	rcx, rdi
	jne	.L50
	.p2align 4,,10
	.p2align 3
.L1:
	mov	rax, QWORD PTR 24[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L51
	add	rsp, 32
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	pop	rbx
	.cfi_def_cfa_offset 24
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	.cfi_restore_state
	test	DWORD PTR PHY_RESET[rip], ecx
	jne	.L1
	mov	edx, DWORD PTR P_SPEED_STATUS[rip]
	lea	rcx, 8[rsp]
	mov	rsi, r12
	call	ksz_pread8@PLT
	mov	rax, QWORD PTR 8[rsp]
	test	DWORD PTR PHY_HP_MDIX[rip], ebx
	je	.L6
	mov	rcx, QWORD PTR PORT_HP_MDIX[rip]
	or	rcx, rax
.L7:
	cmp	rcx, rax
	je	.L8
	mov	edx, DWORD PTR P_SPEED_STATUS[rip]
	mov	rsi, r12
	mov	rdi, rbp
	call	ksz_pwrite8@PLT
.L8:
	mov	edx, DWORD PTR P_FORCE_CTRL[rip]
	lea	rcx, 16[rsp]
	mov	rsi, r12
	mov	rdi, rbp
	call	ksz_pread8@PLT
	mov	rdx, QWORD PTR 16[rsp]
	test	DWORD PTR PHY_AUTO_NEG_ENABLE[rip], ebx
	jne	.L9
	mov	rcx, QWORD PTR PORT_AUTO_NEG_DISABLE[rip]
	or	rcx, rdx
.L10:
	mov	rax, QWORD PTR 0[rbp]
	mov	eax, DWORD PTR [rax+r12*4]
	test	eax, eax
	je	.L11
	or	rcx, QWORD PTR PORT_AUTO_NEG_DISABLE[rip]
.L11:
	mov	rax, QWORD PTR PORT_FORCE_100_MBIT[rip]
	mov	rsi, rcx
	or	rsi, rax
	not	rax
	and	rax, rcx
	test	DWORD PTR PHY_SPEED_100MBIT[rip], ebx
	cmove	rsi, rax
	mov	rax, QWORD PTR PORT_FORCE_FULL_DUPLEX[rip]
	mov	rcx, rsi
	or	rsi, rax
	not	rax
	and	rcx, rax
	test	DWORD PTR PHY_FULL_DUPLEX[rip], ebx
	cmovne	rcx, rsi
	cmp	rcx, rdx
	je	.L16
	mov	edx, DWORD PTR P_FORCE_CTRL[rip]
	mov	rsi, r12
	mov	rdi, rbp
	call	ksz_pwrite8@PLT
.L16:
	mov	edx, DWORD PTR P_NEG_RESTART_CTRL[rip]
	mov	rsi, r12
	mov	rcx, rsp
	mov	rdi, rbp
	call	ksz_pread8@PLT
	mov	rsi, QWORD PTR [rsp]
	test	DWORD PTR PHY_LED_DISABLE[rip], ebx
	je	.L17
	mov	rcx, QWORD PTR PORT_LED_OFF[rip]
	or	rcx, rsi
.L18:
	mov	rax, QWORD PTR PORT_TX_DISABLE[rip]
	mov	rdx, rcx
	or	rdx, rax
	not	rax
	and	rax, rcx
	test	DWORD PTR PHY_TRANSMIT_DISABLE[rip], ebx
	cmove	rdx, rax
	mov	rcx, rdx
	mov	rdx, QWORD PTR PORT_AUTO_NEG_RESTART[rip]
	mov	rax, rcx
	or	rax, rdx
	not	rdx
	and	rdx, rcx
	test	DWORD PTR PHY_AUTO_NEG_RESTART[rip], ebx
	cmove	rax, rdx
	mov	rcx, rax
	mov	rax, QWORD PTR PORT_POWER_DOWN[rip]
	mov	rdx, rcx
	or	rdx, rax
	not	rax
	and	rax, rcx
	test	DWORD PTR PHY_POWER_DOWN[rip], ebx
	cmove	rdx, rax
	mov	rcx, rdx
	mov	rdx, QWORD PTR PORT_AUTO_MDIX_DISABLE[rip]
	mov	rax, rcx
	or	rax, rdx
	not	rdx
	and	rdx, rcx
	test	DWORD PTR PHY_AUTO_MDIX_DISABLE[rip], ebx
	cmove	rax, rdx
	mov	rcx, rax
	mov	rax, QWORD PTR PORT_FORCE_MDIX[rip]
	mov	rdx, rcx
	or	rdx, rax
	not	rax
	and	rax, rcx
	test	DWORD PTR PHY_FORCE_MDIX[rip], ebx
	cmove	rdx, rax
	mov	rax, QWORD PTR PORT_PHY_LOOPBACK[rip]
	mov	rcx, rdx
	or	rdx, rax
	not	rax
	and	rcx, rax
	test	DWORD PTR PHY_LOOPBACK[rip], ebx
	cmovne	rcx, rdx
	cmp	rcx, rsi
	je	.L1
	mov	edx, DWORD PTR P_NEG_RESTART_CTRL[rip]
	mov	rsi, r12
	mov	rdi, rbp
	call	ksz_pwrite8@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L50:
	mov	edx, DWORD PTR P_LOCAL_CTRL[rip]
	mov	rsi, r12
	mov	rdi, rbp
	call	ksz_pwrite8@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L9:
	mov	rax, QWORD PTR PORT_AUTO_NEG_DISABLE[rip]
	not	rax
	and	rax, rdx
	mov	rcx, rax
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L17:
	mov	rax, QWORD PTR PORT_LED_OFF[rip]
	not	rax
	and	rax, rsi
	mov	rcx, rax
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L6:
	mov	rcx, QWORD PTR PORT_HP_MDIX[rip]
	not	rcx
	and	rcx, rax
	jmp	.L7
.L51:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	ksz8795_w_phy, .-ksz8795_w_phy
	.comm	P_SPEED_STATUS,4,4
	.comm	P_NEG_RESTART_CTRL,4,4
	.comm	P_LOCAL_CTRL,4,4
	.comm	P_FORCE_CTRL,4,4
	.comm	PORT_TX_DISABLE,8,8
	.comm	PORT_POWER_DOWN,8,8
	.comm	PORT_PHY_LOOPBACK,8,8
	.comm	PORT_LED_OFF,8,8
	.comm	PORT_HP_MDIX,8,8
	.comm	PORT_FORCE_MDIX,8,8
	.comm	PORT_FORCE_FULL_DUPLEX,8,8
	.comm	PORT_FORCE_100_MBIT,8,8
	.comm	PORT_AUTO_NEG_SYM_PAUSE,8,8
	.comm	PORT_AUTO_NEG_RESTART,8,8
	.comm	PORT_AUTO_NEG_DISABLE,8,8
	.comm	PORT_AUTO_NEG_10BT_FD,8,8
	.comm	PORT_AUTO_NEG_10BT,8,8
	.comm	PORT_AUTO_NEG_100BTX_FD,8,8
	.comm	PORT_AUTO_NEG_100BTX,8,8
	.comm	PORT_AUTO_MDIX_DISABLE,8,8
	.comm	PHY_TRANSMIT_DISABLE,4,4
	.comm	PHY_SPEED_100MBIT,4,4
	.comm	PHY_RESET,4,4
	.comm	PHY_POWER_DOWN,4,4
	.comm	PHY_LOOPBACK,4,4
	.comm	PHY_LED_DISABLE,4,4
	.comm	PHY_HP_MDIX,4,4
	.comm	PHY_FULL_DUPLEX,4,4
	.comm	PHY_FORCE_MDIX,4,4
	.comm	PHY_AUTO_NEG_SYM_PAUSE,4,4
	.comm	PHY_AUTO_NEG_RESTART,4,4
	.comm	PHY_AUTO_NEG_ENABLE,4,4
	.comm	PHY_AUTO_NEG_10BT_FD,4,4
	.comm	PHY_AUTO_NEG_10BT,4,4
	.comm	PHY_AUTO_NEG_100BTX_FD,4,4
	.comm	PHY_AUTO_NEG_100BTX,4,4
	.comm	PHY_AUTO_MDIX_DISABLE,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_ksz8795.c_ksz8795_w_phy.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	ksz8795_w_phy, %function
ksz8795_w_phy:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, lr}
	mov	r4, r3
	ldr	r3, .L61
	sub	sp, sp, #20
	cmp	r2, #128
	ldr	r3, [r3]
	str	r3, [sp, #12]
	mov	r3,#0
	mov	r5, r0
	mov	r6, r1
	beq	.L2
	cmp	r2, #129
	bne	.L1
	ldr	r7, .L61+4
	add	r3, sp, #8
	ldr	r2, [r7]
	bl	ksz_pread8
	ldr	r1, .L61+8
	ldr	r2, .L61+12
	ldr	r3, .L61+16
	ldr	lr, [r1]
	ldr	ip, [r2]
	ldr	r1, .L61+20
	ldr	r0, [r3]
	ldr	r8, .L61+24
	ldr	r1, [r1]
	orr	r3, lr, ip
	ldr	r2, .L61+28
	ldr	r8, [r8]
	orr	r3, r3, r0
	ldr	r9, [r2]
	orr	r3, r3, r1
	ldr	r2, [sp, #8]
	orr	r3, r3, r8
	bic	r3, r2, r3
	tst	r4, r9
	orrne	r3, r3, lr
	ldr	lr, .L61+32
	ldr	lr, [lr]
	tst	r4, lr
	orrne	r3, r3, ip
	ldr	ip, .L61+36
	ldr	ip, [ip]
	tst	r4, ip
	orrne	r3, r3, r0
	ldr	r0, .L61+40
	ldr	r0, [r0]
	tst	r4, r0
	orrne	r3, r3, r1
	ldr	r1, .L61+44
	ldr	r1, [r1]
	tst	r4, r1
	orrne	r3, r3, r8
.L36:
	cmp	r3, r2
	beq	.L1
	mov	r1, r6
	mov	r0, r5
	ldr	r2, [r7]
	bl	ksz_pwrite8
.L1:
	ldr	r3, .L61
	ldr	r2, [r3]
	ldr	r3, [sp, #12]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L60
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, pc}
.L2:
	ldr	r3, .L61+48
	ldr	r3, [r3]
	tst	r4, r3
	bne	.L1
	ldr	r7, .L61+52
	add	r3, sp, #4
	ldr	r2, [r7]
	bl	ksz_pread8
	ldr	r3, .L61+56
	ldr	r2, [sp, #4]
	ldr	r3, [r3]
	tst	r4, r3
	ldr	r3, .L61+60
	ldr	r3, [r3]
	orrne	r3, r2, r3
	biceq	r3, r2, r3
	cmp	r3, r2
	beq	.L8
	mov	r1, r6
	mov	r0, r5
	ldr	r2, [r7]
	bl	ksz_pwrite8
.L8:
	ldr	r7, .L61+64
	mov	r1, r6
	ldr	r2, [r7]
	add	r3, sp, #8
	mov	r0, r5
	bl	ksz_pread8
	ldr	r3, .L61+68
	ldr	r1, .L61+72
	ldr	r3, [r3]
	ldr	r0, [r5]
	tst	r4, r3
	ldr	r2, [sp, #8]
	ldr	r3, [r1]
	ldr	r0, [r0, r6, lsl #2]
	orreq	r3, r2, r3
	bicne	r3, r2, r3
	cmp	r0, #0
	ldrne	r1, [r1]
	ldr	r0, .L61+76
	orrne	r3, r3, r1
	ldr	r1, .L61+80
	ldr	r0, [r0]
	ldr	r1, [r1]
	tst	r4, r0
	ldr	r0, .L61+84
	orrne	r3, r3, r1
	biceq	r3, r3, r1
	ldr	r1, .L61+88
	ldr	r0, [r0]
	ldr	r1, [r1]
	tst	r4, r0
	orrne	r3, r3, r1
	biceq	r3, r3, r1
	cmp	r3, r2
	beq	.L16
	mov	r1, r6
	mov	r0, r5
	ldr	r2, [r7]
	bl	ksz_pwrite8
.L16:
	ldr	r7, .L61+92
	mov	r3, sp
	mov	r1, r6
	ldr	r2, [r7]
	mov	r0, r5
	bl	ksz_pread8
	ldr	r3, .L61+96
	ldr	r0, .L61+100
	ldr	r3, [r3]
	ldr	r1, .L61+104
	tst	r4, r3
	ldr	r3, .L61+108
	ldr	r2, [sp]
	ldr	r3, [r3]
	ldr	r0, [r0]
	ldr	r1, [r1]
	orrne	r3, r2, r3
	biceq	r3, r2, r3
	tst	r4, r0
	ldr	r0, .L61+112
	orrne	r3, r3, r1
	biceq	r3, r3, r1
	ldr	r1, .L61+116
	ldr	r0, [r0]
	ldr	r1, [r1]
	tst	r4, r0
	ldr	r0, .L61+120
	orrne	r3, r3, r1
	biceq	r3, r3, r1
	ldr	r1, .L61+124
	ldr	r0, [r0]
	ldr	r1, [r1]
	tst	r4, r0
	ldr	r0, .L61+128
	orrne	r3, r3, r1
	biceq	r3, r3, r1
	ldr	r1, .L61+132
	ldr	r0, [r0]
	ldr	r1, [r1]
	tst	r4, r0
	ldr	r0, .L61+136
	orrne	r3, r3, r1
	biceq	r3, r3, r1
	ldr	r1, .L61+140
	ldr	r0, [r0]
	ldr	r1, [r1]
	tst	r4, r0
	ldr	r0, .L61+144
	orrne	r3, r3, r1
	biceq	r3, r3, r1
	ldr	r1, .L61+148
	ldr	r0, [r0]
	ldr	r1, [r1]
	tst	r4, r0
	orrne	r3, r3, r1
	biceq	r3, r3, r1
	b	.L36
.L60:
	bl	__stack_chk_fail
.L62:
	.align	2
.L61:
	.word	.LC0
	.word	P_LOCAL_CTRL
	.word	PORT_AUTO_NEG_SYM_PAUSE
	.word	PORT_AUTO_NEG_100BTX_FD
	.word	PORT_AUTO_NEG_100BTX
	.word	PORT_AUTO_NEG_10BT_FD
	.word	PORT_AUTO_NEG_10BT
	.word	PHY_AUTO_NEG_SYM_PAUSE
	.word	PHY_AUTO_NEG_100BTX_FD
	.word	PHY_AUTO_NEG_100BTX
	.word	PHY_AUTO_NEG_10BT_FD
	.word	PHY_AUTO_NEG_10BT
	.word	PHY_RESET
	.word	P_SPEED_STATUS
	.word	PHY_HP_MDIX
	.word	PORT_HP_MDIX
	.word	P_FORCE_CTRL
	.word	PHY_AUTO_NEG_ENABLE
	.word	PORT_AUTO_NEG_DISABLE
	.word	PHY_SPEED_100MBIT
	.word	PORT_FORCE_100_MBIT
	.word	PHY_FULL_DUPLEX
	.word	PORT_FORCE_FULL_DUPLEX
	.word	P_NEG_RESTART_CTRL
	.word	PHY_LED_DISABLE
	.word	PHY_TRANSMIT_DISABLE
	.word	PORT_TX_DISABLE
	.word	PORT_LED_OFF
	.word	PHY_AUTO_NEG_RESTART
	.word	PORT_AUTO_NEG_RESTART
	.word	PHY_POWER_DOWN
	.word	PORT_POWER_DOWN
	.word	PHY_AUTO_MDIX_DISABLE
	.word	PORT_AUTO_MDIX_DISABLE
	.word	PHY_FORCE_MDIX
	.word	PORT_FORCE_MDIX
	.word	PHY_LOOPBACK
	.word	PORT_PHY_LOOPBACK
	.size	ksz8795_w_phy, .-ksz8795_w_phy
	.comm	P_SPEED_STATUS,4,4
	.comm	P_NEG_RESTART_CTRL,4,4
	.comm	P_LOCAL_CTRL,4,4
	.comm	P_FORCE_CTRL,4,4
	.comm	PORT_TX_DISABLE,4,4
	.comm	PORT_POWER_DOWN,4,4
	.comm	PORT_PHY_LOOPBACK,4,4
	.comm	PORT_LED_OFF,4,4
	.comm	PORT_HP_MDIX,4,4
	.comm	PORT_FORCE_MDIX,4,4
	.comm	PORT_FORCE_FULL_DUPLEX,4,4
	.comm	PORT_FORCE_100_MBIT,4,4
	.comm	PORT_AUTO_NEG_SYM_PAUSE,4,4
	.comm	PORT_AUTO_NEG_RESTART,4,4
	.comm	PORT_AUTO_NEG_DISABLE,4,4
	.comm	PORT_AUTO_NEG_10BT_FD,4,4
	.comm	PORT_AUTO_NEG_10BT,4,4
	.comm	PORT_AUTO_NEG_100BTX_FD,4,4
	.comm	PORT_AUTO_NEG_100BTX,4,4
	.comm	PORT_AUTO_MDIX_DISABLE,4,4
	.comm	PHY_TRANSMIT_DISABLE,4,4
	.comm	PHY_SPEED_100MBIT,4,4
	.comm	PHY_RESET,4,4
	.comm	PHY_POWER_DOWN,4,4
	.comm	PHY_LOOPBACK,4,4
	.comm	PHY_LED_DISABLE,4,4
	.comm	PHY_HP_MDIX,4,4
	.comm	PHY_FULL_DUPLEX,4,4
	.comm	PHY_FORCE_MDIX,4,4
	.comm	PHY_AUTO_NEG_SYM_PAUSE,4,4
	.comm	PHY_AUTO_NEG_RESTART,4,4
	.comm	PHY_AUTO_NEG_ENABLE,4,4
	.comm	PHY_AUTO_NEG_10BT_FD,4,4
	.comm	PHY_AUTO_NEG_10BT,4,4
	.comm	PHY_AUTO_NEG_100BTX_FD,4,4
	.comm	PHY_AUTO_NEG_100BTX,4,4
	.comm	PHY_AUTO_MDIX_DISABLE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
