	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nvt_hw_detect
_nvt_hw_detect:                         ## @nvt_hw_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, %rbx
	callq	_nvt_get_dev
	movq	%rax, %r14
	movq	%rbx, %rdi
	callq	_nvt_efm_enable
	movq	_CR_CHIP_ID_HI@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movq	%rbx, %rdi
	callq	_nvt_cr_read
	movl	%eax, (%rbx)
	cmpl	$255, %eax
	jne	LBB0_2
## %bb.1:
	movq	%rbx, %rdi
	callq	_nvt_efm_disable
	movq	_CR_EFIR2@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 12(%rbx)
	movq	_CR_EFDR2@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%rbx)
	movq	%rbx, %rdi
	callq	_nvt_efm_enable
	movl	(%r15), %esi
	movq	%rbx, %rdi
	callq	_nvt_cr_read
	movl	%eax, (%rbx)
LBB0_2:
	movq	_CR_CHIP_ID_LO@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_nvt_cr_read
	movl	%eax, 4(%rbx)
	movq	%rbx, %rdi
	callq	_nvt_efm_disable
	movl	(%rbx), %esi
	shll	$8, %esi
	orl	4(%rbx), %esi
	movq	_NVT_INVALID@GOTPCREL(%rip), %rax
	cmpl	(%rax), %esi
	jne	LBB0_4
## %bb.3:
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	callq	_dev_err
	movq	_ENODEV@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_8
LBB0_4:
	movq	%rbx, %rdi
	callq	_nvt_find_chip
	movl	(%rbx), %ecx
	movl	4(%rbx), %r8d
	testq	%rax, %rax
	je	LBB0_5
## %bb.6:
	leaq	L_.str.2(%rip), %rsi
	movq	%r14, %rdi
	movq	%rax, %rdx
	callq	_dev_info
	jmp	LBB0_7
LBB0_5:
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdi
	movl	%ecx, %edx
	movl	%r8d, %ecx
	callq	_dev_warn
LBB0_7:
	xorl	%eax, %eax
LBB0_8:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CR_CHIP_ID_HI,4,2              ## @CR_CHIP_ID_HI
	.comm	_CR_EFIR2,4,2                   ## @CR_EFIR2
	.comm	_CR_EFDR2,4,2                   ## @CR_EFDR2
	.comm	_CR_CHIP_ID_LO,4,2              ## @CR_CHIP_ID_LO
	.comm	_NVT_INVALID,4,2                ## @NVT_INVALID
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"No device found on either EFM port\n"

	.comm	_ENODEV,4,2                     ## @ENODEV
L_.str.1:                               ## @.str.1
	.asciz	"unknown chip, id: 0x%02x 0x%02x, it may not work..."

L_.str.2:                               ## @.str.2
	.asciz	"found %s or compatible: chip id: 0x%02x 0x%02x"

	.no_dead_strip	_nvt_hw_detect
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nvt_hw_detect
_nvt_hw_detect:                         ; @nvt_hw_detect
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	mov	x20, x0
	bl	_nvt_get_dev
	mov	x19, x0
	mov	x0, x20
	bl	_nvt_efm_enable
Lloh0:
	adrp	x21, _CR_CHIP_ID_HI@GOTPAGE
Lloh1:
	ldr	x21, [x21, _CR_CHIP_ID_HI@GOTPAGEOFF]
	ldr	w1, [x21]
	mov	x0, x20
	bl	_nvt_cr_read
	str	w0, [x20]
	cmp	w0, #255
	b.ne	LBB0_2
; %bb.1:
	mov	x0, x20
	bl	_nvt_efm_disable
Lloh2:
	adrp	x8, _CR_EFIR2@GOTPAGE
Lloh3:
	ldr	x8, [x8, _CR_EFIR2@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
Lloh5:
	adrp	x9, _CR_EFDR2@GOTPAGE
Lloh6:
	ldr	x9, [x9, _CR_EFDR2@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	stp	w9, w8, [x20, #8]
	mov	x0, x20
	bl	_nvt_efm_enable
	ldr	w1, [x21]
	mov	x0, x20
	bl	_nvt_cr_read
	str	w0, [x20]
LBB0_2:
Lloh8:
	adrp	x8, _CR_CHIP_ID_LO@GOTPAGE
Lloh9:
	ldr	x8, [x8, _CR_CHIP_ID_LO@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_nvt_cr_read
	str	w0, [x20, #4]
	mov	x0, x20
	bl	_nvt_efm_disable
	ldp	w8, w9, [x20]
	orr	w1, w9, w8, lsl #8
Lloh11:
	adrp	x8, _NVT_INVALID@GOTPAGE
Lloh12:
	ldr	x8, [x8, _NVT_INVALID@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	cmp	w1, w8
	b.ne	LBB0_4
; %bb.3:
Lloh14:
	adrp	x1, l_.str@PAGE
Lloh15:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_dev_err
Lloh16:
	adrp	x8, _ENODEV@GOTPAGE
Lloh17:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_8
LBB0_4:
	mov	x0, x20
	bl	_nvt_find_chip
	ldp	w3, w4, [x20]
	cbz	x0, LBB0_6
; %bb.5:
	mov	x2, x0
Lloh19:
	adrp	x1, l_.str.2@PAGE
Lloh20:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_dev_info
	b	LBB0_7
LBB0_6:
Lloh21:
	adrp	x1, l_.str.1@PAGE
Lloh22:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	mov	x2, x3
	mov	x3, x4
	bl	_dev_warn
LBB0_7:
	mov	w0, #0
LBB0_8:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_CR_CHIP_ID_HI,4,2              ; @CR_CHIP_ID_HI
	.comm	_CR_EFIR2,4,2                   ; @CR_EFIR2
	.comm	_CR_EFDR2,4,2                   ; @CR_EFDR2
	.comm	_CR_CHIP_ID_LO,4,2              ; @CR_CHIP_ID_LO
	.comm	_NVT_INVALID,4,2                ; @NVT_INVALID
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"No device found on either EFM port\n"

	.comm	_ENODEV,4,2                     ; @ENODEV
l_.str.1:                               ; @.str.1
	.asciz	"unknown chip, id: 0x%02x 0x%02x, it may not work..."

l_.str.2:                               ; @.str.2
	.asciz	"found %s or compatible: chip id: 0x%02x 0x%02x"

	.no_dead_strip	_nvt_hw_detect
.subsections_via_symbols
