	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mt7601u_tssi_cal
_mt7601u_tssi_cal:                      ## @mt7601u_tssi_cal
	.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	16(%rdi), %rax
	cmpl	$0, 16(%rax)
	je	LBB0_25
## %bb.1:
	movq	%rdi, %r12
	callq	_mt7601u_use_hvga
	movl	%eax, %ebx
	cmpl	$0, 40(%r12)
	je	LBB0_24
## %bb.2:
	movq	%r12, %rdi
	callq	_mt7601u_tssi_read_ready
	testl	%eax, %eax
	je	LBB0_25
## %bb.3:
	movq	%r12, %rdi
	callq	_mt7601u_tssi_params_get
	movq	%rax, %r15
	shrq	$32, %r15
	xorl	%edx, %edx
	testl	%ebx, %ebx
	sete	%dl
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
                                        ## kill: def $eax killed $eax killed $rax
	subl	(%r12,%rdx,4), %eax
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movsbl	%al, %ebx
	movl	%ebx, %edi
	callq	_lin2dBd
	movl	%eax, %r13d
	movl	12(%r12), %edi
	movsbl	%al, %r14d
	leaq	L_.str(%rip), %rsi
	movl	%ebx, %edx
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	movl	%r14d, %ecx
	movl	%ebx, %r8d
	xorl	%eax, %eax
	callq	_dev_dbg
	movq	32(%r12), %rax
	movl	(%rax), %edx
	cmpl	$4, %edx
	jg	LBB0_5
## %bb.4:
	movq	16(%r12), %rax
	movq	(%rax), %rcx
	jmp	LBB0_8
LBB0_25:
	xorl	%eax, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movq	16(%r12), %rax
	movq	(%rax), %rcx
	cmpl	$8, %edx
	ja	LBB0_7
## %bb.6:
	incq	%rcx
	jmp	LBB0_8
LBB0_7:
	addq	$2, %rcx
LBB0_8:
	movsbl	(%rcx), %edx
	testl	%ebx, %ebx
	je	LBB0_10
## %bb.9:
	subb	24(%r12), %r13b
	movsbl	%r13b, %r14d
LBB0_10:
	movsbl	8(%rax), %eax
	imull	%r14d, %eax
	shll	$9, %edx
	addl	%eax, %edx
	subl	%edx, %r15d
	movl	12(%r12), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%r15d, %ecx
	xorl	%eax, %eax
	callq	_dev_dbg
	cmpl	$127, -56(%rbp)                 ## 4-byte Folded Reload
	jl	LBB0_13
## %bb.11:
	testl	%r15d, %r15d
	jle	LBB0_13
## %bb.12:
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_16
LBB0_13:
	cmpl	$0, -48(%rbp)                   ## 4-byte Folded Reload
	jg	LBB0_17
## %bb.14:
	testl	%r15d, %r15d
	jns	LBB0_17
## %bb.15:
	leaq	L_.str.3(%rip), %rsi
LBB0_16:
	movl	12(%r12), %edi
	callq	_dev_err
	xorl	%r15d, %r15d
LBB0_17:
	movl	8(%r12), %edx
	movl	%edx, %eax
	xorl	%r15d, %eax
	jns	LBB0_22
## %bb.18:
	movl	%r15d, %esi
	negl	%esi
	cmovsl	%r15d, %esi
	cmpl	$4095, %esi                     ## imm = 0xFFF
	ja	LBB0_22
## %bb.19:
	movl	%edx, %edi
	negl	%edi
	cmovnsl	%edi, %edx
	movl	$-2048, %eax                    ## imm = 0xF800
	xorl	%ecx, %ecx
	cmpl	%edx, %esi
	ja	LBB0_23
## %bb.20:
	testl	%r15d, %r15d
	jle	LBB0_22
## %bb.21:
	cmpl	%edi, %r15d
	je	LBB0_23
LBB0_22:
	movl	%r15d, 8(%r12)
	xorl	%eax, %eax
	testl	%r15d, %r15d
	setg	%al
	shll	$12, %eax
	addl	$-2048, %eax                    ## imm = 0xF800
	movl	%r15d, %ecx
