	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rt2500usb_config_key
_rt2500usb_config_key:                  ## @rt2500usb_config_key
	.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	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r15
	movq	%rsi, %r13
	movq	%rdi, %r14
	movq	(%rsi), %rax
	movq	_SET_KEY@GOTPCREL(%rip), %r12
	cmpq	(%r12), %rax
	jne	LBB0_15
## %bb.1:
	movq	(%r15), %rax
	movq	_WLAN_CIPHER_SUITE_WEP40@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_3
## %bb.2:
	movq	_WLAN_CIPHER_SUITE_WEP104@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_6
LBB0_3:
	cmpq	$0, 8(%r15)
	jne	LBB0_4
LBB0_6:
	movq	_TXRX_CSR0_KEY_ID@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movq	_TXRX_CSR0@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_rt2500usb_register_read
	movl	%eax, %ebx
	movq	_TXRX_CSR0_ALGORITHM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ebx, %edi
	callq	_rt2x00_get_field16
	andl	%r12d, %ebx
	je	LBB0_9
## %bb.7:
	cmpl	%r12d, %ebx
	jne	LBB0_9
## %bb.8:
	movq	_ENOSPC@GOTPCREL(%rip), %rcx
	jmp	LBB0_5
LBB0_9:
	movl	%eax, %r12d
	movq	_TXRX_CSR0_KEY_ID@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%ebx, %edi
	callq	_rt2x00_get_field16
	testl	%eax, %eax
	je	LBB0_10
## %bb.11:
	movl	%eax, %edi
	callq	_ffz
	movl	%eax, %edi
	jmp	LBB0_12
LBB0_10:
	xorl	%edi, %edi
LBB0_12:
	addl	16(%r15), %edi
	movl	%edi, 16(%r15)
	jle	LBB0_14
## %bb.13:
	cmpl	%r12d, 8(%r13)
	jne	LBB0_4
LBB0_14:
	callq	_KEY_ENTRY
	movl	12(%r13), %edx
	movq	%r14, %rdi
	movl	%eax, %esi
	movl	$4, %ecx
	callq	_rt2500usb_register_multiwrite
	movq	_IEEE80211_KEY_FLAG_GENERATE_IV@GOTPCREL(%rip), %rax
	movl	20(%r15), %ecx
	orl	(%rax), %ecx
	movq	_IEEE80211_KEY_FLAG_GENERATE_MMIC@GOTPCREL(%rip), %rax
	orl	(%rax), %ecx
	movl	%ecx, 20(%r15)
	movq	_SET_KEY@GOTPCREL(%rip), %r12
LBB0_15:
	movq	_TXRX_CSR0@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_rt2500usb_register_read
	movl	%eax, -44(%rbp)
	movl	8(%r13), %edx
	movq	_TXRX_CSR0_ALGORITHM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-44(%rbp), %rbx
	movq	%rbx, %rdi
	callq	_rt2x00_set_field16
	movq	_IEEE80211_HEADER@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	_TXRX_CSR0_IV_OFFSET@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_rt2x00_set_field16
	movl	-44(%rbp), %edi
	movq	_TXRX_CSR0_KEY_ID@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	callq	_rt2x00_get_field16
	movq	(%r13), %rcx
	cmpq	(%r12), %rcx
	jne	LBB0_17
## %bb.16:
	movb	16(%r15), %cl
	btsl	%ecx, %eax
	jmp	LBB0_19
LBB0_17:
	movq	_DISABLE_KEY@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	jne	LBB0_19
## %bb.18:
	movb	16(%r15), %cl
	btrl	%ecx, %eax
LBB0_19:
	movl	(%rbx), %esi
	leaq	-44(%rbp), %rdi
	movl	%eax, %edx
	callq	_rt2x00_set_field16
	movq	_TXRX_CSR0@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	-44(%rbp), %edx
	movq	%r14, %rdi
	callq	_rt2500usb_register_write
	xorl	%eax, %eax
	jmp	LBB0_20
LBB0_4:
	movq	_EOPNOTSUPP@GOTPCREL(%rip), %rcx
