	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ivtv_yuv_next_free
_ivtv_yuv_next_free:                    ## @ivtv_yuv_next_free
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	leaq	16(%rdi), %r15
	movq	%r15, %rdi
	callq	_atomic_read
	cmpl	$-1, %eax
	jne	LBB0_2
## %bb.1:
	movq	%r14, %rdi
	callq	_ivtv_yuv_init
LBB0_2:
	leaq	20(%r14), %rdi
	callq	_atomic_read
	movl	%eax, %ebx
	movq	%r15, %rdi
	callq	_atomic_read
	xorl	%edx, %edx
	movl	%ebx, %esi
	subl	%eax, %esi
	movq	_IVTV_YUV_BUFFERS@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	cmovll	%ecx, %edx
	leal	(%rsi,%rdx), %eax
	cmpl	(%r14), %eax
	jge	LBB0_3
## %bb.4:
	movq	8(%r14), %rax
	movslq	%ebx, %rcx
	movq	$0, (%rax,%rcx,8)
	jmp	LBB0_5
LBB0_3:
	decl	%ebx
	movl	%ebx, %eax
	cltd
	idivl	%ecx
	movl	%edx, %ebx
LBB0_5:
	movl	%ebx, 4(%r14)
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_IVTV_YUV_BUFFERS,4,2           ## @IVTV_YUV_BUFFERS
	.no_dead_strip	_ivtv_yuv_next_free
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ivtv_yuv_next_free
_ivtv_yuv_next_free:                    ; @ivtv_yuv_next_free
	.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	x19, x0
	add	x21, x0, #16
	mov	x0, x21
	bl	_atomic_read
	cmn	w0, #1
	b.ne	LBB0_2
; %bb.1:
	mov	x0, x19
	bl	_ivtv_yuv_init
LBB0_2:
	add	x0, x19, #20
	bl	_atomic_read
	mov	x20, x0
	mov	x0, x21
	bl	_atomic_read
Lloh0:
	adrp	x8, _IVTV_YUV_BUFFERS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _IVTV_YUV_BUFFERS@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	subs	w9, w20, w0
	csel	w10, w8, wzr, lt
	add	w9, w9, w10
	ldr	w10, [x19]
	cmp	w9, w10
	b.ge	LBB0_4
; %bb.3:
	ldr	x8, [x19, #8]
	str	xzr, [x8, w20, sxtw #3]
	b	LBB0_5
LBB0_4:
	sub	w9, w20, #1
	sdiv	w10, w9, w8
	msub	w20, w10, w8, w9
LBB0_5:
	str	w20, [x19, #4]
	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	_IVTV_YUV_BUFFERS,4,2           ; @IVTV_YUV_BUFFERS
	.no_dead_strip	_ivtv_yuv_next_free
.subsections_via_symbols
