	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vicodec_mark_last_buf
_vicodec_mark_last_buf:                 ## @vicodec_mark_last_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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movl	12(%rdi), %edi
	callq	_spin_lock
	cmpl	$0, (%rbx)
	je	LBB0_2
## %bb.1:
	movq	_EBUSY@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_7
LBB0_2:
	xorl	%r14d, %r14d
	cmpl	$0, 4(%rbx)
	jne	LBB0_7
## %bb.3:
	movl	16(%rbx), %edi
	callq	_v4l2_m2m_last_src_buf
	movq	%rax, 24(%rbx)
	movl	$1, (%rbx)
	testq	%rax, %rax
	jne	LBB0_7
## %bb.4:
	leaq	16(%rbx), %r15
	movl	(%r15), %edi
	callq	_v4l2_m2m_dst_buf_remove
	testq	%rax, %rax
	je	LBB0_5
## %bb.6:
	movq	_V4L2_BUF_FLAG_LAST@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	%ecx, 4(%rax)
	movq	_VB2_BUF_STATE_DONE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movq	%rax, %rdi
	callq	_vb2_buffer_done
	movabsq	$4294967296, %rax               ## imm = 0x100000000
	movq	%rax, (%rbx)
	movq	_vicodec_eos_event@GOTPCREL(%rip), %rsi
	movq	%r15, %rdi
	callq	_v4l2_event_queue_fh
	jmp	LBB0_7
LBB0_5:
	movl	$1, 8(%rbx)
LBB0_7:
	movl	12(%rbx), %edi
	callq	_spin_unlock
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_V4L2_BUF_FLAG_LAST,4,2         ## @V4L2_BUF_FLAG_LAST
	.comm	_VB2_BUF_STATE_DONE,4,2         ## @VB2_BUF_STATE_DONE
	.comm	_vicodec_eos_event,4,2          ## @vicodec_eos_event
	.no_dead_strip	_vicodec_mark_last_buf
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function vicodec_mark_last_buf
lCPI0_0:
	.long	0                               ; 0x0
	.long	1                               ; 0x1
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	2
_vicodec_mark_last_buf:                 ; @vicodec_mark_last_buf
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	ldr	w0, [x0, #12]
	bl	_spin_lock
	ldr	w8, [x19]
	cbz	w8, LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _EBUSY@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_7
LBB0_2:
	ldr	w8, [x19, #4]
	cbnz	w8, LBB0_6
; %bb.3:
	mov	x20, x19
	ldr	w0, [x20, #16]!
	bl	_v4l2_m2m_last_src_buf
	str	x0, [x19, #24]
	mov	w8, #1
	str	w8, [x19]
	cbnz	x0, LBB0_6
; %bb.4:
	ldr	w0, [x20]
	bl	_v4l2_m2m_dst_buf_remove
	cbz	x0, LBB0_8
; %bb.5:
Lloh3:
	adrp	x8, _V4L2_BUF_FLAG_LAST@GOTPAGE
Lloh4:
	ldr	x8, [x8, _V4L2_BUF_FLAG_LAST@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	ldr	w9, [x0, #4]
	orr	w8, w9, w8
	str	w8, [x0, #4]
Lloh6:
	adrp	x8, _VB2_BUF_STATE_DONE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _VB2_BUF_STATE_DONE@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	bl	_vb2_buffer_done
Lloh9:
	adrp	x8, lCPI0_0@PAGE
Lloh10:
	ldr	d0, [x8, lCPI0_0@PAGEOFF]
	str	d0, [x19]
Lloh11:
	adrp	x1, _vicodec_eos_event@GOTPAGE
Lloh12:
	ldr	x1, [x1, _vicodec_eos_event@GOTPAGEOFF]
	mov	x0, x20
	bl	_v4l2_event_queue_fh
LBB0_6:
	mov	w20, #0
LBB0_7:
	ldr	w0, [x19, #12]
	bl	_spin_unlock
	mov	x0, x20
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_8:
	mov	w20, #0
	mov	w8, #1
	str	w8, [x19, #8]
	b	LBB0_7
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdr	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_V4L2_BUF_FLAG_LAST,4,2         ; @V4L2_BUF_FLAG_LAST
	.comm	_VB2_BUF_STATE_DONE,4,2         ; @VB2_BUF_STATE_DONE
	.comm	_vicodec_eos_event,4,2          ; @vicodec_eos_event
	.no_dead_strip	_vicodec_mark_last_buf
.subsections_via_symbols
