	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rt2500usb_init_eeprom
_rt2500usb_init_eeprom:                 ## @rt2500usb_init_eeprom
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	_EEPROM_ANTENNA@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_rt2x00_eeprom_read
	movl	%eax, %r14d
	movq	_EEPROM_ANTENNA_RF_TYPE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r14d, %edi
	callq	_rt2x00_get_field16
	movq	%rax, %r12
	movq	_MAC_CSR0@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_rt2500usb_register_read
	movl	%eax, %ebx
	movq	_RT2570@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	movl	%r12d, %edx
	movl	%ebx, %ecx
	callq	_rt2x00_set_chip
	testl	$65520, %ebx                    ## imm = 0xFFF0
	jne	LBB0_2
## %bb.1:
	andl	$15, %ebx
	je	LBB0_2
## %bb.4:
	movq	_RF2522@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_rt2x00_rf
	testl	%eax, %eax
	jne	LBB0_11
## %bb.5:
	movq	_RF2523@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_rt2x00_rf
	testl	%eax, %eax
	jne	LBB0_11
## %bb.6:
	movq	_RF2524@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_rt2x00_rf
	testl	%eax, %eax
	jne	LBB0_11
## %bb.7:
	movq	_RF2525@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_rt2x00_rf
	testl	%eax, %eax
	jne	LBB0_11
## %bb.8:
	movq	_RF2525E@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_rt2x00_rf
	testl	%eax, %eax
	jne	LBB0_11
## %bb.9:
	movq	_RF5222@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_rt2x00_rf
	testl	%eax, %eax
	je	LBB0_10
LBB0_11:
	movq	_EEPROM_ANTENNA_TX_DEFAULT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r14d, %edi
	callq	_rt2x00_get_field16
	movq	%rax, 24(%r15)
	movq	_EEPROM_ANTENNA_RX_DEFAULT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r14d, %edi
	callq	_rt2x00_get_field16
	movq	%rax, 32(%r15)
	movq	_ANTENNA_SW_DIVERSITY@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	%rcx, 24(%r15)
	jne	LBB0_13
## %bb.12:
	movq	_ANTENNA_HW_DIVERSITY@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rdx
	movq	%rdx, 24(%r15)
LBB0_13:
	cmpq	%rax, %rcx
	jne	LBB0_15
## %bb.14:
	movq	_ANTENNA_HW_DIVERSITY@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 32(%r15)
LBB0_15:
	movq	_EEPROM_ANTENNA_HARDWARE_RADIO@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r14d, %edi
	callq	_rt2x00_get_field16
	testq	%rax, %rax
	je	LBB0_17
## %bb.16:
	movq	_CAPABILITY_HW_BUTTON@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	8(%r15), %rsi
	callq	___set_bit
LBB0_17:
	movq	_EEPROM_CALIBRATE_OFFSET@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_rt2x00_eeprom_read
	movq	_EEPROM_CALIBRATE_OFFSET_RSSI@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movl	%eax, %edi
	callq	_rt2x00_get_field16
	movq	%rax, (%r15)
	xorl	%eax, %eax
	jmp	LBB0_18
LBB0_2:
	leaq	L_.str(%rip), %rsi
LBB0_3:
	movq	%r15, %rdi
	callq	_rt2x00_err
	movq	_ENODEV@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_18:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_3
	.cfi_endproc
                                        ## -- End function
	.comm	_EEPROM_ANTENNA,4,2             ## @EEPROM_ANTENNA
	.comm	_EEPROM_ANTENNA_RF_TYPE,4,2     ## @EEPROM_ANTENNA_RF_TYPE
	.comm	_MAC_CSR0,4,2                   ## @MAC_CSR0
	.comm	_RT2570,4,2                     ## @RT2570
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Invalid RT chipset detected\n"

	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_RF2522,4,2                     ## @RF2522
	.comm	_RF2523,4,2                     ## @RF2523
	.comm	_RF2524,4,2                     ## @RF2524
	.comm	_RF2525,4,2                     ## @RF2525
	.comm	_RF2525E,4,2                    ## @RF2525E
	.comm	_RF5222,4,2                     ## @RF5222
