	.file	"extr_ar9003_eeprom.c_ar9300_eeprom_restore_internal.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"Trying EEPROM access at Address 0x%04x\n"
	.align 8
.LC1:
	.string	"Trying OTP access at Address 0x%04x\n"
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"Found valid EEPROM data\n"
	.section	.rodata.str1.8
	.align 8
.LC3:
	.string	"Found block at %x: code=%d ref=%d length=%d major=%d minor=%d\n"
	.section	.rodata.str1.1
.LC4:
	.string	"Skipping bad header\n"
.LC5:
	.string	"checksum %x %x\n"
	.section	.rodata.str1.8
	.align 8
.LC6:
	.string	"skipping block with bad checksum\n"
	.text
	.p2align 4
	.type	ar9300_eeprom_restore_internal, @function
ar9300_eeprom_restore_internal:
.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
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 88
	.cfi_def_cfa_offset 144
	mov	QWORD PTR 32[rsp], rsi
	mov	DWORD PTR 44[rsp], edx
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 72[rsp], rax
	xor	eax, eax
	call	ath9k_hw_common@PLT
	mov	rdi, r13
	mov	r15, rax
	call	ath9k_hw_use_flash@PLT
	test	rax, rax
	je	.L7
	mov	rbx, QWORD PTR 32[rsp]
	mov	edx, DWORD PTR 44[rsp]
	mov	rdi, r13
	mov	rsi, rbx
	call	ar9300_eeprom_restore_flash@PLT
	mov	eax, DWORD PTR [rbx]
	test	eax, eax
	je	.L7
	xor	r12d, r12d
	cmp	eax, 255
	je	.L7
	.p2align 4,,10
	.p2align 3
