	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cros_ec_cmd_xfer_lpc
_cros_ec_cmd_xfer_lpc:                  ## @cros_ec_cmd_xfer_lpc
	.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	%rdi, %r14
	movq	(%rsi), %rdx
	movq	8(%rsi), %rcx
	movq	_EC_PROTO2_MAX_PARAM_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	%rax, %rdx
	jg	LBB0_4
## %bb.1:
	cmpq	%rax, %rcx
	jg	LBB0_4
## %bb.2:
	movq	%rsi, %r15
	movq	_EC_HOST_ARGS_FLAG_FROM_HOST@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	movq	%rbx, -80(%rbp)
	movq	16(%rsi), %rax
	movq	%rax, -72(%rbp)
	movq	%rdx, -64(%rbp)
	addq	%rdx, %rbx
	addq	%rax, %rbx
	addq	24(%rsi), %rbx
	movq	_cros_ec_lpc_ops@GOTPCREL(%rip), %r12
	movq	_EC_LPC_ADDR_HOST_PARAM@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	32(%rsi), %rax
	movl	%edx, %esi
	movq	%rax, %rdx
	callq	*8(%r12)
	cltq
	addq	%rbx, %rax
	movq	%rax, -56(%rbp)
	movq	_EC_LPC_ADDR_HOST_ARGS@GOTPCREL(%rip), %r13
	movl	(%r13), %edi
	leaq	-80(%rbp), %rdx
	movl	$32, %esi
	callq	*8(%r12)
	movq	24(%r15), %rax
	movq	%rax, -48(%rbp)
	movq	_EC_LPC_ADDR_HOST_CMD@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	-48(%rbp), %rdx
	movl	$1, %esi
	callq	*8(%r12)
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_ec_response_timed_out
	testq	%rax, %rax
	je	LBB0_8
## %bb.3:
	movl	(%r14), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_warn
	movq	_EIO@GOTPCREL(%rip), %rax
	jmp	LBB0_6
LBB0_4:
	movl	(%r14), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_5:
	xorl	%ebx, %ebx
LBB0_6:
	subl	(%rax), %ebx
LBB0_7:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movq	_EC_LPC_ADDR_HOST_DATA@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	-48(%rbp), %rdx
	movl	$1, %esi
	callq	*(%r12)
	movq	%rax, 40(%r15)
	movq	%r14, %rdi
	movq	%r15, %rsi
	callq	_cros_ec_check_result
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_7
## %bb.9:
	movl	(%r13), %edi
	leaq	-80(%rbp), %rdx
	movl	$32, %esi
	callq	*(%r12)
	movq	-64(%rbp), %rdx
	movq	8(%r15), %rcx
	cmpq	%rcx, %rdx
	jle	LBB0_11
## %bb.10:
	movl	(%r14), %edi
	leaq	L_.str.2(%rip), %rsi
	callq	_dev_err
	movq	_ENOSPC@GOTPCREL(%rip), %rax
	jmp	LBB0_5
LBB0_11:
	movq	24(%r15), %rax
	addq	%rdx, %rax
	addq	-80(%rbp), %rax
	addq	-72(%rbp), %rax
	movq	%rax, -48(%rbp)
	movq	_EC_LPC_ADDR_HOST_PARAM@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	32(%r15), %rax
	movl	%edx, %esi
	movq	%rax, %rdx
	callq	*(%r12)
	addq	-48(%rbp), %rax
	movq	%rax, -48(%rbp)
	movq	-56(%rbp), %rdx
	cmpq	%rax, %rdx
	jne	LBB0_13
## %bb.12:
	movl	-64(%rbp), %ebx
	jmp	LBB0_7
