	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function coda_finish_encode
_coda_finish_encode:                    ## @coda_finish_encode
	.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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	40(%rdi), %r13
	addq	$16, %rdi
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	callq	_mutex_lock
	movl	20(%r15), %edi
	callq	_v4l2_m2m_src_buf_remove
	movq	%rax, %rbx
	movl	20(%r15), %edi
	callq	_v4l2_m2m_next_dst_buf
	movq	%rax, %r12
	movq	%r15, %rdi
	movq	%rax, %rsi
	callq	_trace_coda_enc_pic_done
	movq	_CODA_CMD_ENC_PIC_BB_START@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	callq	_coda_read
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movl	32(%r15), %edi
	callq	_CODA_REG_BIT_WR_PTR
	movq	%r13, %rdi
	movl	%eax, %esi
	callq	_coda_read
	movq	%rax, %r14
	cmpq	$0, (%r12)
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	je	LBB0_2
## %bb.1:
	movq	_V4L2_BUF_FLAG_KEYFRAME@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 8(%rbx)
	je	LBB0_3
LBB0_2:
	movq	%r12, %rdi
	addq	$12, %rdi
	subq	-48(%rbp), %r14                 ## 8-byte Folded Reload
	movq	24(%r15), %rax
	movq	(%rax), %rdx
	addq	%r14, %rdx
	addq	8(%rax), %rdx
	addq	16(%rax), %rdx
	xorl	%esi, %esi
	jmp	LBB0_4
LBB0_3:
	movq	%r12, %rdi
	addq	$12, %rdi
	subq	-48(%rbp), %r14                 ## 8-byte Folded Reload
	xorl	%esi, %esi
	movq	%r14, %rdx
LBB0_4:
	callq	_vb2_set_plane_payload
	leaq	L_.str(%rip), %rdx
	movl	$1, %edi
	movq	%r15, %rsi
	movl	%r14d, %ecx
	xorl	%eax, %eax
	callq	_coda_dbg
	movq	_CODA_RET_ENC_PIC_SLICE_NUM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	callq	_coda_read
	movq	_CODA_RET_ENC_PIC_FLAG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	callq	_coda_read
	movq	_V4L2_BUF_FLAG_KEYFRAME@GOTPCREL(%rip), %rbx
	movq	_V4L2_BUF_FLAG_PFRAME@GOTPCREL(%rip), %r14
	movl	(%r14), %eax
	orl	(%rbx), %eax
	movq	_V4L2_BUF_FLAG_LAST@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	notl	%eax
	andl	%eax, 8(%r12)
	movq	_CODA_RET_ENC_PIC_TYPE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	movq	%rcx, %r13
	callq	_coda_read
	testq	%rax, %rax
	cmoveq	%rbx, %r14
	movl	8(%r12), %eax
	orl	(%r14), %eax
	movl	%eax, 8(%r12)
	movl	(%r13), %ecx
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	andl	8(%rbx), %ecx
	orl	%eax, %ecx
	movl	%ecx, 8(%r12)
	movq	%rbx, %rdi
	movq	%r12, %rsi
	xorl	%edx, %edx
	callq	_v4l2_m2m_buf_copy_metadata
	movq	_VB2_BUF_STATE_DONE@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	movq	%rbx, %rdi
	callq	_v4l2_m2m_buf_done
	movl	20(%r15), %edi
	callq	_v4l2_m2m_dst_buf_remove
	movq	%rax, %rbx
	movl	(%r14), %edx
	movq	%r15, %rdi
	movq	%rax, %rsi
	callq	_coda_m2m_buf_done
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_mutex_unlock
	movq	(%r15), %rax
	leaq	-1(%rax), %rcx
	movq	%rcx, (%r15)
	testq	%rax, %rax
	jg	LBB0_6
## %bb.5:
	movq	8(%r15), %rax
	decq	%rax
	movq	%rax, (%r15)
