	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function prepare_cros_ec_rx
_prepare_cros_ec_rx:                    ## @prepare_cros_ec_rx
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r15
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movl	4(%rsi), %eax
	movl	%eax, 16(%rdx)
	movq	%rdx, %rsi
	callq	_cros_ec_check_result
	testl	%eax, %eax
	js	LBB0_21
## %bb.1:
	movl	(%rbx), %edx
	movl	(%r15), %ecx
	cmpl	%ecx, %edx
	jle	LBB0_3
## %bb.2:
	movl	(%r14), %edi
	leaq	L_.str(%rip), %rsi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_dev_err
	movq	_ENOSPC@GOTPCREL(%rip), %rcx
	jmp	LBB0_20
LBB0_3:
	movq	_IN_MSG_EC_RESPONSE_PREAMBLE@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	movdqu	(%rbx,%rax,8), %xmm0
	movdqu	16(%rbx,%rax,8), %xmm1
	paddq	%xmm0, %xmm1
	pshufd	$238, %xmm1, %xmm0              ## xmm0 = xmm1[2,3,2,3]
	paddq	%xmm1, %xmm0
	movq	%xmm0, %rax
	testl	%edx, %edx
	jle	LBB0_18
## %bb.4:
	movq	8(%r15), %r9
	cmpl	$4, %edx
	jb	LBB0_5
## %bb.6:
	movq	%r9, %rsi
	subq	%rbx, %rsi
	addq	$-64, %rsi
	cmpq	$32, %rsi
	jae	LBB0_8
LBB0_5:
	xorl	%esi, %esi
LBB0_14:
	movq	%rsi, %r8
	notq	%r8
	addq	%rdx, %r8
	movq	%rdx, %rdi
	andq	$3, %rdi
	je	LBB0_16
	.p2align	4, 0x90
LBB0_15:                                ## =>This Inner Loop Header: Depth=1
	movq	64(%rbx,%rsi,8), %rcx
	movq	%rcx, (%r9,%rsi,8)
	addq	%rcx, %rax
	incq	%rsi
	decq	%rdi
	jne	LBB0_15
LBB0_16:
	cmpq	$3, %r8
	jb	LBB0_18
	.p2align	4, 0x90
LBB0_17:                                ## =>This Inner Loop Header: Depth=1
	movq	64(%rbx,%rsi,8), %rcx
	movq	%rcx, (%r9,%rsi,8)
	addq	%rcx, %rax
	movq	72(%rbx,%rsi,8), %rcx
	movq	%rcx, 8(%r9,%rsi,8)
	addq	%rcx, %rax
	movq	80(%rbx,%rsi,8), %rcx
	movq	%rcx, 16(%r9,%rsi,8)
	addq	%rcx, %rax
	movq	88(%rbx,%rsi,8), %rcx
	movq	%rcx, 24(%r9,%rsi,8)
	addq	%rcx, %rax
	addq	$4, %rsi
	cmpq	%rsi, %rdx
	jne	LBB0_17
	jmp	LBB0_18
LBB0_8:
	movl	%edx, %esi
	andl	$-4, %esi
	movq	%rax, %xmm0
	leaq	-4(%rsi), %rax
	movq	%rax, %r8
	shrq	$2, %r8
	incq	%r8
	testq	%rax, %rax
	je	LBB0_23
## %bb.9:
	movq	%r8, %rax
	andq	$-2, %rax
	pxor	%xmm1, %xmm1
	xorl	%edi, %edi
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movdqu	64(%rbx,%rdi,8), %xmm2
	movdqu	80(%rbx,%rdi,8), %xmm3
	movdqu	%xmm2, (%r9,%rdi,8)
	movdqu	%xmm3, 16(%r9,%rdi,8)
	paddq	%xmm2, %xmm0
	paddq	%xmm3, %xmm1
	movdqu	96(%rbx,%rdi,8), %xmm2
	movdqu	112(%rbx,%rdi,8), %xmm3
	movdqu	%xmm2, 32(%r9,%rdi,8)
	movdqu	%xmm3, 48(%r9,%rdi,8)
	paddq	%xmm2, %xmm0
	paddq	%xmm3, %xmm1
	addq	$8, %rdi
	addq	$-2, %rax
	jne	LBB0_10
## %bb.11:
	testb	$1, %r8b
	je	LBB0_13
LBB0_12:
	movdqu	64(%rbx,%rdi,8), %xmm2
	movdqu	80(%rbx,%rdi,8), %xmm3
	movdqu	%xmm2, (%r9,%rdi,8)
	movdqu	%xmm3, 16(%r9,%rdi,8)
	paddq	%xmm2, %xmm0
	paddq	%xmm3, %xmm1
LBB0_13:
	paddq	%xmm1, %xmm0
	pshufd	$238, %xmm0, %xmm1              ## xmm1 = xmm0[2,3,2,3]
	paddq	%xmm0, %xmm1
	movq	%xmm1, %rax
	cmpq	%rdx, %rsi
	jne	LBB0_14
LBB0_18:
	testq	%rax, %rax
	je	LBB0_22
