	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rt73usb_config_shared_key
_rt73usb_config_shared_key:             ## @rt73usb_config_shared_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
	subq	$24, %rsp
	.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_11
## %bb.1:
	movb	8(%r13), %cl
	movl	$15, %ebx
	shll	%cl, %ebx
	movq	_SEC_CSR0@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_rt2x00usb_register_read
	andl	%ebx, %eax
	je	LBB0_4
## %bb.2:
	cmpl	%ebx, %eax
	jne	LBB0_4
## %bb.3:
	movq	_ENOSPC@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_17
LBB0_4:
	testl	%eax, %eax
	je	LBB0_5
## %bb.6:
	movl	%eax, %edi
	callq	_ffz
	jmp	LBB0_7
LBB0_5:
	xorl	%eax, %eax
LBB0_7:
	addl	%eax, (%r15)
	movl	24(%r13), %esi
	movl	$4, %edx
	callq	_memcpy
	movl	20(%r13), %esi
	movl	$4, %edx
	callq	_memcpy
	movl	16(%r13), %esi
	movl	$4, %edx
	callq	_memcpy
	movl	(%r15), %edi
	callq	_SHARED_KEY_ENTRY
	movl	%eax, -44(%rbp)
	leaq	-56(%rbp), %rdx
	movq	%r14, %rdi
	movl	%eax, %esi
	movl	$12, %ecx
	callq	_rt2x00usb_register_multiwrite
	movl	(%r15), %eax
	leal	(%rax,%rax,2), %r12d
	cmpl	$7, %eax
	jg	LBB0_9
## %bb.8:
	movl	$7, %ebx
	movl	%r12d, %ecx
	shll	%cl, %ebx
	movq	_SEC_CSR1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_rt2x00usb_register_read
	movl	%eax, -44(%rbp)
	movl	12(%r13), %edx
	shlq	$32, %rbx
	movl	%r12d, %esi
	orq	%rbx, %rsi
	leaq	-44(%rbp), %rdi
	callq	_rt2x00_set_field32
	movq	_SEC_CSR1@GOTPCREL(%rip), %rax
	jmp	LBB0_10
LBB0_9:
	addl	$-24, %r12d
	movl	$7, %ebx
	movl	%r12d, %ecx
	shll	%cl, %ebx
	movq	_SEC_CSR5@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_rt2x00usb_register_read
	movl	%eax, -44(%rbp)
	movl	12(%r13), %edx
	shlq	$32, %rbx
	orq	%rbx, %r12
	leaq	-44(%rbp), %rdi
	movq	%r12, %rsi
	callq	_rt2x00_set_field32
	movq	_SEC_CSR5@GOTPCREL(%rip), %rax
LBB0_10:
	movl	(%rax), %esi
	movl	-44(%rbp), %edx
	movq	%r14, %rdi
	callq	_rt2x00usb_register_write
	movq	_SET_KEY@GOTPCREL(%rip), %r12
	movq	_IEEE80211_KEY_FLAG_GENERATE_IV@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 4(%r15)
LBB0_11:
	movb	(%r15), %cl
	movl	$1, %ebx
	shll	%cl, %ebx
	movq	_SEC_CSR0@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movq	%r14, %rdi
	callq	_rt2x00usb_register_read
	movl	%eax, -44(%rbp)
	movq	(%r13), %rcx
	cmpq	(%r12), %rcx
	jne	LBB0_13
## %bb.12:
	orl	%ebx, %eax
	jmp	LBB0_15
LBB0_13:
	movq	_DISABLE_KEY@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	jne	LBB0_16
## %bb.14:
	notl	%ebx
	andl	%ebx, %eax
LBB0_15:
	movl	%eax, -44(%rbp)
LBB0_16:
	movl	(%r15), %esi
	movq	%r14, %rdi
	movl	%eax, %edx
	callq	_rt2x00usb_register_write
	xorl	%eax, %eax
LBB0_17:
	addq	$24, %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	_SEC_CSR0,4,2                   ## @SEC_CSR0
	.comm	_ENOSPC,4,2                     ## @ENOSPC
	.comm	_SEC_CSR1,4,2                   ## @SEC_CSR1
	.comm	_SEC_CSR5,4,2                   ## @SEC_CSR5
	.comm	_IEEE80211_KEY_FLAG_GENERATE_IV,4,2 ## @IEEE80211_KEY_FLAG_GENERATE_IV
	.comm	_DISABLE_KEY,8,3                ## @DISABLE_KEY
	.no_dead_strip	_rt73usb_config_shared_key
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rt73usb_config_shared_key
_rt73usb_config_shared_key:             ; @rt73usb_config_shared_key
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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	x21, x2
	mov	x20, x1
	mov	x19, x0
	ldr	x8, [x1]
Lloh0:
	adrp	x24, _SET_KEY@GOTPAGE
