	.file	"extr_rtl871x_security.c_r8712_wep_encrypt.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	r8712_wep_encrypt
	.type	r8712_wep_encrypt, @function
r8712_wep_encrypt:
.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
	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, 120
	.cfi_def_cfa_offset 176
	mov	rbx, QWORD PTR [rsi]
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 104[rsp], rax
	xor	eax, eax
	test	rbx, rbx
	je	.L1
	mov	rax, QWORD PTR 8[rsi]
	cmp	rax, QWORD PTR _WEP40_[rip]
	mov	rbp, rdi
	mov	r15, rsi
	je	.L3
	cmp	rax, QWORD PTR _WEP104_[rip]
	je	.L3
.L1:
	mov	rax, QWORD PTR 104[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L13
	add	rsp, 120
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L3:
	.cfi_restore_state
	mov	rdx, QWORD PTR 8[rbp]
	mov	rax, QWORD PTR 16[rbp]
	cmp	QWORD PTR 16[r15], 0
	mov	rax, QWORD PTR [rax+rdx*8]
	mov	QWORD PTR 32[rsp], rax
	je	.L1
	add	eax, 3
	lea	r14, 80[rsp]
	lea	r13, 72[rsp]
	xor	r12d, r12d
	mov	DWORD PTR 52[rsp], eax
	movsx	rdi, DWORD PTR TXDESC_OFFSET[rip]
	lea	rax, 83[rsp]
	mov	QWORD PTR 40[rsp], rax
	lea	rax, 76[rsp]
	mov	QWORD PTR 56[rsp], rax
	add	rbx, rdi
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L6:
	mov	r9, QWORD PTR 0[rbp]
	sub	r9, QWORD PTR 40[r15]
	mov	rdi, r10
	mov	QWORD PTR 8[rsp], r10
	mov	rcx, r9
	mov	QWORD PTR 24[rsp], r9
	sub	rcx, rax
	mov	rsi, rcx
	mov	QWORD PTR 16[rsp], rcx
	call	getcrc32@PLT
	mov	edi, eax
	call	cpu_to_le32@PLT
	mov	edx, DWORD PTR 52[rsp]
	mov	rsi, r14
	mov	rdi, r13
	mov	DWORD PTR 76[rsp], eax
	call	arcfour_init@PLT
	mov	r10, QWORD PTR 8[rsp]
	mov	rcx, QWORD PTR 16[rsp]
	mov	rdi, r13
	mov	rdx, r10
	mov	rsi, r10
	call	arcfour_encrypt@PLT
	mov	r9, QWORD PTR 24[rsp]
	mov	rdx, QWORD PTR 56[rsp]
	mov	rdi, r13
	mov	ecx, 4
	lea	rsi, [rbx+r9]
	call	arcfour_encrypt@PLT
	add	rbx, QWORD PTR 0[rbp]
	mov	rdi, rbx
	call	RND4@PLT
	mov	rbx, rax
.L7:
	cmp	r12, QWORD PTR 16[r15]
	jnb	.L1
.L8:
	movsx	rsi, DWORD PTR 24[r15]
	mov	edx, 3
	mov	rdi, r14
	add	r12, 1
	add	rsi, rbx
	call	memcpy@PLT
	mov	rdx, QWORD PTR 8[rbp]
	mov	rax, QWORD PTR 24[rbp]
	mov	rdi, QWORD PTR 40[rsp]
	mov	rsi, QWORD PTR [rax+rdx*8]
	mov	rdx, QWORD PTR 32[rsp]
	call	memcpy@PLT
	movsx	rax, DWORD PTR 28[r15]
	movsx	rdx, DWORD PTR 24[r15]
	add	rax, rdx
	lea	r10, [rbx+rax]
	cmp	r12, QWORD PTR 16[r15]
	jne	.L6
	mov	r9, QWORD PTR 32[r15]
	sub	r9, QWORD PTR 40[r15]
	mov	rdi, r10
	mov	QWORD PTR 8[rsp], r10
	mov	rcx, r9
	mov	QWORD PTR 24[rsp], r9
	sub	rcx, rax
	mov	rsi, rcx
	mov	QWORD PTR 16[rsp], rcx
	call	getcrc32@PLT
	mov	edi, eax
	call	cpu_to_le32@PLT
	mov	edx, DWORD PTR 52[rsp]
	mov	rsi, r14
	mov	rdi, r13
	mov	DWORD PTR 76[rsp], eax
	call	arcfour_init@PLT
	mov	r10, QWORD PTR 8[rsp]
	mov	rcx, QWORD PTR 16[rsp]
	mov	rdi, r13
	mov	rdx, r10
	mov	rsi, r10
	call	arcfour_encrypt@PLT
	mov	r9, QWORD PTR 24[rsp]
	mov	rdx, QWORD PTR 56[rsp]
	mov	rdi, r13
	mov	ecx, 4
	lea	rsi, [rbx+r9]
	call	arcfour_encrypt@PLT
	jmp	.L7
.L13:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	r8712_wep_encrypt, .-r8712_wep_encrypt
	.comm	_WEP40_,8,8
	.comm	_WEP104_,8,8
	.comm	TXDESC_OFFSET,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_rtl871x_security.c_r8712_wep_encrypt.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	r8712_wep_encrypt
	.syntax unified
	.arm
	.fpu softvfp
	.type	r8712_wep_encrypt, %function
r8712_wep_encrypt:
	@ args = 0, pretend = 0, frame = 40
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	ldr	r5, [r1]
	ldr	r3, .L17
	sub	sp, sp, #44
	cmp	r5, #0
	ldr	r3, [r3]
	str	r3, [sp, #36]
	mov	r3,#0
	beq	.L1
	ldr	r2, .L17+4
	ldr	r3, [r1, #4]
	ldr	r2, [r2]
	mov	r6, r1
	cmp	r3, r2
	mov	r7, r0
	beq	.L3
	ldr	r2, .L17+8
	ldr	r2, [r2]
	cmp	r3, r2
	beq	.L3
.L1:
	ldr	r3, .L17
	ldr	r2, [r3]
	ldr	r3, [sp, #36]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L16
	add	sp, sp, #44
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L3:
	ldr	r9, [r6, #8]
	ldmib	r7, {r2, r3}
	cmp	r9, #0
	ldr	r10, [r3, r2, lsl #2]
	beq	.L1
	ldr	r3, .L17+12
	mov	r8, #0
	ldr	r0, [r3]
	add	fp, r10, #3
	add	r5, r5, r0
	b	.L8
.L6:
	ldr	r2, [r7]
	mov	r0, r4
	sub	r9, r2, r9
	sub	r3, r9, r3
	mov	r1, r3
	str	r3, [sp, #4]
	bl	getcrc32
	bl	cpu_to_le32
	mov	ip, r0
	mov	r2, fp
	add	r1, sp, #20
	add	r0, sp, #12
	str	ip, [sp, #16]
	bl	arcfour_init
	mov	r2, r4
	mov	r1, r4
	ldr	r3, [sp, #4]
	add	r0, sp, #12
	bl	arcfour_encrypt
	add	r1, r5, r9
	mov	r3, #4
	add	r2, sp, #16
	add	r0, sp, #12
	bl	arcfour_encrypt
	ldr	r0, [r7]
	add	r0, r5, r0
	bl	RND4
	mov	r5, r0
.L7:
	ldr	r9, [r6, #8]
	cmp	r8, r9
	bcs	.L1
.L8:
	ldr	r4, [r6, #12]
	mov	r2, #3
	add	r1, r5, r4
	add	r0, sp, #20
	bl	memcpy
	ldr	r3, [r7, #12]
	ldr	r1, [r7, #4]
	mov	r2, r10
	ldr	r1, [r3, r1, lsl #2]
	add	r0, sp, #23
	bl	memcpy
	ldr	r3, [r6, #16]
	add	r8, r8, #1
	cmp	r8, r9
	add	r3, r4, r3
	ldr	r9, [r6, #24]
	add	r4, r5, r3
	bne	.L6
	ldr	r2, [r6, #20]
	mov	r0, r4
	sub	r9, r2, r9
	sub	r3, r9, r3
	mov	r1, r3
	str	r3, [sp, #4]
	bl	getcrc32
	bl	cpu_to_le32
	mov	ip, r0
	mov	r2, fp
	add	r1, sp, #20
	add	r0, sp, #12
	str	ip, [sp, #16]
	bl	arcfour_init
	mov	r2, r4
	mov	r1, r4
	ldr	r3, [sp, #4]
	add	r0, sp, #12
	bl	arcfour_encrypt
	mov	r3, #4
	add	r1, r5, r9
	add	r2, sp, #16
	add	r0, sp, #12
	bl	arcfour_encrypt
	b	.L7
.L16:
	bl	__stack_chk_fail
.L18:
	.align	2
.L17:
	.word	.LC0
	.word	_WEP40_
	.word	_WEP104_
	.word	TXDESC_OFFSET
	.size	r8712_wep_encrypt, .-r8712_wep_encrypt
	.comm	_WEP40_,4,4
	.comm	_WEP104_,4,4
	.comm	TXDESC_OFFSET,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