LBB0_23:
	movl	%eax, %edx
	addl	%ecx, %edx
	leal	4095(%rax,%rcx), %r15d
	cmovnsl	%edx, %r15d
	sarl	$12, %r15d
	movl	12(%r12), %edi
	leaq	L_.str.4(%rip), %rsi
	movl	%r15d, %edx
	xorl	%eax, %eax
	callq	_dev_dbg
	movq	_MT_TX_ALC_CFG_1@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	movq	%r12, %rdi
	callq	_mt7601u_rr
	movl	%eax, %r14d
	movq	_MT_TX_ALC_CFG_1_TEMP_COMP@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	movl	%eax, %esi
	callq	_FIELD_GET
	movl	%eax, %edi
	callq	_s6_to_int
	addl	%eax, %r15d
	movl	(%rbx), %ebx
	notl	%ebx
	andl	%r14d, %ebx
	movl	%r15d, %edi
	callq	_int_to_s6
	orl	%eax, %ebx
	movl	(%r13), %esi
	movq	%r12, %rdi
	movl	%ebx, %edx
	callq	_mt7601u_wr
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
LBB0_24:
	movq	%r12, %rdi
	movl	%ebx, %esi
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_mt7601u_mcu_tssi_read_kick     ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"tssi dc:%04hx db:%04hx hvga:%d\n"

L_.str.1:                               ## @.str.1
	.asciz	"Power curr:%08x diff:%08x\n"

L_.str.2:                               ## @.str.2
	.asciz	"Error: TSSI upper saturation\n"

L_.str.3:                               ## @.str.3
	.asciz	"Error: TSSI lower saturation\n"

