	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cros_ec_pkt_xfer_ish
_cros_ec_pkt_xfer_ish:                  ## @cros_ec_pkt_xfer_ish
	.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	%rsi, %rbx
	movq	%rdi, %r13
	movq	32(%rdi), %rdi
	callq	_ishtp_get_client_data
	movq	%rax, %r12
	movq	%rax, %rdi
	callq	_cl_data_to_dev
	movq	(%r13), %rcx
	movslq	(%rbx), %r15
	addq	$16, %r15
	cmpq	%rcx, %r15
	jbe	LBB0_4
## %bb.1:
	leaq	L_.str(%rip), %rsi
	movq	%rax, %rdi
	movq	%r15, %rdx
	jmp	LBB0_2
LBB0_4:
	movslq	4(%rbx), %r14
	addq	$40, %r14
	movq	8(%r13), %rcx
	cmpq	%rcx, %r14
	jbe	LBB0_6
## %bb.5:
	leaq	L_.str.1(%rip), %rsi
	movq	%rax, %rdi
	movq	%r14, %rdx
LBB0_2:
	callq	_dev_err
	movq	_EMSGSIZE@GOTPCREL(%rip), %rax
LBB0_3:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_15:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movq	24(%r13), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	16(%r13), %rbx
	movq	_init_lock@GOTPCREL(%rip), %rdi
	callq	_down_read_trylock
	testl	%eax, %eax
	je	LBB0_7
## %bb.8:
	movq	_CROS_EC_COMMAND@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 32(%rbx)
	movq	$0, 24(%rbx)
	movq	_OUT_MSG_EC_REQUEST_PREAMBLE@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	addq	%rax, 16(%r13)
	movq	%r13, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	callq	_cros_ec_prepare_tx
	movq	_OUT_MSG_EC_REQUEST_PREAMBLE@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	subq	%rax, 16(%r13)
	movl	16(%rbx), %edx
	movl	12(%rbx), %ecx
	movl	8(%rbx), %r8d
	movl	(%rbx), %eax
	movl	4(%rbx), %r9d
	movl	%eax, (%rsp)
	leaq	L_.str.3(%rip), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	xorl	%eax, %eax
	callq	_dev_dbg
	movq	%r12, %rdi
	movq	%rbx, %rsi
	movq	%r14, %rdx
	movq	-64(%rbp), %r12                 ## 8-byte Reload
	movq	%r12, %rcx
	movq	%r15, %r8
	callq	_ish_send
	testl	%eax, %eax
	js	LBB0_9
## %bb.10:
	movq	%r13, %rdi
	movq	%r12, %rsi
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rdx
	callq	_prepare_cros_ec_rx
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_12
## %bb.11:
	movl	(%r12), %ebx
	movl	4(%r12), %r8d
	movl	12(%r12), %edx
	movl	8(%r12), %ecx
	leaq	L_.str.4(%rip), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	movl	%ebx, %r9d
	xorl	%eax, %eax
	callq	_dev_dbg
	jmp	LBB0_12
LBB0_7:
	leaq	L_.str.2(%rip), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_dev_warn
	movq	_EAGAIN@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_9:
	movl	%eax, %ebx
	movq	-56(%rbp), %r14                 ## 8-byte Reload
LBB0_12:
	movq	8(%r14), %rax
	movq	_EC_CMD_REBOOT_EC@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_14
## %bb.13:
	movq	_EC_REBOOT_DELAY_MS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_msleep
LBB0_14:
	movq	_init_lock@GOTPCREL(%rip), %rdi
	callq	_up_read
	jmp	LBB0_15
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Incoming payload size %zu is too large for ec_dev->din_size %d\n"

	.comm	_EMSGSIZE,4,2                   ## @EMSGSIZE
L_.str.1:                               ## @.str.1
	.asciz	"Outgoing payload size %zu is too large for ec_dev->dout_size %d\n"

	.comm	_init_lock,4,2                  ## @init_lock
L_.str.2:                               ## @.str.2
	.asciz	"Host is not ready to send messages to ISH. Try again\n"

	.comm	_EAGAIN,4,2                     ## @EAGAIN
	.comm	_CROS_EC_COMMAND,4,2            ## @CROS_EC_COMMAND
	.comm	_OUT_MSG_EC_REQUEST_PREAMBLE,8,3 ## @OUT_MSG_EC_REQUEST_PREAMBLE
L_.str.3:                               ## @.str.3
	.asciz	"out_msg: struct_ver=0x%x checksum=0x%x command=0x%x command_ver=0x%x data_len=0x%x\n"

