	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mt76x02_mac_wcid_set_key       ## -- Begin function mt76x02_mac_wcid_set_key
	.p2align	4, 0x90
_mt76x02_mac_wcid_set_key:              ## @mt76x02_mac_wcid_set_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	$168, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %rbx
	movl	%esi, %r15d
	movq	%rdi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	leaq	-176(%rbp), %rsi
	movq	%rdx, %rdi
	callq	_mt76x02_mac_get_key_info
	movl	%eax, %r13d
	testq	%rbx, %rbx
	je	LBB0_3
## %bb.1:
	movq	_MT_CIPHER_NONE@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r13d
	jne	LBB0_3
## %bb.2:
	movq	_EOPNOTSUPP@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
	jmp	LBB0_11
LBB0_3:
	movl	%r15d, %edi
	callq	_MT_WCID_KEY
	leaq	-176(%rbp), %rdx
	movq	%r14, %rdi
	movl	%eax, %esi
	movl	$128, %ecx
	callq	_mt76_wr_copy
	movl	%r15d, %edi
	callq	_MT_WCID_ATTR
	movq	_MT_WCID_ATTR_PKEY_MODE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movq	%r14, %rdi
	movl	%eax, %esi
	movl	%r13d, %ecx
	callq	_mt76_rmw_field
	leaq	-208(%rbp), %rdi
	xorl	%r12d, %r12d
	xorl	%esi, %esi
	movl	$32, %edx
	callq	_memset
	testq	%rbx, %rbx
	je	LBB0_10
## %bb.4:
	movl	%r15d, %edi
	callq	_MT_WCID_ATTR
	movq	_MT_WCID_ATTR_PAIRWISE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movq	_IEEE80211_KEY_FLAG_PAIRWISE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	xorl	%ecx, %ecx
	andl	(%rbx), %esi
	setne	%cl
	movq	%r14, %rdi
	movl	%eax, %esi
	callq	_mt76_rmw_field
	leaq	8(%rbx), %rdi
	callq	_atomic64_read
	movl	4(%rbx), %edx
	shll	$6, %edx
	movl	%edx, -196(%rbp)
	movq	_MT_CIPHER_TKIP@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	cmpl	%ecx, %r13d
	jb	LBB0_6
## %bb.5:
	orl	$32, %edx
	movl	%edx, -196(%rbp)
	movl	%eax, %ebx
	movl	%eax, %edi
	sarl	$16, %edi
	leaq	-192(%rbp), %rsi
	callq	_put_unaligned_le32
	movl	%ebx, %eax
	movq	_MT_CIPHER_TKIP@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
LBB0_6:
	cmpl	%ecx, %r13d
	jne	LBB0_8
## %bb.7:
	movl	%eax, %edx
	shrl	$8, %edx
	movzbl	%dl, %ecx
	movl	%ecx, -208(%rbp)
	andl	$95, %edx
	orl	$32, %edx
	movl	%edx, -204(%rbp)
	movzbl	%al, %eax
	movl	%eax, -200(%rbp)
	jmp	LBB0_10
LBB0_8:
	movq	_MT_CIPHER_AES_CCMP@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %r13d
	jb	LBB0_10
## %bb.9:
	movzwl	%ax, %edi
	leaq	-208(%rbp), %rsi
	callq	_put_unaligned_le16
LBB0_10:
	movl	%r15d, %edi
	callq	_MT_WCID_IV
	leaq	-208(%rbp), %rdx
	movq	%r14, %rdi
	movl	%eax, %esi
	movl	$32, %ecx
	callq	_mt76_wr_copy
LBB0_11:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_13
## %bb.12:
	movl	%r12d, %eax
	addq	$168, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_13:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_MT_CIPHER_NONE,4,2             ## @MT_CIPHER_NONE
	.comm	_EOPNOTSUPP,4,2                 ## @EOPNOTSUPP
	.comm	_MT_WCID_ATTR_PKEY_MODE,4,2     ## @MT_WCID_ATTR_PKEY_MODE
	.comm	_MT_WCID_ATTR_PAIRWISE,4,2      ## @MT_WCID_ATTR_PAIRWISE
	.comm	_IEEE80211_KEY_FLAG_PAIRWISE,4,2 ## @IEEE80211_KEY_FLAG_PAIRWISE
	.comm	_MT_CIPHER_TKIP,4,2             ## @MT_CIPHER_TKIP
	.comm	_MT_CIPHER_AES_CCMP,4,2         ## @MT_CIPHER_AES_CCMP
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mt76x02_mac_wcid_set_key       ; -- Begin function mt76x02_mac_wcid_set_key
	.p2align	2
_mt76x02_mac_wcid_set_key:              ; @mt76x02_mac_wcid_set_key
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #240
	.cfi_def_cfa_offset 240
	stp	x24, x23, [sp, #176]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #192]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #208]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #224]            ; 16-byte Folded Spill
	add	x29, sp, #224
	.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
	mov	x22, x2
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-56]
	add	x1, sp, #40
	mov	x0, x2
	bl	_mt76x02_mac_get_key_info
	mov	x21, x0
	cbz	x22, LBB0_3
