	.file	"extr_rt61pci.c_rt61pci_set_state.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	rt61pci_set_state, @function
rt61pci_set_state:
.LFB0:
	.cfi_startproc
	endbr64
	push	r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	push	r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	push	r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	push	rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	mov	ebx, esi
	sub	rsp, 16
	.cfi_def_cfa_offset 64
	mov	r12d, DWORD PTR STATE_AWAKE[rip]
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 8[rsp], rax
	xor	eax, eax
	lea	r14, 4[rsp]
	cmp	r12d, esi
	mov	esi, DWORD PTR MAC_CSR12[rip]
	setne	r13b
	call	rt2x00mmio_register_read@PLT
	cmp	r12d, ebx
	mov	esi, DWORD PTR MAC_CSR12_FORCE_WAKEUP[rip]
	mov	rdi, r14
	sete	r12b
	mov	DWORD PTR 4[rsp], eax
	xor	ebx, ebx
	movzx	r12d, r12b
	mov	edx, r12d
	call	rt2x00_set_field32@PLT
	mov	esi, DWORD PTR MAC_CSR12_PUT_TO_SLEEP[rip]
	movzx	edx, r13b
	mov	rdi, r14
	call	rt2x00_set_field32@PLT
	mov	edx, DWORD PTR 4[rsp]
	mov	esi, DWORD PTR MAC_CSR12[rip]
	mov	rdi, rbp
	call	rt2x00mmio_register_write@PLT
	mov	eax, DWORD PTR REGISTER_BUSY_COUNT[rip]
	test	eax, eax
	jne	.L2
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L13:
	mov	edx, DWORD PTR 4[rsp]
	mov	esi, DWORD PTR MAC_CSR12[rip]
	mov	rdi, rbp
	add	ebx, 1
	call	rt2x00mmio_register_write@PLT
	mov	edi, 10
	call	msleep@PLT
	cmp	DWORD PTR REGISTER_BUSY_COUNT[rip], ebx
	jbe	.L4
.L2:
	mov	esi, DWORD PTR MAC_CSR12[rip]
	mov	rdi, rbp
	call	rt2x00mmio_register_read@PLT
	mov	esi, DWORD PTR MAC_CSR12_BBP_CURRENT_STATE[rip]
	mov	edi, eax
	call	rt2x00_get_field32@PLT
	cmp	eax, r12d
	jne	.L13
	xor	eax, eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L4:
	mov	eax, DWORD PTR EBUSY[rip]
	neg	eax
.L1:
	mov	rcx, QWORD PTR 8[rsp]
	xor	rcx, QWORD PTR fs:40
	jne	.L14
	add	rsp, 16
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	pop	rbx
	.cfi_def_cfa_offset 40
	pop	rbp
	.cfi_def_cfa_offset 32
	pop	r12
	.cfi_def_cfa_offset 24
	pop	r13
	.cfi_def_cfa_offset 16
	pop	r14
	.cfi_def_cfa_offset 8
	ret
.L14:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	rt61pci_set_state, .-rt61pci_set_state
	.comm	STATE_AWAKE,4,4
	.comm	REGISTER_BUSY_COUNT,4,4
	.comm	MAC_CSR12_PUT_TO_SLEEP,4,4
	.comm	MAC_CSR12_FORCE_WAKEUP,4,4
	.comm	MAC_CSR12_BBP_CURRENT_STATE,4,4
	.comm	MAC_CSR12,4,4
	.comm	EBUSY,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_rt61pci.c_rt61pci_set_state.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	rt61pci_set_state, %function
rt61pci_set_state:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, lr}
	ldr	r3, .L13
	mov	r4, r1
	ldr	r6, .L13+4
	ldr	r8, [r3]
	ldr	r3, .L13+8
	sub	sp, sp, #12
	ldr	r1, [r6]
	ldr	r3, [r3]
	str	r3, [sp, #4]
	mov	r3,#0
	mov	r5, r0
	bl	rt2x00mmio_register_read
	sub	r7, r8, r4
	clz	r7, r7
	mov	r3, r0
	ldr	r1, .L13+12
	lsr	r7, r7, #5
	mov	r2, r7
	ldr	r1, [r1]
	mov	r0, sp
	str	r3, [sp]
	bl	rt2x00_set_field32
	ldr	r3, .L13+16
	subs	r2, r8, r4
	movne	r2, #1
	ldr	r1, [r3]
	mov	r0, sp
	ldr	r8, .L13+20
	bl	rt2x00_set_field32
	mov	r0, r5
	ldr	r1, [r6]
	ldr	r2, [sp]
	bl	rt2x00mmio_register_write
	ldr	r3, [r8]
	cmp	r3, #0
	movne	r4, #0
	ldrne	r9, .L13+24
	bne	.L2
	b	.L4
.L11:
	ldr	r2, [sp]
	ldr	r1, [r6]
	mov	r0, r5
	bl	rt2x00mmio_register_write
	mov	r0, #10
	bl	msleep
	ldr	r3, [r8]
	add	r4, r4, #1
	cmp	r3, r4
	bls	.L4
.L2:
	ldr	r1, [r6]
	mov	r0, r5
	bl	rt2x00mmio_register_read
	ldr	r1, [r9]
	bl	rt2x00_get_field32
	cmp	r0, r7
	bne	.L11
	mov	r0, #0
	b	.L1
.L4:
	ldr	r3, .L13+28
	ldr	r0, [r3]
	rsb	r0, r0, #0
.L1:
	ldr	r3, .L13+8
	ldr	r2, [r3]
	ldr	r3, [sp, #4]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L12
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, pc}
.L12:
	bl	__stack_chk_fail
.L14:
	.align	2
.L13:
	.word	STATE_AWAKE
	.word	MAC_CSR12
	.word	.LC0
	.word	MAC_CSR12_FORCE_WAKEUP
	.word	MAC_CSR12_PUT_TO_SLEEP
	.word	REGISTER_BUSY_COUNT
	.word	MAC_CSR12_BBP_CURRENT_STATE
	.word	EBUSY
	.size	rt61pci_set_state, .-rt61pci_set_state
	.comm	STATE_AWAKE,4,4
	.comm	REGISTER_BUSY_COUNT,4,4
	.comm	MAC_CSR12_PUT_TO_SLEEP,4,4
	.comm	MAC_CSR12_FORCE_WAKEUP,4,4
	.comm	MAC_CSR12_BBP_CURRENT_STATE,4,4
	.comm	MAC_CSR12,4,4
	.comm	EBUSY,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