L_.str.4:                               ## @.str.4
	.asciz	"in_msg: struct_ver=0x%x checksum=0x%x result=0x%x data_len=0x%x\n"

	.comm	_EC_CMD_REBOOT_EC,8,3           ## @EC_CMD_REBOOT_EC
	.comm	_EC_REBOOT_DELAY_MS,4,2         ## @EC_REBOOT_DELAY_MS
	.no_dead_strip	_cros_ec_pkt_xfer_ish
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cros_ec_pkt_xfer_ish
_cros_ec_pkt_xfer_ish:                  ; @cros_ec_pkt_xfer_ish
	.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	x19, x1
	mov	x21, x0
	ldr	x0, [x0, #32]
	bl	_ishtp_get_client_data
	mov	x24, x0
	bl	_cl_data_to_dev
	mov	x20, x0
	ldrsw	x8, [x19]
	add	x23, x8, #16
	ldr	x3, [x21]
	cmp	x23, x3
	b.ls	LBB0_2
; %bb.1:
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	mov	x2, x23
	b	LBB0_4
LBB0_2:
	ldrsw	x8, [x19, #4]
	add	x25, x8, #40
	ldr	x3, [x21, #8]
	cmp	x25, x3
	b.ls	LBB0_7
; %bb.3:
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x20
	mov	x2, x25
LBB0_4:
	bl	_dev_err
Lloh4:
	adrp	x8, _EMSGSIZE@GOTPAGE
Lloh5:
	ldr	x8, [x8, _EMSGSIZE@GOTPAGEOFF]
LBB0_5:
	ldr	w8, [x8]
	neg	w23, w8
LBB0_6:
	mov	x0, x23
	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_7:
	ldp	x26, x22, [x21, #16]
Lloh6:
	adrp	x0, _init_lock@GOTPAGE
Lloh7:
	ldr	x0, [x0, _init_lock@GOTPAGEOFF]
	bl	_down_read_trylock
	cbz	w0, LBB0_11
; %bb.8:
Lloh8:
	adrp	x8, _CROS_EC_COMMAND@GOTPAGE
Lloh9:
	ldr	x8, [x8, _CROS_EC_COMMAND@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	str	w8, [x26, #32]
	str	xzr, [x26, #24]
Lloh11:
	adrp	x27, _OUT_MSG_EC_REQUEST_PREAMBLE@GOTPAGE
Lloh12:
	ldr	x27, [x27, _OUT_MSG_EC_REQUEST_PREAMBLE@GOTPAGEOFF]
	ldr	x8, [x27]
	ldr	x9, [x21, #16]
	add	x8, x9, x8
	str	x8, [x21, #16]
	mov	x0, x21
	mov	x1, x19
	bl	_cros_ec_prepare_tx
	ldr	x8, [x27]
	ldr	x9, [x21, #16]
	sub	x8, x9, x8
	str	x8, [x21, #16]
	ldp	w3, w2, [x26, #12]
	ldp	w5, w4, [x26, #4]
	ldr	w8, [x26]
	str	x8, [sp]
Lloh13:
	adrp	x1, l_.str.3@PAGE
Lloh14:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x20
	bl	_dev_dbg
	mov	x0, x24
	mov	x1, x26
	mov	x2, x25
	mov	x3, x22
	mov	x4, x23
	bl	_ish_send
	tbnz	w0, #31, LBB0_12
; %bb.9:
	mov	x0, x21
	mov	x1, x22
	mov	x2, x19
	bl	_prepare_cros_ec_rx
	mov	x23, x0
	cbnz	w0, LBB0_13
; %bb.10:
	ldp	w3, w2, [x22, #8]
	ldp	w23, w4, [x22]
Lloh15:
	adrp	x1, l_.str.4@PAGE
Lloh16:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x0, x20
	mov	x5, x23
	bl	_dev_dbg
	b	LBB0_13
LBB0_11:
Lloh17:
	adrp	x1, l_.str.2@PAGE
Lloh18:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x20
	bl	_dev_warn
Lloh19:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh20:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
	b	LBB0_5
LBB0_12:
	mov	x23, x0
LBB0_13:
	ldr	x8, [x19, #8]
Lloh21:
	adrp	x9, _EC_CMD_REBOOT_EC@GOTPAGE
Lloh22:
	ldr	x9, [x9, _EC_CMD_REBOOT_EC@GOTPAGEOFF]
Lloh23:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_15
; %bb.14:
Lloh24:
	adrp	x8, _EC_REBOOT_DELAY_MS@GOTPAGE
Lloh25:
	ldr	x8, [x8, _EC_REBOOT_DELAY_MS@GOTPAGEOFF]
Lloh26:
	ldr	w0, [x8]
	bl	_msleep
LBB0_15:
Lloh27:
	adrp	x0, _init_lock@GOTPAGE
Lloh28:
	ldr	x0, [x0, _init_lock@GOTPAGEOFF]
	bl	_up_read
	b	LBB0_6
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh27, Lloh28
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Incoming payload size %zu is too large for ec_dev->din_size %d\n"

	.comm	_EMSGSIZE,4,2                   ; @EMSGSIZE
l_.str.1:                               ; @.str.1
	.asciz	"Outgoing payload size %zu is too large for ec_dev->dout_size %d\n"

	.comm	_init_lock,4,2                  ; @init_lock
l_.str.2:                               ; @.str.2
	.asciz	"Host is not ready to send messages to ISH. Try again\n"

	.comm	_EAGAIN,4,2                     ; @EAGAIN
	.comm	_CROS_EC_COMMAND,4,2            ; @CROS_EC_COMMAND
	.comm	_OUT_MSG_EC_REQUEST_PREAMBLE,8,3 ; @OUT_MSG_EC_REQUEST_PREAMBLE
l_.str.3:                               ; @.str.3
	.asciz	"out_msg: struct_ver=0x%x checksum=0x%x command=0x%x command_ver=0x%x data_len=0x%x\n"

l_.str.4:                               ; @.str.4
	.asciz	"in_msg: struct_ver=0x%x checksum=0x%x result=0x%x data_len=0x%x\n"

	.comm	_EC_CMD_REBOOT_EC,8,3           ; @EC_CMD_REBOOT_EC
	.comm	_EC_REBOOT_DELAY_MS,4,2         ; @EC_REBOOT_DELAY_MS
	.no_dead_strip	_cros_ec_pkt_xfer_ish
.subsections_via_symbols
