	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function __elan_update_firmware
___elan_update_firmware:                ## @__elan_update_firmware
	.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	%rsi, %rbx
	movq	%rdi, %r15
	movq	24(%rdi), %r14
	movl	$0, -44(%rbp)
	movq	8(%rdi), %rax
	movq	%r14, %rdi
	callq	*(%rax)
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_19
## %bb.1:
	movq	_ETP_IAP_START_ADDR@GOTPCREL(%rip), %rax
	movslq	(%rax), %rdi
	shlq	$3, %rdi
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	addq	(%rbx), %rdi
	callq	_get_unaligned_le16
	addl	%eax, %eax
	movq	_ETP_FW_PAGE_SIZE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	cltd
	idivl	%ecx
	xorl	%r13d, %r13d
	cmpl	(%r15), %eax
	jge	LBB0_15
## %bb.2:
	movl	%eax, %ebx
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_7 Depth 2
                                        ##     Child Loop BB0_10 Depth 2
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %r8
	movl	%ecx, %eax
	imull	%ebx, %eax
	movslq	%eax, %r9
	movl	$0, %r14d
	testl	%ecx, %ecx
	jle	LBB0_11
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	%ecx, %edx
	leaq	-1(%rdx), %r10
	cmpq	$14, %r10
	jae	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	xorl	%esi, %esi
	xorl	%r14d, %r14d
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_3 Depth=1
	shrq	%r10
	incq	%r10
	movq	%r10, %rdi
	andq	$-8, %rdi
	leaq	(%rdi,%rdi), %rsi
	leaq	(%r8,%r9,4), %rcx
	addq	$32, %rcx
	pxor	%xmm0, %xmm0
	xorl	%eax, %eax
	pxor	%xmm1, %xmm1
	.p2align	4, 0x90
LBB0_7:                                 ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movups	-32(%rcx,%rax,8), %xmm2
	movups	-16(%rcx,%rax,8), %xmm3
	movups	(%rcx,%rax,8), %xmm4
	movups	16(%rcx,%rax,8), %xmm5
	movaps	%xmm2, %xmm6
	shufps	$136, %xmm3, %xmm6              ## xmm6 = xmm6[0,2],xmm3[0,2]
	movaps	%xmm4, %xmm7
	shufps	$136, %xmm5, %xmm7              ## xmm7 = xmm7[0,2],xmm5[0,2]
	shufps	$221, %xmm3, %xmm2              ## xmm2 = xmm2[1,3],xmm3[1,3]
	shufps	$221, %xmm5, %xmm4              ## xmm4 = xmm4[1,3],xmm5[1,3]
	pslld	$8, %xmm2
	por	%xmm6, %xmm2
	paddd	%xmm2, %xmm0
	pslld	$8, %xmm4
	por	%xmm7, %xmm4
	paddd	%xmm4, %xmm1
	addq	$8, %rax
	cmpq	%rax, %rdi
	jne	LBB0_7
## %bb.8:                               ##   in Loop: Header=BB0_3 Depth=1
	paddd	%xmm0, %xmm1
	pshufd	$238, %xmm1, %xmm0              ## xmm0 = xmm1[2,3,2,3]
	paddd	%xmm1, %xmm0
	pshufd	$85, %xmm0, %xmm1               ## xmm1 = xmm0[1,1,1,1]
	paddd	%xmm0, %xmm1
	movd	%xmm1, %r14d
	cmpq	%rdi, %r10
	je	LBB0_11
LBB0_9:                                 ##   in Loop: Header=BB0_3 Depth=1
	leaq	(%r8,%r9,4), %rax
	addq	$4, %rax
	.p2align	4, 0x90
LBB0_10:                                ##   Parent Loop BB0_3 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	(%rax,%rsi,4), %ecx
	shll	$8, %ecx
	orl	-4(%rax,%rsi,4), %ecx
	addl	%ecx, %r14d
	addq	$2, %rsi
	cmpq	%rdx, %rsi
	jb	LBB0_10
