	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vsc73xx_detect
_vsc73xx_detect:                        ## @vsc73xx_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	%r15
	pushq	%r14
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	_VSC73XX_BLOCK_SYSTEM@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movq	_VSC73XX_ICPU_MBOX_VAL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	-28(%rbp), %r8
	xorl	%edx, %edx
	callq	_vsc73xx_read
	testl	%eax, %eax
	je	LBB0_3
## %bb.1:
	movl	%eax, %ebx
	movl	4(%r14), %edi
	leaq	L_.str(%rip), %rsi
LBB0_2:
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_dev_err
LBB0_23:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_3:
	cmpl	$-1, -28(%rbp)
	je	LBB0_4
## %bb.6:
	movl	(%r15), %esi
	movq	_VSC73XX_CHIPID@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	-28(%rbp), %r8
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_vsc73xx_read
	testl	%eax, %eax
	je	LBB0_8
## %bb.7:
	movl	%eax, %ebx
	movl	4(%r14), %edi
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_2
LBB0_4:
	movl	4(%r14), %edi
	leaq	L_.str.1(%rip), %rsi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_dev_info
LBB0_5:
	movq	_EAGAIN@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_23
LBB0_8:
	movl	-28(%rbp), %eax
	movq	_VSC73XX_CHIPID_ID_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	movl	%eax, %edx
	sarl	%cl, %edx
	movq	_VSC73XX_CHIPID_ID_MASK@GOTPCREL(%rip), %rcx
	andl	(%rcx), %edx
	movl	%edx, %ecx
	andl	$-4, %ecx
	cmpl	$128, %ecx
	jne	LBB0_9
## %bb.11:
	movl	%edx, (%r14)
	movq	_VSC73XX_CHIPID_REV_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	sarl	%cl, %eax
	movq	_VSC73XX_CHIPID_REV_MASK@GOTPCREL(%rip), %rcx
	andl	(%rcx), %eax
	movl	4(%r14), %edi
	leaq	L_.str.4(%rip), %rsi
	movl	%eax, %ecx
	xorl	%eax, %eax
	callq	_dev_info
	movl	(%r15), %esi
	movq	_VSC73XX_ICPU_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	leaq	-28(%rbp), %r8
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_vsc73xx_read
	testl	%eax, %eax
	je	LBB0_13