LBB0_5:
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_20:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SET_KEY,8,3                    ## @SET_KEY
	.comm	_WLAN_CIPHER_SUITE_WEP40,8,3    ## @WLAN_CIPHER_SUITE_WEP40
	.comm	_WLAN_CIPHER_SUITE_WEP104,8,3   ## @WLAN_CIPHER_SUITE_WEP104
	.comm	_EOPNOTSUPP,4,2                 ## @EOPNOTSUPP
	.comm	_TXRX_CSR0_KEY_ID,4,2           ## @TXRX_CSR0_KEY_ID
	.comm	_TXRX_CSR0,4,2                  ## @TXRX_CSR0
	.comm	_TXRX_CSR0_ALGORITHM,4,2        ## @TXRX_CSR0_ALGORITHM
	.comm	_ENOSPC,4,2                     ## @ENOSPC
	.comm	_IEEE80211_KEY_FLAG_GENERATE_IV,4,2 ## @IEEE80211_KEY_FLAG_GENERATE_IV
	.comm	_IEEE80211_KEY_FLAG_GENERATE_MMIC,4,2 ## @IEEE80211_KEY_FLAG_GENERATE_MMIC
	.comm	_TXRX_CSR0_IV_OFFSET,4,2        ## @TXRX_CSR0_IV_OFFSET
	.comm	_IEEE80211_HEADER,4,2           ## @IEEE80211_HEADER
	.comm	_DISABLE_KEY,8,3                ## @DISABLE_KEY
	.no_dead_strip	_rt2500usb_config_key
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rt2500usb_config_key
_rt2500usb_config_key:                  ; @rt2500usb_config_key
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x20, x2
	mov	x21, x1
	mov	x19, x0
	ldr	x8, [x1]
Lloh0:
	adrp	x24, _SET_KEY@GOTPAGE
Lloh1:
	ldr	x24, [x24, _SET_KEY@GOTPAGEOFF]
	ldr	x9, [x24]
	cmp	x8, x9
	b.ne	LBB0_9
; %bb.1:
	ldr	x8, [x20]
Lloh2:
	adrp	x9, _WLAN_CIPHER_SUITE_WEP40@GOTPAGE
Lloh3:
	ldr	x9, [x9, _WLAN_CIPHER_SUITE_WEP40@GOTPAGEOFF]
Lloh4:
	ldr	x9, [x9]
Lloh5:
	adrp	x10, _WLAN_CIPHER_SUITE_WEP104@GOTPAGE
Lloh6:
	ldr	x10, [x10, _WLAN_CIPHER_SUITE_WEP104@GOTPAGEOFF]
Lloh7:
	ldr	x10, [x10]
	cmp	x8, x9
	ccmp	x8, x10, #4, ne
	b.ne	LBB0_3
