	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rtl8367b_detect
_rtl8367b_detect:                       ## @rtl8367b_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
	movq	_RTL8367B_RTL_MAGIC_ID_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_RTL8367B_RTL_MAGIC_ID_VAL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_rtl8366_smi_write_reg
	movq	_RTL8367B_CHIP_NUMBER_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-28(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_rtl8366_smi_read_reg
	testl	%eax, %eax
	je	LBB0_3
## %bb.1:
	movl	%eax, %r14d
	movl	(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	leaq	L_.str.1(%rip), %rdx
	jmp	LBB0_2
LBB0_3:
	movq	_RTL8367B_CHIP_VER_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-24(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_rtl8366_smi_read_reg
	testl	%eax, %eax
	je	LBB0_5
## %bb.4:
	movl	%eax, %r14d
	movl	(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	leaq	L_.str.2(%rip), %rdx
	jmp	LBB0_2
LBB0_5:
	movq	_RTL8367B_CHIP_MODE_REG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-20(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_rtl8366_smi_read_reg
	testl	%eax, %eax
	je	LBB0_7
## %bb.6:
	movl	%eax, %r14d
	movl	(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	leaq	L_.str.3(%rip), %rdx
LBB0_2:
	xorl	%eax, %eax
	callq	_dev_err
LBB0_12:
	movl	%r14d, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_7:
	movl	-24(%rbp), %ecx
	cmpl	$4096, %ecx                     ## imm = 0x1000
	je	LBB0_8
## %bb.9:
	cmpl	$4112, %ecx                     ## imm = 0x1010
	jne	LBB0_13
## %bb.10:
	leaq	L_.str.5(%rip), %rdx
	jmp	LBB0_11
LBB0_8:
	leaq	L_.str.4(%rip), %rdx
LBB0_11:
	movl	(%rbx), %edi
	leaq	L_.str.7(%rip), %rsi
	callq	_dev_info
	xorl	%r14d, %r14d
	jmp	LBB0_12
LBB0_13:
	movl	(%rbx), %edi
	movl	-28(%rbp), %edx
	movl	-20(%rbp), %r8d
	leaq	L_.str.6(%rip), %rsi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_dev_err
	movq	_ENODEV@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_RTL8367B_RTL_MAGIC_ID_REG,4,2  ## @RTL8367B_RTL_MAGIC_ID_REG
	.comm	_RTL8367B_RTL_MAGIC_ID_VAL,4,2  ## @RTL8367B_RTL_MAGIC_ID_VAL
	.comm	_RTL8367B_CHIP_NUMBER_REG,4,2   ## @RTL8367B_CHIP_NUMBER_REG
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"unable to read %s register\n"

L_.str.1:                               ## @.str.1
	.asciz	"chip number"

	.comm	_RTL8367B_CHIP_VER_REG,4,2      ## @RTL8367B_CHIP_VER_REG
L_.str.2:                               ## @.str.2
	.asciz	"chip version"

	.comm	_RTL8367B_CHIP_MODE_REG,4,2     ## @RTL8367B_CHIP_MODE_REG
L_.str.3:                               ## @.str.3
	.asciz	"chip mode"

L_.str.4:                               ## @.str.4
	.asciz	"8367RB"

L_.str.5:                               ## @.str.5
	.asciz	"8367R-VB"

L_.str.6:                               ## @.str.6
	.asciz	"unknown chip num:%04x ver:%04x, mode:%04x\n"

	.comm	_ENODEV,4,2                     ## @ENODEV
L_.str.7:                               ## @.str.7
	.asciz	"RTL%s chip found\n"

	.no_dead_strip	_rtl8367b_detect
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rtl8367b_detect
_rtl8367b_detect:                       ; @rtl8367b_detect
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	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
	mov	x19, x0
Lloh0:
	adrp	x8, _RTL8367B_RTL_MAGIC_ID_REG@GOTPAGE
Lloh1:
	ldr	x8, [x8, _RTL8367B_RTL_MAGIC_ID_REG@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
Lloh3:
	adrp	x8, _RTL8367B_RTL_MAGIC_ID_VAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _RTL8367B_RTL_MAGIC_ID_VAL@GOTPAGEOFF]
Lloh5:
	ldr	w2, [x8]
	bl	_rtl8366_smi_write_reg
Lloh6:
	adrp	x8, _RTL8367B_CHIP_NUMBER_REG@GOTPAGE
Lloh7:
	ldr	x8, [x8, _RTL8367B_CHIP_NUMBER_REG@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	sub	x2, x29, #20
	mov	x0, x19
	bl	_rtl8366_smi_read_reg
	cbz	w0, LBB0_2
; %bb.1:
	mov	x20, x0
	ldr	w0, [x19]
Lloh9:
	adrp	x8, l_.str.1@PAGE
Lloh10:
	add	x8, x8, l_.str.1@PAGEOFF
	b	LBB0_6
LBB0_2:
Lloh11:
	adrp	x8, _RTL8367B_CHIP_VER_REG@GOTPAGE
Lloh12:
	ldr	x8, [x8, _RTL8367B_CHIP_VER_REG@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	sub	x2, x29, #24
	mov	x0, x19
	bl	_rtl8366_smi_read_reg
	cbz	w0, LBB0_4
; %bb.3:
	mov	x20, x0
	ldr	w0, [x19]
Lloh14:
	adrp	x8, l_.str.2@PAGE
Lloh15:
	add	x8, x8, l_.str.2@PAGEOFF
	b	LBB0_6
LBB0_4:
Lloh16:
	adrp	x8, _RTL8367B_CHIP_MODE_REG@GOTPAGE
Lloh17:
	ldr	x8, [x8, _RTL8367B_CHIP_MODE_REG@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
	sub	x2, x29, #28
	mov	x0, x19
	bl	_rtl8366_smi_read_reg
	cbz	w0, LBB0_8
; %bb.5:
	mov	x20, x0
	ldr	w0, [x19]
Lloh19:
	adrp	x8, l_.str.3@PAGE
Lloh20:
	add	x8, x8, l_.str.3@PAGEOFF
LBB0_6:
	str	x8, [sp]
Lloh21:
	adrp	x1, l_.str@PAGE
Lloh22:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
LBB0_7:
	mov	x0, x20
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
LBB0_8:
	ldur	w8, [x29, #-24]
	cmp	w8, #1, lsl #12                 ; =4096
	b.eq	LBB0_11
; %bb.9:
	mov	w9, #4112
	cmp	w8, w9
	b.ne	LBB0_13
; %bb.10:
Lloh23:
	adrp	x2, l_.str.5@PAGE
Lloh24:
	add	x2, x2, l_.str.5@PAGEOFF
	b	LBB0_12
LBB0_11:
Lloh25:
	adrp	x2, l_.str.4@PAGE
Lloh26:
	add	x2, x2, l_.str.4@PAGEOFF
LBB0_12:
	ldr	w0, [x19]
Lloh27:
	adrp	x1, l_.str.7@PAGE
Lloh28:
	add	x1, x1, l_.str.7@PAGEOFF
	bl	_dev_info
	mov	w20, #0
	b	LBB0_7
LBB0_13:
	ldr	w0, [x19]
	ldur	w9, [x29, #-20]
	ldur	w10, [x29, #-28]
	stp	x8, x10, [sp, #8]
	str	x9, [sp]
Lloh29:
	adrp	x1, l_.str.6@PAGE
Lloh30:
	add	x1, x1, l_.str.6@PAGEOFF
	bl	_dev_err
Lloh31:
	adrp	x8, _ENODEV@GOTPAGE
Lloh32:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh33:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_7
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpAdd	Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.comm	_RTL8367B_RTL_MAGIC_ID_REG,4,2  ; @RTL8367B_RTL_MAGIC_ID_REG
	.comm	_RTL8367B_RTL_MAGIC_ID_VAL,4,2  ; @RTL8367B_RTL_MAGIC_ID_VAL
	.comm	_RTL8367B_CHIP_NUMBER_REG,4,2   ; @RTL8367B_CHIP_NUMBER_REG
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"unable to read %s register\n"

l_.str.1:                               ; @.str.1
	.asciz	"chip number"

	.comm	_RTL8367B_CHIP_VER_REG,4,2      ; @RTL8367B_CHIP_VER_REG
l_.str.2:                               ; @.str.2
	.asciz	"chip version"

	.comm	_RTL8367B_CHIP_MODE_REG,4,2     ; @RTL8367B_CHIP_MODE_REG
l_.str.3:                               ; @.str.3
	.asciz	"chip mode"

l_.str.4:                               ; @.str.4
	.asciz	"8367RB"

l_.str.5:                               ; @.str.5
	.asciz	"8367R-VB"

l_.str.6:                               ; @.str.6
	.asciz	"unknown chip num:%04x ver:%04x, mode:%04x\n"

	.comm	_ENODEV,4,2                     ; @ENODEV
l_.str.7:                               ; @.str.7
	.asciz	"RTL%s chip found\n"

	.no_dead_strip	_rtl8367b_detect
.subsections_via_symbols
