	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mt76x2_fixup_xtal
_mt76x2_fixup_xtal:                     ## @mt76x2_fixup_xtal
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %r14
	movq	_MT_EE_XTAL_TRIM_2@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_mt76x02_eeprom_get
	movl	%eax, %ecx
	andl	$127, %ecx
	movl	%ecx, %edx
	negl	%edx
	testb	$-128, %al
	cmovel	%ecx, %edx
	xorl	%ebx, %ebx
	cmpb	$-1, %al
	cmovnel	%edx, %ebx
	cmpl	$256, %eax                      ## imm = 0x100
	jb	LBB0_2
## %bb.1:
	sarl	$8, %eax
	cmpl	$255, %eax
	jne	LBB0_3
LBB0_2:
	movq	_MT_EE_XTAL_TRIM_1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_mt76x02_eeprom_get
	movzbl	%al, %ecx
	cmpl	$255, %ecx
	movl	$20, %edx
	movl	%ecx, %eax
	cmovel	%edx, %eax
	testl	%ecx, %ecx
	cmovel	%edx, %eax
LBB0_3:
	andl	$127, %eax
	addl	%ebx, %eax
	movq	_MT_XO_CTRL5@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movq	_MT_XO_CTRL5_C2_VAL@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movq	%r14, %rdi
	movl	%eax, %ecx
	callq	_mt76_rmw_field
	movq	_MT_XO_CTRL6@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_MT_XO_CTRL6_C2_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	callq	_mt76_set
	movq	_MT_EE_NIC_CONF_2@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_mt76x02_eeprom_get
	movq	_MT_EE_NIC_CONF_2_XTAL_OPTION@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	movl	%eax, %esi
	callq	_FIELD_GET
	testl	%eax, %eax
	je	LBB0_4
## %bb.5:
	cmpl	$1, %eax
	jne	LBB0_8
## %bb.6:
	movl	$1545596624, %edx               ## imm = 0x5C1FEED0
	jmp	LBB0_7
LBB0_4:
	movl	$1545596544, %edx               ## imm = 0x5C1FEE80
LBB0_7:
	movq	_MT_XO_CTRL7@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_mt76_wr                        ## TAILCALL
LBB0_8:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MT_EE_XTAL_TRIM_2,4,2          ## @MT_EE_XTAL_TRIM_2
	.comm	_MT_EE_XTAL_TRIM_1,4,2          ## @MT_EE_XTAL_TRIM_1
	.comm	_MT_XO_CTRL5,4,2                ## @MT_XO_CTRL5
	.comm	_MT_XO_CTRL5_C2_VAL,4,2         ## @MT_XO_CTRL5_C2_VAL
	.comm	_MT_XO_CTRL6,4,2                ## @MT_XO_CTRL6
	.comm	_MT_XO_CTRL6_C2_CTRL,4,2        ## @MT_XO_CTRL6_C2_CTRL
	.comm	_MT_EE_NIC_CONF_2,4,2           ## @MT_EE_NIC_CONF_2
	.comm	_MT_EE_NIC_CONF_2_XTAL_OPTION,4,2 ## @MT_EE_NIC_CONF_2_XTAL_OPTION
	.comm	_MT_XO_CTRL7,4,2                ## @MT_XO_CTRL7
	.no_dead_strip	_mt76x2_fixup_xtal
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mt76x2_fixup_xtal
_mt76x2_fixup_xtal:                     ; @mt76x2_fixup_xtal
	.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, _MT_EE_XTAL_TRIM_2@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MT_EE_XTAL_TRIM_2@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_mt76x02_eeprom_get
	and	w8, w0, #0x7f
	tst	w0, #0x80
	cneg	w8, w8, ne
	mov	w9, #255
	bics	wzr, w9, w0
	csel	w21, wzr, w8, eq
	cmp	w0, #256
	b.lo	LBB0_2
; %bb.1:
	asr	w8, w0, #8
	cmp	w8, #255
	b.ne	LBB0_3
LBB0_2:
Lloh3:
	adrp	x8, _MT_EE_XTAL_TRIM_1@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MT_EE_XTAL_TRIM_1@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_mt76x02_eeprom_get
	and	w8, w0, #0xff
	cmp	w8, #255
	ccmp	w8, #0, #4, ne
	mov	w9, #20
	csel	w8, w9, w8, eq
LBB0_3:
	mov	w20, #61056
	movk	w20, #23583, lsl #16
Lloh6:
	adrp	x9, _MT_XO_CTRL5@GOTPAGE
Lloh7:
	ldr	x9, [x9, _MT_XO_CTRL5@GOTPAGEOFF]
	and	w8, w8, #0x7f
Lloh8:
	ldr	w1, [x9]
Lloh9:
	adrp	x9, _MT_XO_CTRL5_C2_VAL@GOTPAGE
Lloh10:
	ldr	x9, [x9, _MT_XO_CTRL5_C2_VAL@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x9]
	add	w3, w8, w21
	mov	x0, x19
	bl	_mt76_rmw_field
Lloh12:
	adrp	x8, _MT_XO_CTRL6@GOTPAGE
Lloh13:
	ldr	x8, [x8, _MT_XO_CTRL6@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
Lloh15:
	adrp	x8, _MT_XO_CTRL6_C2_CTRL@GOTPAGE
Lloh16:
	ldr	x8, [x8, _MT_XO_CTRL6_C2_CTRL@GOTPAGEOFF]
Lloh17:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_mt76_set
Lloh18:
	adrp	x8, _MT_EE_NIC_CONF_2@GOTPAGE
Lloh19:
	ldr	x8, [x8, _MT_EE_NIC_CONF_2@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_mt76x02_eeprom_get
	mov	x1, x0
Lloh21:
	adrp	x8, _MT_EE_NIC_CONF_2_XTAL_OPTION@GOTPAGE
Lloh22:
	ldr	x8, [x8, _MT_EE_NIC_CONF_2_XTAL_OPTION@GOTPAGEOFF]
Lloh23:
	ldr	w0, [x8]
	bl	_FIELD_GET
	cbz	w0, LBB0_6
; %bb.4:
	cmp	w0, #1
	b.ne	LBB0_7
; %bb.5:
	add	w20, w20, #80
LBB0_6:
Lloh24:
	adrp	x8, _MT_XO_CTRL7@GOTPAGE
Lloh25:
	ldr	x8, [x8, _MT_XO_CTRL7@GOTPAGEOFF]
Lloh26:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x20
	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
	b	_mt76_wr
LBB0_7:
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_MT_EE_XTAL_TRIM_2,4,2          ; @MT_EE_XTAL_TRIM_2
	.comm	_MT_EE_XTAL_TRIM_1,4,2          ; @MT_EE_XTAL_TRIM_1
	.comm	_MT_XO_CTRL5,4,2                ; @MT_XO_CTRL5
	.comm	_MT_XO_CTRL5_C2_VAL,4,2         ; @MT_XO_CTRL5_C2_VAL
	.comm	_MT_XO_CTRL6,4,2                ; @MT_XO_CTRL6
	.comm	_MT_XO_CTRL6_C2_CTRL,4,2        ; @MT_XO_CTRL6_C2_CTRL
	.comm	_MT_EE_NIC_CONF_2,4,2           ; @MT_EE_NIC_CONF_2
	.comm	_MT_EE_NIC_CONF_2_XTAL_OPTION,4,2 ; @MT_EE_NIC_CONF_2_XTAL_OPTION
	.comm	_MT_XO_CTRL7,4,2                ; @MT_XO_CTRL7
	.no_dead_strip	_mt76x2_fixup_xtal
.subsections_via_symbols
