	.file	"extr_rt2800lib.c_rt2800_config_ant.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.globl	rt2800_config_ant
	.type	rt2800_config_ant, @function
rt2800_config_ant:
.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
	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	rbx, rsi
	mov	esi, 1
	sub	rsp, 40
	.cfi_def_cfa_offset 80
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 24[rsp], rax
	xor	eax, eax
	lea	r13, 12[rsp]
	lea	r12, 16[rsp]
	mov	rdx, r13
	call	rt2800_bbp_read@PLT
	mov	esi, 3
	mov	rdi, rbp
	mov	rdx, r12
	call	rt2800_bbp_read@PLT
	mov	esi, DWORD PTR RT3572[rip]
	mov	rdi, rbp
	call	rt2x00_rt@PLT
	test	rax, rax
	jne	.L35
.L3:
	mov	eax, DWORD PTR [rbx]
	cmp	eax, 2
	je	.L5
.L38:
	and	eax, -3
	cmp	eax, 1
	jne	.L6
	mov	esi, DWORD PTR BBP1_TX_ANTENNA[rip]
	xor	edx, edx
	mov	rdi, r13
	call	rt2x00_set_field8@PLT
.L6:
	mov	eax, DWORD PTR 4[rbx]
	cmp	eax, 2
	je	.L8
.L40:
	cmp	eax, 3
	je	.L9
	cmp	eax, 1
	je	.L36
