	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function flashsv2_encode_frame
_flashsv2_encode_frame:                 ## @flashsv2_encode_frame
	.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
	movq	%rcx, %r14
	movq	%rdx, %r13
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movq	24(%rdi), %r12
	movl	$0, -44(%rbp)
	movq	_AV_INPUT_BUFFER_MIN_SIZE@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	addq	24(%r12), %rdx
	xorl	%ecx, %ecx
	callq	_ff_alloc_packet2
	testl	%eax, %eax
	js	LBB0_16
## %bb.1:
	movq	(%rbx), %rax
	testq	%rax, %rax
	jne	LBB0_3
## %bb.2:
	movl	$1, -44(%rbp)
LBB0_3:
	movq	8(%rbx), %rcx
	testq	%rcx, %rcx
	jle	LBB0_6
## %bb.4:
	addq	(%r12), %rcx
	cmpq	%rcx, %rax
	jge	LBB0_5
LBB0_6:
	testq	%rax, %rax
	je	LBB0_10
## %bb.7:
	movq	16(%rbx), %rcx
	addq	(%r12), %rcx
	cmpq	%rcx, %rax
	jle	LBB0_11
## %bb.8:
	leaq	-44(%rbp), %rsi
	movq	%r12, %rdi
	callq	_recommend_keyframe
	cmpl	$0, -44(%rbp)
	je	LBB0_11
## %bb.9:
	movq	_AV_LOG_DEBUG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	(%rbx), %rcx
	leaq	L_.str(%rip), %rdx
	movq	%rbx, %rdi
	callq	_av_log
	cmpl	$0, -44(%rbp)
	jne	LBB0_10
	jmp	LBB0_11
LBB0_5:
	movl	$1, -44(%rbp)
LBB0_10:
	movq	(%r13), %rax
	movq	8(%r13), %rcx
	movl	(%rcx), %esi
	movl	(%rax), %edx
	movq	%r12, %rdi
	callq	_reconfigure_at_keyframe
	testl	%eax, %eax
	jne	LBB0_16
LBB0_11:
	cmpq	$0, 16(%r12)
	je	LBB0_13
## %bb.12:
	movq	%r12, %rdi
	callq	_optimum_dist
	movl	%eax, 8(%r12)
LBB0_13:
	movq	(%r13), %rax
	movq	8(%r13), %rcx
	movl	(%rcx), %esi
	movl	(%rax), %edx
	movl	(%r15), %r8d
	movl	8(%r15), %ecx
	movl	-44(%rbp), %r9d
	movq	%r12, %rdi
	callq	_write_bitstream
	movl	%eax, %r13d
	cmpl	$0, -44(%rbp)
	je	LBB0_15
## %bb.14:
	movq	%r12, %rdi
	callq	_new_key_frame
	movq	(%rbx), %rcx
	movq	%rcx, (%r12)
	movq	_AV_PKT_FLAG_KEY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 4(%r15)
	movq	_AV_LOG_DEBUG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.1(%rip), %rdx
	movq	%rbx, %rdi
	callq	_av_log
LBB0_15:
	movl	%r13d, (%r15)
	movl	$1, (%r14)
	xorl	%eax, %eax
LBB0_16:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AV_INPUT_BUFFER_MIN_SIZE,8,3   ## @AV_INPUT_BUFFER_MIN_SIZE
	.comm	_AV_LOG_DEBUG,4,2               ## @AV_LOG_DEBUG
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Recommending key frame at frame %d\n"

	.comm	_AV_PKT_FLAG_KEY,4,2            ## @AV_PKT_FLAG_KEY
