	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function program_store
_program_store:                         ## @program_store
	.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	%rcx, %r15
	movq	%rdx, %r12
	movq	%rdi, %rbx
	callq	_to_cros_ec_dev
	movq	%rax, %r13
	movq	_EC_LB_PROG_LEN@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	(%r13), %rax
	movq	(%rax), %rsi
	addq	$-20, %rsi
	callq	_min
	movslq	%eax, %rcx
	cmpq	%r15, %rcx
	jae	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rsi
	movq	%rbx, %rdi
	movl	%r15d, %edx
	movl	%eax, %ecx
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_4
LBB0_2:
	movq	%r13, %rdi
	callq	_alloc_lightbar_cmd_msg
	testq	%rax, %rax
	je	LBB0_3
## %bb.5:
	movq	%rax, %r14
	movq	%r12, -48(%rbp)                 ## 8-byte Spill
	xorl	%eax, %eax
	callq	_lb_throttle
	movl	%eax, %r12d
	testl	%eax, %eax
	je	LBB0_6
LBB0_11:
	movq	%r14, %rdi
	callq	_kfree
	jmp	LBB0_12
LBB0_3:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
LBB0_4:
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
LBB0_12:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	leaq	L_.str.1(%rip), %rsi
	movq	%rbx, %rdi
	movq	%r15, %rdx
	callq	_dev_info
	movq	16(%r14), %rax
	movq	_LIGHTBAR_CMD_SET_PROGRAM@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, 16(%rax)
	movq	%r15, (%rax)
	movl	8(%rax), %edi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	movq	%r15, %rdx
	callq	_memcpy
	leaq	20(%r15), %rax
	movq	%rax, (%r14)
	movq	(%r13), %rdi
	movq	%r14, %rsi
	callq	_cros_ec_cmd_xfer
	testl	%eax, %eax
	js	LBB0_7
## %bb.8:
	movq	8(%r14), %rax
	movq	_EC_RES_SUCCESS@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_9
## %bb.10:
	movl	%r15d, %r12d
	jmp	LBB0_11
LBB0_7:
	movl	%eax, %r12d
	jmp	LBB0_11
LBB0_9:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.comm	_EC_LB_PROG_LEN,4,2             ## @EC_LB_PROG_LEN
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Program is %u bytes, too long to send (max: %u)"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
L_.str.1:                               ## @.str.1
	.asciz	"Copying %zu byte program to EC"

	.comm	_LIGHTBAR_CMD_SET_PROGRAM,4,2   ## @LIGHTBAR_CMD_SET_PROGRAM
	.comm	_EC_RES_SUCCESS,8,3             ## @EC_RES_SUCCESS
	.no_dead_strip	_program_store
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function program_store
_program_store:                         ; @program_store
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x19, x3
	mov	x22, x2
	mov	x23, x0
	bl	_to_cros_ec_dev
	mov	x21, x0
Lloh0:
	adrp	x8, _EC_LB_PROG_LEN@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EC_LB_PROG_LEN@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
	ldr	x8, [x21]
	ldr	x8, [x8]
	sub	x1, x8, #20
	bl	_min
	mov	x3, x0
	sxtw	x8, w3
	cmp	x8, x19
	b.hs	LBB0_2
; %bb.1:
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x23
	mov	x2, x19
                                        ; kill: def $w3 killed $w3 killed $x3
	bl	_dev_err
Lloh5:
	adrp	x8, _EINVAL@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_6
LBB0_2:
	mov	x0, x21
	bl	_alloc_lightbar_cmd_msg
	cbz	x0, LBB0_5
; %bb.3:
	mov	x20, x0
	bl	_lb_throttle
	mov	x24, x0
	cbz	w0, LBB0_8
LBB0_4:
	mov	x0, x20
	bl	_kfree
	b	LBB0_7
LBB0_5:
Lloh7:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh8:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_6:
	ldr	w8, [x8]
	neg	w24, w8
LBB0_7:
	mov	x0, x24
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
LBB0_8:
Lloh9:
	adrp	x1, l_.str.1@PAGE
Lloh10:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x23
	mov	x2, x19
	bl	_dev_info
	ldr	x8, [x20, #16]
Lloh11:
	adrp	x9, _LIGHTBAR_CMD_SET_PROGRAM@GOTPAGE
Lloh12:
	ldr	x9, [x9, _LIGHTBAR_CMD_SET_PROGRAM@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	str	w9, [x8, #16]
	str	x19, [x8]
	ldr	w0, [x8, #8]
	mov	x1, x22
	mov	x2, x19
	bl	_memcpy
	add	x8, x19, #20
	str	x8, [x20]
	ldr	x0, [x21]
	mov	x1, x20
	bl	_cros_ec_cmd_xfer
	tbnz	w0, #31, LBB0_11
; %bb.9:
	ldr	x8, [x20, #8]
Lloh14:
	adrp	x9, _EC_RES_SUCCESS@GOTPAGE
Lloh15:
	ldr	x9, [x9, _EC_RES_SUCCESS@GOTPAGEOFF]
Lloh16:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_12
; %bb.10:
	mov	x24, x19
	b	LBB0_4
LBB0_11:
	mov	x24, x0
	b	LBB0_4
LBB0_12:
Lloh17:
	adrp	x8, _EINVAL@GOTPAGE
Lloh18:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	neg	w24, w8
	b	LBB0_4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_EC_LB_PROG_LEN,4,2             ; @EC_LB_PROG_LEN
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Program is %u bytes, too long to send (max: %u)"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
l_.str.1:                               ; @.str.1
	.asciz	"Copying %zu byte program to EC"

	.comm	_LIGHTBAR_CMD_SET_PROGRAM,4,2   ; @LIGHTBAR_CMD_SET_PROGRAM
	.comm	_EC_RES_SUCCESS,8,3             ; @EC_RES_SUCCESS
	.no_dead_strip	_program_store
.subsections_via_symbols
