	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function fintek_hw_detect
_fintek_hw_detect:                      ## @fintek_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	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r12
	callq	_fintek_config_mode_enable
	movq	_GCR_CONFIG_PORT_SEL@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	%r12, %rdi
	callq	_fintek_cr_read
	cmpl	$255, %eax
	jne	LBB0_2
## %bb.1:
	movq	_KERN_INFO@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_fit_pr
	movq	%r12, %rdi
	callq	_fintek_config_mode_disable
	movq	_CR_INDEX_PORT2@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 28(%r12)
	movq	_CR_DATA_PORT2@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 24(%r12)
	movq	%r12, %rdi
	callq	_fintek_config_mode_enable
	movl	(%rbx), %esi
	movq	%r12, %rdi
	callq	_fintek_cr_read
LBB0_2:
	leaq	L_.str.1(%rip), %rdi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_fit_dbg
	movq	_CIR_CR_CLASS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_fintek_cir_reg_read
	movl	%eax, %ebx
	leaq	L_.str.2(%rip), %rdi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_fit_dbg
	addl	$-129, %ebx
	xorl	%eax, %eax
	cmpl	$2, %ebx
	setb	%al
	movl	%eax, (%r12)
	movq	_GCR_CHIP_ID_HI@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_fintek_cr_read
	movl	%eax, %r15d
	movq	_GCR_CHIP_ID_LO@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_fintek_cr_read
	movl	%eax, %r13d
	movq	_GCR_VENDOR_ID_HI@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_fintek_cr_read
	movl	%eax, %ebx
	movq	_GCR_VENDOR_ID_LO@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_fintek_cr_read
	shll	$8, %ebx
	orl	%eax, %ebx
	movq	_VENDOR_ID_FINTEK@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ebx
	jne	LBB0_3
## %bb.4:
	leaq	L_.str.4(%rip), %rdi
	xorl	%eax, %eax
	callq	_fit_dbg
	jmp	LBB0_5
LBB0_3:
	movq	_KERN_WARNING@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.3(%rip), %rsi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_fit_pr
LBB0_5:
	movl	%r15d, %eax
	shll	$8, %eax
	movl	%r15d, -44(%rbp)                ## 4-byte Spill
	movl	%r13d, %r15d
	orl	%eax, %r15d
	movq	%r12, %rdi
	callq	_fintek_config_mode_disable
	leaq	16(%r12), %r14
	movq	%r14, %rdi
	callq	_spin_lock_irqsave
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, 4(%r12)
	movl	%r13d, 8(%r12)
	movl	%ebx, 12(%r12)
	movq	_LOGICAL_DEV_CIR_REV1@GOTPCREL(%rip), %rax
	movq	%rax, %rcx
	cmpl	$1032, %r15d                    ## imm = 0x408
	je	LBB0_7
## %bb.6:
	movq	_LOGICAL_DEV_CIR_REV2@GOTPCREL(%rip), %rcx
LBB0_7:
	cmpl	$2052, %r15d                    ## imm = 0x804
	cmoveq	%rax, %rcx
	movl	(%rcx), %eax
	movl	%eax, 20(%r12)
	movq	%r14, %rdi
	callq	_spin_unlock_irqrestore
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GCR_CONFIG_PORT_SEL,4,2        ## @GCR_CONFIG_PORT_SEL
	.comm	_KERN_INFO,4,2                  ## @KERN_INFO
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"first portsel read was bunk, trying alt"

	.comm	_CR_INDEX_PORT2,4,2             ## @CR_INDEX_PORT2
	.comm	_CR_DATA_PORT2,4,2              ## @CR_DATA_PORT2
L_.str.1:                               ## @.str.1
	.asciz	"portsel reg: 0x%02x"

	.comm	_CIR_CR_CLASS,4,2               ## @CIR_CR_CLASS
L_.str.2:                               ## @.str.2
	.asciz	"ir_class reg: 0x%02x"

	.comm	_GCR_CHIP_ID_HI,4,2             ## @GCR_CHIP_ID_HI
	.comm	_GCR_CHIP_ID_LO,4,2             ## @GCR_CHIP_ID_LO
	.comm	_GCR_VENDOR_ID_HI,4,2           ## @GCR_VENDOR_ID_HI
	.comm	_GCR_VENDOR_ID_LO,4,2           ## @GCR_VENDOR_ID_LO
	.comm	_VENDOR_ID_FINTEK,4,2           ## @VENDOR_ID_FINTEK
	.comm	_KERN_WARNING,4,2               ## @KERN_WARNING