LBB0_6:
	movl	8(%rbx), %edi
	callq	_coda_frame_type_char
	movl	(%r13), %ecx
	andl	8(%rbx), %ecx
	leaq	L_.str.3(%rip), %rcx
	leaq	L_.str.2(%rip), %r9
	cmoveq	%rcx, %r9
	movq	(%rbx), %r8
	leaq	L_.str.1(%rip), %rdx
	movl	$1, %edi
	movq	%r15, %rsi
	movl	%eax, %ecx
	xorl	%eax, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_coda_dbg                       ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_CODA_CMD_ENC_PIC_BB_START,4,2  ## @CODA_CMD_ENC_PIC_BB_START
	.comm	_V4L2_BUF_FLAG_KEYFRAME,4,2     ## @V4L2_BUF_FLAG_KEYFRAME
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"frame size = %u\n"

	.comm	_CODA_RET_ENC_PIC_SLICE_NUM,4,2 ## @CODA_RET_ENC_PIC_SLICE_NUM
	.comm	_CODA_RET_ENC_PIC_FLAG,4,2      ## @CODA_RET_ENC_PIC_FLAG
	.comm	_V4L2_BUF_FLAG_PFRAME,4,2       ## @V4L2_BUF_FLAG_PFRAME
	.comm	_V4L2_BUF_FLAG_LAST,4,2         ## @V4L2_BUF_FLAG_LAST
	.comm	_CODA_RET_ENC_PIC_TYPE,4,2      ## @CODA_RET_ENC_PIC_TYPE
	.comm	_VB2_BUF_STATE_DONE,4,2         ## @VB2_BUF_STATE_DONE
L_.str.1:                               ## @.str.1
	.asciz	"job finished: encoded %c frame (%d)%s\n"

L_.str.2:                               ## @.str.2
	.asciz	" (last)"

L_.str.3:                               ## @.str.3
	.space	1

	.no_dead_strip	_coda_finish_encode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function coda_finish_encode
