	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mt76_mac_wcid_set_key          ## -- Begin function mt76_mac_wcid_set_key
	.p2align	4, 0x90
_mt76_mac_wcid_set_key:                 ## @mt76_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	$184, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r12
	movl	%esi, %ebx
	movq	%rdi, %r15
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	leaq	-176(%rbp), %rsi
	movq	%rdx, %rdi
	callq	_mt76_mac_get_key_info
	movl	%eax, %r14d
	testq	%r12, %r12
	je	LBB0_3
## %bb.1:
	movq	_MT_CIPHER_NONE@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r14d
	jne	LBB0_3
## %bb.2:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_9
LBB0_3:
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_trace_set_key
	movl	%ebx, %edi
	callq	_MT_WCID_KEY
	leaq	-176(%rbp), %rdx
	movq	%r15, %rdi
	movl	%eax, %esi
	movl	$128, %ecx
	callq	_mt7601u_wr_copy
	leaq	-208(%rbp), %rdi
	xorl	%r13d, %r13d
	xorl	%esi, %esi
	movl	$32, %edx
	callq	_memset
	testq	%r12, %r12
	je	LBB0_6
## %bb.4:
	movl	(%r12), %eax
	shll	$6, %eax
	movl	%eax, -196(%rbp)
	movq	_MT_CIPHER_TKIP@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %r14d
	jb	LBB0_6
## %bb.5:
	orb	$1, -208(%rbp)
	orl	$32, %eax
	movl	%eax, -196(%rbp)
LBB0_6:
	movl	%ebx, %edi
	callq	_MT_WCID_IV
	leaq	-208(%rbp), %rdx
	movq	%r15, %rdi
	movl	%eax, %esi
	movl	$32, %ecx
	callq	_mt7601u_wr_copy
	movl	%ebx, -212(%rbp)                ## 4-byte Spill
	movl	%ebx, %edi
	callq	_MT_WCID_ATTR
	movq	%r15, -224(%rbp)                ## 8-byte Spill
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	_mt7601u_rr
	movq	_MT_WCID_ATTR_PKEY_MODE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	movq	_MT_WCID_ATTR_PKEY_MODE_EXT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r15d
	orl	%edi, %r15d
	notl	%r15d
	andl	%eax, %r15d
	movl	%r14d, %esi
	andl	$7, %esi
	callq	_FIELD_PREP
	movl	%eax, %ebx
	movq	_MT_WCID_ATTR_PKEY_MODE_EXT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	shrl	$3, %r14d
	movl	%r14d, %esi
	callq	_FIELD_PREP
	orl	%ebx, %eax
	orl	%r15d, %eax
	movq	_MT_WCID_ATTR_PAIRWISE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movl	%edx, %ecx
	notl	%ecx
	andl	%eax, %ecx
	testq	%r12, %r12
	je	LBB0_8
## %bb.7:
	movq	_IEEE80211_KEY_FLAG_PAIRWISE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	xorl	%r13d, %r13d
	testl	%eax, 4(%r12)
	setne	%r13b
LBB0_8:
	imull	%edx, %r13d
	orl	%ecx, %r13d
	movl	-212(%rbp), %edi                ## 4-byte Reload
	callq	_MT_WCID_ATTR
	movq	-224(%rbp), %rdi                ## 8-byte Reload
	movl	%eax, %esi
	movl	%r13d, %edx
	callq	_mt7601u_wr
	xorl	%eax, %eax
LBB0_9:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpq	-48(%rbp), %rcx
	jne	LBB0_11
## %bb.10:
	addq	$184, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_11:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_MT_CIPHER_NONE,4,2             ## @MT_CIPHER_NONE
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_MT_CIPHER_TKIP,4,2             ## @MT_CIPHER_TKIP
	.comm	_MT_WCID_ATTR_PKEY_MODE,4,2     ## @MT_WCID_ATTR_PKEY_MODE
	.comm	_MT_WCID_ATTR_PKEY_MODE_EXT,4,2 ## @MT_WCID_ATTR_PKEY_MODE_EXT
	.comm	_MT_WCID_ATTR_PAIRWISE,4,2      ## @MT_WCID_ATTR_PAIRWISE
	.comm	_IEEE80211_KEY_FLAG_PAIRWISE,4,2 ## @IEEE80211_KEY_FLAG_PAIRWISE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_mt76_mac_wcid_set_key          ; -- Begin function mt76_mac_wcid_set_key
	.p2align	2