L_.str.1:                               ## @.str.1
	.asciz	"Invalid RF chipset detected\n"

	.comm	_EEPROM_ANTENNA_TX_DEFAULT,4,2  ## @EEPROM_ANTENNA_TX_DEFAULT
	.comm	_EEPROM_ANTENNA_RX_DEFAULT,4,2  ## @EEPROM_ANTENNA_RX_DEFAULT
	.comm	_ANTENNA_SW_DIVERSITY,8,3       ## @ANTENNA_SW_DIVERSITY
	.comm	_ANTENNA_HW_DIVERSITY,8,3       ## @ANTENNA_HW_DIVERSITY
	.comm	_EEPROM_ANTENNA_HARDWARE_RADIO,4,2 ## @EEPROM_ANTENNA_HARDWARE_RADIO
	.comm	_CAPABILITY_HW_BUTTON,4,2       ## @CAPABILITY_HW_BUTTON
	.comm	_EEPROM_CALIBRATE_OFFSET,4,2    ## @EEPROM_CALIBRATE_OFFSET
	.comm	_EEPROM_CALIBRATE_OFFSET_RSSI,4,2 ## @EEPROM_CALIBRATE_OFFSET_RSSI
	.comm	_EEPROM_ANTENNA_LED_MODE,4,2    ## @EEPROM_ANTENNA_LED_MODE
	.comm	_LED_MODE_ASUS,4,2              ## @LED_MODE_ASUS
	.comm	_LED_MODE_DEFAULT,4,2           ## @LED_MODE_DEFAULT
	.comm	_LED_MODE_TXRX_ACTIVITY,4,2     ## @LED_MODE_TXRX_ACTIVITY
	.comm	_LED_TYPE_ACTIVITY,4,2          ## @LED_TYPE_ACTIVITY
	.comm	_LED_TYPE_RADIO,4,2             ## @LED_TYPE_RADIO
	.no_dead_strip	_rt2500usb_init_eeprom
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rt2500usb_init_eeprom
_rt2500usb_init_eeprom:                 ; @rt2500usb_init_eeprom
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	mov	x19, x0
Lloh0:
	adrp	x8, _EEPROM_ANTENNA@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EEPROM_ANTENNA@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_rt2x00_eeprom_read
	mov	x20, x0
Lloh3:
	adrp	x8, _EEPROM_ANTENNA_RF_TYPE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EEPROM_ANTENNA_RF_TYPE@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	bl	_rt2x00_get_field16
	mov	x21, x0
Lloh6:
	adrp	x8, _MAC_CSR0@GOTPAGE
