	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function elan_i2c_get_sm_version
_elan_i2c_get_sm_version:               ## @elan_i2c_get_sm_version
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r14
	movq	%rdx, %r12
	movq	%rsi, %r13
	movq	%rdi, %r15
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	leaq	-64(%rbp), %rsi
	callq	_elan_i2c_get_pattern
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movl	%eax, %ebx
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_12
LBB0_2:
	cmpl	$1, -64(%rbp)
	jne	LBB0_8
## %bb.3:
	movq	_ETP_I2C_IC_TYPE_CMD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-60(%rbp), %rdx
	movq	%r15, %rdi
	callq	_elan_i2c_read_cmd
	testl	%eax, %eax
	je	LBB0_6
## %bb.4:
	movl	%eax, %ebx
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_5
LBB0_8:
	movq	_ETP_I2C_OSM_VERSION_CMD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-60(%rbp), %rdx
	movq	%r15, %rdi
	callq	_elan_i2c_read_cmd
	testl	%eax, %eax
	jne	LBB0_7
## %bb.9:
	movl	-60(%rbp), %eax
	movl	%eax, (%r12)
	movl	-56(%rbp), %eax
	movl	%eax, (%r13)
	movq	_ETP_I2C_NSM_VERSION_CMD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-60(%rbp), %rdx
	movq	%r15, %rdi
	callq	_elan_i2c_read_cmd
	testl	%eax, %eax
	jne	LBB0_7
	jmp	LBB0_11
LBB0_6:
	leaq	-60(%rbp), %rbx
	movq	%rbx, %rdi
	callq	_be16_to_cpup
	movl	%eax, (%r13)
	movq	_ETP_I2C_NSM_VERSION_CMD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	movq	%rbx, %rdx
	callq	_elan_i2c_read_cmd
	testl	%eax, %eax
	je	LBB0_10
LBB0_7:
	movl	%eax, %ebx
	leaq	L_.str.2(%rip), %rsi
LBB0_5:
	movq	%r15, %rdi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_dev_err
LBB0_12:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_14
## %bb.13:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	movl	-56(%rbp), %eax
	movl	%eax, (%r12)
LBB0_11:
	movl	-60(%rbp), %eax
	andl	$16, %eax
	movl	%eax, (%r14)
	xorl	%ebx, %ebx
	jmp	LBB0_12
LBB0_14:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed to get pattern version\n"

	.comm	_ETP_I2C_IC_TYPE_CMD,4,2        ## @ETP_I2C_IC_TYPE_CMD
L_.str.1:                               ## @.str.1
	.asciz	"failed to get ic type: %d\n"

	.comm	_ETP_I2C_NSM_VERSION_CMD,4,2    ## @ETP_I2C_NSM_VERSION_CMD
L_.str.2:                               ## @.str.2
	.asciz	"failed to get SM version: %d\n"

	.comm	_ETP_I2C_OSM_VERSION_CMD,4,2    ## @ETP_I2C_OSM_VERSION_CMD
	.no_dead_strip	_elan_i2c_get_sm_version
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function elan_i2c_get_sm_version
_elan_i2c_get_sm_version:               ; @elan_i2c_get_sm_version
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	x20, x3
	mov	x21, x2
	mov	x22, x1
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #24]
	add	x1, sp, #8
	bl	_elan_i2c_get_pattern
	cbz	w0, LBB0_3
; %bb.1:
	mov	x23, x0
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
LBB0_2:
	mov	x0, x19
	bl	_dev_err
	b	LBB0_13
LBB0_3:
	ldr	w8, [sp, #8]
	cmp	w8, #1
	b.ne	LBB0_6
; %bb.4:
Lloh5:
	adrp	x8, _ETP_I2C_IC_TYPE_CMD@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ETP_I2C_IC_TYPE_CMD@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	add	x2, sp, #12
	mov	x0, x19
	bl	_elan_i2c_read_cmd
	cbz	w0, LBB0_9
; %bb.5:
	mov	x23, x0
	str	x23, [sp]
Lloh8:
	adrp	x1, l_.str.1@PAGE
Lloh9:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_2
LBB0_6:
Lloh10:
	adrp	x8, _ETP_I2C_OSM_VERSION_CMD@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ETP_I2C_OSM_VERSION_CMD@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	add	x2, sp, #12
	mov	x0, x19
	bl	_elan_i2c_read_cmd
	cbnz	w0, LBB0_10
; %bb.7:
	ldp	w8, w9, [sp, #12]
	str	w8, [x21]
	str	w9, [x22]
Lloh13:
	adrp	x8, _ETP_I2C_NSM_VERSION_CMD@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ETP_I2C_NSM_VERSION_CMD@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	add	x2, sp, #12
	mov	x0, x19
	bl	_elan_i2c_read_cmd
	cbnz	w0, LBB0_10
; %bb.8:
	ldr	w8, [sp, #12]
	b	LBB0_12
LBB0_9:
	add	x0, sp, #12
	bl	_be16_to_cpup
	str	w0, [x22]
Lloh16:
	adrp	x8, _ETP_I2C_NSM_VERSION_CMD@GOTPAGE
Lloh17:
	ldr	x8, [x8, _ETP_I2C_NSM_VERSION_CMD@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
	add	x2, sp, #12
	mov	x0, x19
	bl	_elan_i2c_read_cmd
	cbz	w0, LBB0_11
LBB0_10:
	mov	x23, x0
	str	x23, [sp]
Lloh19:
	adrp	x1, l_.str.2@PAGE
Lloh20:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_dev_err
                                        ; kill: def $w23 killed $w23 killed $x23 def $x23
	b	LBB0_13
LBB0_11:
	ldp	w8, w9, [sp, #12]
	str	w9, [x21]
LBB0_12:
	mov	w23, #0
	and	w8, w8, #0x10
	str	w8, [x20]
LBB0_13:
	ldr	x8, [sp, #24]
Lloh21:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh22:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh23:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_15
; %bb.14:
	mov	x0, x23
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_15:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed to get pattern version\n"

	.comm	_ETP_I2C_IC_TYPE_CMD,4,2        ; @ETP_I2C_IC_TYPE_CMD
l_.str.1:                               ; @.str.1
	.asciz	"failed to get ic type: %d\n"

	.comm	_ETP_I2C_NSM_VERSION_CMD,4,2    ; @ETP_I2C_NSM_VERSION_CMD
l_.str.2:                               ; @.str.2
	.asciz	"failed to get SM version: %d\n"

	.comm	_ETP_I2C_OSM_VERSION_CMD,4,2    ; @ETP_I2C_OSM_VERSION_CMD
	.no_dead_strip	_elan_i2c_get_sm_version
.subsections_via_symbols
