	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cros_ec_cmd_xfer               ## -- Begin function cros_ec_cmd_xfer
	.p2align	4, 0x90
_cros_ec_cmd_xfer:                      ## @cros_ec_cmd_xfer
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %rbx
	leaq	32(%rdi), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	movq	(%rbx), %rax
	movq	_EC_PROTO_VERSION_UNKNOWN@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_4
## %bb.1:
	movq	%rbx, %rdi
	callq	_cros_ec_query_all
	testl	%eax, %eax
	je	LBB0_4
## %bb.2:
	movl	%eax, %r12d
	movl	36(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_err
	movq	%r14, %rdi
	callq	_mutex_unlock
	movl	%r12d, %eax
	jmp	LBB0_13
LBB0_4:
	movq	(%r15), %rax
	cmpq	8(%rbx), %rax
	jle	LBB0_6
## %bb.5:
	movl	36(%rbx), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_dbg
	movq	8(%rbx), %rax
	movq	%rax, (%r15)
LBB0_6:
	movq	8(%r15), %r12
	movl	$1, %edi
	callq	_EC_CMD_PASSTHRU_OFFSET
	movq	16(%r15), %rdx
	cmpq	%rax, %r12
	jge	LBB0_10
## %bb.7:
	movq	16(%rbx), %rcx
	cmpq	%rcx, %rdx
	jle	LBB0_12
## %bb.8:
	movl	36(%rbx), %edi
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_9
LBB0_10:
	movq	24(%rbx), %rcx
	cmpq	%rcx, %rdx
	jle	LBB0_12
## %bb.11:
	movl	36(%rbx), %edi
	leaq	L_.str.3(%rip), %rsi
LBB0_9:
	xorl	%r12d, %r12d
	xorl	%eax, %eax
	callq	_dev_err
	movq	%r14, %rdi
	callq	_mutex_unlock
	movq	_EMSGSIZE@GOTPCREL(%rip), %rax
	subl	(%rax), %r12d
	movl	%r12d, %eax
	jmp	LBB0_13
LBB0_12:
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_send_command
	movl	%eax, %ebx
	movq	%r14, %rdi
	callq	_mutex_unlock
	movl	%ebx, %eax
LBB0_13:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EC_PROTO_VERSION_UNKNOWN,8,3   ## @EC_PROTO_VERSION_UNKNOWN
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"EC version unknown and query failed; aborting command\n"

L_.str.1:                               ## @.str.1
	.asciz	"clamping message receive buffer\n"

L_.str.2:                               ## @.str.2
	.asciz	"request of size %u is too big (max: %u)\n"

	.comm	_EMSGSIZE,4,2                   ## @EMSGSIZE
L_.str.3:                               ## @.str.3
	.asciz	"passthru rq of size %u is too big (max: %u)\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cros_ec_cmd_xfer               ; -- Begin function cros_ec_cmd_xfer
	.p2align	2
_cros_ec_cmd_xfer:                      ; @cros_ec_cmd_xfer
	.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	x21, x1
	mov	x20, x0
	add	x19, x0, #32
	mov	x0, x19
	bl	_mutex_lock
	ldr	x8, [x20]
Lloh0:
	adrp	x9, _EC_PROTO_VERSION_UNKNOWN@GOTPAGE
Lloh1:
	ldr	x9, [x9, _EC_PROTO_VERSION_UNKNOWN@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_3
; %bb.1:
	mov	x0, x20
	bl	_cros_ec_query_all
	cbz	w0, LBB0_3
; %bb.2:
	mov	x22, x0
	ldr	w0, [x20, #36]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	mov	x0, x19
	bl	_mutex_unlock
	mov	x0, x22
	b	LBB0_12
LBB0_3:
	ldr	x8, [x21]
	ldr	x9, [x20, #8]
	cmp	x8, x9
	b.le	LBB0_5
; %bb.4:
	ldr	w0, [x20, #36]
Lloh5:
	adrp	x1, l_.str.1@PAGE
Lloh6:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_dbg
	ldr	x8, [x20, #8]
	str	x8, [x21]
LBB0_5:
	ldr	x22, [x21, #8]
	mov	w0, #1
	bl	_EC_CMD_PASSTHRU_OFFSET
	ldr	x8, [x21, #16]
	cmp	x22, x0
	b.ge	LBB0_8
; %bb.6:
	ldr	x9, [x20, #16]
	cmp	x8, x9
	b.le	LBB0_11
; %bb.7:
	ldr	w0, [x20, #36]
	stp	x8, x9, [sp]
Lloh7:
	adrp	x1, l_.str.2@PAGE
Lloh8:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_10
LBB0_8:
	ldr	x9, [x20, #24]
	cmp	x8, x9
	b.le	LBB0_11
; %bb.9:
	ldr	w0, [x20, #36]
	stp	x8, x9, [sp]
Lloh9:
	adrp	x1, l_.str.3@PAGE
Lloh10:
	add	x1, x1, l_.str.3@PAGEOFF
LBB0_10:
	bl	_dev_err
	mov	x0, x19
	bl	_mutex_unlock
Lloh11:
	adrp	x8, _EMSGSIZE@GOTPAGE
Lloh12:
	ldr	x8, [x8, _EMSGSIZE@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_12
LBB0_11:
	mov	x0, x20
	mov	x1, x21
	bl	_send_command
	mov	x20, x0
	mov	x0, x19
	bl	_mutex_unlock
	mov	x0, x20
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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_EC_PROTO_VERSION_UNKNOWN,8,3   ; @EC_PROTO_VERSION_UNKNOWN
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"EC version unknown and query failed; aborting command\n"

l_.str.1:                               ; @.str.1
	.asciz	"clamping message receive buffer\n"

l_.str.2:                               ; @.str.2
	.asciz	"request of size %u is too big (max: %u)\n"

	.comm	_EMSGSIZE,4,2                   ; @EMSGSIZE
l_.str.3:                               ; @.str.3
	.asciz	"passthru rq of size %u is too big (max: %u)\n"

.subsections_via_symbols
