	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_fifo_write                     ## -- Begin function fifo_write
	.p2align	4, 0x90
_fifo_write:                            ## @fifo_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %ebx
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %r12
	callq	_fifo_remaining
	cmpq	%r14, %rax
	jae	LBB0_1
## %bb.2:
	movq	_FIFO_OVERWRITE@GOTPCREL(%rip), %rax
	testl	%ebx, (%rax)
	je	LBB0_3
## %bb.4:
	movq	%r12, %rdi
	callq	_fifo_remaining
	movq	%r14, %rcx
	subq	%rax, %rcx
	movq	(%r12), %rax
	addq	%rcx, %rax
	movq	8(%r12), %rbx
	movq	%rax, %rdx
	orq	%rbx, %rdx
	shrq	$32, %rdx
	je	LBB0_5
## %bb.6:
	xorl	%edx, %edx
	divq	%rbx
	jmp	LBB0_7
LBB0_1:
	movq	(%r12), %rdx
	movq	8(%r12), %rbx
	movq	16(%r12), %rax
	jmp	LBB0_8
LBB0_3:
	movl	$1, %eax
	jmp	LBB0_12
LBB0_5:
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%ebx
                                        ## kill: def $edx killed $edx def $rdx
LBB0_7:
	movq	%rdx, (%r12)
	movq	16(%r12), %rax
	subq	%rcx, %rax
	movq	%rax, 16(%r12)
LBB0_8:
	addq	%rdx, %rax
	movq	%rax, %rcx
	orq	%rbx, %rcx
	shrq	$32, %rcx
	je	LBB0_9
## %bb.10:
	xorl	%edx, %edx
	divq	%rbx
	movq	%rdx, %rdi
	jmp	LBB0_11
LBB0_9:
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%ebx
	movl	%edx, %edi
LBB0_11:
	subq	%rdi, %rbx
	cmpq	%r14, %rbx
	cmovaeq	%r14, %rbx
	shlq	$2, %rdi
	addq	24(%r12), %rdi
	movq	%r15, %rsi
	movq	%rbx, %rdx
	callq	_memcpy
	movq	24(%r12), %rdi
	addq	%rbx, %r15
	movq	%r14, %rdx
	subq	%rbx, %rdx
	movq	%r15, %rsi
	callq	_memcpy
	addq	%r14, 16(%r12)
	xorl	%eax, %eax
LBB0_12:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_FIFO_OVERWRITE,4,2             ## @FIFO_OVERWRITE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_fifo_write                     ; -- Begin function fifo_write
	.p2align	2
_fifo_write:                            ; @fifo_write
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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	x22, x3
	mov	x19, x2
	mov	x21, x1
	mov	x20, x0
	bl	_fifo_remaining
	cmp	x0, x19
	b.hs	LBB0_3
; %bb.1:
Lloh0:
	adrp	x8, _FIFO_OVERWRITE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _FIFO_OVERWRITE@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	tst	w8, w22
	b.eq	LBB0_5
; %bb.2:
	mov	x0, x20
	bl	_fifo_remaining
	ldp	x9, x8, [x20]
	sub	x10, x19, x0
	add	x9, x9, x10
	udiv	x11, x9, x8
	msub	x9, x11, x8, x9
	str	x9, [x20]
	ldr	x11, [x20, #16]
	sub	x10, x11, x10
	str	x10, [x20, #16]
	b	LBB0_4
LBB0_3:
	ldp	x8, x10, [x20, #8]
	ldr	x9, [x20]
LBB0_4:
	add	x9, x10, x9
	udiv	x10, x9, x8
	msub	x9, x10, x8, x9
	sub	x8, x8, x9
	cmp	x8, x19
	csel	x22, x8, x19, lo
	ldr	x8, [x20, #24]
	add	x0, x8, x9, lsl #2
	mov	x1, x21
	mov	x2, x22
	bl	_memcpy
	ldr	x0, [x20, #24]
	add	x1, x21, x22
	sub	x2, x19, x22
	bl	_memcpy
	mov	w0, #0
	ldr	x8, [x20, #16]
	add	x8, x8, x19
	str	x8, [x20, #16]
	b	LBB0_6
LBB0_5:
	mov	w0, #1
LBB0_6:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_FIFO_OVERWRITE,4,2             ; @FIFO_OVERWRITE
.subsections_via_symbols