Lloh1:
	ldr	x24, [x24, _SET_KEY@GOTPAGEOFF]
	ldr	x9, [x24]
Lloh2:
	adrp	x23, _SEC_CSR0@GOTPAGE
Lloh3:
	ldr	x23, [x23, _SEC_CSR0@GOTPAGEOFF]
	cmp	x8, x9
	b.ne	LBB0_9
; %bb.1:
	ldr	w8, [x20, #8]
	mov	w9, #15
	lsl	w22, w9, w8
	ldr	w1, [x23]
	mov	x0, x19
	bl	_rt2x00usb_register_read
	and	w0, w0, w22
	cmp	w0, #0
	ccmp	w0, w22, #0, ne
	b.eq	LBB0_6
; %bb.2:
	cbz	w0, LBB0_4
; %bb.3:
	bl	_ffz
LBB0_4:
	ldr	w8, [x21]
	add	w8, w8, w0
	str	w8, [x21]
	ldr	w1, [x20, #24]
	mov	w2, #4
	bl	_memcpy
	ldr	w1, [x20, #20]
	mov	w2, #4
	bl	_memcpy
	ldr	w1, [x20, #16]
	mov	w2, #4
	bl	_memcpy
	ldr	w0, [x21]
	bl	_SHARED_KEY_ENTRY
	mov	x1, x0
	str	w0, [sp, #12]
	add	x2, sp, #16
	mov	x0, x19
	mov	w3, #12
	bl	_rt2x00usb_register_multiwrite
	ldr	w8, [x21]
	add	w22, w8, w8, lsl #1
	cmp	w8, #7
	b.gt	LBB0_7
; %bb.5:
	mov	w8, #7
	lsl	w25, w8, w22
Lloh4:
	adrp	x26, _SEC_CSR1@GOTPAGE
Lloh5:
	ldr	x26, [x26, _SEC_CSR1@GOTPAGEOFF]
	b	LBB0_8
LBB0_6:
Lloh6:
	adrp	x8, _ENOSPC@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ENOSPC@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_15
LBB0_7:
	sub	w22, w22, #24
	mov	w8, #7
	lsl	w25, w8, w22
Lloh9:
	adrp	x26, _SEC_CSR5@GOTPAGE
Lloh10:
	ldr	x26, [x26, _SEC_CSR5@GOTPAGEOFF]
LBB0_8:
	ldr	w1, [x26]
	mov	x0, x19
	bl	_rt2x00usb_register_read
	str	w0, [sp, #12]
	ldr	w2, [x20, #12]
	bfi	x22, x25, #32, #32
	add	x0, sp, #12
	mov	x1, x22
	bl	_rt2x00_set_field32
	ldr	w1, [x26]
	ldr	w2, [sp, #12]
	mov	x0, x19
	bl	_rt2x00usb_register_write
Lloh11:
	adrp	x8, _IEEE80211_KEY_FLAG_GENERATE_IV@GOTPAGE
Lloh12:
	ldr	x8, [x8, _IEEE80211_KEY_FLAG_GENERATE_IV@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	ldr	w9, [x21, #4]
	orr	w8, w9, w8
	str	w8, [x21, #4]
LBB0_9:
	ldr	w8, [x21]
	mov	w9, #1
	lsl	w21, w9, w8
	ldr	w1, [x23]
	mov	x0, x19
	bl	_rt2x00usb_register_read
	mov	x2, x0
	str	w0, [sp, #12]
	ldr	x8, [x20]
	ldr	x9, [x24]
	cmp	x8, x9
	b.ne	LBB0_11
; %bb.10:
	orr	w2, w2, w21
	b	LBB0_13
LBB0_11:
Lloh14:
	adrp	x9, _DISABLE_KEY@GOTPAGE
Lloh15:
	ldr	x9, [x9, _DISABLE_KEY@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_14
; %bb.12:
	bic	w2, w2, w21
LBB0_13:
	str	w2, [sp, #12]
LBB0_14:
	ldr	w1, [x23]
	mov	x0, x19
	bl	_rt2x00usb_register_write
	mov	w0, #0
LBB0_15:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_SET_KEY,8,3                    ; @SET_KEY
	.comm	_SEC_CSR0,4,2                   ; @SEC_CSR0
	.comm	_ENOSPC,4,2                     ; @ENOSPC
	.comm	_SEC_CSR1,4,2                   ; @SEC_CSR1
	.comm	_SEC_CSR5,4,2                   ; @SEC_CSR5
	.comm	_IEEE80211_KEY_FLAG_GENERATE_IV,4,2 ; @IEEE80211_KEY_FLAG_GENERATE_IV
	.comm	_DISABLE_KEY,8,3                ; @DISABLE_KEY
	.no_dead_strip	_rt73usb_config_shared_key
.subsections_via_symbols
