	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rtl8366_get_mib_counter
_rtl8366_get_mib_counter:               ## @rtl8366_get_mib_counter
	.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	_RTL8366S_NUM_PORTS@GOTPCREL(%rip), %rax
	cmpl	%edx, (%rax)
	jl	LBB0_2
## %bb.1:
	movq	_RTL8366S_MIB_COUNT@GOTPCREL(%rip), %rax
	cmpl	%esi, (%rax)
	jle	LBB0_2
## %bb.4:
	movq	%rcx, %r14
	movl	%edx, %r12d
	movq	%rdi, %r15
	movq	_rtl8366s_mib_counters@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movslq	%esi, %rcx
	leaq	(%rcx,%rcx,2), %r13
	movl	(%rax,%r13,4), %ecx
	testl	%ecx, %ecx
	je	LBB0_5
## %bb.6:
	cmpl	$1, %ecx
	jne	LBB0_2
## %bb.7:
	movq	_RTL8366S_MIB_COUNTER_PORT_OFFSET2@GOTPCREL(%rip), %rdx
	movq	_RTL8366S_MIB_COUNTER_BASE2@GOTPCREL(%rip), %rcx
	jmp	LBB0_8
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_3:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_21
LBB0_5:
	movq	_RTL8366S_MIB_COUNTER_PORT_OFFSET@GOTPCREL(%rip), %rdx
	movq	_RTL8366S_MIB_COUNTER_BASE@GOTPCREL(%rip), %rcx
LBB0_8:
	imull	(%rdx), %r12d
	addl	(%rcx), %r12d
	addl	4(%rax,%r13,4), %r12d
	movl	$0, -44(%rbp)
	movq	%r15, %rdi
	movl	%r12d, %esi
	xorl	%edx, %edx
	callq	_rtl8366_smi_write_reg
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_21
## %bb.9:
	movq	_RTL8366S_MIB_CTRL_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-44(%rbp), %rdx
	movq	%r15, %rdi
	callq	_rtl8366_smi_read_reg
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_10
LBB0_21:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	movl	-44(%rbp), %eax
	movq	_RTL8366S_MIB_CTRL_BUSY_MASK@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_12
## %bb.11:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_12:
	movq	_RTL8366S_MIB_CTRL_RESET_MASK@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_14
## %bb.13:
	movq	_EIO@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_14:
	movq	_rtl8366s_mib_counters@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	8(%rax,%r13,4), %r13d
	xorl	%ebx, %ebx
	testl	%r13d, %r13d
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	jle	LBB0_15
## %bb.16:
	incl	%r13d
	xorl	%r14d, %r14d
LBB0_17:                                ## =>This Inner Loop Header: Depth=1
	leal	(%r12,%r13), %esi
	addl	$-2, %esi
	movq	%r15, %rdi
	leaq	-44(%rbp), %rdx
	callq	_rtl8366_smi_read_reg
	testl	%eax, %eax
	jne	LBB0_18
## %bb.19:                              ##   in Loop: Header=BB0_17 Depth=1
	shll	$16, %r14d
	movzwl	-44(%rbp), %eax
	movslq	%r14d, %r14
	orq	%rax, %r14
	decl	%r13d
	cmpl	$1, %r13d
	ja	LBB0_17
	jmp	LBB0_20
LBB0_15:
	xorl	%r14d, %r14d
LBB0_20:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	%r14, (%rax)
	jmp	LBB0_21
LBB0_18:
	movl	%eax, %ebx
	jmp	LBB0_21
	.cfi_endproc
                                        ## -- End function
	.comm	_RTL8366S_NUM_PORTS,4,2         ## @RTL8366S_NUM_PORTS
	.comm	_RTL8366S_MIB_COUNT,4,2         ## @RTL8366S_MIB_COUNT
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_rtl8366s_mib_counters,8,3      ## @rtl8366s_mib_counters
	.comm	_RTL8366S_MIB_COUNTER_BASE,4,2  ## @RTL8366S_MIB_COUNTER_BASE
	.comm	_RTL8366S_MIB_COUNTER_PORT_OFFSET,4,2 ## @RTL8366S_MIB_COUNTER_PORT_OFFSET
	.comm	_RTL8366S_MIB_COUNTER_BASE2,4,2 ## @RTL8366S_MIB_COUNTER_BASE2
	.comm	_RTL8366S_MIB_COUNTER_PORT_OFFSET2,4,2 ## @RTL8366S_MIB_COUNTER_PORT_OFFSET2
	.comm	_RTL8366S_MIB_CTRL_REG,4,2      ## @RTL8366S_MIB_CTRL_REG
	.comm	_RTL8366S_MIB_CTRL_BUSY_MASK,4,2 ## @RTL8366S_MIB_CTRL_BUSY_MASK
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_RTL8366S_MIB_CTRL_RESET_MASK,4,2 ## @RTL8366S_MIB_CTRL_RESET_MASK
	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_rtl8366_get_mib_counter
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rtl8366_get_mib_counter
_rtl8366_get_mib_counter:               ; @rtl8366_get_mib_counter
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
                                        ; kill: def $w1 killed $w1 def $x1
Lloh0:
	adrp	x8, _RTL8366S_NUM_PORTS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _RTL8366S_NUM_PORTS@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _RTL8366S_MIB_COUNT@GOTPAGE
