	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mei_me_hbuf_write
_mei_me_hbuf_write:                     ## @mei_me_hbuf_write
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, %r15
	movq	%rcx, %rbx
	movq	%rdx, %r14
	movq	%rsi, %r13
	movq	%rdi, %r12
	testq	%rsi, %rsi
	sete	%al
	testq	%rcx, %rcx
	sete	%cl
	testb	$3, %r14b
	setne	%dl
	orb	%al, %cl
	orb	%dl, %cl
	movzbl	%cl, %edi
	callq	_WARN_ON
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
LBB0_22:
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_23:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movq	%r15, -56(%rbp)                 ## 8-byte Spill
	movl	(%r12), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	_MEI_HDR_FMT@GOTPCREL(%rip), %rax
	movq	(%rax), %r15
	movq	%r13, %rdi
	callq	_MEI_HDR_PRM
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movq	%r15, %rsi
	movl	%eax, %edx
	callq	_dev_dbg
	movq	%r12, %rdi
	callq	_mei_hbuf_empty_slots
	movl	%eax, %r15d
	movl	(%r12), %edi
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edx
	callq	_dev_dbg
	testl	%r15d, %r15d
	js	LBB0_3
## %bb.4:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	leaq	(%rax,%r14), %rdi
	callq	_mei_data2slots
	movl	%r15d, %ecx
	cmpq	%rcx, %rax
	jle	LBB0_6
## %bb.5:
	movq	_EMSGSIZE@GOTPCREL(%rip), %rcx
	jmp	LBB0_22
LBB0_3:
	movq	_EOVERFLOW@GOTPCREL(%rip), %rcx
	jmp	LBB0_22
LBB0_6:
	movq	_MEI_SLOT_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	cmpq	%r14, %rcx
	ja	LBB0_12
## %bb.7:
	xorl	%r15d, %r15d
	jmp	LBB0_8
	.p2align	4, 0x90
LBB0_10:                                ##   in Loop: Header=BB0_8 Depth=1
	movq	%r14, %rax
	xorl	%edx, %edx
	divq	%rcx
	cmpq	%rax, %r15
	jae	LBB0_12
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r13,%r15,8), %rsi
	movq	%r12, %rdi
	callq	_mei_me_hcbww_write
	incq	%r15
	movq	_MEI_SLOT_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	movq	%r14, %rax
	orq	%rcx, %rax
	shrq	$32, %rax
	jne	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	movl	%r14d, %eax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $eax killed $eax def $rax
	cmpq	%rax, %r15
	jb	LBB0_8
LBB0_12:
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	cmpq	%r15, %rcx
	movq	%rbx, %r14
	ja	LBB0_18
## %bb.13:
	xorl	%ebx, %ebx
	jmp	LBB0_14
	.p2align	4, 0x90
LBB0_16:                                ##   in Loop: Header=BB0_14 Depth=1
	movq	%r15, %rax
	xorl	%edx, %edx
	divq	%rcx
	cmpq	%rax, %rbx
	jae	LBB0_18
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	movq	(%r14,%rbx,8), %rsi
	movq	%r12, %rdi
	callq	_mei_me_hcbww_write
	incq	%rbx
	movq	_MEI_SLOT_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rcx
	movq	%r15, %rax
	orq	%rcx, %rax
	shrq	$32, %rax
	jne	LBB0_16
## %bb.15:                              ##   in Loop: Header=BB0_14 Depth=1
	movl	%r15d, %eax
	xorl	%edx, %edx
	divl	%ecx
                                        ## kill: def $eax killed $eax def $rax
	cmpq	%rax, %rbx
	jb	LBB0_14
LBB0_18:
	movq	%r15, %rdx
	andq	$3, %rdx
	je	LBB0_20
## %bb.19:
	movq	$0, -64(%rbp)
	leaq	(%r14,%r15,4), %rsi
	leaq	(,%rdx,4), %rax
	subq	%rax, %rsi
	leaq	-64(%rbp), %rdi
	callq	_memcpy
	movq	-64(%rbp), %rsi
	movq	%r12, %rdi
	callq	_mei_me_hcbww_write
LBB0_20:
	movq	%r12, %rdi
	callq	_mei_hcsr_set_hig
	movq	%r12, %rdi
	callq	_mei_me_hw_is_ready
	movl	%eax, %ecx
	xorl	%eax, %eax
	testl	%ecx, %ecx
	jne	LBB0_23
