	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function send_command
_send_command:                          ## @send_command
	.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	%rsi, %r14
	movq	%rdi, %r15
	movq	%rsi, %rdi
	callq	_trace_cros_ec_cmd
	xorl	%eax, %eax
	cmpl	$3, (%r15)
	setl	%al
	movq	8(%r15,%rax,8), %r13
	testq	%r13, %r13
	je	LBB0_1
## %bb.2:
	movq	%r15, %rdi
	movq	%r14, %rsi
	callq	*%r13
	movl	%eax, %ebx
	movq	(%r14), %rax
	movq	_EC_RES_IN_PROGRESS@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_14
## %bb.3:
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$52, %edi
	callq	_kmalloc
	testq	%rax, %rax
	je	LBB0_4
## %bb.6:
	movq	%rax, %r12
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	movq	$0, 40(%rax)
	movq	_EC_CMD_GET_COMMS_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 32(%r12)
	movl	$4, 8(%r12)
	movq	$0, 24(%r12)
	movq	_EC_COMMAND_RETRIES@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jle	LBB0_13
## %bb.7:
	xorl	%r14d, %r14d
	jmp	LBB0_8
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_8 Depth=1
	incl	%r14d
	movq	_EC_COMMAND_RETRIES@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r14d
	jge	LBB0_13
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movl	$10000, %edi                    ## imm = 0x2710
	movl	$11000, %esi                    ## imm = 0x2AF8
	callq	_usleep_range
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	*%r13
	movl	%eax, %ebx
	movq	_EAGAIN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	%ebx, %eax
	je	LBB0_12
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	testl	%ebx, %ebx
	js	LBB0_13
## %bb.10:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	(%r12), %rax
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movq	%rax, (%rcx)
	movq	(%r12), %rax
	movq	_EC_RES_SUCCESS@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_13
## %bb.11:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	16(%r12), %rax
	movq	_EC_COMMS_STATUS_PROCESSING@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, (%rax)
	jne	LBB0_12
LBB0_13:
	movq	%r12, %rdi
	callq	_kfree
	jmp	LBB0_14
LBB0_1:
	movl	24(%r15), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err_once
	movq	_EIO@GOTPCREL(%rip), %rax
	jmp	LBB0_5
LBB0_4:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
LBB0_5:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_14:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"missing EC transfer API, cannot send command\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_EC_RES_IN_PROGRESS,8,3         ## @EC_RES_IN_PROGRESS
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_EC_CMD_GET_COMMS_STATUS,4,2    ## @EC_CMD_GET_COMMS_STATUS
	.comm	_EC_COMMAND_RETRIES,4,2         ## @EC_COMMAND_RETRIES
	.comm	_EAGAIN,4,2                     ## @EAGAIN
	.comm	_EC_RES_SUCCESS,8,3             ## @EC_RES_SUCCESS
	.comm	_EC_COMMS_STATUS_PROCESSING,4,2 ## @EC_COMMS_STATUS_PROCESSING
	.no_dead_strip	_send_command
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function send_command
_send_command:                          ; @send_command
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	mov	x0, x1
	bl	_trace_cros_ec_cmd
	ldr	w8, [x19]
	cmp	w8, #2
	mov	w8, #16
	mov	w9, #8
	csel	x8, x9, x8, gt
	ldr	x23, [x19, x8]
	cbz	x23, LBB0_11
; %bb.1:
	mov	x0, x19
	mov	x1, x20
	blr	x23
	mov	x21, x0
	ldr	x8, [x20]
Lloh0:
	adrp	x9, _EC_RES_IN_PROGRESS@GOTPAGE
Lloh1:
	ldr	x9, [x9, _EC_RES_IN_PROGRESS@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_14
; %bb.2:
Lloh3:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	w0, #52
	bl	_kmalloc
	cbz	x0, LBB0_12
; %bb.3:
	mov	x22, x0
	str	xzr, [x0, #40]
Lloh6:
	adrp	x8, _EC_CMD_GET_COMMS_STATUS@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EC_CMD_GET_COMMS_STATUS@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	str	w8, [x0, #32]
	mov	w8, #4
	str	w8, [x0, #8]
	str	xzr, [x0, #24]
Lloh9:
	adrp	x24, _EC_COMMAND_RETRIES@GOTPAGE
Lloh10:
	ldr	x24, [x24, _EC_COMMAND_RETRIES@GOTPAGEOFF]
	ldr	w8, [x24]
	cmp	w8, #1
	b.lt	LBB0_10
; %bb.4:
	mov	w25, #0
Lloh11:
	adrp	x26, _EAGAIN@GOTPAGE
Lloh12:
	ldr	x26, [x26, _EAGAIN@GOTPAGEOFF]
Lloh13:
	adrp	x27, _EC_RES_SUCCESS@GOTPAGE
Lloh14:
	ldr	x27, [x27, _EC_RES_SUCCESS@GOTPAGEOFF]
Lloh15:
	adrp	x28, _EC_COMMS_STATUS_PROCESSING@GOTPAGE
Lloh16:
	ldr	x28, [x28, _EC_COMMS_STATUS_PROCESSING@GOTPAGEOFF]
	b	LBB0_6
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	add	w25, w25, #1
	ldr	w8, [x24]
	cmp	w25, w8
	b.ge	LBB0_10
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	mov	w0, #10000
	mov	w1, #11000
	bl	_usleep_range
	mov	x0, x19
	mov	x1, x22
	blr	x23
	mov	x21, x0
	ldr	w8, [x26]
	cmn	w0, w8
	b.eq	LBB0_5
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	tbnz	w21, #31, LBB0_10
; %bb.8:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [x22]
	str	x8, [x20]
	ldr	x8, [x22]
	ldr	x9, [x27]
	cmp	x8, x9
	b.ne	LBB0_10
; %bb.9:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [x22, #16]
	ldr	w8, [x8]
	ldr	w9, [x28]
	tst	w9, w8
	b.ne	LBB0_5
LBB0_10:
	mov	x0, x22
	bl	_kfree
	b	LBB0_14
LBB0_11:
	ldr	w0, [x19, #24]
Lloh17:
	adrp	x1, l_.str@PAGE
Lloh18:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err_once
Lloh19:
	adrp	x8, _EIO@GOTPAGE
Lloh20:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_13
LBB0_12:
Lloh21:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh22:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_13:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_14:
	mov	x0, x21
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"missing EC transfer API, cannot send command\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_EC_RES_IN_PROGRESS,8,3         ; @EC_RES_IN_PROGRESS
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_EC_CMD_GET_COMMS_STATUS,4,2    ; @EC_CMD_GET_COMMS_STATUS
	.comm	_EC_COMMAND_RETRIES,4,2         ; @EC_COMMAND_RETRIES
	.comm	_EAGAIN,4,2                     ; @EAGAIN
	.comm	_EC_RES_SUCCESS,8,3             ; @EC_RES_SUCCESS
	.comm	_EC_COMMS_STATUS_PROCESSING,4,2 ; @EC_COMMS_STATUS_PROCESSING
	.no_dead_strip	_send_command
.subsections_via_symbols