L_.str.4:                               ## @.str.4
	.asciz	"final diff: %08x\n"

	.comm	_MT_TX_ALC_CFG_1,4,2            ## @MT_TX_ALC_CFG_1
	.comm	_MT_TX_ALC_CFG_1_TEMP_COMP,4,2  ## @MT_TX_ALC_CFG_1_TEMP_COMP
	.no_dead_strip	_mt7601u_tssi_cal
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mt7601u_tssi_cal
_mt7601u_tssi_cal:                      ; @mt7601u_tssi_cal
	.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
	ldr	x8, [x0, #16]
	ldr	w8, [x8, #16]
	cbz	w8, LBB0_5
; %bb.1:
	mov	x19, x0
	bl	_mt7601u_use_hvga
	mov	x20, x0
	ldr	w8, [x19, #40]
	cbz	w8, LBB0_21
; %bb.2:
	mov	x0, x19
	bl	_mt7601u_tssi_read_ready
	cbz	w0, LBB0_5
; %bb.3:
	mov	x0, x19
	bl	_mt7601u_tssi_params_get
	mov	x21, x0
	lsr	x25, x0, #32
	cmp	w20, #0
	cset	w8, eq
	ldr	w8, [x19, w8, uxtw #2]
	sub	w24, w21, w8
	sxtb	w23, w24
	mov	x0, x23
	bl	_lin2dBd
	mov	x22, x0
	ldr	w0, [x19, #12]
	sxtw	x8, w22
	stp	x8, x20, [sp]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x23
	bl	_dev_dbg
	ldr	x8, [x19, #32]
	ldr	w9, [x8]
	cmp	w9, #4
	b.gt	LBB0_6
; %bb.4:
	ldr	x8, [x19, #16]
	ldr	x9, [x8]
	ldrsb	w9, [x9]
	cbnz	w20, LBB0_7
	b	LBB0_8
LBB0_5:
	mov	w0, #0
	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
LBB0_6:
	ldr	x8, [x19, #16]
	ldr	x10, [x8]
	cmp	w9, #8
	add	x9, x10, #2
	csinc	x9, x9, x10, hi
	ldrsb	w9, [x9]
	cbz	w20, LBB0_8
LBB0_7:
	ldrb	w10, [x19, #24]
	sub	w10, w22, w10
	sxtb	w22, w10
LBB0_8:
	ldrsb	w8, [x8, #8]
	mul	w8, w22, w8
	add	w2, w8, w9, lsl #9
	sub	w22, w25, w2
	ldr	w0, [x19, #12]
	str	x22, [sp]
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_dbg
	cmp	w21, #127
	b.lt	LBB0_11
; %bb.9:
	cmp	w22, #0
	b.le	LBB0_11
; %bb.10:
Lloh4:
	adrp	x1, l_.str.2@PAGE
Lloh5:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_14
LBB0_11:
	cmp	w24, #0
	b.gt	LBB0_15
; %bb.12:
	tbz	w22, #31, LBB0_15
; %bb.13:
Lloh6:
	adrp	x1, l_.str.3@PAGE
Lloh7:
	add	x1, x1, l_.str.3@PAGEOFF
LBB0_14:
	ldr	w0, [x19, #12]
	bl	_dev_err
	mov	w22, #0
LBB0_15:
	ldr	w8, [x19, #8]
	eor	w9, w8, w22
	tbz	w9, #31, LBB0_19
; %bb.16:
	cmp	w22, #0
	cneg	w9, w22, mi
	cmp	w9, #4095
	b.hi	LBB0_19
; %bb.17:
	cmp	w8, #0
	cneg	w10, w8, mi
	cmp	w9, w10
	b.hi	LBB0_22
; %bb.18:
	neg	w8, w8
	cmp	w22, #1
	ccmp	w22, w8, #0, ge
	b.eq	LBB0_22
LBB0_19:
	str	w22, [x19, #8]
	cmp	w22, #0
	mov	w8, #2048
	cneg	w8, w8, le
LBB0_20:
	add	w8, w8, w22
	add	w9, w8, #4095
	cmp	w8, #0
	csel	w8, w9, w8, lt
	asr	w21, w8, #12
	ldr	w0, [x19, #12]
Lloh8:
	adrp	x1, l_.str.4@PAGE
Lloh9:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x2, x21
	bl	_dev_dbg
Lloh10:
	adrp	x23, _MT_TX_ALC_CFG_1@GOTPAGE
Lloh11:
	ldr	x23, [x23, _MT_TX_ALC_CFG_1@GOTPAGEOFF]
	ldr	w1, [x23]
	mov	x0, x19
	bl	_mt7601u_rr
	mov	x22, x0
Lloh12:
	adrp	x24, _MT_TX_ALC_CFG_1_TEMP_COMP@GOTPAGE
Lloh13:
	ldr	x24, [x24, _MT_TX_ALC_CFG_1_TEMP_COMP@GOTPAGEOFF]
	ldr	w0, [x24]
	mov	x1, x22
	bl	_FIELD_GET
	bl	_s6_to_int
	add	w0, w0, w21
	ldr	w8, [x24]
	bic	w21, w22, w8
	bl	_int_to_s6
	orr	w2, w21, w0
	ldr	w1, [x23]
	mov	x0, x19
	bl	_mt7601u_wr
LBB0_21:
	mov	x0, x19
	mov	x1, x20
	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
	b	_mt7601u_mcu_tssi_read_kick
LBB0_22:
	mov	w22, #0
	mov	w8, #-2048
	b	LBB0_20
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"tssi dc:%04hx db:%04hx hvga:%d\n"

l_.str.1:                               ; @.str.1
	.asciz	"Power curr:%08x diff:%08x\n"

l_.str.2:                               ; @.str.2
	.asciz	"Error: TSSI upper saturation\n"

l_.str.3:                               ; @.str.3
	.asciz	"Error: TSSI lower saturation\n"

l_.str.4:                               ; @.str.4
	.asciz	"final diff: %08x\n"

	.comm	_MT_TX_ALC_CFG_1,4,2            ; @MT_TX_ALC_CFG_1
	.comm	_MT_TX_ALC_CFG_1_TEMP_COMP,4,2  ; @MT_TX_ALC_CFG_1_TEMP_COMP
	.no_dead_strip	_mt7601u_tssi_cal
.subsections_via_symbols