; %bb.2:
	ldr	x8, [x20, #8]
	cbnz	x8, LBB0_14
LBB0_3:
Lloh8:
	adrp	x25, _TXRX_CSR0_KEY_ID@GOTPAGE
Lloh9:
	ldr	x25, [x25, _TXRX_CSR0_KEY_ID@GOTPAGEOFF]
	ldr	w26, [x25]
Lloh10:
	adrp	x8, _TXRX_CSR0@GOTPAGE
Lloh11:
	ldr	x8, [x8, _TXRX_CSR0@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_rt2500usb_register_read
	mov	x23, x0
Lloh13:
	adrp	x8, _TXRX_CSR0_ALGORITHM@GOTPAGE
Lloh14:
	ldr	x8, [x8, _TXRX_CSR0_ALGORITHM@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	bl	_rt2x00_get_field16
	mov	x22, x0
	and	w0, w23, w26
	cmp	w0, #0
	ccmp	w0, w26, #0, ne
	b.eq	LBB0_15
; %bb.4:
	ldr	w1, [x25]
	bl	_rt2x00_get_field16
	cbz	w0, LBB0_6
; %bb.5:
	bl	_ffz
LBB0_6:
	ldr	w8, [x20, #16]
	add	w0, w8, w0
	str	w0, [x20, #16]
	cmp	w0, #1
	b.lt	LBB0_8
; %bb.7:
	ldr	w8, [x21, #8]
	cmp	w8, w22
	b.ne	LBB0_14
LBB0_8:
	bl	_KEY_ENTRY
	mov	x1, x0
	ldr	w2, [x21, #12]
	mov	x0, x19
	mov	w3, #4
	bl	_rt2500usb_register_multiwrite
Lloh16:
	adrp	x8, _IEEE80211_KEY_FLAG_GENERATE_IV@GOTPAGE
Lloh17:
	ldr	x8, [x8, _IEEE80211_KEY_FLAG_GENERATE_IV@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	ldr	w9, [x20, #20]
	orr	w8, w9, w8
Lloh19:
	adrp	x9, _IEEE80211_KEY_FLAG_GENERATE_MMIC@GOTPAGE
Lloh20:
	ldr	x9, [x9, _IEEE80211_KEY_FLAG_GENERATE_MMIC@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
	orr	w8, w9, w8
	str	w8, [x20, #20]
LBB0_9:
Lloh22:
	adrp	x22, _TXRX_CSR0@GOTPAGE
Lloh23:
	ldr	x22, [x22, _TXRX_CSR0@GOTPAGEOFF]
	ldr	w1, [x22]
	mov	x0, x19
	bl	_rt2500usb_register_read
	str	w0, [sp, #12]
	ldr	w2, [x21, #8]
Lloh24:
	adrp	x8, _TXRX_CSR0_ALGORITHM@GOTPAGE
Lloh25:
	ldr	x8, [x8, _TXRX_CSR0_ALGORITHM@GOTPAGEOFF]
Lloh26:
	ldr	w1, [x8]
	add	x0, sp, #12
	bl	_rt2x00_set_field16
Lloh27:
	adrp	x8, _IEEE80211_HEADER@GOTPAGE
Lloh28:
	ldr	x8, [x8, _IEEE80211_HEADER@GOTPAGEOFF]
Lloh29:
	ldr	w2, [x8]
Lloh30:
	adrp	x8, _TXRX_CSR0_IV_OFFSET@GOTPAGE
Lloh31:
	ldr	x8, [x8, _TXRX_CSR0_IV_OFFSET@GOTPAGEOFF]
Lloh32:
	ldr	w1, [x8]
	add	x0, sp, #12
	bl	_rt2x00_set_field16
	ldr	w0, [sp, #12]
Lloh33:
	adrp	x23, _TXRX_CSR0_KEY_ID@GOTPAGE
Lloh34:
	ldr	x23, [x23, _TXRX_CSR0_KEY_ID@GOTPAGEOFF]
	ldr	w1, [x23]
	bl	_rt2x00_get_field16
	mov	x2, x0
	ldr	x8, [x21]
	ldr	x9, [x24]
	cmp	x8, x9
	b.ne	LBB0_11
; %bb.10:
	ldr	w8, [x20, #16]
	mov	w9, #1
	lsl	w8, w9, w8
	orr	w2, w8, w2
	b	LBB0_13
LBB0_11:
Lloh35:
	adrp	x9, _DISABLE_KEY@GOTPAGE
Lloh36:
	ldr	x9, [x9, _DISABLE_KEY@GOTPAGEOFF]
Lloh37:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_13
; %bb.12:
	ldr	w8, [x20, #16]
	mov	w9, #1
	lsl	w8, w9, w8
	bic	w2, w2, w8
LBB0_13:
	ldr	w1, [x23]
	add	x0, sp, #12
	bl	_rt2x00_set_field16
	ldr	w1, [x22]
	ldr	w2, [sp, #12]
	mov	x0, x19
	bl	_rt2500usb_register_write
	mov	w0, #0
	b	LBB0_17
LBB0_14:
Lloh38:
	adrp	x8, _EOPNOTSUPP@GOTPAGE
Lloh39:
	ldr	x8, [x8, _EOPNOTSUPP@GOTPAGEOFF]
	b	LBB0_16
LBB0_15:
Lloh40:
	adrp	x8, _ENOSPC@GOTPAGE
Lloh41:
	ldr	x8, [x8, _ENOSPC@GOTPAGEOFF]
LBB0_16:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_17:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGot	Lloh38, Lloh39
	.loh AdrpLdrGot	Lloh40, Lloh41
	.cfi_endproc
                                        ; -- End function
	.comm	_SET_KEY,8,3                    ; @SET_KEY
	.comm	_WLAN_CIPHER_SUITE_WEP40,8,3    ; @WLAN_CIPHER_SUITE_WEP40
	.comm	_WLAN_CIPHER_SUITE_WEP104,8,3   ; @WLAN_CIPHER_SUITE_WEP104
	.comm	_EOPNOTSUPP,4,2                 ; @EOPNOTSUPP
	.comm	_TXRX_CSR0_KEY_ID,4,2           ; @TXRX_CSR0_KEY_ID
	.comm	_TXRX_CSR0,4,2                  ; @TXRX_CSR0
	.comm	_TXRX_CSR0_ALGORITHM,4,2        ; @TXRX_CSR0_ALGORITHM
	.comm	_ENOSPC,4,2                     ; @ENOSPC
	.comm	_IEEE80211_KEY_FLAG_GENERATE_IV,4,2 ; @IEEE80211_KEY_FLAG_GENERATE_IV
	.comm	_IEEE80211_KEY_FLAG_GENERATE_MMIC,4,2 ; @IEEE80211_KEY_FLAG_GENERATE_MMIC
	.comm	_TXRX_CSR0_IV_OFFSET,4,2        ; @TXRX_CSR0_IV_OFFSET
	.comm	_IEEE80211_HEADER,4,2           ; @IEEE80211_HEADER
	.comm	_DISABLE_KEY,8,3                ; @DISABLE_KEY
	.no_dead_strip	_rt2500usb_config_key
.subsections_via_symbols