LBB0_11:                                ##   in Loop: Header=BB0_3 Depth=1
	leaq	(%r8,%r9,4), %rsi
	movq	%r15, %rdi
	movl	%r14d, %edx
	movl	%ebx, %ecx
	callq	_elan_write_fw_block
	testl	%eax, %eax
	jne	LBB0_12
## %bb.13:                              ##   in Loop: Header=BB0_3 Depth=1
	addl	%r14d, %r13d
	incl	%ebx
	cmpl	(%r15), %ebx
	jge	LBB0_14
## %bb.20:                              ##   in Loop: Header=BB0_3 Depth=1
	movq	_ETP_FW_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	jmp	LBB0_3
LBB0_12:
	movl	%eax, %r12d
	leaq	L_.str(%rip), %rsi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%ebx, %edx
	movl	%eax, %ecx
	callq	_dev_err
	jmp	LBB0_19
LBB0_14:
	movq	-56(%rbp), %r14                 ## 8-byte Reload
LBB0_15:
	movl	$600, %edi                      ## imm = 0x258
	callq	_msleep
	movq	8(%r15), %rax
	leaq	16(%r15), %rsi
	movq	%r14, %rdi
	callq	*8(%rax)
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_19
## %bb.16:
	movq	8(%r15), %rax
	leaq	-44(%rbp), %rdx
	movq	%r14, %rdi
	movl	$1, %esi
	callq	*16(%rax)
	movl	%eax, %r12d
	testl	%eax, %eax
	jne	LBB0_19
## %bb.17:
	movl	-44(%rbp), %ecx
	xorl	%r12d, %r12d
	cmpl	%ecx, %r13d
	je	LBB0_19
## %bb.18:
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdi
	movl	%r13d, %edx
	callq	_dev_err
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
LBB0_19:
	movl	%r12d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ETP_IAP_START_ADDR,4,2         ## @ETP_IAP_START_ADDR
	.comm	_ETP_FW_PAGE_SIZE,4,2           ## @ETP_FW_PAGE_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"write page %d fail: %d\n"