; %bb.1:
Lloh3:
	adrp	x8, _MT_CIPHER_NONE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MT_CIPHER_NONE@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w21, w8
	b.ne	LBB0_3
; %bb.2:
Lloh6:
	adrp	x8, _EOPNOTSUPP@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EOPNOTSUPP@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_11
LBB0_3:
	mov	x0, x20
	bl	_MT_WCID_KEY
	mov	x1, x0
	add	x2, sp, #40
	mov	x0, x19
	mov	w3, #128
	bl	_mt76_wr_copy
	mov	x0, x20
	bl	_MT_WCID_ATTR
	mov	x1, x0
Lloh9:
	adrp	x8, _MT_WCID_ATTR_PKEY_MODE@GOTPAGE
Lloh10:
	ldr	x8, [x8, _MT_WCID_ATTR_PKEY_MODE@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
	mov	x0, x19
	mov	x3, x21
	bl	_mt76_rmw_field
	add	x0, sp, #8
	mov	w1, #0
	mov	w2, #32
	bl	_memset
	cbz	x22, LBB0_10
; %bb.4:
	mov	x0, x20
	bl	_MT_WCID_ATTR
	mov	x1, x0
Lloh12:
	adrp	x8, _MT_WCID_ATTR_PAIRWISE@GOTPAGE
Lloh13:
	ldr	x8, [x8, _MT_WCID_ATTR_PAIRWISE@GOTPAGEOFF]
Lloh14:
	ldr	w2, [x8]
	ldr	w8, [x22]
Lloh15:
	adrp	x9, _IEEE80211_KEY_FLAG_PAIRWISE@GOTPAGE
Lloh16:
	ldr	x9, [x9, _IEEE80211_KEY_FLAG_PAIRWISE@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	tst	w9, w8
	cset	w3, ne
	mov	x0, x19
	bl	_mt76_rmw_field
	add	x0, x22, #8
	bl	_atomic64_read
	mov	x23, x0
	ldr	w8, [x22, #4]
	lsl	w9, w8, #6
	str	w9, [sp, #20]
Lloh18:
	adrp	x22, _MT_CIPHER_TKIP@GOTPAGE
Lloh19:
	ldr	x22, [x22, _MT_CIPHER_TKIP@GOTPAGEOFF]
	ldr	w8, [x22]
	cmp	w21, w8
	b.lo	LBB0_6
; %bb.5:
	orr	w8, w9, #0x20
	str	w8, [sp, #20]
	asr	w0, w23, #16
	add	x8, sp, #8
	add	x1, x8, #16
	bl	_put_unaligned_le32
	ldr	w8, [x22]
LBB0_6:
	cmp	w21, w8
	b.ne	LBB0_8
; %bb.7:
	lsr	w8, w23, #8
	ubfx	w9, w23, #8, #8
	and	w8, w8, #0x7f
	orr	w8, w8, #0x20
	stp	w9, w8, [sp, #8]
	and	w8, w23, #0xff
	str	w8, [sp, #16]
	b	LBB0_10
LBB0_8:
Lloh20:
	adrp	x8, _MT_CIPHER_AES_CCMP@GOTPAGE
Lloh21:
	ldr	x8, [x8, _MT_CIPHER_AES_CCMP@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	cmp	w21, w8
	b.lo	LBB0_10
; %bb.9:
	and	w0, w23, #0xffff
	add	x1, sp, #8
	bl	_put_unaligned_le16
LBB0_10:
	mov	x0, x20
	bl	_MT_WCID_IV
	mov	x1, x0
	add	x2, sp, #8
	mov	x0, x19
	mov	w3, #32
	bl	_mt76_wr_copy
	mov	w0, #0
LBB0_11:
	ldur	x8, [x29, #-56]
Lloh23:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh24:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh25:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_13
; %bb.12:
	ldp	x29, x30, [sp, #224]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #208]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #192]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #176]            ; 16-byte Folded Reload
	add	sp, sp, #240
	ret
LBB0_13:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.comm	_MT_CIPHER_NONE,4,2             ; @MT_CIPHER_NONE
	.comm	_EOPNOTSUPP,4,2                 ; @EOPNOTSUPP
	.comm	_MT_WCID_ATTR_PKEY_MODE,4,2     ; @MT_WCID_ATTR_PKEY_MODE
	.comm	_MT_WCID_ATTR_PAIRWISE,4,2      ; @MT_WCID_ATTR_PAIRWISE
	.comm	_IEEE80211_KEY_FLAG_PAIRWISE,4,2 ; @IEEE80211_KEY_FLAG_PAIRWISE
	.comm	_MT_CIPHER_TKIP,4,2             ; @MT_CIPHER_TKIP
	.comm	_MT_CIPHER_AES_CCMP,4,2         ; @MT_CIPHER_AES_CCMP
.subsections_via_symbols