LBB0_13:
	movl	(%r14), %edi
	leaq	L_.str.3(%rip), %rsi
	movq	%rax, %rcx
	callq	_dev_err
	movq	_EBADMSG@GOTPCREL(%rip), %rax
	jmp	LBB0_5
	.cfi_endproc
                                        ## -- End function
	.comm	_EC_PROTO2_MAX_PARAM_SIZE,8,3   ## @EC_PROTO2_MAX_PARAM_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"invalid buffer sizes (out %d, in %d)\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_EC_HOST_ARGS_FLAG_FROM_HOST,8,3 ## @EC_HOST_ARGS_FLAG_FROM_HOST
	.comm	_cros_ec_lpc_ops,16,3           ## @cros_ec_lpc_ops
	.comm	_EC_LPC_ADDR_HOST_PARAM,4,2     ## @EC_LPC_ADDR_HOST_PARAM
	.comm	_EC_LPC_ADDR_HOST_ARGS,4,2      ## @EC_LPC_ADDR_HOST_ARGS
	.comm	_EC_LPC_ADDR_HOST_CMD,4,2       ## @EC_LPC_ADDR_HOST_CMD
L_.str.1:                               ## @.str.1
	.asciz	"EC responsed timed out\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_EC_LPC_ADDR_HOST_DATA,4,2      ## @EC_LPC_ADDR_HOST_DATA
L_.str.2:                               ## @.str.2
	.asciz	"packet too long (%d bytes, expected %d)"

	.comm	_ENOSPC,4,2                     ## @ENOSPC
L_.str.3:                               ## @.str.3
	.asciz	"bad packet checksum, expected %02x, got %02x\n"

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

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cros_ec_cmd_xfer_lpc
_cros_ec_cmd_xfer_lpc:                  ; @cros_ec_cmd_xfer_lpc
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	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
	mov	x19, x0
Lloh0:
	adrp	x8, _EC_PROTO2_MAX_PARAM_SIZE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EC_PROTO2_MAX_PARAM_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x8]
	ldp	x8, x3, [x1]
	cmp	x8, x9
	ccmp	x3, x9, #0, le
	b.le	LBB0_2
; %bb.1:
	ldr	w0, [x19]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x8
	bl	_dev_err
Lloh5:
	adrp	x8, _EINVAL@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_4
LBB0_2:
	mov	x20, x1
Lloh7:
	adrp	x9, _EC_HOST_ARGS_FLAG_FROM_HOST@GOTPAGE
Lloh8:
	ldr	x9, [x9, _EC_HOST_ARGS_FLAG_FROM_HOST@GOTPAGEOFF]
