	.file	"extr_if_bge.c_bge_eeprom_getbyte.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"EEPROM read timed out\n"
	.text
	.p2align 4
	.type	bge_eeprom_getbyte, @function
bge_eeprom_getbyte:
.LFB0:
	.cfi_startproc
	endbr64
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	mov	r12, rdx
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	mov	ebx, esi
	sub	rsp, 8
	.cfi_def_cfa_offset 48
	mov	edx, DWORD PTR BGE_MLC_AUTO_EEPROM[rip]
	mov	esi, DWORD PTR BGE_MISC_LOCAL_CTL[rip]
	call	BGE_SETBIT@PLT
	mov	edi, DWORD PTR BGE_HALFCLK_384SCL[rip]
	call	BGE_EEHALFCLK@PLT
	mov	esi, DWORD PTR BGE_EE_ADDR[rip]
	or	eax, DWORD PTR BGE_EEADDR_RESET[rip]
	mov	rdi, rbp
	mov	edx, eax
	call	CSR_WRITE_4@PLT
	mov	edi, 20
	call	DELAY@PLT
	mov	edx, DWORD PTR BGE_EE_READCMD[rip]
	mov	esi, DWORD PTR BGE_EE_ADDR[rip]
	mov	rdi, rbp
	or	edx, ebx
	call	CSR_WRITE_4@PLT
	mov	eax, DWORD PTR BGE_TIMEOUT[rip]
	test	eax, eax
	jle	.L2
	xor	r13d, r13d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	mov	eax, DWORD PTR BGE_TIMEOUT[rip]
	add	r13d, 1
	lea	eax, [rax+rax*4]
	add	eax, eax
	cmp	eax, r13d
	jle	.L4
.L5:
	mov	edi, 10
	call	DELAY@PLT
	mov	esi, DWORD PTR BGE_EE_ADDR[rip]
	mov	rdi, rbp
	call	CSR_READ_4@PLT
	test	DWORD PTR BGE_EEADDR_DONE[rip], eax
	je	.L3
	mov	eax, DWORD PTR BGE_TIMEOUT[rip]
	lea	eax, [rax+rax*4]
	add	eax, eax
.L4:
	cmp	r13d, eax
	je	.L11
	mov	esi, DWORD PTR BGE_EE_DATA[rip]
	mov	rdi, rbp
	call	CSR_READ_4@PLT
	mov	edx, ebx
	sar	edx, 31
	shr	edx, 30
	lea	ecx, [rbx+rdx]
	and	ecx, 3
	sub	ecx, edx
	sal	ecx, 3
	sar	eax, cl
	and	eax, 255
	mov	DWORD PTR [r12], eax
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xor	eax, eax
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	.cfi_restore_state
	mov	edi, DWORD PTR 0[rbp]
	lea	rsi, .LC0[rip]
	call	device_printf@PLT
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	mov	eax, 1
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
.L2:
	.cfi_restore_state
	lea	eax, [rax+rax*4]
	xor	r13d, r13d
	add	eax, eax
	jmp	.L4
	.cfi_endproc
.LFE0:
	.size	bge_eeprom_getbyte, .-bge_eeprom_getbyte
	.comm	BGE_TIMEOUT,4,4
	.comm	BGE_MLC_AUTO_EEPROM,4,4
	.comm	BGE_MISC_LOCAL_CTL,4,4
	.comm	BGE_HALFCLK_384SCL,4,4
	.comm	BGE_EE_READCMD,4,4
	.comm	BGE_EE_DATA,4,4
	.comm	BGE_EE_ADDR,4,4
	.comm	BGE_EEADDR_RESET,4,4
	.comm	BGE_EEADDR_DONE,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_if_bge.c_bge_eeprom_getbyte.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"EEPROM read timed out\012\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	bge_eeprom_getbyte, %function
bge_eeprom_getbyte:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	ldr	r3, .L12
	mov	r8, r2
	ldr	r2, .L12+4
	mov	r6, r1
	ldr	r2, [r2]
	ldr	r1, [r3]
	mov	r4, r0
	bl	BGE_SETBIT
	ldr	r3, .L12+8
	ldr	r5, .L12+12
	ldr	r0, [r3]
	ldr	r7, [r5]
	bl	BGE_EEHALFCLK
	mov	r2, r0
	ldr	r3, .L12+16
	mov	r1, r7
	ldr	r3, [r3]
	mov	r0, r4
	orr	r2, r2, r3
	bl	CSR_WRITE_4
	mov	r0, #20
	bl	DELAY
	ldr	r3, .L12+20
	ldr	r7, .L12+24
	ldr	r2, [r3]
	mov	r0, r4
	ldr	r1, [r5]
	orr	r2, r6, r2
	bl	CSR_WRITE_4
	ldr	r3, [r7]
	mov	r9, #0
	cmp	r3, #0
	ble	.L2
	ldr	r10, .L12+28
	b	.L5
.L3:
	add	r3, r3, r3, lsl #2
	add	r9, r9, #1
	cmp	r9, r3, lsl #1
	lsl	r3, r3, #1
	bge	.L4
.L5:
	mov	r0, #10
	bl	DELAY
	mov	r0, r4
	ldr	r1, [r5]
	bl	CSR_READ_4
	ldr	r3, [r10]
	tst	r0, r3
	ldr	r3, [r7]
	beq	.L3
.L2:
	add	r3, r3, r3, lsl #2
	lsl	r3, r3, #1
.L4:
	cmp	r9, r3
	beq	.L11
	ldr	r3, .L12+32
	mov	r0, r4
	ldr	r1, [r3]
	bl	CSR_READ_4
	mov	r3, r0
	mov	r0, #0
	subs	r2, r0, r6
	and	r2, r2, #3
	and	r6, r6, #3
	rsbpl	r6, r2, #0
	lsl	r6, r6, #3
	asr	r6, r3, r6
	and	r6, r6, #255
	str	r6, [r8]
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L11:
	ldr	r0, [r4]
	ldr	r1, .L12+36
	bl	device_printf
	mov	r0, #1
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L13:
	.align	2
.L12:
	.word	BGE_MISC_LOCAL_CTL
	.word	BGE_MLC_AUTO_EEPROM
	.word	BGE_HALFCLK_384SCL
	.word	BGE_EE_ADDR
	.word	BGE_EEADDR_RESET
	.word	BGE_EE_READCMD
	.word	BGE_TIMEOUT
	.word	BGE_EEADDR_DONE
	.word	BGE_EE_DATA
	.word	.LC0
	.size	bge_eeprom_getbyte, .-bge_eeprom_getbyte
	.comm	BGE_TIMEOUT,4,4
	.comm	BGE_MLC_AUTO_EEPROM,4,4
	.comm	BGE_MISC_LOCAL_CTL,4,4
	.comm	BGE_HALFCLK_384SCL,4,4
	.comm	BGE_EE_READCMD,4,4
	.comm	BGE_EE_DATA,4,4
	.comm	BGE_EE_ADDR,4,4
	.comm	BGE_EEADDR_RESET,4,4
	.comm	BGE_EEADDR_DONE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