L_.str.3:                               ## @.str.3
	.asciz	"Unknown vendor ID: 0x%04x"

L_.str.4:                               ## @.str.4
	.asciz	"Read Fintek vendor ID from chip"

	.comm	_LOGICAL_DEV_CIR_REV2,4,2       ## @LOGICAL_DEV_CIR_REV2
	.comm	_LOGICAL_DEV_CIR_REV1,4,2       ## @LOGICAL_DEV_CIR_REV1
	.no_dead_strip	_fintek_hw_detect
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function fintek_hw_detect
_fintek_hw_detect:                      ; @fintek_hw_detect
	.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
	mov	x19, x0
	bl	_fintek_config_mode_enable
Lloh0:
	adrp	x20, _GCR_CONFIG_PORT_SEL@GOTPAGE
Lloh1:
	ldr	x20, [x20, _GCR_CONFIG_PORT_SEL@GOTPAGEOFF]
	ldr	w1, [x20]
	mov	x0, x19
	bl	_fintek_cr_read
                                        ; kill: def $w0 killed $w0 def $x0
	cmp	w0, #255
	b.ne	LBB0_2
; %bb.1:
Lloh2:
	adrp	x8, _KERN_INFO@GOTPAGE
Lloh3:
	ldr	x8, [x8, _KERN_INFO@GOTPAGEOFF]
Lloh4:
	ldr	w0, [x8]
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	bl	_fit_pr
	mov	x0, x19
	bl	_fintek_config_mode_disable
Lloh7:
	adrp	x8, _CR_INDEX_PORT2@GOTPAGE
