	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cyapa_gen3_check_fw
_cyapa_gen3_check_fw:                   ## @cyapa_gen3_check_fw
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	(%rdi), %r14
	movslq	8(%rsi), %rdx
	movq	_CYAPA_FW_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	cmpl	%ecx, %edx
	jne	LBB0_1
## %bb.2:
	movq	%rsi, %r15
	movq	(%rsi), %rdi
	movl	(%rdi), %ebx
	shll	$8, %ebx
	orl	4(%rdi), %ebx
	addq	$8, %rdi
	movq	_CYAPA_FW_HDR_SIZE@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	addl	$-2, %esi
	callq	_cyapa_gen3_csum
	cmpl	%ebx, %eax
	jne	LBB0_4
## %bb.3:
	movq	(%r15), %rax
	movslq	(%r12), %rcx
	movl	-8(%rax,%rcx,4), %ebx
	shll	$8, %ebx
	orl	-4(%rax,%rcx,4), %ebx
	leaq	(%rax,%rcx,4), %rdi
	movq	_CYAPA_FW_DATA_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_cyapa_gen3_csum
	xorl	%r15d, %r15d
	cmpl	%ebx, %eax
	je	LBB0_6
LBB0_4:
	leaq	L_.str.1(%rip), %rsi
	leaq	L_.str.2(%rip), %rdx
	xorl	%r15d, %r15d
	movq	%r14, %rdi
	movl	%eax, %ecx
	movl	%ebx, %r8d
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_5
LBB0_1:
	leaq	L_.str(%rip), %rsi
	xorl	%r15d, %r15d
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_dev_err
LBB0_5:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
LBB0_6:
	movl	%r15d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CYAPA_FW_SIZE,4,2              ## @CYAPA_FW_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"invalid firmware size = %zu, expected %u.\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_CYAPA_FW_HDR_SIZE,4,2          ## @CYAPA_FW_HDR_SIZE
L_.str.1:                               ## @.str.1
	.asciz	"%s %04x, expected: %04x\n"

L_.str.2:                               ## @.str.2
	.asciz	"invalid firmware header checksum = "

	.comm	_CYAPA_FW_DATA_SIZE,4,2         ## @CYAPA_FW_DATA_SIZE
	.no_dead_strip	_cyapa_gen3_check_fw
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cyapa_gen3_check_fw
_cyapa_gen3_check_fw:                   ; @cyapa_gen3_check_fw
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	ldr	x19, [x0]
	ldrsw	x2, [x1, #8]
Lloh0:
	adrp	x8, _CYAPA_FW_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _CYAPA_FW_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	w3, [x8]
	cmp	w2, w3
	b.ne	LBB0_4
; %bb.1:
	mov	x20, x1
	ldr	x8, [x1]
	ldp	w9, w10, [x8]
	orr	w21, w10, w9, lsl #8
	add	x0, x8, #8
Lloh3:
	adrp	x22, _CYAPA_FW_HDR_SIZE@GOTPAGE
Lloh4:
	ldr	x22, [x22, _CYAPA_FW_HDR_SIZE@GOTPAGEOFF]
	ldr	w8, [x22]
	sub	w1, w8, #2
	bl	_cyapa_gen3_csum
	cmp	w0, w21
	b.ne	LBB0_5
; %bb.2:
	ldr	x8, [x20]
	ldrsw	x9, [x22]
	sub	w10, w9, #2
	ldr	w10, [x8, w10, sxtw #2]
	sub	w11, w9, #1
	ldr	w11, [x8, w11, sxtw #2]
	orr	w20, w11, w10, lsl #8
	add	x0, x8, x9, lsl #2
Lloh5:
	adrp	x8, _CYAPA_FW_DATA_SIZE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _CYAPA_FW_DATA_SIZE@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
	bl	_cyapa_gen3_csum
	cmp	w0, w20
	b.ne	LBB0_6
; %bb.3:
	mov	w0, #0
	b	LBB0_9
LBB0_4:
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_8
LBB0_5:
	mov	x3, x0
	str	x21, [sp]
	b	LBB0_7
LBB0_6:
	mov	x3, x0
	str	x20, [sp]
LBB0_7:
Lloh10:
	adrp	x1, l_.str.1@PAGE
Lloh11:
	add	x1, x1, l_.str.1@PAGEOFF
Lloh12:
	adrp	x2, l_.str.2@PAGE
Lloh13:
	add	x2, x2, l_.str.2@PAGEOFF
LBB0_8:
	mov	x0, x19
	bl	_dev_err
Lloh14:
	adrp	x8, _EINVAL@GOTPAGE
Lloh15:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_9:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_CYAPA_FW_SIZE,4,2              ; @CYAPA_FW_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"invalid firmware size = %zu, expected %u.\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_CYAPA_FW_HDR_SIZE,4,2          ; @CYAPA_FW_HDR_SIZE
l_.str.1:                               ; @.str.1
	.asciz	"%s %04x, expected: %04x\n"

l_.str.2:                               ; @.str.2
	.asciz	"invalid firmware header checksum = "

	.comm	_CYAPA_FW_DATA_SIZE,4,2         ; @CYAPA_FW_DATA_SIZE
	.no_dead_strip	_cyapa_gen3_check_fw
.subsections_via_symbols
