	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function elants_i2c_initialize
_elants_i2c_initialize:                 ## @elants_i2c_initialize
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	%rsp, -88(%rbp)                 ## 8-byte Spill
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	8(%rdi), %rbx
	movaps	L___const.elants_i2c_initialize.hello_packet(%rip), %xmm0
	movaps	%xmm0, -64(%rbp)
	movaps	L___const.elants_i2c_initialize.recov_packet(%rip), %xmm0
	movaps	%xmm0, -80(%rbp)
	movq	_HEADER_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	leaq	(,%r14,4), %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %r12
	movq	_MAX_RETRIES@GOTPCREL(%rip), %r13
	cmpl	$0, (%r13)
	jle	LBB0_1
## %bb.2:
	movq	%r15, -96(%rbp)                 ## 8-byte Spill
	shll	$2, %r14d
	movq	%r14, -104(%rbp)                ## 8-byte Spill
	xorl	%r15d, %r15d
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	_BOOT_TIME_DELAY_MS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_msleep
	movq	%rbx, %rdi
	movq	%r12, %rsi
	movq	-104(%rbp), %rdx                ## 8-byte Reload
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_elants_i2c_read
	testl	%eax, %eax
	je	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	%eax, %r14d
	movq	%rbx, %rdi
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
LBB0_14:                                ##   in Loop: Header=BB0_3 Depth=1
	incl	%r15d
	cmpl	(%r13), %r15d
	jge	LBB0_15
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	%rbx, %rdi
	callq	_elants_i2c_sw_reset
	testl	%eax, %eax
	je	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	%eax, %r14d
	movl	(%r13), %eax
	decl	%eax
	cmpl	%eax, %r15d
	jl	LBB0_14
LBB0_5:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	%rbx, %rdi
	callq	_elants_i2c_fastboot
	testl	%eax, %eax
	je	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	%eax, %r14d
	movl	(%r13), %eax
	decl	%eax
	cmpl	%eax, %r15d
	jge	LBB0_7
	jmp	LBB0_14
LBB0_9:                                 ##   in Loop: Header=BB0_3 Depth=1
	movq	%r12, %rdi
	leaq	-64(%rbp), %rsi
	movl	$16, %edx
	callq	_memcmp
	testl	%eax, %eax
	je	LBB0_10
## %bb.11:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	%r12, %rdi
	leaq	-80(%rbp), %rsi
	movl	$16, %edx
	callq	_memcmp
	testl	%eax, %eax
	je	LBB0_12
## %bb.13:                              ##   in Loop: Header=BB0_3 Depth=1
	xorl	%r14d, %r14d
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
	movq	%rbx, %rdi
	leaq	L_.str.1(%rip), %rsi
	movq	-104(%rbp), %rdx                ## 8-byte Reload
                                        ## kill: def $edx killed $edx killed $rdx
	movq	%r12, %rcx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_14
LBB0_10:
	movq	_ELAN_IAP_OPERATIONAL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	-96(%rbp), %r15                 ## 8-byte Reload
	movl	%eax, (%r15)
LBB0_1:
	movq	%r15, %rdi
	callq	_elants_i2c_query_hw_version
	movq	-88(%rbp), %rbx                 ## 8-byte Reload
	jmp	LBB0_16
LBB0_12:
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
LBB0_15:
	movq	-96(%rbp), %r15                 ## 8-byte Reload
	movq	%r15, %rdi
	callq	_elants_i2c_query_hw_version
	testl	%r14d, %r14d
	movq	-88(%rbp), %rbx                 ## 8-byte Reload
	jne	LBB0_21
LBB0_16:
	testl	%eax, %eax
	jne	LBB0_21
## %bb.17:
	movq	%r15, %rdi
	callq	_elants_i2c_query_fw_version
	testl	%eax, %eax
	jne	LBB0_21
## %bb.18:
	movq	%r15, %rdi
	callq	_elants_i2c_query_test_version
	testl	%eax, %eax
	jne	LBB0_21
## %bb.19:
	movq	%r15, %rdi
	callq	_elants_i2c_query_bc_version
	testl	%eax, %eax
	jne	LBB0_21
## %bb.20:
	movq	%r15, %rdi
	callq	_elants_i2c_query_ts_info
	testl	%eax, %eax
	je	LBB0_22
LBB0_21:
	movq	_ELAN_IAP_RECOVERY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%r15)