## %bb.19:
	movl	(%r14), %edi
	leaq	L_.str.1(%rip), %rsi
	movq	%rax, %rdx
	callq	_dev_dbg
	movq	_EBADMSG@GOTPCREL(%rip), %rcx
LBB0_20:
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_21:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_22:
	xorl	%eax, %eax
	jmp	LBB0_21
LBB0_23:
	pxor	%xmm1, %xmm1
	xorl	%edi, %edi
	testb	$1, %r8b
	jne	LBB0_12
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Packet too long (%d bytes, expected %d)"

	.comm	_ENOSPC,4,2                     ## @ENOSPC
	.comm	_IN_MSG_EC_RESPONSE_PREAMBLE,4,2 ## @IN_MSG_EC_RESPONSE_PREAMBLE
L_.str.1:                               ## @.str.1
	.asciz	"Bad received packet checksum %d\n"

	.comm	_EBADMSG,4,2                    ## @EBADMSG
	.no_dead_strip	_prepare_cros_ec_rx
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function prepare_cros_ec_rx
_prepare_cros_ec_rx:                    ; @prepare_cros_ec_rx
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x21, x2
	mov	x20, x1
	mov	x19, x0
	ldr	w8, [x1, #4]
	str	w8, [x2, #16]
	mov	x1, x2
	bl	_cros_ec_check_result
	tbnz	w0, #31, LBB0_12
; %bb.1:
	ldr	w2, [x20]
	ldr	w3, [x21]
	cmp	w2, w3
	b.le	LBB0_3
; %bb.2:
	ldr	w0, [x19]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_dev_err
Lloh2:
	adrp	x8, _ENOSPC@GOTPAGE
Lloh3:
	ldr	x8, [x8, _ENOSPC@GOTPAGEOFF]
	b	LBB0_11
LBB0_3:
Lloh4:
	adrp	x8, _IN_MSG_EC_RESPONSE_PREAMBLE@GOTPAGE
Lloh5:
	ldr	x8, [x8, _IN_MSG_EC_RESPONSE_PREAMBLE@GOTPAGEOFF]
Lloh6:
	ldrsw	x8, [x8]
	add	x8, x20, x8, lsl #3
	ldp	x9, x10, [x8]
	ldp	x11, x8, [x8, #16]
	add	x9, x10, x9
	add	x9, x11, x9
	add	x8, x8, x9
	cmp	w2, #0
	b.le	LBB0_9
; %bb.4:
	ldr	x9, [x21, #8]
	cmp	w2, #8
	b.lo	LBB0_6
; %bb.5:
	sub	x10, x9, x20
	sub	x10, x10, #64
	cmp	x10, #64
	b.hs	LBB0_14
LBB0_6:
	mov	x10, #0
LBB0_7:
	lsl	x12, x10, #3
	add	x11, x12, x20
	add	x11, x11, #64
	add	x9, x9, x12
	sub	x10, x2, x10
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x12, [x11], #8
	str	x12, [x9], #8
	add	x8, x12, x8
	subs	x10, x10, #1
	b.ne	LBB0_8
LBB0_9:
	cbz	x8, LBB0_13
; %bb.10:
	ldr	w0, [x19]
Lloh7:
	adrp	x1, l_.str.1@PAGE
Lloh8:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x8
	bl	_dev_dbg
Lloh9:
	adrp	x8, _EBADMSG@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EBADMSG@GOTPAGEOFF]
LBB0_11:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_12:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_13:
	mov	w0, #0
	b	LBB0_12
LBB0_14:
	and	x10, x2, #0xfffffff8
	movi.2d	v0, #0000000000000000
	mov.d	v0[0], x8
	movi.2d	v1, #0000000000000000
	add	x8, x9, #32
	add	x11, x20, #112
	mov	x12, x10
	movi.2d	v2, #0000000000000000
	movi.2d	v3, #0000000000000000
LBB0_15:                                ; =>This Inner Loop Header: Depth=1
	ldp	q4, q5, [x11, #-48]
	ldp	q6, q7, [x11, #-16]
	stp	q4, q5, [x8, #-32]
	stp	q6, q7, [x8], #64
	add.2d	v0, v4, v0
	add.2d	v1, v5, v1
	add.2d	v2, v6, v2
	add.2d	v3, v7, v3
	add	x11, x11, #64
	subs	x12, x12, #8
	b.ne	LBB0_15
; %bb.16:
	add.2d	v0, v1, v0
	add.2d	v0, v2, v0
	add.2d	v0, v3, v0
	addp.2d	d0, v0
	fmov	x8, d0
	cmp	x10, x2
	b.eq	LBB0_9
	b	LBB0_7
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpAdd	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Packet too long (%d bytes, expected %d)"

	.comm	_ENOSPC,4,2                     ; @ENOSPC
	.comm	_IN_MSG_EC_RESPONSE_PREAMBLE,4,2 ; @IN_MSG_EC_RESPONSE_PREAMBLE
l_.str.1:                               ; @.str.1
	.asciz	"Bad received packet checksum %d\n"

	.comm	_EBADMSG,4,2                    ; @EBADMSG
	.no_dead_strip	_prepare_cros_ec_rx
.subsections_via_symbols
