	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function elants_i2c_fw_write_page
_elants_i2c_fw_write_page:              ## @elants_i2c_fw_write_page
	.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	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movabsq	$730144440490, %rax             ## imm = 0xAA000000AA
	movq	%rax, -72(%rbp)
	movq	_MAX_FW_UPDATE_RETRIES@GOTPCREL(%rip), %rbx
	cmpl	$0, (%rbx)
	jle	LBB0_1
## %bb.2:
	movq	%rsi, %r12
	movq	%rdi, %r14
	xorl	%r15d, %r15d
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_3 Depth=1
	movl	%eax, %r13d
	movq	%r14, %rdi
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
LBB0_9:                                 ##   in Loop: Header=BB0_3 Depth=1
	incl	%r15d
	cmpl	(%rbx), %r15d
	jge	LBB0_10
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	_ELAN_FW_PAGESIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	movq	%r12, %rsi
	callq	_elants_i2c_send
	testl	%eax, %eax
	jne	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%r14, %rdi
	leaq	-56(%rbp), %r12
	movq	%r12, %rsi
	movl	$2, %edx
	callq	_elants_i2c_read
	testl	%eax, %eax
	jne	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%r12, %rdi
	leaq	-72(%rbp), %rsi
	movl	$8, %edx
	callq	_memcmp
	xorl	%r13d, %r13d
	testl	%eax, %eax
	je	LBB0_10
## %bb.8:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %r13d
	movl	-56(%rbp), %edx
	movl	-52(%rbp), %ecx
	movq	%r14, %rdi
	leaq	L_.str.2(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_err
	movq	-64(%rbp), %r12                 ## 8-byte Reload
	jmp	LBB0_9
LBB0_1:
                                        ## implicit-def: $r13d
	jmp	LBB0_10
LBB0_6:
	movl	%eax, %r13d
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
LBB0_10:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_12
## %bb.11:
	movl	%r13d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_FW_UPDATE_RETRIES,4,2      ## @MAX_FW_UPDATE_RETRIES
	.comm	_ELAN_FW_PAGESIZE,4,2           ## @ELAN_FW_PAGESIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"IAP Write Page failed: %d\n"

L_.str.1:                               ## @.str.1
	.asciz	"IAP Ack read failed: %d\n"

	.comm	_EIO,4,2                        ## @EIO
L_.str.2:                               ## @.str.2
	.asciz	"IAP Get Ack Error [%02x:%02x]\n"

	.no_dead_strip	_elants_i2c_fw_write_page
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function elants_i2c_fw_write_page
_elants_i2c_fw_write_page:              ; @elants_i2c_fw_write_page
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #24]
	mov	x8, #170
	movk	x8, #170, lsl #32
	str	x8, [sp, #8]
Lloh3:
	adrp	x24, _MAX_FW_UPDATE_RETRIES@GOTPAGE
Lloh4:
	ldr	x24, [x24, _MAX_FW_UPDATE_RETRIES@GOTPAGEOFF]
	ldr	w8, [x24]
	cmp	w8, #1
	b.lt	LBB0_8
; %bb.1:
	mov	x20, x1
	mov	x19, x0
	mov	w25, #0
Lloh5:
	adrp	x26, _ELAN_FW_PAGESIZE@GOTPAGE
Lloh6:
	ldr	x26, [x26, _ELAN_FW_PAGESIZE@GOTPAGEOFF]
Lloh7:
	adrp	x27, _EIO@GOTPAGE
Lloh8:
	ldr	x27, [x27, _EIO@GOTPAGEOFF]
Lloh9:
	adrp	x21, l_.str.2@PAGE
Lloh10:
	add	x21, x21, l_.str.2@PAGEOFF
Lloh11:
	adrp	x22, l_.str@PAGE
Lloh12:
	add	x22, x22, l_.str@PAGEOFF
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
	mov	x23, x0
	mov	x0, x19
	mov	x1, x22
	mov	x2, x23
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	bl	_dev_err
	add	w25, w25, #1
	ldr	w8, [x24]
	cmp	w25, w8
	b.ge	LBB0_11
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w2, [x26]
	mov	x0, x19
	mov	x1, x20
	bl	_elants_i2c_send
	cbnz	w0, LBB0_2
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	add	x1, sp, #16
	mov	x0, x19
	mov	w2, #2
	bl	_elants_i2c_read
	cbnz	w0, LBB0_9
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	add	x0, sp, #16
	add	x1, sp, #8
	mov	w2, #8
	bl	_memcmp
	cbz	w0, LBB0_10
; %bb.7:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w8, [x27]
	neg	w23, w8
	ldp	w2, w8, [sp, #16]
	str	x8, [sp]
	mov	x0, x19
	mov	x1, x21
	b	LBB0_3
LBB0_8:
                                        ; implicit-def: $w23
	b	LBB0_11
LBB0_9:
	mov	x23, x0
Lloh13:
	adrp	x1, l_.str.1@PAGE
Lloh14:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	mov	x2, x23
	bl	_dev_err
	b	LBB0_11
LBB0_10:
	mov	w23, #0
LBB0_11:
	ldr	x8, [sp, #24]
Lloh15:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh16:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh17:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_13
; %bb.12:
	mov	x0, x23
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_13:
	bl	___stack_chk_fail
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_FW_UPDATE_RETRIES,4,2      ; @MAX_FW_UPDATE_RETRIES
	.comm	_ELAN_FW_PAGESIZE,4,2           ; @ELAN_FW_PAGESIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"IAP Write Page failed: %d\n"

l_.str.1:                               ; @.str.1
	.asciz	"IAP Ack read failed: %d\n"

	.comm	_EIO,4,2                        ; @EIO
l_.str.2:                               ; @.str.2
	.asciz	"IAP Get Ack Error [%02x:%02x]\n"

	.no_dead_strip	_elants_i2c_fw_write_page
.subsections_via_symbols
