	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function wilco_ec_transfer
_wilco_ec_transfer:                     ## @wilco_ec_transfer
	.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
	movq	%rdx, %rcx
	movq	%rsi, %r13
	movq	%rdi, %r15
	movq	_MEC_IO_WRITE@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	xorl	%r14d, %r14d
	xorl	%esi, %esi
	movl	$4, %edx
	callq	_cros_ec_lpc_io_bytes_mec
	movl	(%rbx), %edi
	movl	(%r13), %edx
	movq	16(%r13), %rcx
	movl	$4, %esi
	callq	_cros_ec_lpc_io_bytes_mec
	movq	_EC_MAILBOX_START_COMMAND@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	24(%r15), %rax
	movl	(%rax), %esi
	callq	_outb
	movq	_WILCO_EC_FLAG_NO_RESPONSE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 4(%r13)
	je	LBB0_2
## %bb.1:
	movl	(%r15), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_dbg
	jmp	LBB0_12
LBB0_2:
	movq	%r15, %rdi
	callq	_wilco_ec_response_timed_out
	testq	%rax, %rax
	je	LBB0_4
## %bb.3:
	movl	(%r15), %edi
	leaq	L_.str.1(%rip), %rsi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_dev_dbg
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
	jmp	LBB0_11
LBB0_4:
	movq	16(%r15), %rax
	movl	(%rax), %edi
	callq	_inb
	testq	%rax, %rax
	je	LBB0_6
## %bb.5:
	movl	(%r15), %edi
	leaq	L_.str.2(%rip), %rsi
	xorl	%r14d, %r14d
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	_dev_dbg
	movq	_EIO@GOTPCREL(%rip), %rax
	jmp	LBB0_11
LBB0_6:
	movq	8(%r15), %r12
	movq	_MEC_IO_READ@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_EC_MAILBOX_DATA_SIZE@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edx
	addl	$24, %edx
	xorl	%r14d, %r14d
	xorl	%esi, %esi
	movq	%r12, %rcx
	callq	_cros_ec_lpc_io_bytes_mec
	testq	%rax, %rax
	je	LBB0_8