Lloh9:
	ldr	x9, [x9]
	ldp	x10, x11, [x1, #16]
	stp	x9, x10, [sp, #16]
	str	x8, [sp, #32]
	add	x9, x9, x8
	add	x9, x9, x10
Lloh10:
	adrp	x21, _cros_ec_lpc_ops@GOTPAGE
Lloh11:
	ldr	x21, [x21, _cros_ec_lpc_ops@GOTPAGEOFF]
	add	x23, x9, x11
	ldr	x9, [x21, #8]
Lloh12:
	adrp	x22, _EC_LPC_ADDR_HOST_PARAM@GOTPAGE
Lloh13:
	ldr	x22, [x22, _EC_LPC_ADDR_HOST_PARAM@GOTPAGEOFF]
	ldr	w0, [x22]
	ldr	x2, [x1, #32]
	mov	x1, x8
	blr	x9
	add	x8, x23, w0, sxtw
	str	x8, [sp, #40]
	ldr	x8, [x21, #8]
Lloh14:
	adrp	x23, _EC_LPC_ADDR_HOST_ARGS@GOTPAGE
Lloh15:
	ldr	x23, [x23, _EC_LPC_ADDR_HOST_ARGS@GOTPAGEOFF]
	ldr	w0, [x23]
	add	x2, sp, #16
	mov	w1, #32
	blr	x8
	ldr	x8, [x20, #24]
	str	x8, [sp, #8]
	ldr	x8, [x21, #8]
Lloh16:
	adrp	x9, _EC_LPC_ADDR_HOST_CMD@GOTPAGE
Lloh17:
	ldr	x9, [x9, _EC_LPC_ADDR_HOST_CMD@GOTPAGEOFF]
Lloh18:
	ldr	w0, [x9]
	add	x2, sp, #8
	mov	w1, #1
	blr	x8
	bl	_ec_response_timed_out
	cbz	x0, LBB0_6
; %bb.3:
	ldr	w0, [x19]
Lloh19:
	adrp	x1, l_.str.1@PAGE
Lloh20:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_warn
Lloh21:
	adrp	x8, _EIO@GOTPAGE
Lloh22:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
LBB0_4:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_5:
	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
	add	sp, sp, #112
	ret
LBB0_6:
	ldr	x8, [x21]
Lloh23:
	adrp	x9, _EC_LPC_ADDR_HOST_DATA@GOTPAGE
Lloh24:
	ldr	x9, [x9, _EC_LPC_ADDR_HOST_DATA@GOTPAGEOFF]
Lloh25:
	ldr	w0, [x9]
	add	x2, sp, #8
	mov	w1, #1
	blr	x8
	str	x0, [x20, #40]
	mov	x0, x19
	mov	x1, x20
	bl	_cros_ec_check_result
	cbnz	w0, LBB0_5
; %bb.7:
	ldr	x8, [x21]
	ldr	w0, [x23]
	add	x2, sp, #16
	mov	w1, #32
	blr	x8
	ldr	x8, [sp, #32]
	ldr	x3, [x20, #8]
	cmp	x8, x3
	b.le	LBB0_9
; %bb.8:
	ldr	w0, [x19]
Lloh26:
	adrp	x1, l_.str.2@PAGE
Lloh27:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x2, x8
	bl	_dev_err
Lloh28:
	adrp	x8, _ENOSPC@GOTPAGE
Lloh29:
	ldr	x8, [x8, _ENOSPC@GOTPAGEOFF]
	b	LBB0_4
LBB0_9:
	ldp	x9, x10, [sp, #16]
	ldp	x11, x2, [x20, #24]
	add	x11, x11, x8
	add	x9, x11, x9
	add	x9, x9, x10
	str	x9, [sp, #8]
	ldr	x9, [x21]
	ldr	w0, [x22]
	mov	x1, x8
	blr	x9
	ldr	x8, [sp, #8]
	ldr	x2, [sp, #40]
	add	x3, x8, x0
	cmp	x2, x3
	str	x3, [sp, #8]
	b.ne	LBB0_11
; %bb.10:
	ldr	w0, [sp, #32]
	b	LBB0_5
LBB0_11:
	ldr	w0, [x19]
Lloh30:
	adrp	x1, l_.str.3@PAGE
Lloh31:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_err
Lloh32:
	adrp	x8, _EBADMSG@GOTPAGE
Lloh33:
	ldr	x8, [x8, _EBADMSG@GOTPAGEOFF]
	b	LBB0_4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh28, Lloh29
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh32, Lloh33
	.loh AdrpAdd	Lloh30, Lloh31
	.cfi_endproc
                                        ; -- End function
	.comm	_EC_PROTO2_MAX_PARAM_SIZE,8,3   ; @EC_PROTO2_MAX_PARAM_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"invalid buffer sizes (out %d, in %d)\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_EC_HOST_ARGS_FLAG_FROM_HOST,8,3 ; @EC_HOST_ARGS_FLAG_FROM_HOST
	.comm	_cros_ec_lpc_ops,16,3           ; @cros_ec_lpc_ops
	.comm	_EC_LPC_ADDR_HOST_PARAM,4,2     ; @EC_LPC_ADDR_HOST_PARAM
	.comm	_EC_LPC_ADDR_HOST_ARGS,4,2      ; @EC_LPC_ADDR_HOST_ARGS
	.comm	_EC_LPC_ADDR_HOST_CMD,4,2       ; @EC_LPC_ADDR_HOST_CMD
l_.str.1:                               ; @.str.1
	.asciz	"EC responsed timed out\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_EC_LPC_ADDR_HOST_DATA,4,2      ; @EC_LPC_ADDR_HOST_DATA
l_.str.2:                               ; @.str.2
	.asciz	"packet too long (%d bytes, expected %d)"

	.comm	_ENOSPC,4,2                     ; @ENOSPC
l_.str.3:                               ; @.str.3
	.asciz	"bad packet checksum, expected %02x, got %02x\n"

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