	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rtl8366s_detect
_rtl8366s_detect:                       ## @rtl8366s_detect
	.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
	subq	$16, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %rbx
	movl	$0, -20(%rbp)
	movl	$0, -24(%rbp)
	movq	_RTL8366S_CHIP_ID_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-20(%rbp), %rdx
	callq	_rtl8366_smi_read_reg
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movl	%eax, %r14d
	movl	(%rbx), %edi
	leaq	L_.str(%rip), %rsi
LBB0_6:
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_8
LBB0_2:
	movl	-20(%rbp), %edx
	cmpl	$128, %edx
	jne	LBB0_3
## %bb.4:
	movq	_RTL8366S_CHIP_VERSION_CTRL_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-24(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_rtl8366_smi_read_reg
	movl	(%rbx), %edi
	testl	%eax, %eax
	je	LBB0_7
## %bb.5:
	movl	%eax, %r14d
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_6
LBB0_3:
	movl	(%rbx), %edi
	leaq	L_.str.1(%rip), %rsi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_dev_err
	movq	_ENODEV@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
	jmp	LBB0_8
LBB0_7:
	movl	-20(%rbp), %edx
	movq	_RTL8366S_CHIP_VERSION_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	andl	-24(%rbp), %ecx
	leaq	L_.str.3(%rip), %rsi
	callq	_dev_info
	xorl	%r14d, %r14d
LBB0_8:
	movl	%r14d, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_RTL8366S_CHIP_ID_REG,4,2       ## @RTL8366S_CHIP_ID_REG
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"unable to read chip id\n"

L_.str.1:                               ## @.str.1
	.asciz	"unknown chip id (%04x)\n"

	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_RTL8366S_CHIP_VERSION_CTRL_REG,4,2 ## @RTL8366S_CHIP_VERSION_CTRL_REG
L_.str.2:                               ## @.str.2
	.asciz	"unable to read chip version\n"

L_.str.3:                               ## @.str.3
	.asciz	"RTL%04x ver. %u chip found\n"

	.comm	_RTL8366S_CHIP_VERSION_MASK,4,2 ## @RTL8366S_CHIP_VERSION_MASK
	.no_dead_strip	_rtl8366s_detect
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rtl8366s_detect
_rtl8366s_detect:                       ; @rtl8366s_detect
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.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
	mov	x20, x0
	str	xzr, [sp, #8]
Lloh0:
	adrp	x8, _RTL8366S_CHIP_ID_REG@GOTPAGE
Lloh1:
	ldr	x8, [x8, _RTL8366S_CHIP_ID_REG@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	add	x2, sp, #12
	bl	_rtl8366_smi_read_reg
	cbz	w0, LBB0_2
; %bb.1:
	mov	x19, x0
	ldr	w0, [x20]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_7
LBB0_2:
	ldr	w8, [sp, #12]
	cmp	w8, #128
	b.ne	LBB0_5
; %bb.3:
Lloh5:
	adrp	x8, _RTL8366S_CHIP_VERSION_CTRL_REG@GOTPAGE
Lloh6:
	ldr	x8, [x8, _RTL8366S_CHIP_VERSION_CTRL_REG@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	add	x2, sp, #8
	mov	x0, x20
	bl	_rtl8366_smi_read_reg
	mov	x19, x0
	ldr	w0, [x20]
	cbz	w19, LBB0_6
; %bb.4:
Lloh8:
	adrp	x1, l_.str.2@PAGE
Lloh9:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_err
	b	LBB0_7
LBB0_5:
	ldr	w0, [x20]
	str	x8, [sp]
Lloh10:
	adrp	x1, l_.str.1@PAGE
Lloh11:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
Lloh12:
	adrp	x8, _ENODEV@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	neg	w19, w8
	b	LBB0_7
LBB0_6:
	ldp	w8, w2, [sp, #8]
Lloh15:
	adrp	x9, _RTL8366S_CHIP_VERSION_MASK@GOTPAGE
Lloh16:
	ldr	x9, [x9, _RTL8366S_CHIP_VERSION_MASK@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	and	w3, w9, w8
Lloh18:
	adrp	x1, l_.str.3@PAGE
Lloh19:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_info
LBB0_7:
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_RTL8366S_CHIP_ID_REG,4,2       ; @RTL8366S_CHIP_ID_REG
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"unable to read chip id\n"

l_.str.1:                               ; @.str.1
	.asciz	"unknown chip id (%04x)\n"

	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_RTL8366S_CHIP_VERSION_CTRL_REG,4,2 ; @RTL8366S_CHIP_VERSION_CTRL_REG
l_.str.2:                               ; @.str.2
	.asciz	"unable to read chip version\n"

l_.str.3:                               ; @.str.3
	.asciz	"RTL%04x ver. %u chip found\n"

	.comm	_RTL8366S_CHIP_VERSION_MASK,4,2 ; @RTL8366S_CHIP_VERSION_MASK
	.no_dead_strip	_rtl8366s_detect
.subsections_via_symbols
