	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function elants_i2c_query_hw_version
_elants_i2c_query_hw_version:           ## @elants_i2c_query_hw_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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsp, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	%rdi, -80(%rbp)                 ## 8-byte Spill
	movq	8(%rdi), %r15
	movq	_CMD_HEADER_READ@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -64(%rbp)
	movq	_E_ELAN_INFO_FW_ID@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -60(%rbp)
	movabsq	$4294967296, %rax               ## imm = 0x100000000
	movq	%rax, -56(%rbp)
	movq	_HEADER_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	leaq	(,%r12,4), %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r13
	movq	_MAX_RETRIES@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jle	LBB0_8
## %bb.1:
	movq	%r14, -72(%rbp)                 ## 8-byte Spill
	shll	$2, %r12d
	xorl	%r14d, %r14d
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	%r15, %rdi
	leaq	L_.str(%rip), %rsi
	movl	%ebx, %edx
	movl	%r12d, %ecx
	movq	%r13, %r8
	callq	_dev_dbg
	incl	%r14d
	movq	_MAX_RETRIES@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r14d
	jge	LBB0_6
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	leaq	-64(%rbp), %rsi
	movl	$16, %edx
	movq	%r13, %rcx
	movl	%r12d, %r8d
	callq	_elants_i2c_execute_command
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_5
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%r13, %rdi
	callq	_elants_i2c_parse_version
	movq	-80(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, (%rcx)
	cmpl	$65535, %eax                    ## imm = 0xFFFF
	je	LBB0_5
## %bb.4:
	xorl	%ebx, %ebx
	movq	-72(%rbp), %r14                 ## 8-byte Reload
	jmp	LBB0_9
LBB0_6:
	testl	%ebx, %ebx
	movq	-72(%rbp), %r14                 ## 8-byte Reload
	je	LBB0_8
## %bb.7:
	leaq	L_.str.1(%rip), %rsi
	movq	%r15, %rdi
	movl	%ebx, %edx
	callq	_dev_err
	jmp	LBB0_9
LBB0_8:
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edx
	leaq	L_.str.2(%rip), %rsi
	movq	%r15, %rdi
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_9:
	movq	%r14, %rsp
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_11
## %bb.10:
	movl	%ebx, %eax
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_11:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_CMD_HEADER_READ,4,2            ## @CMD_HEADER_READ
	.comm	_E_ELAN_INFO_FW_ID,4,2          ## @E_ELAN_INFO_FW_ID
	.comm	_HEADER_SIZE,4,2                ## @HEADER_SIZE
	.comm	_MAX_RETRIES,4,2                ## @MAX_RETRIES
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"read fw id error=%d, buf=%*phC\n"

L_.str.1:                               ## @.str.1
	.asciz	"Failed to read fw id: %d\n"

L_.str.2:                               ## @.str.2
	.asciz	"Invalid fw id: %#04x\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.no_dead_strip	_elants_i2c_query_hw_version
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function elants_i2c_query_hw_version
lCPI0_0:
	.long	0                               ; 0x0
	.long	1                               ; 0x1
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	2
_elants_i2c_query_hw_version:           ; @elants_i2c_query_hw_version
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	sub	sp, sp, #32
	mov	x20, x0
	mov	x25, sp
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-88]
	ldr	x19, [x0, #8]
Lloh3:
	adrp	x8, _CMD_HEADER_READ@GOTPAGE
Lloh4:
	ldr	x8, [x8, _CMD_HEADER_READ@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
Lloh6:
	adrp	x9, _E_ELAN_INFO_FW_ID@GOTPAGE
Lloh7:
	ldr	x9, [x9, _E_ELAN_INFO_FW_ID@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	stp	w8, w9, [x29, #-104]
Lloh9:
	adrp	x8, lCPI0_0@PAGE
Lloh10:
	ldr	d0, [x8, lCPI0_0@PAGEOFF]
	stur	d0, [x29, #-96]
Lloh11:
	adrp	x8, _HEADER_SIZE@GOTPAGE
Lloh12:
	ldr	x8, [x8, _HEADER_SIZE@GOTPAGEOFF]
Lloh13:
	ldr	w12, [x8]
	lsl	x8, x12, #2
	mov	x9, x8
Lloh14:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh15:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0x7fffffff0
	sub	x21, x9, x8
	mov	sp, x21
Lloh16:
	adrp	x26, _MAX_RETRIES@GOTPAGE
Lloh17:
	ldr	x26, [x26, _MAX_RETRIES@GOTPAGEOFF]
	ldr	w8, [x26]
	cmp	w8, #1
	b.lt	LBB0_8
; %bb.1:
	mov	w27, #0
	lsl	w23, w12, #2
	mov	w28, #65535
Lloh18:
	adrp	x24, l_.str@PAGE
Lloh19:
	add	x24, x24, l_.str@PAGEOFF
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x19
	mov	x1, x24
	mov	x2, x22
	mov	x3, x23
	mov	x4, x21
	bl	_dev_dbg
	add	w27, w27, #1
	ldr	w8, [x26]
	cmp	w27, w8
	b.ge	LBB0_6
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	sub	x1, x29, #104
	mov	x0, x19
	mov	w2, #16
	mov	x3, x21
	mov	x4, x23
	bl	_elants_i2c_execute_command
	mov	x22, x0
	cbnz	w0, LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x21
	bl	_elants_i2c_parse_version
	str	w0, [x20]
	cmp	w0, w28
	b.eq	LBB0_2
; %bb.5:
	mov	w22, #0
	b	LBB0_9
LBB0_6:
	cbz	w22, LBB0_8
; %bb.7:
Lloh20:
	adrp	x1, l_.str.1@PAGE
Lloh21:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	mov	x2, x22
	bl	_dev_err
	b	LBB0_9
LBB0_8:
	ldr	w2, [x20]
Lloh22:
	adrp	x1, l_.str.2@PAGE
Lloh23:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_dev_err
Lloh24:
	adrp	x8, _EINVAL@GOTPAGE
Lloh25:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh26:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_9:
	mov	sp, x25
	ldur	x8, [x29, #-88]
Lloh27:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh28:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh29:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_11
; %bb.10:
	mov	x0, x22
	sub	sp, x29, #80
	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
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_11:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdrp	Lloh9, Lloh11
	.loh AdrpLdr	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_CMD_HEADER_READ,4,2            ; @CMD_HEADER_READ
	.comm	_E_ELAN_INFO_FW_ID,4,2          ; @E_ELAN_INFO_FW_ID
	.comm	_HEADER_SIZE,4,2                ; @HEADER_SIZE
	.comm	_MAX_RETRIES,4,2                ; @MAX_RETRIES
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"read fw id error=%d, buf=%*phC\n"

l_.str.1:                               ; @.str.1
	.asciz	"Failed to read fw id: %d\n"

l_.str.2:                               ; @.str.2
	.asciz	"Invalid fw id: %#04x\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.no_dead_strip	_elants_i2c_query_hw_version
.subsections_via_symbols