_mt76_mac_wcid_set_key:                 ; @mt76_mac_wcid_set_key
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #256
	.cfi_def_cfa_offset 256
	stp	x26, x25, [sp, #176]            ; 16-byte Folded Spill
	stp	x24, x23, [sp, #192]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #208]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #224]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #240]            ; 16-byte Folded Spill
	add	x29, sp, #240
	.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
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-72]
	add	x1, sp, #40
	mov	x0, x2
	bl	_mt76_mac_get_key_info
	mov	x22, x0
	cbz	x21, LBB0_3
; %bb.1:
Lloh3:
	adrp	x8, _MT_CIPHER_NONE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MT_CIPHER_NONE@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w22, w8
	b.ne	LBB0_3
; %bb.2:
Lloh6:
	adrp	x8, _EINVAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_10
LBB0_3:
	mov	x0, x19
	mov	x1, x20
	bl	_trace_set_key
	mov	x0, x20
	bl	_MT_WCID_KEY
	mov	x1, x0
	add	x2, sp, #40
	mov	x0, x19
	mov	w3, #128
	bl	_mt7601u_wr_copy
	add	x0, sp, #8
	mov	w1, #0
	mov	w2, #32
	bl	_memset
	cbz	x21, LBB0_6
; %bb.4:
	ldr	w8, [x21]
	lsl	w8, w8, #6
	str	w8, [sp, #20]
Lloh9:
	adrp	x9, _MT_CIPHER_TKIP@GOTPAGE
Lloh10:
	ldr	x9, [x9, _MT_CIPHER_TKIP@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	cmp	w22, w9
	b.lo	LBB0_6
; %bb.5:
	ldr	w9, [sp, #8]
	orr	w9, w9, #0x1
	orr	w8, w8, #0x20
	str	w9, [sp, #8]
	str	w8, [sp, #20]
LBB0_6:
	mov	x0, x20
	bl	_MT_WCID_IV
	mov	x1, x0
	add	x2, sp, #8
	mov	x0, x19
	mov	w3, #32
	bl	_mt7601u_wr_copy
	mov	x0, x20
	bl	_MT_WCID_ATTR
	mov	x1, x0
	mov	x0, x19
	bl	_mt7601u_rr
Lloh12:
	adrp	x8, _MT_WCID_ATTR_PKEY_MODE@GOTPAGE
Lloh13:
	ldr	x8, [x8, _MT_WCID_ATTR_PKEY_MODE@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
Lloh15:
	adrp	x24, _MT_WCID_ATTR_PKEY_MODE_EXT@GOTPAGE
Lloh16:
	ldr	x24, [x24, _MT_WCID_ATTR_PKEY_MODE_EXT@GOTPAGEOFF]
	ldr	w9, [x24]
	orr	w9, w9, w8
	bic	w25, w0, w9
	and	w1, w22, #0x7
	mov	x0, x8
	bl	_FIELD_PREP
	mov	x23, x0
	ldr	w0, [x24]
	lsr	w1, w22, #3
	bl	_FIELD_PREP
	orr	w8, w25, w23
	orr	w9, w8, w0
Lloh17:
	adrp	x8, _MT_WCID_ATTR_PAIRWISE@GOTPAGE
Lloh18:
	ldr	x8, [x8, _MT_WCID_ATTR_PAIRWISE@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	bic	w9, w9, w8
	cbz	x21, LBB0_8
; %bb.7:
	ldr	w10, [x21, #4]
Lloh20:
	adrp	x11, _IEEE80211_KEY_FLAG_PAIRWISE@GOTPAGE
Lloh21:
	ldr	x11, [x11, _IEEE80211_KEY_FLAG_PAIRWISE@GOTPAGEOFF]
Lloh22:
	ldr	w11, [x11]
	tst	w11, w10
	cset	w10, ne
	b	LBB0_9
LBB0_8:
	mov	w10, #0
LBB0_9:
	mul	w8, w10, w8
	orr	w21, w8, w9
	mov	x0, x20
	bl	_MT_WCID_ATTR
	mov	x1, x0
	mov	x0, x19
	mov	x2, x21
	bl	_mt7601u_wr
	mov	w0, #0
LBB0_10:
	ldur	x8, [x29, #-72]
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_12
; %bb.11:
	ldp	x29, x30, [sp, #240]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #224]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #208]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #192]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #176]            ; 16-byte Folded Reload
	add	sp, sp, #256
	ret
LBB0_12:
	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 AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh15, Lloh16
	.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	_EINVAL,4,2                     ; @EINVAL
	.comm	_MT_CIPHER_TKIP,4,2             ; @MT_CIPHER_TKIP
	.comm	_MT_WCID_ATTR_PKEY_MODE,4,2     ; @MT_WCID_ATTR_PKEY_MODE
	.comm	_MT_WCID_ATTR_PKEY_MODE_EXT,4,2 ; @MT_WCID_ATTR_PKEY_MODE_EXT
	.comm	_MT_WCID_ATTR_PAIRWISE,4,2      ; @MT_WCID_ATTR_PAIRWISE
	.comm	_IEEE80211_KEY_FLAG_PAIRWISE,4,2 ; @IEEE80211_KEY_FLAG_PAIRWISE
.subsections_via_symbols