Lloh4:
	ldr	x9, [x9, _RTL8366S_MIB_COUNT@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	cmp	w8, w2
	ccmp	w9, w1, #4, ge
	b.le	LBB0_4
; %bb.1:
	mov	x19, x3
	mov	x20, x0
Lloh6:
	adrp	x22, _rtl8366s_mib_counters@GOTPAGE
Lloh7:
	ldr	x22, [x22, _rtl8366s_mib_counters@GOTPAGEOFF]
	ldr	x8, [x22]
	mov	w9, #12
	smull	x9, w1, w9
	ldr	w9, [x8, x9]
	cbz	w9, LBB0_6
; %bb.2:
	cmp	w9, #1
	b.ne	LBB0_4
; %bb.3:
Lloh8:
	adrp	x9, _RTL8366S_MIB_COUNTER_PORT_OFFSET2@GOTPAGE
Lloh9:
	ldr	x9, [x9, _RTL8366S_MIB_COUNTER_PORT_OFFSET2@GOTPAGEOFF]
Lloh10:
	adrp	x10, _RTL8366S_MIB_COUNTER_BASE2@GOTPAGE
Lloh11:
	ldr	x10, [x10, _RTL8366S_MIB_COUNTER_BASE2@GOTPAGEOFF]
	b	LBB0_7
LBB0_4:
Lloh12:
	adrp	x8, _EINVAL@GOTPAGE
Lloh13:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_5:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_9
LBB0_6:
Lloh14:
	adrp	x9, _RTL8366S_MIB_COUNTER_PORT_OFFSET@GOTPAGE
Lloh15:
	ldr	x9, [x9, _RTL8366S_MIB_COUNTER_PORT_OFFSET@GOTPAGEOFF]
Lloh16:
	adrp	x10, _RTL8366S_MIB_COUNTER_BASE@GOTPAGE
Lloh17:
	ldr	x10, [x10, _RTL8366S_MIB_COUNTER_BASE@GOTPAGEOFF]
LBB0_7:
	sxtw	x23, w1
	ldr	w10, [x10]
	ldr	w9, [x9]
	madd	w9, w9, w2, w10
	mov	w10, #12
	madd	x8, x23, x10, x8
	ldr	w8, [x8, #4]
	add	w21, w8, w9
	str	wzr, [sp, #12]
	mov	x0, x20
	mov	x1, x21
	mov	w2, #0
	bl	_rtl8366_smi_write_reg
	cbnz	w0, LBB0_9
; %bb.8:
Lloh18:
	adrp	x8, _RTL8366S_MIB_CTRL_REG@GOTPAGE
Lloh19:
	ldr	x8, [x8, _RTL8366S_MIB_CTRL_REG@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
	add	x2, sp, #12
	mov	x0, x20
	bl	_rtl8366_smi_read_reg
	cbz	w0, LBB0_10
LBB0_9:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_10:
	ldr	w8, [sp, #12]
Lloh21:
	adrp	x9, _RTL8366S_MIB_CTRL_BUSY_MASK@GOTPAGE
Lloh22:
	ldr	x9, [x9, _RTL8366S_MIB_CTRL_BUSY_MASK@GOTPAGEOFF]
Lloh23:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_12
; %bb.11:
Lloh24:
	adrp	x8, _EBUSY@GOTPAGE
Lloh25:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
	b	LBB0_5
LBB0_12:
Lloh26:
	adrp	x9, _RTL8366S_MIB_CTRL_RESET_MASK@GOTPAGE
Lloh27:
	ldr	x9, [x9, _RTL8366S_MIB_CTRL_RESET_MASK@GOTPAGEOFF]
Lloh28:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_14
; %bb.13:
Lloh29:
	adrp	x8, _EIO@GOTPAGE
Lloh30:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_5
LBB0_14:
	ldr	x8, [x22]
	mov	w9, #12
	madd	x8, x23, x9, x8
	ldr	w8, [x8, #8]
	cmp	w8, #1
	b.lt	LBB0_18
; %bb.15:
	mov	w22, #0
	add	w23, w8, #1
LBB0_16:                                ; =>This Inner Loop Header: Depth=1
	add	w8, w21, w23
	sub	w1, w8, #2
	add	x2, sp, #12
	mov	x0, x20
	bl	_rtl8366_smi_read_reg
	cbnz	w0, LBB0_9
; %bb.17:                               ;   in Loop: Header=BB0_16 Depth=1
	lsl	w8, w22, #16
	ldrh	w9, [sp, #12]
	sxtw	x8, w8
	orr	x22, x9, x8
	sub	w23, w23, #1
	cmp	w23, #1
	b.hi	LBB0_16
	b	LBB0_19
LBB0_18:
	mov	x22, #0
LBB0_19:
	mov	w0, #0
	str	x22, [x19]
	b	LBB0_9
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.comm	_RTL8366S_NUM_PORTS,4,2         ; @RTL8366S_NUM_PORTS
	.comm	_RTL8366S_MIB_COUNT,4,2         ; @RTL8366S_MIB_COUNT
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_rtl8366s_mib_counters,8,3      ; @rtl8366s_mib_counters
	.comm	_RTL8366S_MIB_COUNTER_BASE,4,2  ; @RTL8366S_MIB_COUNTER_BASE
	.comm	_RTL8366S_MIB_COUNTER_PORT_OFFSET,4,2 ; @RTL8366S_MIB_COUNTER_PORT_OFFSET
	.comm	_RTL8366S_MIB_COUNTER_BASE2,4,2 ; @RTL8366S_MIB_COUNTER_BASE2
	.comm	_RTL8366S_MIB_COUNTER_PORT_OFFSET2,4,2 ; @RTL8366S_MIB_COUNTER_PORT_OFFSET2
	.comm	_RTL8366S_MIB_CTRL_REG,4,2      ; @RTL8366S_MIB_CTRL_REG
	.comm	_RTL8366S_MIB_CTRL_BUSY_MASK,4,2 ; @RTL8366S_MIB_CTRL_BUSY_MASK
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_RTL8366S_MIB_CTRL_RESET_MASK,4,2 ; @RTL8366S_MIB_CTRL_RESET_MASK
	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_rtl8366_get_mib_counter
.subsections_via_symbols