Lloh7:
	ldr	x8, [x8, _MAC_CSR0@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_rt2500usb_register_read
	mov	x22, x0
Lloh9:
	adrp	x8, _RT2570@GOTPAGE
Lloh10:
	ldr	x8, [x8, _RT2570@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x21
	mov	x3, x22
	bl	_rt2x00_set_chip
	and	w8, w22, #0xfff0
	and	w9, w22, #0xf
	cmp	w8, #0
	ccmp	w9, #0, #4, eq
	b.ne	LBB0_3
; %bb.1:
Lloh12:
	adrp	x1, l_.str@PAGE
Lloh13:
	add	x1, x1, l_.str@PAGEOFF
LBB0_2:
	mov	x0, x19
	bl	_rt2x00_err
Lloh14:
	adrp	x8, _ENODEV@GOTPAGE
Lloh15:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_16
LBB0_3:
Lloh17:
	adrp	x8, _RF2522@GOTPAGE
Lloh18:
	ldr	x8, [x8, _RF2522@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_rt2x00_rf
	cbnz	w0, LBB0_9
; %bb.4:
Lloh20:
	adrp	x8, _RF2523@GOTPAGE
Lloh21:
	ldr	x8, [x8, _RF2523@GOTPAGEOFF]
Lloh22:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_rt2x00_rf
	cbnz	w0, LBB0_9
; %bb.5:
Lloh23:
	adrp	x8, _RF2524@GOTPAGE
Lloh24:
	ldr	x8, [x8, _RF2524@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_rt2x00_rf
	cbnz	w0, LBB0_9
; %bb.6:
Lloh26:
	adrp	x8, _RF2525@GOTPAGE
Lloh27:
	ldr	x8, [x8, _RF2525@GOTPAGEOFF]
Lloh28:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_rt2x00_rf
	cbnz	w0, LBB0_9
; %bb.7:
Lloh29:
	adrp	x8, _RF2525E@GOTPAGE
Lloh30:
	ldr	x8, [x8, _RF2525E@GOTPAGEOFF]
Lloh31:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_rt2x00_rf
	cbnz	w0, LBB0_9
; %bb.8:
Lloh32:
	adrp	x8, _RF5222@GOTPAGE
Lloh33:
	ldr	x8, [x8, _RF5222@GOTPAGEOFF]
Lloh34:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_rt2x00_rf
	cbz	w0, LBB0_17
LBB0_9:
Lloh35:
	adrp	x8, _EEPROM_ANTENNA_TX_DEFAULT@GOTPAGE
Lloh36:
	ldr	x8, [x8, _EEPROM_ANTENNA_TX_DEFAULT@GOTPAGEOFF]
Lloh37:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_rt2x00_get_field16
	str	x0, [x19, #24]
Lloh38:
	adrp	x8, _EEPROM_ANTENNA_RX_DEFAULT@GOTPAGE
Lloh39:
	ldr	x8, [x8, _EEPROM_ANTENNA_RX_DEFAULT@GOTPAGEOFF]
Lloh40:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_rt2x00_get_field16
	str	x0, [x19, #32]
	ldr	x10, [x19, #24]
Lloh41:
	adrp	x8, _ANTENNA_SW_DIVERSITY@GOTPAGE
Lloh42:
	ldr	x8, [x8, _ANTENNA_SW_DIVERSITY@GOTPAGEOFF]
Lloh43:
	ldr	x9, [x8]
Lloh44:
	adrp	x8, _ANTENNA_HW_DIVERSITY@GOTPAGE
Lloh45:
	ldr	x8, [x8, _ANTENNA_HW_DIVERSITY@GOTPAGEOFF]
	cmp	x10, x9
	b.ne	LBB0_11
; %bb.10:
	ldr	x10, [x8]
	str	x10, [x19, #24]
LBB0_11:
	cmp	x9, x0
	b.ne	LBB0_13
; %bb.12:
	ldr	x8, [x8]
	str	x8, [x19, #32]
LBB0_13:
Lloh46:
	adrp	x8, _EEPROM_ANTENNA_HARDWARE_RADIO@GOTPAGE
Lloh47:
	ldr	x8, [x8, _EEPROM_ANTENNA_HARDWARE_RADIO@GOTPAGEOFF]
Lloh48:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_rt2x00_get_field16
	cbz	x0, LBB0_15
; %bb.14:
Lloh49:
	adrp	x8, _CAPABILITY_HW_BUTTON@GOTPAGE
Lloh50:
	ldr	x8, [x8, _CAPABILITY_HW_BUTTON@GOTPAGEOFF]
Lloh51:
	ldr	w0, [x8]
	add	x1, x19, #8
	bl	___set_bit
LBB0_15:
Lloh52:
	adrp	x8, _EEPROM_CALIBRATE_OFFSET@GOTPAGE
Lloh53:
	ldr	x8, [x8, _EEPROM_CALIBRATE_OFFSET@GOTPAGEOFF]
Lloh54:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_rt2x00_eeprom_read
Lloh55:
	adrp	x8, _EEPROM_CALIBRATE_OFFSET_RSSI@GOTPAGE
Lloh56:
	ldr	x8, [x8, _EEPROM_CALIBRATE_OFFSET_RSSI@GOTPAGEOFF]
Lloh57:
	ldr	w1, [x8]
	bl	_rt2x00_get_field16
	mov	x8, x0
	mov	w0, #0
	str	x8, [x19]
LBB0_16:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_17:
Lloh58:
	adrp	x1, l_.str.1@PAGE
Lloh59:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGot	Lloh44, Lloh45
	.loh AdrpLdrGotLdr	Lloh41, Lloh42, Lloh43
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh46, Lloh47, Lloh48
	.loh AdrpLdrGotLdr	Lloh49, Lloh50, Lloh51
	.loh AdrpLdrGotLdr	Lloh55, Lloh56, Lloh57
	.loh AdrpLdrGotLdr	Lloh52, Lloh53, Lloh54
	.loh AdrpAdd	Lloh58, Lloh59
	.cfi_endproc
                                        ; -- End function
	.comm	_EEPROM_ANTENNA,4,2             ; @EEPROM_ANTENNA
	.comm	_EEPROM_ANTENNA_RF_TYPE,4,2     ; @EEPROM_ANTENNA_RF_TYPE
	.comm	_MAC_CSR0,4,2                   ; @MAC_CSR0
	.comm	_RT2570,4,2                     ; @RT2570
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Invalid RT chipset detected\n"

	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_RF2522,4,2                     ; @RF2522
	.comm	_RF2523,4,2                     ; @RF2523
	.comm	_RF2524,4,2                     ; @RF2524
	.comm	_RF2525,4,2                     ; @RF2525
	.comm	_RF2525E,4,2                    ; @RF2525E
	.comm	_RF5222,4,2                     ; @RF5222
l_.str.1:                               ; @.str.1
	.asciz	"Invalid RF chipset detected\n"

	.comm	_EEPROM_ANTENNA_TX_DEFAULT,4,2  ; @EEPROM_ANTENNA_TX_DEFAULT
	.comm	_EEPROM_ANTENNA_RX_DEFAULT,4,2  ; @EEPROM_ANTENNA_RX_DEFAULT
	.comm	_ANTENNA_SW_DIVERSITY,8,3       ; @ANTENNA_SW_DIVERSITY
	.comm	_ANTENNA_HW_DIVERSITY,8,3       ; @ANTENNA_HW_DIVERSITY
	.comm	_EEPROM_ANTENNA_HARDWARE_RADIO,4,2 ; @EEPROM_ANTENNA_HARDWARE_RADIO
	.comm	_CAPABILITY_HW_BUTTON,4,2       ; @CAPABILITY_HW_BUTTON
	.comm	_EEPROM_CALIBRATE_OFFSET,4,2    ; @EEPROM_CALIBRATE_OFFSET
	.comm	_EEPROM_CALIBRATE_OFFSET_RSSI,4,2 ; @EEPROM_CALIBRATE_OFFSET_RSSI
	.comm	_EEPROM_ANTENNA_LED_MODE,4,2    ; @EEPROM_ANTENNA_LED_MODE
	.comm	_LED_MODE_ASUS,4,2              ; @LED_MODE_ASUS
	.comm	_LED_MODE_DEFAULT,4,2           ; @LED_MODE_DEFAULT
	.comm	_LED_MODE_TXRX_ACTIVITY,4,2     ; @LED_MODE_TXRX_ACTIVITY
	.comm	_LED_TYPE_ACTIVITY,4,2          ; @LED_TYPE_ACTIVITY
	.comm	_LED_TYPE_RADIO,4,2             ; @LED_TYPE_RADIO
	.no_dead_strip	_rt2500usb_init_eeprom
.subsections_via_symbols
