	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_wlc_lcnphy_vbatsense           ## -- Begin function wlc_lcnphy_vbatsense
	.p2align	4, 0x90
_wlc_lcnphy_vbatsense:                  ## @wlc_lcnphy_vbatsense
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	%rdi, %r15
	cmpl	$1, %esi
	jne	LBB0_1
## %bb.2:
	movl	8(%r15), %ebx
	movq	_maccontrol@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_D11REGOFFS
	movl	%ebx, %edi
	movl	%eax, %esi
	callq	_bcma_read32
	movq	_MCTL_EN_MAC@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	sete	%al
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	je	LBB0_4
## %bb.3:
	movq	(%r15), %rax
	movl	(%rax), %edi
	callq	_wlapi_suspend_mac_and_wait
LBB0_4:
	movq	_VBATSENSE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_wlc_lcnphy_vbat_temp_sense_setup
	jmp	LBB0_5
LBB0_1:
	movl	$0, -44(%rbp)                   ## 4-byte Folded Spill
LBB0_5:
	movq	%r15, %rdi
	movl	$1141, %esi                     ## imm = 0x475
	callq	_read_phy_reg
	movl	%eax, %ebx
	movq	_LCN_VBAT_SCALE_NOM@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movq	_LCN_VBAT_SCALE_DEN@GOTPCREL(%rip), %rax
	movl	(%rax), %r13d
	cmpl	$1, %r14d
	jne	LBB0_8
## %bb.6:
	cmpb	$0, -44(%rbp)                   ## 1-byte Folded Reload
	jne	LBB0_8
## %bb.7:
	movq	(%r15), %rax
	movl	(%rax), %edi
	callq	_wlapi_enable_mac
LBB0_8:
	andl	$511, %ebx                      ## imm = 0x1FF
	xorl	%eax, %eax
	cmpl	$256, %ebx                      ## imm = 0x100
	setb	%al
	shll	$9, %eax
	leal	(%rax,%rbx), %ecx
	addl	$-512, %ecx                     ## imm = 0xFE00
	imull	%r12d, %ecx
	movl	%r13d, %eax
	sarl	%eax
	addl	%ecx, %eax
	cltd
	idivl	%r13d
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_maccontrol,4,2                 ## @maccontrol
	.comm	_MCTL_EN_MAC,4,2                ## @MCTL_EN_MAC
	.comm	_VBATSENSE,4,2                  ## @VBATSENSE
	.comm	_LCN_VBAT_SCALE_NOM,4,2         ## @LCN_VBAT_SCALE_NOM
	.comm	_LCN_VBAT_SCALE_DEN,4,2         ## @LCN_VBAT_SCALE_DEN
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_wlc_lcnphy_vbatsense           ; -- Begin function wlc_lcnphy_vbatsense
	.p2align	2
_wlc_lcnphy_vbatsense:                  ; @wlc_lcnphy_vbatsense
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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	x20, x1
	mov	x19, x0
	cmp	w1, #1
	b.ne	LBB0_4
; %bb.1:
	ldr	w21, [x19, #8]
Lloh0:
	adrp	x8, _maccontrol@GOTPAGE
Lloh1:
	ldr	x8, [x8, _maccontrol@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	bl	_D11REGOFFS
	mov	x1, x0
	mov	x0, x21
	bl	_bcma_read32
Lloh3:
	adrp	x8, _MCTL_EN_MAC@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MCTL_EN_MAC@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	ands	w8, w8, w0
	cset	w22, eq
	cbz	w8, LBB0_3
; %bb.2:
	ldr	x8, [x19]
	ldr	w0, [x8]
	bl	_wlapi_suspend_mac_and_wait
LBB0_3:
Lloh6:
	adrp	x8, _VBATSENSE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _VBATSENSE@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_wlc_lcnphy_vbat_temp_sense_setup
	b	LBB0_5
LBB0_4:
	mov	w22, #0
LBB0_5:
	mov	x0, x19
	mov	w1, #1141
	bl	_read_phy_reg
	mov	x21, x0
Lloh9:
	adrp	x8, _LCN_VBAT_SCALE_NOM@GOTPAGE
Lloh10:
	ldr	x8, [x8, _LCN_VBAT_SCALE_NOM@GOTPAGEOFF]
Lloh11:
	ldr	w23, [x8]
Lloh12:
	adrp	x8, _LCN_VBAT_SCALE_DEN@GOTPAGE
Lloh13:
	ldr	x8, [x8, _LCN_VBAT_SCALE_DEN@GOTPAGEOFF]
Lloh14:
	ldr	w24, [x8]
	cmp	w20, #1
	b.ne	LBB0_8
; %bb.6:
	tbnz	w22, #0, LBB0_8
; %bb.7:
	ldr	x8, [x19]
	ldr	w0, [x8]
	bl	_wlapi_enable_mac
LBB0_8:
	and	w8, w21, #0x1ff
	mov	w9, #-512
	cmp	w8, #255
	csel	w8, w9, wzr, hi
	bfxil	w8, w21, #0, #9
	mul	w8, w8, w23
	add	w8, w8, w24, asr #1
	sdiv	w0, w8, w24
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_maccontrol,4,2                 ; @maccontrol
	.comm	_MCTL_EN_MAC,4,2                ; @MCTL_EN_MAC
	.comm	_VBATSENSE,4,2                  ; @VBATSENSE
	.comm	_LCN_VBAT_SCALE_NOM,4,2         ; @LCN_VBAT_SCALE_NOM
	.comm	_LCN_VBAT_SCALE_DEN,4,2         ; @LCN_VBAT_SCALE_DEN
.subsections_via_symbols