## %bb.21:
	movq	_EIO@GOTPCREL(%rip), %rcx
	jmp	LBB0_22
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_MEI_HDR_FMT,8,3                ## @MEI_HDR_FMT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"empty slots = %hu.\n"

	.comm	_EOVERFLOW,4,2                  ## @EOVERFLOW
	.comm	_EMSGSIZE,4,2                   ## @EMSGSIZE
	.comm	_MEI_SLOT_SIZE,8,3              ## @MEI_SLOT_SIZE
	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_mei_me_hbuf_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mei_me_hbuf_write
_mei_me_hbuf_write:                     ; @mei_me_hbuf_write
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.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
	mov	x20, x4
	mov	x21, x3
	mov	x22, x2
	mov	x23, x1
	mov	x19, x0
	tst	x2, #0x3
	cset	w8, ne
	cmp	x1, #0
	ccmp	x3, #0, #4, ne
	cset	w9, eq
	orr	w0, w8, w9
	bl	_WARN_ON
	cbz	x0, LBB0_4
; %bb.1:
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_2:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_3:
	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
	add	sp, sp, #96
	ret
LBB0_4:
	ldr	w24, [x19]
Lloh2:
	adrp	x8, _MEI_HDR_FMT@GOTPAGE
Lloh3:
	ldr	x8, [x8, _MEI_HDR_FMT@GOTPAGEOFF]
Lloh4:
	ldr	x25, [x8]
	mov	x0, x23
	bl	_MEI_HDR_PRM
	mov	x2, x0
	mov	x0, x24
	mov	x1, x25
	bl	_dev_dbg
	mov	x0, x19
	bl	_mei_hbuf_empty_slots
	mov	x24, x0
	ldr	w0, [x19]
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x24
	bl	_dev_dbg
	tbnz	w24, #31, LBB0_7
; %bb.5:
	add	x0, x20, x22
	bl	_mei_data2slots
	cmp	x0, w24, uxtw
	b.le	LBB0_8
; %bb.6:
Lloh7:
	adrp	x8, _EMSGSIZE@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EMSGSIZE@GOTPAGEOFF]
	b	LBB0_2
LBB0_7:
Lloh9:
	adrp	x8, _EOVERFLOW@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EOVERFLOW@GOTPAGEOFF]
	b	LBB0_2
LBB0_8:
Lloh11:
	adrp	x24, _MEI_SLOT_SIZE@GOTPAGE
Lloh12:
	ldr	x24, [x24, _MEI_SLOT_SIZE@GOTPAGEOFF]
	ldr	x8, [x24]
	cmp	x8, x22
	b.hi	LBB0_11
; %bb.9:
	mov	x25, #0
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	ldr	x1, [x23, x25, lsl #3]
	mov	x0, x19
	bl	_mei_me_hcbww_write
	add	x25, x25, #1
	ldr	x8, [x24]
	udiv	x9, x22, x8
	cmp	x25, x9
	b.lo	LBB0_10
LBB0_11:
	cmp	x8, x20
	b.hi	LBB0_14
; %bb.12:
	mov	x22, #0
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	ldr	x1, [x21, x22, lsl #3]
	mov	x0, x19
	bl	_mei_me_hcbww_write
	add	x22, x22, #1
	ldr	x8, [x24]
	udiv	x8, x20, x8
	cmp	x22, x8
	b.lo	LBB0_13
LBB0_14:
	ands	x2, x20, #0x3
	b.eq	LBB0_16
; %bb.15:
	str	xzr, [sp, #8]
	add	x8, x21, x20, lsl #2
	sub	x1, x8, x2, lsl #2
	add	x0, sp, #8
	bl	_memcpy
	ldr	x1, [sp, #8]
	mov	x0, x19
	bl	_mei_me_hcbww_write
LBB0_16:
	mov	x0, x19
	bl	_mei_hcsr_set_hig
	mov	x0, x19
	bl	_mei_me_hw_is_ready
	cbz	w0, LBB0_18
; %bb.17:
	mov	w0, #0
	b	LBB0_3
LBB0_18:
Lloh13:
	adrp	x8, _EIO@GOTPAGE
Lloh14:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_2
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_MEI_HDR_FMT,8,3                ; @MEI_HDR_FMT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"empty slots = %hu.\n"

	.comm	_EOVERFLOW,4,2                  ; @EOVERFLOW
	.comm	_EMSGSIZE,4,2                   ; @EMSGSIZE
	.comm	_MEI_SLOT_SIZE,8,3              ; @MEI_SLOT_SIZE
	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_mei_me_hbuf_write
.subsections_via_symbols
