	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cros_ec_spi_receive_response
_cros_ec_spi_receive_response:          ## @cros_ec_spi_receive_response
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r12d
	movq	%rdi, %r14
	movl	(%rdi), %eax
	movq	_EC_MSG_PREAMBLE_COUNT@GOTPCREL(%rip), %r15
	xorl	%edi, %edi
	cmpl	(%r15), %eax
	setl	%dil
	callq	_BUG_ON
	movq	_jiffies@GOTPCREL(%rip), %rbx
	movq	(%rbx), %r13
	movq	_EC_MSG_DEADLINE_MS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_msecs_to_jiffies
	addq	%r13, %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	jmp	LBB0_1
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_1 Depth=1
	movq	%r13, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	callq	_time_after
	testq	%rax, %rax
	movq	_EC_MSG_PREAMBLE_COUNT@GOTPCREL(%rip), %r15
	movq	_jiffies@GOTPCREL(%rip), %rbx
	jne	LBB0_7
LBB0_1:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_4 Depth 2
	movq	(%rbx), %r13
	movq	8(%r14), %rsi
	movl	(%r15), %edx
	movq	%r14, %rdi
	callq	_receive_n_bytes
	testl	%eax, %eax
	js	LBB0_16
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	movslq	(%r15), %rcx
	testq	%rcx, %rcx
	je	LBB0_6
## %bb.3:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	8(%r14), %r15
	movq	_EC_SPI_FRAME_START@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	addq	$8, %r15
	leaq	-8(,%rcx,8), %rbx
	xorl	%edx, %edx
	.p2align	4, 0x90
LBB0_4:                                 ##   Parent Loop BB0_1 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	cmpq	%rax, -8(%r15)
	je	LBB0_8
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=2
	addq	$8, %r15
	addq	$-8, %rbx
	incl	%edx
	cmpq	$-8, %rbx
	jne	LBB0_4
	jmp	LBB0_6
LBB0_8:
	movl	16(%r14), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_dbg
	shrq	$3, %rbx
	testl	%ebx, %ebx
	js	LBB0_9
## %bb.10:
	xorl	%edi, %edi
	cmpl	%ebx, (%r14)
	setl	%dil
	jmp	LBB0_11
LBB0_9:
	movl	$1, %edi
LBB0_11:
	callq	_BUG_ON
	movl	%ebx, %edi
	movl	%r12d, %esi
	callq	_min
	movl	%eax, %ebx
	movq	8(%r14), %rdi
	movq	%r15, %rsi
	movl	%eax, %edx
	callq	_memmove
	movslq	%ebx, %r13
	leaq	(,%r13,8), %rbx
	addq	8(%r14), %rbx
	movl	16(%r14), %edi
	leaq	L_.str.2(%rip), %rsi
	movl	%r12d, %edx
	movl	%r13d, %ecx
	xorl	%eax, %eax
	callq	_dev_dbg
	subl	%r13d, %r12d
	jle	LBB0_15
## %bb.12:
	leaq	L_.str.3(%rip), %r15
	.p2align	4, 0x90
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	movl	%r12d, %edi
	movl	$256, %esi                      ## imm = 0x100
	callq	_min
	movl	%eax, %r13d
	movl	16(%r14), %edi
	movq	%rbx, %r8
	subq	8(%r14), %r8
	sarq	$3, %r8
	movq	%r15, %rsi
	movl	%eax, %edx
	movl	%r12d, %ecx
	xorl	%eax, %eax
	callq	_dev_dbg
	movq	%r14, %rdi
	movq	%rbx, %rsi
	movl	%r13d, %edx
	callq	_receive_n_bytes
	testl	%eax, %eax
	js	LBB0_16
## %bb.14:                              ##   in Loop: Header=BB0_13 Depth=1
	movl	16(%r14), %edi
	leaq	L_.str.4(%rip), %rsi
	movq	%rbx, %rdx
	movl	%r13d, %ecx
	callq	_debug_packet
	movslq	%r13d, %rax
	leaq	(%rbx,%rax,8), %rbx
	subl	%r13d, %r12d
	jg	LBB0_13
LBB0_15:
	movl	16(%r14), %edi
	subq	8(%r14), %rbx
	shrq	$3, %rbx
	leaq	L_.str.5(%rip), %rsi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_dev_dbg
	xorl	%eax, %eax
LBB0_16:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_7:
	movl	16(%r14), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_warn
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.comm	_EC_MSG_PREAMBLE_COUNT,4,2      ## @EC_MSG_PREAMBLE_COUNT
	.comm	_jiffies,8,3                    ## @jiffies
	.comm	_EC_MSG_DEADLINE_MS,4,2         ## @EC_MSG_DEADLINE_MS
	.comm	_EC_SPI_FRAME_START,8,3         ## @EC_SPI_FRAME_START
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"msg found at %zd\n"

L_.str.1:                               ## @.str.1
	.asciz	"EC failed to respond in time\n"

	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
L_.str.2:                               ## @.str.2
	.asciz	"need %d, got %d bytes from preamble\n"

L_.str.3:                               ## @.str.3
	.asciz	"loop, todo=%d, need_len=%d, ptr=%zd\n"

L_.str.4:                               ## @.str.4
	.asciz	"interim"

L_.str.5:                               ## @.str.5
	.asciz	"loop done, ptr=%zd\n"

	.no_dead_strip	_cros_ec_spi_receive_response
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cros_ec_spi_receive_response
_cros_ec_spi_receive_response:          ; @cros_ec_spi_receive_response
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	mov	x20, x1
	mov	x19, x0
	ldr	w8, [x0]
Lloh0:
	adrp	x24, _EC_MSG_PREAMBLE_COUNT@GOTPAGE