## %bb.12:
	movl	%eax, %ebx
	movl	4(%r14), %edi
	leaq	L_.str.5(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_23
LBB0_9:
	movl	4(%r14), %edi
	leaq	L_.str.3(%rip), %rsi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_dev_err
LBB0_10:
	movq	_ENODEV@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_23
LBB0_13:
	movl	-28(%rbp), %eax
	movq	_VSC73XX_ICPU_CTRL_ICPU_PI_EN@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, %edx
	andl	%eax, %edx
	movq	_VSC73XX_ICPU_CTRL_BOOT_EN@GOTPCREL(%rip), %rsi
	movl	(%rsi), %esi
	testl	%eax, %esi
	je	LBB0_16
## %bb.14:
	testl	%edx, %edx
	je	LBB0_16
## %bb.15:
	movl	4(%r14), %edi
	leaq	L_.str.6(%rip), %rsi
	jmp	LBB0_21
LBB0_16:
	testl	%eax, %esi
	sete	%bl
	je	LBB0_19
## %bb.17:
	testl	%edx, %edx
	jne	LBB0_19
## %bb.18:
	movl	4(%r14), %edi
	leaq	L_.str.8(%rip), %rsi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_5
LBB0_19:
	testl	%eax, %ecx
	setne	%al
	andb	%al, %bl
	movl	4(%r14), %edi
	cmpb	$1, %bl
	jne	LBB0_22
## %bb.20:
	leaq	L_.str.9(%rip), %rsi
LBB0_21:
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_dev_err
	movl	4(%r14), %edi
	leaq	L_.str.7(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_10
LBB0_22:
	leaq	L_.str.10(%rip), %rsi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_dev_info
	jmp	LBB0_23
	.cfi_endproc
                                        ## -- End function
	.comm	_VSC73XX_BLOCK_SYSTEM,4,2       ## @VSC73XX_BLOCK_SYSTEM
	.comm	_VSC73XX_ICPU_MBOX_VAL,4,2      ## @VSC73XX_ICPU_MBOX_VAL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"unable to read mailbox (%d)\n"

L_.str.1:                               ## @.str.1
	.asciz	"chip seems dead.\n"

	.comm	_EAGAIN,4,2                     ## @EAGAIN
	.comm	_VSC73XX_CHIPID,4,2             ## @VSC73XX_CHIPID
L_.str.2:                               ## @.str.2
	.asciz	"unable to read chip id (%d)\n"

	.comm	_VSC73XX_CHIPID_ID_SHIFT,4,2    ## @VSC73XX_CHIPID_ID_SHIFT
	.comm	_VSC73XX_CHIPID_ID_MASK,4,2     ## @VSC73XX_CHIPID_ID_MASK
L_.str.3:                               ## @.str.3
	.asciz	"unsupported chip, id=%04x\n"

	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_VSC73XX_CHIPID_REV_SHIFT,4,2   ## @VSC73XX_CHIPID_REV_SHIFT
	.comm	_VSC73XX_CHIPID_REV_MASK,4,2    ## @VSC73XX_CHIPID_REV_MASK
L_.str.4:                               ## @.str.4
	.asciz	"VSC%04X (rev: %d) switch found\n"

	.comm	_VSC73XX_ICPU_CTRL,4,2          ## @VSC73XX_ICPU_CTRL
L_.str.5:                               ## @.str.5
	.asciz	"unable to read iCPU control\n"

	.comm	_VSC73XX_ICPU_CTRL_ICPU_PI_EN,4,2 ## @VSC73XX_ICPU_CTRL_ICPU_PI_EN
	.comm	_VSC73XX_ICPU_CTRL_BOOT_EN,4,2  ## @VSC73XX_ICPU_CTRL_BOOT_EN
L_.str.6:                               ## @.str.6
	.asciz	"iCPU enabled boots from SI, has external memory\n"

L_.str.7:                               ## @.str.7
	.asciz	"no idea how to deal with this\n"

L_.str.8:                               ## @.str.8
	.asciz	"iCPU enabled boots from PI/SI, no external memory\n"

L_.str.9:                               ## @.str.9
	.asciz	"iCPU enabled, boots from PI external memory\n"

L_.str.10:                              ## @.str.10
	.asciz	"iCPU disabled, no external memory\n"

	.no_dead_strip	_vsc73xx_detect
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vsc73xx_detect
_vsc73xx_detect:                        ; @vsc73xx_detect
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	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
	mov	x19, x0
Lloh0:
	adrp	x21, _VSC73XX_BLOCK_SYSTEM@GOTPAGE
Lloh1:
	ldr	x21, [x21, _VSC73XX_BLOCK_SYSTEM@GOTPAGEOFF]
	ldr	w1, [x21]
Lloh2:
	adrp	x8, _VSC73XX_ICPU_MBOX_VAL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _VSC73XX_ICPU_MBOX_VAL@GOTPAGEOFF]
Lloh4:
	ldr	w3, [x8]
	add	x4, sp, #28
	mov	w2, #0
	bl	_vsc73xx_read
	cbz	w0, LBB0_2
; %bb.1:
	mov	x20, x0
	ldr	w0, [x19, #4]
	str	x20, [sp]
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_13
LBB0_2:
	ldr	w8, [sp, #28]
	cmn	w8, #1
	b.eq	LBB0_5
; %bb.3:
	ldr	w1, [x21]
Lloh7:
	adrp	x8, _VSC73XX_CHIPID@GOTPAGE
Lloh8:
	ldr	x8, [x8, _VSC73XX_CHIPID@GOTPAGEOFF]
Lloh9:
	ldr	w3, [x8]
	add	x4, sp, #28
	mov	x0, x19
	mov	w2, #0
	bl	_vsc73xx_read
	cbz	w0, LBB0_7
; %bb.4:
	mov	x20, x0
	ldr	w0, [x19, #4]
	str	x20, [sp]
Lloh10:
	adrp	x1, l_.str.2@PAGE
Lloh11:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_err
                                        ; kill: def $w20 killed $w20 killed $x20 def $x20
	b	LBB0_13
LBB0_5:
	ldr	w0, [x19, #4]
Lloh12:
	adrp	x1, l_.str.1@PAGE
Lloh13:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_info
LBB0_6:
Lloh14:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh15:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
	b	LBB0_12
LBB0_7:
	ldr	w9, [sp, #28]
Lloh16:
	adrp	x8, _VSC73XX_CHIPID_ID_SHIFT@GOTPAGE
Lloh17:
	ldr	x8, [x8, _VSC73XX_CHIPID_ID_SHIFT@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	asr	w8, w9, w8
Lloh19:
	adrp	x10, _VSC73XX_CHIPID_ID_MASK@GOTPAGE
Lloh20:
	ldr	x10, [x10, _VSC73XX_CHIPID_ID_MASK@GOTPAGEOFF]
Lloh21:
	ldr	w10, [x10]
	and	w8, w8, w10
	and	w10, w8, #0xfffffffc
	cmp	w10, #128
	b.ne	LBB0_10
; %bb.8:
	str	w8, [x19]
Lloh22:
	adrp	x10, _VSC73XX_CHIPID_REV_SHIFT@GOTPAGE
Lloh23:
	ldr	x10, [x10, _VSC73XX_CHIPID_REV_SHIFT@GOTPAGEOFF]
Lloh24:
	ldr	w10, [x10]
	asr	w9, w9, w10
Lloh25:
	adrp	x10, _VSC73XX_CHIPID_REV_MASK@GOTPAGE
Lloh26:
	ldr	x10, [x10, _VSC73XX_CHIPID_REV_MASK@GOTPAGEOFF]
Lloh27:
	ldr	w10, [x10]
	and	w9, w9, w10
	ldr	w0, [x19, #4]
	stp	x8, x9, [sp]
Lloh28:
	adrp	x1, l_.str.4@PAGE
Lloh29:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_dev_info
	ldr	w1, [x21]
Lloh30:
	adrp	x8, _VSC73XX_ICPU_CTRL@GOTPAGE
Lloh31:
	ldr	x8, [x8, _VSC73XX_ICPU_CTRL@GOTPAGEOFF]
Lloh32:
	ldr	w3, [x8]
	add	x4, sp, #28
	mov	x0, x19
	mov	w2, #0
	bl	_vsc73xx_read
	cbz	w0, LBB0_14
; %bb.9:
	mov	x20, x0
	ldr	w0, [x19, #4]
Lloh33:
	adrp	x1, l_.str.5@PAGE
Lloh34:
	add	x1, x1, l_.str.5@PAGEOFF
	bl	_dev_err
	b	LBB0_13
LBB0_10:
	ldr	w0, [x19, #4]
                                        ; kill: def $w8 killed $w8 killed $x8 def $x8
	str	x8, [sp]
Lloh35:
	adrp	x1, l_.str.3@PAGE
Lloh36:
	add	x1, x1, l_.str.3@PAGEOFF
LBB0_11:
	bl	_dev_err
Lloh37:
	adrp	x8, _ENODEV@GOTPAGE
Lloh38:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
LBB0_12:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_13:
	mov	x0, x20
	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
	add	sp, sp, #80
	ret
LBB0_14:
	ldr	w9, [sp, #28]
Lloh39:
	adrp	x8, _VSC73XX_ICPU_CTRL_ICPU_PI_EN@GOTPAGE
Lloh40:
	ldr	x8, [x8, _VSC73XX_ICPU_CTRL_ICPU_PI_EN@GOTPAGEOFF]
Lloh41:
	ldr	w8, [x8]
	and	w8, w8, w9
Lloh42:
	adrp	x10, _VSC73XX_ICPU_CTRL_BOOT_EN@GOTPAGE
Lloh43:
	ldr	x10, [x10, _VSC73XX_ICPU_CTRL_BOOT_EN@GOTPAGEOFF]
Lloh44:
	ldr	w10, [x10]
	ands	w9, w10, w9
	b.eq	LBB0_17
; %bb.15:
	cbz	w8, LBB0_17
; %bb.16:
	ldr	w0, [x19, #4]
Lloh45:
	adrp	x1, l_.str.6@PAGE
Lloh46:
	add	x1, x1, l_.str.6@PAGEOFF
	b	LBB0_22
LBB0_17:
	cmp	w9, #0
	cset	w10, eq
	cbz	w9, LBB0_20
; %bb.18:
	cbnz	w8, LBB0_20
; %bb.19:
	ldr	w0, [x19, #4]
Lloh47:
	adrp	x1, l_.str.8@PAGE
Lloh48:
	add	x1, x1, l_.str.8@PAGEOFF
	bl	_dev_err
	b	LBB0_6
LBB0_20:
	cmp	w8, #0
	cset	w8, ne
	and	w8, w10, w8
	ldr	w0, [x19, #4]
	cmp	w8, #1
	b.ne	LBB0_23
; %bb.21:
Lloh49:
	adrp	x1, l_.str.9@PAGE
Lloh50:
	add	x1, x1, l_.str.9@PAGEOFF
LBB0_22:
	bl	_dev_err
	ldr	w0, [x19, #4]
Lloh51:
	adrp	x1, l_.str.7@PAGE
Lloh52:
	add	x1, x1, l_.str.7@PAGEOFF
	b	LBB0_11
LBB0_23:
Lloh53:
	adrp	x1, l_.str.10@PAGE
Lloh54:
	add	x1, x1, l_.str.10@PAGEOFF
	bl	_dev_info
	mov	w20, #0
	b	LBB0_13
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpAdd	Lloh33, Lloh34
	.loh AdrpAdd	Lloh35, Lloh36
	.loh AdrpLdrGot	Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh44
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpAdd	Lloh45, Lloh46
	.loh AdrpAdd	Lloh47, Lloh48
	.loh AdrpAdd	Lloh49, Lloh50
	.loh AdrpAdd	Lloh51, Lloh52
	.loh AdrpAdd	Lloh53, Lloh54
	.cfi_endproc
                                        ; -- End function
	.comm	_VSC73XX_BLOCK_SYSTEM,4,2       ; @VSC73XX_BLOCK_SYSTEM
	.comm	_VSC73XX_ICPU_MBOX_VAL,4,2      ; @VSC73XX_ICPU_MBOX_VAL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"unable to read mailbox (%d)\n"

l_.str.1:                               ; @.str.1
	.asciz	"chip seems dead.\n"

	.comm	_EAGAIN,4,2                     ; @EAGAIN
	.comm	_VSC73XX_CHIPID,4,2             ; @VSC73XX_CHIPID
l_.str.2:                               ; @.str.2
	.asciz	"unable to read chip id (%d)\n"

	.comm	_VSC73XX_CHIPID_ID_SHIFT,4,2    ; @VSC73XX_CHIPID_ID_SHIFT
	.comm	_VSC73XX_CHIPID_ID_MASK,4,2     ; @VSC73XX_CHIPID_ID_MASK
l_.str.3:                               ; @.str.3
	.asciz	"unsupported chip, id=%04x\n"

	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_VSC73XX_CHIPID_REV_SHIFT,4,2   ; @VSC73XX_CHIPID_REV_SHIFT
	.comm	_VSC73XX_CHIPID_REV_MASK,4,2    ; @VSC73XX_CHIPID_REV_MASK
l_.str.4:                               ; @.str.4
	.asciz	"VSC%04X (rev: %d) switch found\n"

	.comm	_VSC73XX_ICPU_CTRL,4,2          ; @VSC73XX_ICPU_CTRL
l_.str.5:                               ; @.str.5
	.asciz	"unable to read iCPU control\n"

	.comm	_VSC73XX_ICPU_CTRL_ICPU_PI_EN,4,2 ; @VSC73XX_ICPU_CTRL_ICPU_PI_EN
	.comm	_VSC73XX_ICPU_CTRL_BOOT_EN,4,2  ; @VSC73XX_ICPU_CTRL_BOOT_EN
l_.str.6:                               ; @.str.6
	.asciz	"iCPU enabled boots from SI, has external memory\n"

l_.str.7:                               ; @.str.7
	.asciz	"no idea how to deal with this\n"

l_.str.8:                               ; @.str.8
	.asciz	"iCPU enabled boots from PI/SI, no external memory\n"

l_.str.9:                               ; @.str.9
	.asciz	"iCPU enabled, boots from PI external memory\n"

l_.str.10:                              ; @.str.10
	.asciz	"iCPU disabled, no external memory\n"

	.no_dead_strip	_vsc73xx_detect
.subsections_via_symbols
