	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function fsl_elbc_write_buf
_fsl_elbc_write_buf:                    ## @fsl_elbc_write_buf
	.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
	movl	%edx, %r12d
	movq	8(%rdi), %rax
	movq	(%rax), %rax
	movq	(%rax), %r15
	testl	%edx, %edx
	jle	LBB0_1
## %bb.2:
	movq	%rsi, %r14
	movl	4(%rdi), %ebx
	addl	(%rdi), %ebx
	movl	(%r15), %eax
	movl	%ebx, %ecx
	subl	%eax, %ecx
	cmpl	%r12d, %ecx
	jae	LBB0_4
## %bb.3:
	movl	16(%r15), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%r12d, %edx
	xorl	%eax, %eax
	callq	_dev_err
	movl	(%r15), %eax
	subl	%eax, %ebx
	movl	%ebx, %r12d
LBB0_4:
	movl	%eax, %edi
	shlq	$2, %rdi
	addq	8(%r15), %rdi
	movq	%r14, %rsi
	movl	%r12d, %edx
	callq	_memcpy_toio
	movl	(%r15), %eax
	shlq	$2, %rax
	addq	8(%r15), %rax
	movslq	%r12d, %rbx
	leaq	(%rax,%rbx,4), %rdi
	addq	$-4, %rdi
	callq	_in_8
	addl	%ebx, (%r15)
	jmp	LBB0_5
LBB0_1:
	movl	16(%r15), %edi
	leaq	L_.str(%rip), %rsi
	movl	%r12d, %edx
	xorl	%eax, %eax
	callq	_dev_err
	movq	$0, 24(%r15)
LBB0_5:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"write_buf of %d bytes"

L_.str.1:                               ## @.str.1
	.asciz	"write_buf beyond end of buffer (%d requested, %u available)\n"

	.no_dead_strip	_fsl_elbc_write_buf
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function fsl_elbc_write_buf
_fsl_elbc_write_buf:                    ; @fsl_elbc_write_buf
	.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	x19, x2
	ldr	x8, [x0, #8]
	ldr	x8, [x8]
	ldr	x21, [x8]
	cmp	w2, #0
	b.le	LBB0_4
; %bb.1:
	mov	x20, x1
	ldp	w9, w10, [x0]
	ldr	w8, [x21]
	add	w22, w10, w9
	sub	w9, w22, w8
	cmp	w9, w19
	b.hs	LBB0_3
; %bb.2:
	ldr	w0, [x21, #16]
	str	x9, [sp]
Lloh0:
	adrp	x1, l_.str.1@PAGE
Lloh1:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x19
	bl	_dev_err
	ldr	w8, [x21]
	sub	w19, w22, w8
LBB0_3:
	ldr	x9, [x21, #8]
	add	x0, x9, w8, uxtw #2
	mov	x1, x20
	mov	x2, x19
	bl	_memcpy_toio
	ldr	x8, [x21, #8]
	ldr	w9, [x21]
	add	x8, x8, x9, lsl #2
	add	x8, x8, w19, sxtw #2
	sub	x0, x8, #4
	bl	_in_8
	ldr	w8, [x21]
	add	w8, w8, w19
	str	w8, [x21]
	b	LBB0_5
LBB0_4:
	ldr	w0, [x21, #16]
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x19
	bl	_dev_err
	str	xzr, [x21, #24]
LBB0_5:
	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 AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"write_buf of %d bytes"

l_.str.1:                               ; @.str.1
	.asciz	"write_buf beyond end of buffer (%d requested, %u available)\n"

	.no_dead_strip	_fsl_elbc_write_buf
.subsections_via_symbols