Lloh1:
	ldr	x24, [x24, _EC_MSG_PREAMBLE_COUNT@GOTPAGEOFF]
	ldr	w9, [x24]
	cmp	w8, w9
	cset	w0, lt
	bl	_BUG_ON
Lloh2:
	adrp	x25, _jiffies@GOTPAGE
Lloh3:
	ldr	x25, [x25, _jiffies@GOTPAGEOFF]
	ldr	x21, [x25]
Lloh4:
	adrp	x8, _EC_MSG_DEADLINE_MS@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EC_MSG_DEADLINE_MS@GOTPAGEOFF]
Lloh6:
	ldr	w0, [x8]
	bl	_msecs_to_jiffies
	add	x22, x0, x21
Lloh7:
	adrp	x26, _EC_SPI_FRAME_START@GOTPAGE
Lloh8:
	ldr	x26, [x26, _EC_SPI_FRAME_START@GOTPAGEOFF]
	b	LBB0_2
LBB0_1:                                 ;   in Loop: Header=BB0_2 Depth=1
	mov	x0, x23
	mov	x1, x22
	bl	_time_after
	cbnz	x0, LBB0_16
LBB0_2:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_5 Depth 2
	ldr	x23, [x25]
	ldr	x1, [x19, #8]
	ldr	w2, [x24]
	mov	x0, x19
	bl	_receive_n_bytes
	tbnz	w0, #31, LBB0_15
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	ldrsw	x9, [x24]
	cbz	w9, LBB0_1
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	w2, #0
	ldr	x10, [x19, #8]
	ldr	x8, [x26]
	add	x21, x10, #8
	lsl	x9, x9, #3
	sub	x27, x9, #8
LBB0_5:                                 ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldur	x9, [x21, #-8]
	cmp	x9, x8
	b.eq	LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=2
	add	x21, x21, #8
	sub	x27, x27, #8
	add	w2, w2, #1
	cmn	x27, #8
	b.ne	LBB0_5
	b	LBB0_1
LBB0_7:
	ldr	w0, [x19, #16]
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
	lsr	x22, x27, #3
	tbnz	w22, #31, LBB0_9
; %bb.8:
	ldr	w8, [x19]
	cmp	w8, w22
	cset	w0, lt
	b	LBB0_10
LBB0_9:
	mov	w0, #1
LBB0_10:
	bl	_BUG_ON
	mov	x0, x22
	mov	x1, x20
	bl	_min
	mov	x22, x0
	ldr	x0, [x19, #8]
	mov	x1, x21
	mov	x2, x22
	bl	_memmove
	ldr	x8, [x19, #8]
	add	x21, x8, w22, sxtw #3
	ldr	w0, [x19, #16]
	str	x22, [sp]
Lloh11:
	adrp	x1, l_.str.2@PAGE
Lloh12:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x2, x20
	bl	_dev_dbg
	sub	w20, w20, w22
	cmp	w20, #1
	b.lt	LBB0_14
; %bb.11:
Lloh13:
	adrp	x22, l_.str.3@PAGE
Lloh14:
	add	x22, x22, l_.str.3@PAGEOFF
Lloh15:
	adrp	x23, l_.str.4@PAGE
Lloh16:
	add	x23, x23, l_.str.4@PAGEOFF
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	mov	x0, x20
	mov	w1, #256
	bl	_min
	mov	x24, x0
	ldr	w0, [x19, #16]
	ldr	x8, [x19, #8]
	sub	x8, x21, x8
	asr	x8, x8, #3
	stp	x20, x8, [sp]
	mov	x1, x22
	mov	x2, x24
	bl	_dev_dbg
	mov	x0, x19
	mov	x1, x21
	mov	x2, x24
	bl	_receive_n_bytes
	tbnz	w0, #31, LBB0_15
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=1
	ldr	w0, [x19, #16]
	mov	x1, x23
	mov	x2, x21
	mov	x3, x24
	bl	_debug_packet
	add	x21, x21, w24, sxtw #3
	sub	w20, w20, w24
	cmp	w20, #0
	b.gt	LBB0_12
LBB0_14:
	ldr	w0, [x19, #16]
	ldr	x8, [x19, #8]
	sub	x8, x21, x8
	lsr	x2, x8, #3
Lloh17:
	adrp	x1, l_.str.5@PAGE
Lloh18:
	add	x1, x1, l_.str.5@PAGEOFF
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_dev_dbg
	mov	w0, #0
LBB0_15:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_16:
	ldr	w0, [x19, #16]
Lloh19:
	adrp	x1, l_.str.1@PAGE
Lloh20:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_warn
Lloh21:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh22:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_15
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_EC_MSG_PREAMBLE_COUNT,4,2      ; @EC_MSG_PREAMBLE_COUNT
	.comm	_jiffies,8,3                    ; @jiffies
	.comm	_EC_MSG_DEADLINE_MS,4,2         ; @EC_MSG_DEADLINE_MS
	.comm	_EC_SPI_FRAME_START,8,3         ; @EC_SPI_FRAME_START
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"msg found at %zd\n"

l_.str.1:                               ; @.str.1
	.asciz	"EC failed to respond in time\n"

	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
l_.str.2:                               ; @.str.2
	.asciz	"need %d, got %d bytes from preamble\n"

l_.str.3:                               ; @.str.3
	.asciz	"loop, todo=%d, need_len=%d, ptr=%zd\n"

l_.str.4:                               ; @.str.4
	.asciz	"interim"

l_.str.5:                               ; @.str.5
	.asciz	"loop done, ptr=%zd\n"

	.no_dead_strip	_cros_ec_spi_receive_response
.subsections_via_symbols