L_.str.1:                               ## @.str.1
	.asciz	"checksum diff sw=[%04X], fw=[%04X]\n"

	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	___elan_update_firmware
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function __elan_update_firmware
___elan_update_firmware:                ; @__elan_update_firmware
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.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
	mov	x22, x1
	mov	x20, x0
	ldr	x19, [x0, #24]
	str	wzr, [sp, #12]
	ldr	x8, [x0, #8]
	ldr	x8, [x8]
	mov	x0, x19
	blr	x8
	mov	x25, x0
	cbnz	w0, LBB0_20
; %bb.1:
	ldr	x8, [x22]
Lloh0:
	adrp	x9, _ETP_IAP_START_ADDR@GOTPAGE
Lloh1:
	ldr	x9, [x9, _ETP_IAP_START_ADDR@GOTPAGEOFF]
Lloh2:
	ldrsw	x9, [x9]
	add	x0, x8, x9, lsl #3
	bl	_get_unaligned_le16
	lsl	w9, w0, #1
Lloh3:
	adrp	x26, _ETP_FW_PAGE_SIZE@GOTPAGE
Lloh4:
	ldr	x26, [x26, _ETP_FW_PAGE_SIZE@GOTPAGEOFF]
	ldr	w8, [x26]
	sdiv	w23, w9, w8
	ldr	w9, [x20]
	cmp	w23, w9
	b.ge	LBB0_14
; %bb.2:
	mov	w21, #0
LBB0_3:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_8 Depth 2
                                        ;     Child Loop BB0_10 Depth 2
	ldr	x9, [x22]
	mul	w10, w8, w23
	add	x1, x9, w10, sxtw #2
	cmp	w8, #1
	b.lt	LBB0_6
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	w8, w8
	sub	x9, x8, #1
	cmp	x9, #30
	b.hs	LBB0_7
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x9, #0
	mov	w24, #0
	b	LBB0_10
LBB0_6:                                 ;   in Loop: Header=BB0_3 Depth=1
	mov	w24, #0
	b	LBB0_11
LBB0_7:                                 ;   in Loop: Header=BB0_3 Depth=1
	lsr	x9, x9, #1
	add	x10, x9, #1
	and	x11, x10, #0xfffffffffffffff0
	lsl	x9, x11, #1
	add	x12, x1, #64
	movi.2d	v0, #0000000000000000
	mov	x13, x11
	movi.2d	v1, #0000000000000000
	movi.2d	v2, #0000000000000000
	movi.2d	v3, #0000000000000000
LBB0_8:                                 ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	sub	x14, x12, #64
	ld2.4s	{ v4, v5 }, [x14]
	sub	x14, x12, #32
	ld2.4s	{ v6, v7 }, [x14]
	mov	x14, x12
	ld2.4s	{ v16, v17 }, [x14], #32
	ld2.4s	{ v18, v19 }, [x14]
	shl.4s	v20, v5, #8
	shl.4s	v21, v7, #8
	shl.4s	v22, v17, #8
	shl.4s	v23, v19, #8
	orr.16b	v4, v20, v4
	orr.16b	v5, v21, v6
	orr.16b	v6, v22, v16
	orr.16b	v7, v23, v18
	add.4s	v0, v4, v0
	add.4s	v1, v5, v1
	add.4s	v2, v6, v2
	add.4s	v3, v7, v3
	add	x12, x12, #128
	subs	x13, x13, #16
	b.ne	LBB0_8
; %bb.9:                                ;   in Loop: Header=BB0_3 Depth=1
	add.4s	v0, v1, v0
	add.4s	v0, v2, v0
	add.4s	v0, v3, v0
	addv.4s	s0, v0
	fmov	w24, s0
	cmp	x10, x11
	b.eq	LBB0_11
LBB0_10:                                ;   Parent Loop BB0_3 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	add	x10, x1, x9, lsl #2
	ldp	w10, w11, [x10]
	orr	w10, w10, w11, lsl #8
	add	w24, w10, w24
	add	x9, x9, #2
	cmp	x9, x8
	b.lo	LBB0_10
LBB0_11:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x0, x20
	mov	x2, x24
	mov	x3, x23
	bl	_elan_write_fw_block
	cbnz	w0, LBB0_19
; %bb.12:                               ;   in Loop: Header=BB0_3 Depth=1
	add	w21, w24, w21
	add	w23, w23, #1
	ldr	w8, [x20]
	cmp	w23, w8
	b.ge	LBB0_15
; %bb.13:                               ;   in Loop: Header=BB0_3 Depth=1
	ldr	w8, [x26]
	b	LBB0_3
LBB0_14:
	mov	w21, #0
LBB0_15:
	mov	w0, #600
	bl	_msleep
	ldr	x8, [x20, #8]
	ldr	x8, [x8, #8]
	add	x1, x20, #16
	mov	x0, x19
	blr	x8
	mov	x25, x0
	cbnz	w0, LBB0_20
; %bb.16:
	ldr	x8, [x20, #8]
	ldr	x8, [x8, #16]
	add	x2, sp, #12
	mov	x0, x19
	mov	w1, #1
	blr	x8
	mov	x25, x0
	cbnz	w0, LBB0_20
; %bb.17:
	ldr	w3, [sp, #12]
	cmp	w21, w3
	b.ne	LBB0_21
; %bb.18:
	mov	w25, #0
	b	LBB0_20
LBB0_19:
	mov	x25, x0
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	mov	x2, x23
	mov	x3, x25
	bl	_dev_err
LBB0_20:
	mov	x0, x25
	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
	add	sp, sp, #96
	ret
LBB0_21:
Lloh7:
	adrp	x1, l_.str.1@PAGE
Lloh8:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	mov	x2, x21
	bl	_dev_err
Lloh9:
	adrp	x8, _EIO@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w25, w8
	b	LBB0_20
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_ETP_IAP_START_ADDR,4,2         ; @ETP_IAP_START_ADDR
	.comm	_ETP_FW_PAGE_SIZE,4,2           ; @ETP_FW_PAGE_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"write page %d fail: %d\n"

l_.str.1:                               ; @.str.1
	.asciz	"checksum diff sw=[%04X], fw=[%04X]\n"

	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	___elan_update_firmware
.subsections_via_symbols