Lloh8:
	ldr	x8, [x8, _CR_INDEX_PORT2@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
Lloh10:
	adrp	x9, _CR_DATA_PORT2@GOTPAGE
Lloh11:
	ldr	x9, [x9, _CR_DATA_PORT2@GOTPAGEOFF]
Lloh12:
	ldr	w9, [x9]
	stp	w9, w8, [x19, #24]
	mov	x0, x19
	bl	_fintek_config_mode_enable
	ldr	w1, [x20]
	mov	x0, x19
	bl	_fintek_cr_read
                                        ; kill: def $w0 killed $w0 def $x0
LBB0_2:
	str	x0, [sp]
Lloh13:
	adrp	x0, l_.str.1@PAGE
Lloh14:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_fit_dbg
Lloh15:
	adrp	x8, _CIR_CR_CLASS@GOTPAGE
Lloh16:
	ldr	x8, [x8, _CIR_CR_CLASS@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_fintek_cir_reg_read
	mov	x20, x0
	str	x20, [sp]
Lloh18:
	adrp	x0, l_.str.2@PAGE
Lloh19:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_fit_dbg
	sub	w8, w20, #129
	cmp	w8, #2
	cset	w8, lo
	str	w8, [x19]
Lloh20:
	adrp	x8, _GCR_CHIP_ID_HI@GOTPAGE
Lloh21:
	ldr	x8, [x8, _GCR_CHIP_ID_HI@GOTPAGEOFF]
Lloh22:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_fintek_cr_read
	mov	x20, x0
Lloh23:
	adrp	x8, _GCR_CHIP_ID_LO@GOTPAGE
Lloh24:
	ldr	x8, [x8, _GCR_CHIP_ID_LO@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_fintek_cr_read
	mov	x21, x0
Lloh26:
	adrp	x8, _GCR_VENDOR_ID_HI@GOTPAGE
Lloh27:
	ldr	x8, [x8, _GCR_VENDOR_ID_HI@GOTPAGEOFF]
Lloh28:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_fintek_cr_read
	mov	x22, x0
Lloh29:
	adrp	x8, _GCR_VENDOR_ID_LO@GOTPAGE
Lloh30:
	ldr	x8, [x8, _GCR_VENDOR_ID_LO@GOTPAGEOFF]
Lloh31:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_fintek_cr_read
	orr	w23, w0, w22, lsl #8
Lloh32:
	adrp	x8, _VENDOR_ID_FINTEK@GOTPAGE
Lloh33:
	ldr	x8, [x8, _VENDOR_ID_FINTEK@GOTPAGEOFF]
Lloh34:
	ldr	w8, [x8]
	cmp	w23, w8
	b.ne	LBB0_4
; %bb.3:
Lloh35:
	adrp	x0, l_.str.4@PAGE
Lloh36:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_fit_dbg
	b	LBB0_5
LBB0_4:
Lloh37:
	adrp	x8, _KERN_WARNING@GOTPAGE
Lloh38:
	ldr	x8, [x8, _KERN_WARNING@GOTPAGEOFF]
Lloh39:
	ldr	w0, [x8]
	str	x23, [sp]
Lloh40:
	adrp	x1, l_.str.3@PAGE
Lloh41:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_fit_pr
LBB0_5:
	orr	w24, w21, w20, lsl #8
	mov	x0, x19
	bl	_fintek_config_mode_disable
	add	x22, x19, #16
	mov	x0, x22
	bl	_spin_lock_irqsave
	stp	w20, w21, [x19, #4]
	str	w23, [x19, #12]
	cmp	w24, #1032
	mov	w8, #2052
Lloh42:
	adrp	x9, _LOGICAL_DEV_CIR_REV1@GOTPAGE
Lloh43:
	ldr	x9, [x9, _LOGICAL_DEV_CIR_REV1@GOTPAGEOFF]
	ccmp	w24, w8, #4, ne
Lloh44:
	adrp	x8, _LOGICAL_DEV_CIR_REV2@GOTPAGE
Lloh45:
	ldr	x8, [x8, _LOGICAL_DEV_CIR_REV2@GOTPAGEOFF]
	csel	x8, x9, x8, eq
	ldr	w8, [x8]
	str	w8, [x19, #20]
	mov	x0, x22
	bl	_spin_unlock_irqrestore
	mov	w0, #0
	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
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh35, Lloh36
	.loh AdrpAdd	Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpLdrGot	Lloh44, Lloh45
	.loh AdrpLdrGot	Lloh42, Lloh43
	.cfi_endproc
                                        ; -- End function
	.comm	_GCR_CONFIG_PORT_SEL,4,2        ; @GCR_CONFIG_PORT_SEL
	.comm	_KERN_INFO,4,2                  ; @KERN_INFO
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"first portsel read was bunk, trying alt"

	.comm	_CR_INDEX_PORT2,4,2             ; @CR_INDEX_PORT2
	.comm	_CR_DATA_PORT2,4,2              ; @CR_DATA_PORT2
l_.str.1:                               ; @.str.1
	.asciz	"portsel reg: 0x%02x"

	.comm	_CIR_CR_CLASS,4,2               ; @CIR_CR_CLASS
l_.str.2:                               ; @.str.2
	.asciz	"ir_class reg: 0x%02x"

	.comm	_GCR_CHIP_ID_HI,4,2             ; @GCR_CHIP_ID_HI
	.comm	_GCR_CHIP_ID_LO,4,2             ; @GCR_CHIP_ID_LO
	.comm	_GCR_VENDOR_ID_HI,4,2           ; @GCR_VENDOR_ID_HI
	.comm	_GCR_VENDOR_ID_LO,4,2           ; @GCR_VENDOR_ID_LO
	.comm	_VENDOR_ID_FINTEK,4,2           ; @VENDOR_ID_FINTEK
	.comm	_KERN_WARNING,4,2               ; @KERN_WARNING
l_.str.3:                               ; @.str.3
	.asciz	"Unknown vendor ID: 0x%04x"

l_.str.4:                               ; @.str.4
	.asciz	"Read Fintek vendor ID from chip"

	.comm	_LOGICAL_DEV_CIR_REV2,4,2       ; @LOGICAL_DEV_CIR_REV2
	.comm	_LOGICAL_DEV_CIR_REV1,4,2       ; @LOGICAL_DEV_CIR_REV1
	.no_dead_strip	_fintek_hw_detect
.subsections_via_symbols