LBB0_22:
	movq	%rbx, %rsp
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_24
## %bb.23:
	xorl	%eax, %eax
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_24:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## @__const.elants_i2c_initialize.hello_packet
L___const.elants_i2c_initialize.hello_packet:
	.long	85                              ## 0x55
	.long	85                              ## 0x55
	.long	85                              ## 0x55
	.long	85                              ## 0x55

	.p2align	4                               ## @__const.elants_i2c_initialize.recov_packet
L___const.elants_i2c_initialize.recov_packet:
	.long	85                              ## 0x55
	.long	85                              ## 0x55
	.long	128                             ## 0x80
	.long	128                             ## 0x80

	.comm	_HEADER_SIZE,4,2                ## @HEADER_SIZE
	.comm	_MAX_RETRIES,4,2                ## @MAX_RETRIES
	.comm	_BOOT_TIME_DELAY_MS,4,2         ## @BOOT_TIME_DELAY_MS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed to read 'hello' packet: %d\n"

	.comm	_ELAN_IAP_OPERATIONAL,4,2       ## @ELAN_IAP_OPERATIONAL
	.comm	_EIO,4,2                        ## @EIO
	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"invalid 'hello' packet: %*ph\n"

	.comm	_ELAN_IAP_RECOVERY,4,2          ## @ELAN_IAP_RECOVERY
	.no_dead_strip	_elants_i2c_initialize
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function elants_i2c_initialize
_elants_i2c_initialize:                 ; @elants_i2c_initialize
	.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, #64
	mov	x19, x0
	mov	x22, 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	x20, [x0, #8]
Lloh3:
	adrp	x8, l___const.elants_i2c_initialize.hello_packet@PAGE
Lloh4:
	add	x8, x8, l___const.elants_i2c_initialize.hello_packet@PAGEOFF
Lloh5:
	ldr	q1, [x8]
Lloh6:
	adrp	x8, l___const.elants_i2c_initialize.recov_packet@PAGE
Lloh7:
	add	x8, x8, l___const.elants_i2c_initialize.recov_packet@PAGEOFF
Lloh8:
	ldr	q0, [x8]
	stp	q0, q1, [x29, #-128]
Lloh9:
	adrp	x8, _HEADER_SIZE@GOTPAGE
Lloh10:
	ldr	x8, [x8, _HEADER_SIZE@GOTPAGEOFF]
Lloh11:
	ldr	w12, [x8]
	lsl	x8, x12, #2
	mov	x9, x8
Lloh12:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh13:
	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
Lloh14:
	adrp	x27, _MAX_RETRIES@GOTPAGE
Lloh15:
	ldr	x27, [x27, _MAX_RETRIES@GOTPAGEOFF]
	ldr	w8, [x27]
	cmp	w8, #0
	b.le	LBB0_12
; %bb.1:
	stur	x22, [x29, #-136]               ; 8-byte Folded Spill
	mov	w28, #0
	lsl	w22, w12, #2
Lloh16:
	adrp	x26, _BOOT_TIME_DELAY_MS@GOTPAGE
Lloh17:
	ldr	x26, [x26, _BOOT_TIME_DELAY_MS@GOTPAGEOFF]
Lloh18:
	adrp	x23, l_.str.1@PAGE
Lloh19:
	add	x23, x23, l_.str.1@PAGEOFF
Lloh20:
	adrp	x24, l_.str@PAGE
Lloh21:
	add	x24, x24, l_.str@PAGEOFF
	b	LBB0_5
LBB0_2:                                 ;   in Loop: Header=BB0_5 Depth=1
	ldr	w0, [x26]
	bl	_msleep
	mov	x0, x20
	mov	x1, x21
	mov	x2, x22
	bl	_elants_i2c_read
	cbz	w0, LBB0_9
; %bb.3:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x25, x0
	mov	x0, x20
	mov	x1, x24
	mov	x2, x25
	bl	_dev_err
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	add	w28, w28, #1
	ldr	w8, [x27]
	cmp	w28, w8
	b.ge	LBB0_15
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	bl	_elants_i2c_sw_reset
	cbz	w0, LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x25, x0
	ldr	w8, [x27]
	sub	w8, w8, #1
	cmp	w28, w8
	b.lt	LBB0_4
LBB0_7:                                 ;   in Loop: Header=BB0_5 Depth=1
	mov	x0, x20
	bl	_elants_i2c_fastboot
	cbz	w0, LBB0_2
; %bb.8:                                ;   in Loop: Header=BB0_5 Depth=1
	mov	x25, x0
	ldr	w8, [x27]
	sub	w8, w8, #1
	cmp	w28, w8
	b.ge	LBB0_2
	b	LBB0_4
LBB0_9:                                 ;   in Loop: Header=BB0_5 Depth=1
	sub	x1, x29, #112
	mov	x0, x21
	mov	w2, #16
	bl	_memcmp
	cbz	w0, LBB0_13
; %bb.10:                               ;   in Loop: Header=BB0_5 Depth=1
	sub	x1, x29, #128
	mov	x0, x21
	mov	w2, #16
	bl	_memcmp
	cbz	w0, LBB0_14
; %bb.11:                               ;   in Loop: Header=BB0_5 Depth=1
Lloh22:
	adrp	x8, _EINVAL@GOTPAGE
Lloh23:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	neg	w25, w8
	str	x21, [sp, #-16]!
	mov	x0, x20
	mov	x1, x23
	mov	x2, x22
	bl	_dev_err
	add	sp, sp, #16
	b	LBB0_4
LBB0_12:
	mov	x0, x19
	bl	_elants_i2c_query_hw_version
	b	LBB0_16
LBB0_13:
Lloh25:
	adrp	x8, _ELAN_IAP_OPERATIONAL@GOTPAGE
Lloh26:
	ldr	x8, [x8, _ELAN_IAP_OPERATIONAL@GOTPAGEOFF]
Lloh27:
	ldr	w8, [x8]
	str	w8, [x19]
	mov	x0, x19
	bl	_elants_i2c_query_hw_version
	ldur	x22, [x29, #-136]               ; 8-byte Folded Reload
	b	LBB0_16
LBB0_14:
Lloh28:
	adrp	x8, _EIO@GOTPAGE
Lloh29:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh30:
	ldr	w8, [x8]
	neg	w25, w8
LBB0_15:
	mov	x0, x19
	bl	_elants_i2c_query_hw_version
	ldur	x22, [x29, #-136]               ; 8-byte Folded Reload
	cbnz	w25, LBB0_21
LBB0_16:
	cbnz	w0, LBB0_21
; %bb.17:
	mov	x0, x19
	bl	_elants_i2c_query_fw_version
	cbnz	w0, LBB0_21
; %bb.18:
	mov	x0, x19
	bl	_elants_i2c_query_test_version
	cbnz	w0, LBB0_21
; %bb.19:
	mov	x0, x19
	bl	_elants_i2c_query_bc_version
	cbnz	w0, LBB0_21
; %bb.20:
	mov	x0, x19
	bl	_elants_i2c_query_ts_info
	cbz	w0, LBB0_22
LBB0_21:
Lloh31:
	adrp	x8, _ELAN_IAP_RECOVERY@GOTPAGE
Lloh32:
	ldr	x8, [x8, _ELAN_IAP_RECOVERY@GOTPAGEOFF]
Lloh33:
	ldr	w8, [x8]
	str	w8, [x19]
LBB0_22:
	mov	sp, x22
	ldur	x8, [x29, #-88]
Lloh34:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh35:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh36:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_24
; %bb.23:
	mov	w0, #0
	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_24:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAddLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAddLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__literal16,16byte_literals
	.p2align	2                               ; @__const.elants_i2c_initialize.hello_packet
l___const.elants_i2c_initialize.hello_packet:
	.long	85                              ; 0x55
	.long	85                              ; 0x55
	.long	85                              ; 0x55
	.long	85                              ; 0x55

	.p2align	2                               ; @__const.elants_i2c_initialize.recov_packet
l___const.elants_i2c_initialize.recov_packet:
	.long	85                              ; 0x55
	.long	85                              ; 0x55
	.long	128                             ; 0x80
	.long	128                             ; 0x80

	.comm	_HEADER_SIZE,4,2                ; @HEADER_SIZE
	.comm	_MAX_RETRIES,4,2                ; @MAX_RETRIES
	.comm	_BOOT_TIME_DELAY_MS,4,2         ; @BOOT_TIME_DELAY_MS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed to read 'hello' packet: %d\n"

	.comm	_ELAN_IAP_OPERATIONAL,4,2       ; @ELAN_IAP_OPERATIONAL
	.comm	_EIO,4,2                        ; @EIO
	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"invalid 'hello' packet: %*ph\n"

	.comm	_ELAN_IAP_RECOVERY,4,2          ; @ELAN_IAP_RECOVERY
	.no_dead_strip	_elants_i2c_initialize
.subsections_via_symbols