.L10:
	mov	edx, DWORD PTR 16[rsp]
	mov	esi, 3
	mov	rdi, rbp
	call	rt2800_bbp_write@PLT
	mov	edx, DWORD PTR 12[rsp]
	mov	esi, 1
	mov	rdi, rbp
	call	rt2800_bbp_write@PLT
	mov	rax, QWORD PTR 24[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L37
	add	rsp, 40
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	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
.L35:
	.cfi_restore_state
	mov	edi, DWORD PTR CAPABILITY_BT_COEXIST[rip]
	lea	rsi, 4[rbp]
	call	test_bit@PLT
	test	rax, rax
	je	.L3
	mov	rdi, rbp
	call	rt2800_config_3572bt_ant@PLT
	mov	eax, DWORD PTR [rbx]
	cmp	eax, 2
	jne	.L38
	.p2align 4,,10
	.p2align 3
.L5:
	mov	esi, DWORD PTR RT3572[rip]
	mov	rdi, rbp
	call	rt2x00_rt@PLT
	test	rax, rax
	je	.L7
	mov	edi, DWORD PTR CAPABILITY_BT_COEXIST[rip]
	lea	rsi, 4[rbp]
	call	test_bit@PLT
	test	rax, rax
	jne	.L39
.L7:
	mov	esi, DWORD PTR BBP1_TX_ANTENNA[rip]
	mov	edx, 2
	mov	rdi, r13
	call	rt2x00_set_field8@PLT
	mov	eax, DWORD PTR 4[rbx]
	cmp	eax, 2
	jne	.L40
.L8:
	mov	esi, DWORD PTR RT3572[rip]
	mov	rdi, rbp
	call	rt2x00_rt@PLT
	test	rax, rax
	je	.L16
	mov	edi, DWORD PTR CAPABILITY_BT_COEXIST[rip]
	lea	rsi, 4[rbp]
	call	test_bit@PLT
	test	rax, rax
	jne	.L41
.L16:
	mov	esi, DWORD PTR BBP3_RX_ANTENNA[rip]
	mov	edx, 1
	mov	rdi, r12
	call	rt2x00_set_field8@PLT
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L36:
	mov	esi, DWORD PTR RT3070[rip]
	mov	rdi, rbp
	call	rt2x00_rt@PLT
	test	rax, rax
	je	.L11
.L14:
	mov	esi, DWORD PTR EEPROM_NIC_CONF1[rip]
	mov	rdi, rbp
	lea	rdx, 20[rsp]
	call	rt2x00_eeprom_read@PLT
	mov	esi, DWORD PTR EEPROM_NIC_CONF1_ANT_DIVERSITY[rip]
	mov	edi, DWORD PTR 20[rsp]
	call	rt2x00_get_field16@PLT
	test	eax, eax
	jne	.L42
.L15:
	mov	esi, DWORD PTR BBP3_RX_ANTENNA[rip]
	xor	edx, edx
	mov	rdi, r12
	call	rt2x00_set_field8@PLT
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L9:
	mov	esi, DWORD PTR BBP3_RX_ANTENNA[rip]
	mov	edx, 2
	mov	rdi, r12
	call	rt2x00_set_field8@PLT
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L11:
	mov	esi, DWORD PTR RT3090[rip]
	mov	rdi, rbp
	call	rt2x00_rt@PLT
	test	rax, rax
	jne	.L14
	mov	esi, DWORD PTR RT3352[rip]
	mov	rdi, rbp
	call	rt2x00_rt@PLT
	test	rax, rax
	jne	.L14
	mov	esi, DWORD PTR RT3390[rip]
	mov	rdi, rbp
	call	rt2x00_rt@PLT
	test	rax, rax
	jne	.L14
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L42:
	mov	esi, DWORD PTR 8[rbp]
	mov	rdi, rbp
	call	rt2800_set_ant_diversity@PLT
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L41:
	mov	esi, DWORD PTR BBP3_RX_ADC[rip]
	mov	rdi, r12
	mov	edx, 1
	call	rt2x00_set_field8@PLT
	mov	eax, DWORD PTR IEEE80211_BAND_5GHZ[rip]
	xor	edx, edx
	cmp	DWORD PTR 0[rbp], eax
	mov	esi, DWORD PTR BBP3_RX_ANTENNA[rip]
	mov	rdi, r12
	sete	dl
	call	rt2x00_set_field8@PLT
	mov	esi, DWORD PTR ANTENNA_B[rip]
	mov	rdi, rbp
	call	rt2800_set_ant_diversity@PLT
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L39:
	mov	esi, DWORD PTR BBP1_TX_ANTENNA[rip]
	mov	edx, 1
	mov	rdi, r13
	call	rt2x00_set_field8@PLT
	jmp	.L6
.L37:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	rt2800_config_ant, .-rt2800_config_ant
	.comm	RT3572,4,4
	.comm	RT3390,4,4
	.comm	RT3352,4,4
	.comm	RT3090,4,4
	.comm	RT3070,4,4
	.comm	IEEE80211_BAND_5GHZ,4,4
	.comm	EEPROM_NIC_CONF1_ANT_DIVERSITY,4,4
	.comm	EEPROM_NIC_CONF1,4,4
	.comm	CAPABILITY_BT_COEXIST,4,4
	.comm	BBP3_RX_ANTENNA,4,4
	.comm	BBP3_RX_ADC,4,4
	.comm	BBP1_TX_ANTENNA,4,4
	.comm	ANTENNA_B,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_rt2800lib.c_rt2800_config_ant.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	rt2800_config_ant
	.syntax unified
	.arm
	.fpu softvfp
	.type	rt2800_config_ant, %function
rt2800_config_ant:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, lr}
	mov	r4, r0
	sub	sp, sp, #16
	ldr	r3, .L43
	mov	r2, sp
	mov	r5, r1
	ldr	r6, .L43+4
	mov	r1, #1
	ldr	r3, [r3]
	str	r3, [sp, #12]
	mov	r3,#0
	bl	rt2800_bbp_read
	mov	r1, #3
	add	r2, sp, #4
	mov	r0, r4
	bl	rt2800_bbp_read
	mov	r0, r4
	ldr	r1, [r6]
	bl	rt2x00_rt
	cmp	r0, #0
	bne	.L35
.L3:
	ldr	r3, [r5]
	cmp	r3, #2
	beq	.L5
.L38:
	bic	r3, r3, #2
	cmp	r3, #1
	bne	.L6
	ldr	r3, .L43+8
	mov	r0, sp
	mov	r2, #0
	ldr	r1, [r3]
	bl	rt2x00_set_field8
.L6:
	ldr	r3, [r5, #4]
	cmp	r3, #2
	beq	.L8
.L40:
	cmp	r3, #3
	beq	.L9
	cmp	r3, #1
	beq	.L36
.L10:
	mov	r1, #3
	ldr	r2, [sp, #4]
	mov	r0, r4
	bl	rt2800_bbp_write
	ldr	r2, [sp]
	mov	r0, r4
	mov	r1, #1
	bl	rt2800_bbp_write
	ldr	r3, .L43
	ldr	r2, [r3]
	ldr	r3, [sp, #12]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L37
	add	sp, sp, #16
	@ sp needed
	pop	{r4, r5, r6, pc}
.L35:
	ldr	r3, .L43+12
	add	r1, r4, #4
	ldr	r0, [r3]
	bl	test_bit
	cmp	r0, #0
	beq	.L3
	mov	r0, r4
	bl	rt2800_config_3572bt_ant
	ldr	r3, [r5]
	cmp	r3, #2
	bne	.L38
.L5:
	mov	r0, r4
	ldr	r1, [r6]
	bl	rt2x00_rt
	cmp	r0, #0
	beq	.L7
	ldr	r3, .L43+12
	add	r1, r4, #4
	ldr	r0, [r3]
	bl	test_bit
	cmp	r0, #0
	bne	.L39
.L7:
	ldr	r3, .L43+8
	mov	r0, sp
	ldr	r1, [r3]
	mov	r2, #2
	bl	rt2x00_set_field8
	ldr	r3, [r5, #4]
	cmp	r3, #2
	bne	.L40
.L8:
	mov	r0, r4
	ldr	r1, [r6]
	bl	rt2x00_rt
	cmp	r0, #0
	beq	.L16
	ldr	r3, .L43+12
	add	r1, r4, #4
	ldr	r0, [r3]
	bl	test_bit
	cmp	r0, #0
	bne	.L41
.L16:
	ldr	r3, .L43+16
	mov	r2, #1
	ldr	r1, [r3]
	add	r0, sp, #4
	bl	rt2x00_set_field8
	b	.L10
.L36:
	ldr	r3, .L43+20
	mov	r0, r4
	ldr	r1, [r3]
	bl	rt2x00_rt
	cmp	r0, #0
	beq	.L11
.L14:
	ldr	r3, .L43+24
	add	r2, sp, #8
	ldr	r1, [r3]
	mov	r0, r4
	bl	rt2x00_eeprom_read
	ldr	r3, .L43+28
	ldr	r0, [sp, #8]
	ldr	r1, [r3]
	bl	rt2x00_get_field16
	cmp	r0, #0
	bne	.L42
.L15:
	ldr	r3, .L43+16
	mov	r2, #0
	ldr	r1, [r3]
	add	r0, sp, #4
	bl	rt2x00_set_field8
	b	.L10
.L9:
	ldr	r3, .L43+16
	mov	r2, #2
	ldr	r1, [r3]
	add	r0, sp, #4
	bl	rt2x00_set_field8
	b	.L10
.L11:
	ldr	r3, .L43+32
	mov	r0, r4
	ldr	r1, [r3]
	bl	rt2x00_rt
	cmp	r0, #0
	bne	.L14
	ldr	r3, .L43+36
	mov	r0, r4
	ldr	r1, [r3]
	bl	rt2x00_rt
	cmp	r0, #0
	bne	.L14
	ldr	r3, .L43+40
	mov	r0, r4
	ldr	r1, [r3]
	bl	rt2x00_rt
	cmp	r0, #0
	bne	.L14
	b	.L15
.L42:
	mov	r0, r4
	ldr	r1, [r4, #8]
	bl	rt2800_set_ant_diversity
	b	.L15
.L41:
	ldr	r3, .L43+44
	mov	r2, #1
	ldr	r1, [r3]
	add	r0, sp, #4
	bl	rt2x00_set_field8
	ldr	r3, .L43+48
	ldr	r1, [r4]
	ldr	r2, [r3]
	ldr	r3, .L43+16
	sub	r2, r1, r2
	clz	r2, r2
	ldr	r1, [r3]
	add	r0, sp, #4
	lsr	r2, r2, #5
	bl	rt2x00_set_field8
	ldr	r3, .L43+52
	mov	r0, r4
	ldr	r1, [r3]
	bl	rt2800_set_ant_diversity
	b	.L10
.L39:
	ldr	r3, .L43+8
	mov	r0, sp
	mov	r2, #1
	ldr	r1, [r3]
	bl	rt2x00_set_field8
	b	.L6
.L37:
	bl	__stack_chk_fail
.L44:
	.align	2
.L43:
	.word	.LC0
	.word	RT3572
	.word	BBP1_TX_ANTENNA
	.word	CAPABILITY_BT_COEXIST
	.word	BBP3_RX_ANTENNA
	.word	RT3070
	.word	EEPROM_NIC_CONF1
	.word	EEPROM_NIC_CONF1_ANT_DIVERSITY
	.word	RT3090
	.word	RT3352
	.word	RT3390
	.word	BBP3_RX_ADC
	.word	IEEE80211_BAND_5GHZ
	.word	ANTENNA_B
	.size	rt2800_config_ant, .-rt2800_config_ant
	.comm	RT3572,4,4
	.comm	RT3390,4,4
	.comm	RT3352,4,4
	.comm	RT3090,4,4
	.comm	RT3070,4,4
	.comm	IEEE80211_BAND_5GHZ,4,4
	.comm	EEPROM_NIC_CONF1_ANT_DIVERSITY,4,4
	.comm	EEPROM_NIC_CONF1,4,4
	.comm	CAPABILITY_BT_COEXIST,4,4
	.comm	BBP3_RX_ANTENNA,4,4
	.comm	BBP3_RX_ADC,4,4
	.comm	BBP1_TX_ANTENNA,4,4
	.comm	ANTENNA_B,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