L_.str.1:                               ## @.str.1
	.asciz	"Inserting key frame at frame %d\n"

	.no_dead_strip	_flashsv2_encode_frame
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function flashsv2_encode_frame
_flashsv2_encode_frame:                 ; @flashsv2_encode_frame
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x19, x3
	mov	x23, x2
	mov	x20, x1
	mov	x21, x0
	ldr	x22, [x0, #24]
	str	wzr, [sp, #12]
	ldr	x8, [x22, #24]
Lloh0:
	adrp	x9, _AV_INPUT_BUFFER_MIN_SIZE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _AV_INPUT_BUFFER_MIN_SIZE@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	add	x2, x9, x8
	mov	w3, #0
	bl	_ff_alloc_packet2
	tbnz	w0, #31, LBB0_16
; %bb.1:
	ldr	x8, [x21]
	cbnz	x8, LBB0_3
; %bb.2:
	mov	w9, #1
	str	w9, [sp, #12]
LBB0_3:
	ldr	x9, [x21, #8]
	cmp	x9, #1
	b.lt	LBB0_5
; %bb.4:
	ldr	x10, [x22]
	add	x9, x10, x9
	cmp	x8, x9
	b.ge	LBB0_9
LBB0_5:
	cbz	x8, LBB0_10
; %bb.6:
	ldr	x9, [x22]
	ldr	x10, [x21, #16]
	add	x9, x10, x9
	cmp	x8, x9
	b.le	LBB0_11
; %bb.7:
	add	x1, sp, #12
	mov	x0, x22
	bl	_recommend_keyframe
	ldr	w8, [sp, #12]
	cbz	w8, LBB0_11
; %bb.8:
Lloh3:
	adrp	x8, _AV_LOG_DEBUG@GOTPAGE
Lloh4:
	ldr	x8, [x8, _AV_LOG_DEBUG@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	ldr	x3, [x21]
Lloh6:
	adrp	x2, l_.str@PAGE
Lloh7:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x21
	bl	_av_log
	ldr	w8, [sp, #12]
	cbnz	w8, LBB0_10
	b	LBB0_11
LBB0_9:
	mov	w8, #1
	str	w8, [sp, #12]
LBB0_10:
	ldp	x9, x8, [x23]
	ldr	w1, [x8]
	ldr	w2, [x9]
	mov	x0, x22
	bl	_reconfigure_at_keyframe
	cbnz	w0, LBB0_16
LBB0_11:
	ldr	x8, [x22, #16]
	cbz	x8, LBB0_13
; %bb.12:
	mov	x0, x22
	bl	_optimum_dist
	str	w0, [x22, #8]
LBB0_13:
	ldp	x9, x8, [x23]
	ldr	w1, [x8]
	ldr	w2, [x9]
	ldr	w3, [x20, #8]
	ldr	w4, [x20]
	ldr	w5, [sp, #12]
	mov	x0, x22
	bl	_write_bitstream
	mov	x23, x0
	ldr	w8, [sp, #12]
	cbz	w8, LBB0_15
; %bb.14:
	mov	x0, x22
	bl	_new_key_frame
	ldr	x3, [x21]
	str	x3, [x22]
Lloh8:
	adrp	x8, _AV_PKT_FLAG_KEY@GOTPAGE
Lloh9:
	ldr	x8, [x8, _AV_PKT_FLAG_KEY@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	ldr	w9, [x20, #4]
	orr	w8, w9, w8
	str	w8, [x20, #4]
Lloh11:
	adrp	x8, _AV_LOG_DEBUG@GOTPAGE
Lloh12:
	ldr	x8, [x8, _AV_LOG_DEBUG@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
Lloh14:
	adrp	x2, l_.str.1@PAGE
Lloh15:
	add	x2, x2, l_.str.1@PAGEOFF
	mov	x0, x21
	bl	_av_log
LBB0_15:
	mov	w0, #0
	str	w23, [x20]
	mov	w8, #1
	str	w8, [x19]
LBB0_16:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_AV_INPUT_BUFFER_MIN_SIZE,8,3   ; @AV_INPUT_BUFFER_MIN_SIZE
	.comm	_AV_LOG_DEBUG,4,2               ; @AV_LOG_DEBUG
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Recommending key frame at frame %d\n"

	.comm	_AV_PKT_FLAG_KEY,4,2            ; @AV_PKT_FLAG_KEY
l_.str.1:                               ; @.str.1
	.asciz	"Inserting key frame at frame %d\n"

	.no_dead_strip	_flashsv2_encode_frame
.subsections_via_symbols