## %bb.7:
	movl	(%r15), %edi
	movl	16(%r12), %edx
	leaq	L_.str.3(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_dbg
	jmp	LBB0_10
LBB0_8:
	movq	8(%r12), %rdx
	testq	%rdx, %rdx
	je	LBB0_13
## %bb.9:
	movl	(%r15), %edi
	leaq	L_.str.4(%rip), %rsi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_dev_dbg
LBB0_10:
	movq	_EBADMSG@GOTPCREL(%rip), %rax
LBB0_11:
	subl	(%rax), %r14d
LBB0_12:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_13:
	movl	(%r12), %edx
	movl	(%rbx), %ecx
	cmpl	%ecx, %edx
	jne	LBB0_16
## %bb.14:
	movl	8(%r13), %ecx
	cmpl	%ecx, %edx
	jge	LBB0_18
## %bb.15:
	movl	(%r15), %edi
	leaq	L_.str.6(%rip), %rsi
	jmp	LBB0_17
LBB0_16:
	movl	(%r15), %edi
	leaq	L_.str.5(%rip), %rsi
LBB0_17:
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_dev_dbg
	movq	_EMSGSIZE@GOTPCREL(%rip), %rax
	jmp	LBB0_11
LBB0_18:
	movl	12(%r13), %edi
	movl	4(%r12), %esi
	movl	%ecx, %edx
	callq	_memcpy
	movl	(%r12), %r14d
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_MEC_IO_WRITE,4,2               ## @MEC_IO_WRITE
	.comm	_EC_MAILBOX_START_COMMAND,4,2   ## @EC_MAILBOX_START_COMMAND
	.comm	_WILCO_EC_FLAG_NO_RESPONSE,4,2  ## @WILCO_EC_FLAG_NO_RESPONSE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"EC does not respond to this command\n"

L_.str.1:                               ## @.str.1
	.asciz	"response timed out\n"

	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
L_.str.2:                               ## @.str.2
	.asciz	"bad response: 0x%02x\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_MEC_IO_READ,4,2                ## @MEC_IO_READ
	.comm	_EC_MAILBOX_DATA_SIZE,4,2       ## @EC_MAILBOX_DATA_SIZE
L_.str.3:                               ## @.str.3
	.asciz	"bad packet checksum 0x%02x\n"

	.comm	_EBADMSG,4,2                    ## @EBADMSG
L_.str.4:                               ## @.str.4
	.asciz	"EC reported failure: 0x%02x\n"

L_.str.5:                               ## @.str.5
	.asciz	"unexpected packet size (%u != %u)"

	.comm	_EMSGSIZE,4,2                   ## @EMSGSIZE
L_.str.6:                               ## @.str.6
	.asciz	"EC didn't return enough data (%u < %zu)"

	.no_dead_strip	_wilco_ec_transfer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function wilco_ec_transfer
_wilco_ec_transfer:                     ; @wilco_ec_transfer
	.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
	mov	x3, x2
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x21, _MEC_IO_WRITE@GOTPAGE
Lloh1:
	ldr	x21, [x21, _MEC_IO_WRITE@GOTPAGEOFF]
	ldr	w0, [x21]
	mov	w1, #0
	mov	w2, #4
	bl	_cros_ec_lpc_io_bytes_mec
	ldr	w0, [x21]
	ldr	w2, [x20]
	ldr	x3, [x20, #16]
	mov	w1, #4
	bl	_cros_ec_lpc_io_bytes_mec
Lloh2:
	adrp	x8, _EC_MAILBOX_START_COMMAND@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EC_MAILBOX_START_COMMAND@GOTPAGEOFF]
Lloh4:
	ldr	w0, [x8]
	ldr	x8, [x19, #24]
	ldr	w1, [x8]
	bl	_outb
	ldr	w8, [x20, #4]
Lloh5:
	adrp	x9, _WILCO_EC_FLAG_NO_RESPONSE@GOTPAGE
Lloh6:
	ldr	x9, [x9, _WILCO_EC_FLAG_NO_RESPONSE@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_2
; %bb.1:
	ldr	w0, [x19]
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
	mov	w0, #0
	b	LBB0_12
LBB0_2:
	mov	x0, x19
	bl	_wilco_ec_response_timed_out
	cbz	x0, LBB0_4
; %bb.3:
	ldr	w0, [x19]
Lloh10:
	adrp	x1, l_.str.1@PAGE
Lloh11:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_dbg
Lloh12:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
	b	LBB0_11
LBB0_4:
	ldr	x8, [x19, #16]
	ldr	w0, [x8]
	bl	_inb
	cbz	x0, LBB0_6
; %bb.5:
	ldr	w8, [x19]
	str	x0, [sp]
Lloh14:
	adrp	x1, l_.str.2@PAGE
Lloh15:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x8
	bl	_dev_dbg
Lloh16:
	adrp	x8, _EIO@GOTPAGE
Lloh17:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_11
LBB0_6:
Lloh18:
	adrp	x8, _MEC_IO_READ@GOTPAGE
Lloh19:
	ldr	x8, [x8, _MEC_IO_READ@GOTPAGEOFF]
	ldr	x21, [x19, #8]
Lloh20:
	ldr	w0, [x8]
Lloh21:
	adrp	x22, _EC_MAILBOX_DATA_SIZE@GOTPAGE
Lloh22:
	ldr	x22, [x22, _EC_MAILBOX_DATA_SIZE@GOTPAGEOFF]
	ldr	w8, [x22]
	add	w2, w8, #24
	mov	w1, #0
	mov	x3, x21
	bl	_cros_ec_lpc_io_bytes_mec
	cbz	x0, LBB0_8
; %bb.7:
	ldr	w0, [x19]
	ldr	w8, [x21, #16]
	str	x8, [sp]
Lloh23:
	adrp	x1, l_.str.3@PAGE
Lloh24:
	add	x1, x1, l_.str.3@PAGEOFF
	b	LBB0_10
LBB0_8:
	ldr	x8, [x21, #8]
	cbz	x8, LBB0_13
; %bb.9:
	ldr	w0, [x19]
	str	x8, [sp]
Lloh25:
	adrp	x1, l_.str.4@PAGE
Lloh26:
	add	x1, x1, l_.str.4@PAGEOFF
LBB0_10:
	bl	_dev_dbg
Lloh27:
	adrp	x8, _EBADMSG@GOTPAGE
Lloh28:
	ldr	x8, [x8, _EBADMSG@GOTPAGEOFF]
LBB0_11:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_12:
	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
LBB0_13:
	ldr	w8, [x21]
	ldr	w9, [x22]
	cmp	w8, w9
	b.ne	LBB0_16
; %bb.14:
	ldr	w2, [x20, #8]
	cmp	w8, w2
	b.ge	LBB0_18
; %bb.15:
	ldr	w0, [x19]
                                        ; kill: def $w8 killed $w8 killed $x8 def $x8
	stp	x8, x2, [sp]
Lloh29:
	adrp	x1, l_.str.6@PAGE
Lloh30:
	add	x1, x1, l_.str.6@PAGEOFF
	b	LBB0_17
LBB0_16:
	ldr	w0, [x19]
	stp	x8, x9, [sp]
Lloh31:
	adrp	x1, l_.str.5@PAGE
Lloh32:
	add	x1, x1, l_.str.5@PAGEOFF
LBB0_17:
	bl	_dev_dbg
Lloh33:
	adrp	x8, _EMSGSIZE@GOTPAGE
Lloh34:
	ldr	x8, [x8, _EMSGSIZE@GOTPAGEOFF]
	b	LBB0_11
LBB0_18:
	ldr	w0, [x20, #12]
	ldr	w1, [x21, #4]
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_memcpy
	ldr	w0, [x21]
	b	LBB0_12
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpAdd	Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh33, Lloh34
	.cfi_endproc
                                        ; -- End function
	.comm	_MEC_IO_WRITE,4,2               ; @MEC_IO_WRITE
	.comm	_EC_MAILBOX_START_COMMAND,4,2   ; @EC_MAILBOX_START_COMMAND
	.comm	_WILCO_EC_FLAG_NO_RESPONSE,4,2  ; @WILCO_EC_FLAG_NO_RESPONSE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"EC does not respond to this command\n"

l_.str.1:                               ; @.str.1
	.asciz	"response timed out\n"

	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
l_.str.2:                               ; @.str.2
	.asciz	"bad response: 0x%02x\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_MEC_IO_READ,4,2                ; @MEC_IO_READ
	.comm	_EC_MAILBOX_DATA_SIZE,4,2       ; @EC_MAILBOX_DATA_SIZE
l_.str.3:                               ; @.str.3
	.asciz	"bad packet checksum 0x%02x\n"

	.comm	_EBADMSG,4,2                    ; @EBADMSG
l_.str.4:                               ; @.str.4
	.asciz	"EC reported failure: 0x%02x\n"

l_.str.5:                               ; @.str.5
	.asciz	"unexpected packet size (%u != %u)"

	.comm	_EMSGSIZE,4,2                   ; @EMSGSIZE
l_.str.6:                               ; @.str.6
	.asciz	"EC didn't return enough data (%u < %zu)"

	.no_dead_strip	_wilco_ec_transfer
.subsections_via_symbols