.L1:
	mov	rax, QWORD PTR 72[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L44
	add	rsp, 88
	.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
.L7:
	.cfi_restore_state
	mov	esi, DWORD PTR GFP_KERNEL[rip]
	mov	edi, 2048
	call	kzalloc@PLT
	mov	rbp, rax
	test	rax, rax
	je	.L45
	mov	edx, DWORD PTR 44[rsp]
	mov	rdi, QWORD PTR 32[rsp]
	lea	rsi, ar9300_default[rip]
	call	memcpy@PLT
	mov	rdi, r13
	call	AR_SREV_9485@PLT
	mov	r12d, DWORD PTR AR9300_BASE_ADDR_4K[rip]
	test	rax, rax
	je	.L46
.L9:
	mov	esi, DWORD PTR EEPROM[rip]
	mov	ecx, r12d
	mov	rdi, r15
	xor	eax, eax
	lea	rdx, .LC0[rip]
	call	ath_dbg@PLT
	mov	rbx, QWORD PTR ar9300_read_eeprom@GOTPCREL[rip]
	mov	edx, r12d
	mov	rdi, r13
	mov	rsi, rbx
	call	ar9300_check_eeprom_header@PLT
	mov	QWORD PTR 16[rsp], rbx
	test	rax, rax
	je	.L47
.L11:
	mov	esi, DWORD PTR EEPROM[rip]
	mov	rdi, r15
	xor	eax, eax
	xor	r14d, r14d
	lea	rdx, .LC2[rip]
	call	ath_dbg@PLT
	lea	rax, 68[rsp]
	mov	QWORD PTR 24[rsp], rax
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L19:
	mov	esi, DWORD PTR EEPROM[rip]
	lea	rdx, .LC6[rip]
	mov	rdi, r15
	xor	eax, eax
	call	ath_dbg@PLT
.L20:
	add	ebx, DWORD PTR COMP_HDR_LEN[rip]
	add	ebx, DWORD PTR COMP_CKSUM_LEN[rip]
	sub	r12d, ebx
.L15:
	add	r14d, 1
	cmp	r14d, 100
	je	.L13
.L21:
	mov	ecx, DWORD PTR COMP_HDR_LEN[rip]
	mov	rdx, rbp
	mov	esi, r12d
	mov	rdi, r13
	mov	rax, QWORD PTR 16[rsp]
	call	rax
	test	eax, eax
	je	.L12
	mov	rdi, rbp
	call	ar9300_check_header@PLT
	test	eax, eax
	je	.L13
	mov	r9, QWORD PTR 24[rsp]
	lea	rcx, 60[rsp]
	lea	rdx, 56[rsp]
	mov	rdi, rbp
	lea	rsi, 52[rsp]
	lea	r8, 64[rsp]
	call	ar9300_comp_hdr_unpack@PLT
	sub	rsp, 8
	.cfi_def_cfa_offset 152
	mov	rdi, r15
	mov	ecx, r12d
	mov	eax, DWORD PTR 76[rsp]
	mov	esi, DWORD PTR EEPROM[rip]
	lea	rdx, .LC3[rip]
	push	rax
	.cfi_def_cfa_offset 160
	mov	eax, DWORD PTR 80[rsp]
	push	rax
	.cfi_def_cfa_offset 168
	mov	eax, DWORD PTR 84[rsp]
	push	rax
	.cfi_def_cfa_offset 176
	mov	r9d, DWORD PTR 88[rsp]
	xor	eax, eax
	mov	r8d, DWORD PTR 84[rsp]
	call	ath_dbg@PLT
	add	rsp, 32
	.cfi_def_cfa_offset 144
	mov	rdi, r13
	call	AR_SREV_9485@PLT
	test	rax, rax
	jne	.L14
	cmp	DWORD PTR 60[rsp], 1023
	jg	.L17
.L14:
	mov	rdi, r13
	call	AR_SREV_9485@PLT
	mov	ebx, DWORD PTR 60[rsp]
	test	rax, rax
	je	.L18
	cmp	ebx, DWORD PTR EEPROM_DATA_LEN_9485[rip]
	jg	.L17
.L18:
	mov	ecx, DWORD PTR COMP_HDR_LEN[rip]
	mov	rdx, rbp
	mov	esi, r12d
	mov	rdi, r13
	mov	rax, QWORD PTR 16[rsp]
	add	ecx, ebx
	add	ecx, DWORD PTR COMP_CKSUM_LEN[rip]
	call	rax
	movsx	rax, DWORD PTR COMP_HDR_LEN[rip]
	mov	esi, DWORD PTR 60[rsp]
	lea	rdi, 0[rbp+rax*4]
	call	ar9300_comp_cksum@PLT
	mov	DWORD PTR 12[rsp], eax
	mov	eax, DWORD PTR COMP_HDR_LEN[rip]
	add	eax, ebx
	cdqe
	lea	rdi, 0[rbp+rax*4]
	call	get_unaligned_le16@PLT
	mov	ecx, DWORD PTR 12[rsp]
	mov	esi, DWORD PTR EEPROM[rip]
	mov	rdi, r15
	mov	r8d, eax
	mov	DWORD PTR 40[rsp], eax
	lea	rdx, .LC5[rip]
	xor	eax, eax
	call	ath_dbg@PLT
	mov	r8d, DWORD PTR 40[rsp]
	cmp	DWORD PTR 12[rsp], r8d
	jne	.L19
	mov	eax, DWORD PTR 44[rsp]
	mov	r9, rbp
	mov	esi, r14d
	mov	rdi, r13
	push	rax
	.cfi_def_cfa_offset 152
	mov	eax, DWORD PTR 68[rsp]
	push	rax
	.cfi_def_cfa_offset 160
	mov	r8, QWORD PTR 48[rsp]
	mov	ecx, DWORD PTR 72[rsp]
	mov	edx, DWORD PTR 68[rsp]
	call	ar9300_compress_decision@PLT
	pop	rax
	.cfi_def_cfa_offset 152
	pop	rdx
	.cfi_def_cfa_offset 144
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L17:
	mov	esi, DWORD PTR EEPROM[rip]
	lea	rdx, .LC4[rip]
	mov	rdi, r15
	xor	eax, eax
	call	ath_dbg@PLT
	sub	r12d, DWORD PTR COMP_HDR_LEN[rip]
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L47:
	mov	r12d, DWORD PTR AR9300_BASE_ADDR_512[rip]
	mov	esi, DWORD PTR EEPROM[rip]
	lea	rdx, .LC0[rip]
	mov	rdi, r15
	mov	ecx, r12d
	call	ath_dbg@PLT
	mov	edx, r12d
	mov	rsi, rbx
	mov	rdi, r13
	call	ar9300_check_eeprom_header@PLT
	test	rax, rax
	jne	.L11
	mov	r12d, DWORD PTR AR9300_BASE_ADDR[rip]
	mov	esi, DWORD PTR EEPROM[rip]
	lea	rdx, .LC1[rip]
	mov	rdi, r15
	mov	ecx, r12d
	call	ath_dbg@PLT
	mov	rbx, QWORD PTR ar9300_read_otp@GOTPCREL[rip]
	mov	edx, r12d
	mov	rdi, r13
	mov	rsi, rbx
	call	ar9300_check_eeprom_header@PLT
	mov	QWORD PTR 16[rsp], rbx
	test	rax, rax
	jne	.L11
	mov	r12d, DWORD PTR AR9300_BASE_ADDR_512[rip]
	mov	esi, DWORD PTR EEPROM[rip]
	lea	rdx, .LC1[rip]
	mov	rdi, r15
	mov	ecx, r12d
	call	ath_dbg@PLT
	mov	edx, r12d
	mov	rsi, rbx
	mov	rdi, r13
	call	ar9300_check_eeprom_header@PLT
	test	rax, rax
	jne	.L11
	.p2align 4,,10
	.p2align 3
.L12:
	mov	rdi, rbp
	mov	r12d, -1
	call	kfree@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L13:
	mov	rdi, rbp
	call	kfree@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L45:
	mov	r12d, DWORD PTR ENOMEM[rip]
	neg	r12d
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L46:
	mov	rdi, r13
	call	AR_SREV_9330@PLT
	mov	r12d, DWORD PTR AR9300_BASE_ADDR_512[rip]
	test	rax, rax
	cmove	r12d, DWORD PTR AR9300_BASE_ADDR[rip]
	jmp	.L9
.L44:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	ar9300_eeprom_restore_internal, .-ar9300_eeprom_restore_internal
	.comm	ar9300_default,4,4
	.comm	MSTATE,4,4
	.comm	GFP_KERNEL,4,4
	.comm	ENOMEM,4,4
	.comm	EEPROM_DATA_LEN_9485,4,4
	.comm	EEPROM,4,4
	.comm	COMP_HDR_LEN,4,4
	.comm	COMP_CKSUM_LEN,4,4
	.comm	AR9300_BASE_ADDR_512,4,4
	.comm	AR9300_BASE_ADDR_4K,4,4
	.comm	AR9300_BASE_ADDR,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_ar9003_eeprom.c_ar9300_eeprom_restore_internal.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"Trying EEPROM access at Address 0x%04x\012\000"
	.align	2
.LC1:
	.ascii	"Trying OTP access at Address 0x%04x\012\000"
	.align	2
.LC2:
	.ascii	"Found valid EEPROM data\012\000"
	.align	2
.LC3:
	.ascii	"Found block at %x: code=%d ref=%d length=%d major=%"
	.ascii	"d minor=%d\012\000"
	.align	2
.LC4:
	.ascii	"Skipping bad header\012\000"
	.align	2
.LC5:
	.ascii	"checksum %x %x\012\000"
	.align	2
.LC6:
	.ascii	"skipping block with bad checksum\012\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC7:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	ar9300_eeprom_restore_internal, %function
ar9300_eeprom_restore_internal:
	@ args = 0, pretend = 0, frame = 48
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	ldr	r3, .L44
	sub	sp, sp, #76
	str	r1, [sp, #40]
	str	r2, [sp, #44]
	mov	r7, r0
	ldr	r3, [r3]
	str	r3, [sp, #68]
	mov	r3,#0
	bl	ath9k_hw_common
	mov	fp, r0
	mov	r0, r7
	bl	ath9k_hw_use_flash
	cmp	r0, #0
	beq	.L6
	ldr	r4, [sp, #40]
	mov	r0, r7
	mov	r1, r4
	ldr	r2, [sp, #44]
	bl	ar9300_eeprom_restore_flash
	ldr	r3, [r4]
	cmp	r3, #0
	cmpne	r3, #255
	bne	.L40
.L6:
	ldr	r3, .L44+4
	mov	r0, #2048
	ldr	r1, [r3]
	bl	kzalloc
	subs	r4, r0, #0
	beq	.L41
	ldr	r2, [sp, #44]
	ldr	r1, .L44+8
	ldr	r0, [sp, #40]
	bl	memcpy
	mov	r0, r7
	bl	AR_SREV_9485
	cmp	r0, #0
	beq	.L7
	ldr	r3, .L44+12
	ldr	r6, [r3]
.L8:
	ldr	r10, .L44+16
	mov	r3, r6
	ldr	r1, [r10]
	ldr	r2, .L44+20
	mov	r0, fp
	bl	ath_dbg
	mov	r2, r6
	mov	r0, r7
	ldr	r1, .L44+24
	bl	ar9300_check_eeprom_header
	cmp	r0, #0
	bne	.L24
	ldr	r5, .L44+28
	ldr	r2, .L44+20
	ldr	r6, [r5]
	ldr	r1, [r10]
	mov	r3, r6
	mov	r0, fp
	bl	ath_dbg
	mov	r2, r6
	mov	r0, r7
	ldr	r1, .L44+24
	bl	ar9300_check_eeprom_header
	cmp	r0, #0
	beq	.L42
.L24:
	ldr	r3, .L44+24
	str	r3, [sp, #28]
.L10:
	mov	r0, fp
	ldr	r2, .L44+32
	ldr	r1, [r10]
	bl	ath_dbg
	mov	r9, #0
	ldr	r8, .L44+36
	b	.L20
.L18:
	mov	r0, fp
	ldr	r2, .L44+40
	ldr	r1, [r10]
	bl	ath_dbg
.L19:
	ldr	r3, .L44+44
	ldr	r2, [r8]
	ldr	r3, [r3]
	add	r5, r5, r2
	add	r5, r5, r3
	sub	r6, r6, r5
.L14:
	add	r9, r9, #1
	cmp	r9, #100
	beq	.L12
.L20:
	mov	r2, r4
	mov	r1, r6
	mov	r0, r7
	ldr	r3, [r8]
	ldr	ip, [sp, #28]
	blx	ip
	cmp	r0, #0
	beq	.L11
	mov	r0, r4
	bl	ar9300_check_header
	cmp	r0, #0
	beq	.L12
	add	r2, sp, #64
	add	r3, sp, #60
	str	r2, [sp, #4]
	str	r3, [sp]
	add	r2, sp, #52
	add	r3, sp, #56
	add	r1, sp, #48
	mov	r0, r4
	bl	ar9300_comp_hdr_unpack
	ldr	ip, [sp, #64]
	ldr	r0, [sp, #60]
	ldr	r1, [sp, #56]
	ldr	r2, [sp, #52]
	ldr	r3, [sp, #48]
	str	ip, [sp, #16]
	str	r0, [sp, #12]
	str	r1, [sp, #8]
	str	r2, [sp, #4]
	ldr	r1, [r10]
	ldr	r2, .L44+48
	str	r3, [sp]
	mov	r0, fp
	mov	r3, r6
	bl	ath_dbg
	mov	r0, r7
	bl	AR_SREV_9485
	cmp	r0, #0
	bne	.L13
	ldr	r3, [sp, #56]
	cmp	r3, #1024
	bge	.L16
.L13:
	mov	r0, r7
	bl	AR_SREV_9485
	cmp	r0, #0
	ldr	r5, [sp, #56]
	beq	.L17
	ldr	r3, .L44+52
	ldr	r3, [r3]
	cmp	r5, r3
	bgt	.L16
.L17:
	ldr	r2, .L44+44
	ldr	r3, [r8]
	ldr	r2, [r2]
	add	r3, r5, r3
	add	r3, r3, r2
	ldr	ip, [sp, #28]
	mov	r2, r4
	mov	r1, r6
	mov	r0, r7
	blx	ip
	ldr	r0, [r8]
	ldr	r1, [sp, #56]
	add	r0, r4, r0, lsl #2
	bl	ar9300_comp_cksum
	ldr	r2, [r8]
	str	r0, [sp, #32]
	add	r0, r5, r2
	add	r0, r4, r0, lsl #2
	bl	get_unaligned_le16
	ldr	r3, [sp, #32]
	str	r0, [sp]
	str	r0, [sp, #32]
	ldr	r2, .L44+56
	mov	r0, fp
	ldr	r1, [r10]
	str	r3, [sp, #36]
	bl	ath_dbg
	ldr	r0, [sp, #32]
	ldr	r3, [sp, #36]
	cmp	r3, r0
	bne	.L18
	ldr	r2, [sp, #44]
	ldr	r3, [sp, #56]
	str	r2, [sp, #12]
	ldr	r2, [sp, #40]
	str	r3, [sp, #8]
	str	r2, [sp]
	mov	r1, r9
	mov	r0, r7
	ldr	r3, [sp, #52]
	ldr	r2, [sp, #48]
	str	r4, [sp, #4]
	bl	ar9300_compress_decision
	b	.L19
.L16:
	mov	r0, fp
	ldr	r2, .L44+60
	ldr	r1, [r10]
	bl	ath_dbg
	ldr	r3, [r8]
	sub	r6, r6, r3
	b	.L14
.L12:
	mov	r0, r4
	bl	kfree
.L1:
	ldr	r3, .L44
	ldr	r2, [r3]
	ldr	r3, [sp, #68]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L43
	mov	r0, r6
	add	sp, sp, #76
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L41:
	ldr	r3, .L44+64
	ldr	r6, [r3]
	rsb	r6, r6, #0
	b	.L1
.L11:
	mov	r0, r4
	bl	kfree
	mvn	r6, #0
	b	.L1
.L7:
	mov	r0, r7
	bl	AR_SREV_9330
	cmp	r0, #0
	ldrne	r3, .L44+28
	ldreq	r3, .L44+68
	ldr	r6, [r3]
	b	.L8
.L40:
	mov	r6, #0
	b	.L1
.L42:
	ldr	r3, .L44+68
	ldr	r2, .L44+72
	ldr	r6, [r3]
	ldr	r1, [r10]
	mov	r3, r6
	mov	r0, fp
	bl	ath_dbg
	mov	r2, r6
	mov	r0, r7
	ldr	r1, .L44+76
	bl	ar9300_check_eeprom_header
	cmp	r0, #0
	bne	.L25
	ldr	r6, [r5]
	ldr	r2, .L44+72
	mov	r3, r6
	ldr	r1, [r10]
	mov	r0, fp
	bl	ath_dbg
	mov	r2, r6
	mov	r0, r7
	ldr	r1, .L44+76
	bl	ar9300_check_eeprom_header
	cmp	r0, #0
	beq	.L11
.L25:
	ldr	r3, .L44+76
	str	r3, [sp, #28]
	b	.L10
.L43:
	bl	__stack_chk_fail
.L45:
	.align	2
.L44:
	.word	.LC7
	.word	GFP_KERNEL
	.word	ar9300_default
	.word	AR9300_BASE_ADDR_4K
	.word	EEPROM
	.word	.LC0
	.word	ar9300_read_eeprom
	.word	AR9300_BASE_ADDR_512
	.word	.LC2
	.word	COMP_HDR_LEN
	.word	.LC6
	.word	COMP_CKSUM_LEN
	.word	.LC3
	.word	EEPROM_DATA_LEN_9485
	.word	.LC5
	.word	.LC4
	.word	ENOMEM
	.word	AR9300_BASE_ADDR
	.word	.LC1
	.word	ar9300_read_otp
	.size	ar9300_eeprom_restore_internal, .-ar9300_eeprom_restore_internal
	.comm	ar9300_default,4,4
	.comm	MSTATE,4,4
	.comm	GFP_KERNEL,4,4
	.comm	ENOMEM,4,4
	.comm	EEPROM_DATA_LEN_9485,4,4
	.comm	EEPROM,4,4
	.comm	COMP_HDR_LEN,4,4
	.comm	COMP_CKSUM_LEN,4,4
	.comm	AR9300_BASE_ADDR_512,4,4
	.comm	AR9300_BASE_ADDR_4K,4,4
	.comm	AR9300_BASE_ADDR,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
