	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rs_write
_rs_write:                              ## @rs_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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	$-1, %r12d
	cmpq	$0, 16(%rdi)
	jne	LBB0_9
## %bb.1:
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %r13
	cmpq	$0, 24(%rdi)
	je	LBB0_2
## %bb.10:
	movl	(%r13), %edi
	callq	_rsd_callback_lock
	movl	4(%r13), %edi
	callq	_fifo_write_avail
	cmpq	%r14, %rax
	cmovbq	%rax, %r14
	movl	4(%r13), %edi
	movq	%r15, %rsi
	movq	%r14, %rdx
	callq	_fifo_write
	movl	(%r13), %edi
	callq	_rsd_callback_unlock
	movl	%r14d, %r12d
	jmp	LBB0_9
LBB0_2:
	xorl	%r12d, %r12d
	testq	%r14, %r14
	je	LBB0_9
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r13), %edi
	callq	_rsd_callback_lock
	movl	4(%r13), %edi
	callq	_fifo_write_avail
	testq	%rax, %rax
	je	LBB0_4
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	%r14, %rbx
	subq	%r12, %rbx
	cmpq	%rax, %rbx
	cmovaeq	%rax, %rbx
	movl	4(%r13), %edi
	leaq	(%r15,%r12), %rsi
	movq	%rbx, %rdx
	callq	_fifo_write
	movl	(%r13), %edi
	callq	_rsd_callback_unlock
	addq	%rbx, %r12
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_3 Depth=1
	movl	(%r13), %edi
	callq	_rsd_callback_unlock
	cmpq	$0, 16(%r13)
	jne	LBB0_7
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	8(%r13), %edi
	callq	_slock_lock
	movl	8(%r13), %esi
	movl	12(%r13), %edi
	callq	_scond_wait
	movl	8(%r13), %edi
	callq	_slock_unlock
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_3 Depth=1
	cmpq	%r14, %r12
	jae	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_3 Depth=1
	cmpq	$0, 16(%r13)
	je	LBB0_3
LBB0_9:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_rs_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rs_write
_rs_write:                              ; @rs_write
	.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
	ldr	x8, [x0, #16]
	cbz	x8, LBB0_2
; %bb.1:
	mov	w22, #-1
	b	LBB0_11
LBB0_2:
	mov	x21, x2
	mov	x20, x1
	mov	x19, x0
	ldr	x8, [x0, #24]
	cbz	x8, LBB0_4
; %bb.3:
	ldr	w0, [x19]
	bl	_rsd_callback_lock
	ldr	w0, [x19, #4]
	bl	_fifo_write_avail
	cmp	x0, x21
	csel	x22, x0, x21, lo
	ldr	w0, [x19, #4]
	mov	x1, x20
	mov	x2, x22
	bl	_fifo_write
	ldr	w0, [x19]
	bl	_rsd_callback_unlock
                                        ; kill: def $w22 killed $w22 killed $x22 def $x22
	b	LBB0_11
LBB0_4:
	mov	x22, #0
	cbz	x21, LBB0_11
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x19]
	bl	_rsd_callback_lock
	ldr	w0, [x19, #4]
	bl	_fifo_write_avail
	cbz	x0, LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	sub	x8, x21, x22
	cmp	x8, x0
	csel	x23, x8, x0, lo
	ldr	w0, [x19, #4]
	add	x1, x20, x22
	mov	x2, x23
	bl	_fifo_write
	ldr	w0, [x19]
	bl	_rsd_callback_unlock
	add	x22, x23, x22
	b	LBB0_9
LBB0_7:                                 ;   in Loop: Header=BB0_5 Depth=1
	ldr	w0, [x19]
	bl	_rsd_callback_unlock
	ldr	x8, [x19, #16]
	cbnz	x8, LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w0, [x19, #8]
	bl	_slock_lock
	ldp	w1, w0, [x19, #8]
	bl	_scond_wait
	ldr	w0, [x19, #8]
	bl	_slock_unlock
LBB0_9:                                 ;   in Loop: Header=BB0_5 Depth=1
	cmp	x22, x21
	b.hs	LBB0_11
; %bb.10:                               ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_5
LBB0_11:
	mov	x0, x22
	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
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_rs_write
.subsections_via_symbols