_coda_finish_encode:                    ; @coda_finish_encode
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x19, x0
	ldr	x22, [x0, #40]
	add	x20, x0, #16
	mov	x0, x20
	bl	_mutex_lock
	ldr	w0, [x19, #20]
	bl	_v4l2_m2m_src_buf_remove
	mov	x21, x0
	ldr	w0, [x19, #20]
	bl	_v4l2_m2m_next_dst_buf
	mov	x23, x0
	mov	x0, x19
	mov	x1, x23
	bl	_trace_coda_enc_pic_done
Lloh0:
	adrp	x8, _CODA_CMD_ENC_PIC_BB_START@GOTPAGE
Lloh1:
	ldr	x8, [x8, _CODA_CMD_ENC_PIC_BB_START@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x0, x22
	bl	_coda_read
	mov	x24, x0
	ldr	w0, [x19, #32]
	bl	_CODA_REG_BIT_WR_PTR
	mov	x1, x0
	mov	x0, x22
	bl	_coda_read
	ldr	x8, [x23]
Lloh3:
	adrp	x25, _V4L2_BUF_FLAG_KEYFRAME@GOTPAGE
Lloh4:
	ldr	x25, [x25, _V4L2_BUF_FLAG_KEYFRAME@GOTPAGEOFF]
	cbz	x8, LBB0_2
; %bb.1:
	ldr	w8, [x21, #8]
	ldr	w9, [x25]
	tst	w9, w8
	b.eq	LBB0_3
LBB0_2:
	add	x8, x23, #12
	ldr	x9, [x19, #24]
	ldp	x10, x11, [x9]
	sub	x24, x0, x24
	add	x10, x24, x10
	ldr	x9, [x9, #16]
	add	x10, x10, x11
	add	x2, x10, x9
	mov	x0, x8
	mov	w1, #0
	b	LBB0_4
LBB0_3:
	add	x8, x23, #12
	sub	x24, x0, x24
	mov	x0, x8
	mov	w1, #0
	mov	x2, x24
LBB0_4:
	bl	_vb2_set_plane_payload
Lloh5:
	adrp	x2, l_.str@PAGE
Lloh6:
	add	x2, x2, l_.str@PAGEOFF
	mov	w0, #1
	mov	x1, x19
	mov	x3, x24
	bl	_coda_dbg
Lloh7:
	adrp	x8, _CODA_RET_ENC_PIC_SLICE_NUM@GOTPAGE
Lloh8:
	ldr	x8, [x8, _CODA_RET_ENC_PIC_SLICE_NUM@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	mov	x0, x22
	bl	_coda_read
Lloh10:
	adrp	x8, _CODA_RET_ENC_PIC_FLAG@GOTPAGE
Lloh11:
	ldr	x8, [x8, _CODA_RET_ENC_PIC_FLAG@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	mov	x0, x22
	bl	_coda_read
	ldr	w8, [x25]
Lloh13:
	adrp	x26, _V4L2_BUF_FLAG_PFRAME@GOTPAGE
Lloh14:
	ldr	x26, [x26, _V4L2_BUF_FLAG_PFRAME@GOTPAGEOFF]
	ldr	w9, [x26]
	orr	w8, w9, w8
Lloh15:
	adrp	x24, _V4L2_BUF_FLAG_LAST@GOTPAGE
Lloh16:
	ldr	x24, [x24, _V4L2_BUF_FLAG_LAST@GOTPAGEOFF]
	ldr	w9, [x24]
	orr	w8, w8, w9
	ldr	w9, [x23, #8]
	bic	w8, w9, w8
	str	w8, [x23, #8]
Lloh17:
	adrp	x8, _CODA_RET_ENC_PIC_TYPE@GOTPAGE
Lloh18:
	ldr	x8, [x8, _CODA_RET_ENC_PIC_TYPE@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
	mov	x0, x22
	bl	_coda_read
	cmp	x0, #0
	csel	x8, x25, x26, eq
	ldr	w8, [x8]
	ldr	w9, [x23, #8]
	orr	w8, w9, w8
	str	w8, [x23, #8]
	ldr	w9, [x21, #8]
	ldr	w10, [x24]
	and	w9, w10, w9
	orr	w8, w9, w8
	str	w8, [x23, #8]
	mov	x0, x21
	mov	x1, x23
	mov	w2, #0
	bl	_v4l2_m2m_buf_copy_metadata
Lloh20:
	adrp	x22, _VB2_BUF_STATE_DONE@GOTPAGE
Lloh21:
	ldr	x22, [x22, _VB2_BUF_STATE_DONE@GOTPAGEOFF]
	ldr	w1, [x22]
	mov	x0, x21
	bl	_v4l2_m2m_buf_done
	ldr	w0, [x19, #20]
	bl	_v4l2_m2m_dst_buf_remove
	mov	x21, x0
	ldr	w2, [x22]
	mov	x0, x19
	mov	x1, x21
	bl	_coda_m2m_buf_done
	mov	x0, x20
	bl	_mutex_unlock
	ldr	x8, [x19]
	sub	x9, x8, #1
	str	x9, [x19]
	cmp	x8, #0
	b.gt	LBB0_6
; %bb.5:
	ldr	x8, [x19, #8]
	sub	x8, x8, #1
	str	x8, [x19]
LBB0_6:
	ldr	w0, [x21, #8]
	bl	_coda_frame_type_char
	mov	x3, x0
	ldr	x8, [x21]
	ldr	w9, [x21, #8]
	ldr	w10, [x24]
Lloh22:
	adrp	x11, l_.str.2@PAGE
Lloh23:
	add	x11, x11, l_.str.2@PAGEOFF
Lloh24:
	adrp	x12, l_.str.3@PAGE
Lloh25:
	add	x12, x12, l_.str.3@PAGEOFF
	tst	w10, w9
	csel	x9, x12, x11, eq
	stp	x8, x9, [sp]
Lloh26:
	adrp	x2, l_.str.1@PAGE
Lloh27:
	add	x2, x2, l_.str.1@PAGEOFF
	mov	w0, #1
	mov	x1, x19
	bl	_coda_dbg
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpAdd	Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_CODA_CMD_ENC_PIC_BB_START,4,2  ; @CODA_CMD_ENC_PIC_BB_START
	.comm	_V4L2_BUF_FLAG_KEYFRAME,4,2     ; @V4L2_BUF_FLAG_KEYFRAME
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"frame size = %u\n"

	.comm	_CODA_RET_ENC_PIC_SLICE_NUM,4,2 ; @CODA_RET_ENC_PIC_SLICE_NUM
	.comm	_CODA_RET_ENC_PIC_FLAG,4,2      ; @CODA_RET_ENC_PIC_FLAG
	.comm	_V4L2_BUF_FLAG_PFRAME,4,2       ; @V4L2_BUF_FLAG_PFRAME
	.comm	_V4L2_BUF_FLAG_LAST,4,2         ; @V4L2_BUF_FLAG_LAST
	.comm	_CODA_RET_ENC_PIC_TYPE,4,2      ; @CODA_RET_ENC_PIC_TYPE
	.comm	_VB2_BUF_STATE_DONE,4,2         ; @VB2_BUF_STATE_DONE
l_.str.1:                               ; @.str.1
	.asciz	"job finished: encoded %c frame (%d)%s\n"

l_.str.2:                               ; @.str.2
	.asciz	" (last)"

l_.str.3:                               ; @.str.3
	.space	1

	.no_dead_strip	_coda_finish_encode
.subsections_via_symbols
