	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function encode_nals
_encode_nals:                           ## @encode_nals
	.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
	testl	%ecx, %ecx
	je	LBB0_1
## %bb.2:
	movl	%ecx, %r14d
	movq	%rdx, %r13
	movq	%rsi, %r12
	movq	(%rdi), %rsi
	movl	(%rsi), %ebx
	movq	%rsi, -56(%rbp)                 ## 8-byte Spill
	jle	LBB0_9
## %bb.3:
	movl	%r14d, %eax
	cmpl	$9, %r14d
	jae	LBB0_5
## %bb.4:
	xorl	%ecx, %ecx
	jmp	LBB0_8
LBB0_1:
	xorl	%r15d, %r15d
	jmp	LBB0_19
LBB0_5:
	movl	%eax, %ecx
	andl	$7, %ecx
	testq	%rcx, %rcx
	movl	$8, %edx
	cmovneq	%rcx, %rdx
	movq	%rax, %rcx
	subq	%rdx, %rcx
	movd	%ebx, %xmm1
	pxor	%xmm0, %xmm0
	xorl	%edx, %edx
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movups	(%r13,%rdx,8), %xmm2
	movups	16(%r13,%rdx,8), %xmm3
	shufps	$136, %xmm3, %xmm2              ## xmm2 = xmm2[0,2],xmm3[0,2]
	paddd	%xmm2, %xmm1
	movups	32(%r13,%rdx,8), %xmm2
	movups	48(%r13,%rdx,8), %xmm3
	shufps	$136, %xmm3, %xmm2              ## xmm2 = xmm2[0,2],xmm3[0,2]
	paddd	%xmm2, %xmm0
	addq	$8, %rdx
	cmpq	%rdx, %rcx
	jne	LBB0_6
## %bb.7:
	paddd	%xmm1, %xmm0
	pshufd	$238, %xmm0, %xmm1              ## xmm1 = xmm0[2,3,2,3]
	paddd	%xmm0, %xmm1
	pshufd	$85, %xmm1, %xmm0               ## xmm0 = xmm1[1,1,1,1]
	paddd	%xmm1, %xmm0
	movd	%xmm0, %ebx
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	addl	(%r13,%rcx,8), %ebx
	incq	%rcx
	cmpq	%rcx, %rax
	jne	LBB0_8
LBB0_9:
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	movq	%r12, %rsi
	movl	%ebx, %edx
	xorl	%ecx, %ecx
	callq	_ff_alloc_packet2
	testl	%eax, %eax
	js	LBB0_10
## %bb.11:
	movq	(%r12), %r12
	testl	%r14d, %r14d
	jle	LBB0_16
## %bb.12:
	movq	-56(%rbp), %r15                 ## 8-byte Reload
	movl	(%r15), %edx
	testl	%edx, %edx
	jle	LBB0_16
## %bb.13:
	cmpl	%ebx, %edx
	jle	LBB0_15
## %bb.14:
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdx
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_av_log
	movl	$-1, %r15d
	jmp	LBB0_19
LBB0_10:
	movl	%eax, %r15d
	jmp	LBB0_19
LBB0_15:
	leaq	4(%r15), %rbx
	movl	4(%r15), %esi
	movq	%r12, %rdi
	callq	_memcpy
	movslq	(%r15), %rax
	leaq	(%r12,%rax,4), %r12
	movl	$0, (%r15)
	movq	%rbx, %rdi
	callq	_av_freep
LBB0_16:
	movl	$1, %r15d
	testl	%r14d, %r14d
	jle	LBB0_19
## %bb.17:
	movl	%r14d, %r14d
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_18:                                ## =>This Inner Loop Header: Depth=1
	movl	(%r13,%rbx,8), %edx
	movl	4(%r13,%rbx,8), %esi
	movq	%r12, %rdi
	callq	_memcpy
	movslq	(%r13,%rbx,8), %rax
	leaq	(%r12,%rax,4), %r12
	incq	%rbx
	cmpq	%rbx, %r14
	jne	LBB0_18
LBB0_19:
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AV_LOG_ERROR,4,2               ## @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Error: nal buffer is too small\n"

	.no_dead_strip	_encode_nals
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function encode_nals
_encode_nals:                           ; @encode_nals
	.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
	cbz	w3, LBB0_4
; %bb.1:
	mov	x20, x3
	mov	x19, x2
	mov	x22, x1
	mov	x21, x0
	ldr	x24, [x0]
	ldr	w23, [x24]
	cmp	w3, #1
	b.lt	LBB0_10
; %bb.2:
	mov	w8, w20
	cmp	w20, #17
	b.hs	LBB0_5
; %bb.3:
	mov	x9, #0
	b	LBB0_8
LBB0_4:
	mov	w0, #0
	b	LBB0_20
LBB0_5:
	ands	x9, x8, #0xf
	mov	w10, #16
	csel	x9, x10, x9, eq
	sub	x9, x8, x9
	movi.2d	v0, #0000000000000000
	movi.2d	v1, #0000000000000000
	mov.s	v1[0], w23
	add	x11, x19, #64
	mov	x10, x9
	movi.2d	v2, #0000000000000000
	movi.2d	v3, #0000000000000000
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	sub	x12, x11, #64
	ld2.4s	{ v4, v5 }, [x12]
	sub	x12, x11, #32
	ld2.4s	{ v6, v7 }, [x12]
	add	x12, x11, #128
	ld2.4s	{ v16, v17 }, [x11], #32
	ld2.4s	{ v18, v19 }, [x11]
	add.4s	v1, v4, v1
	add.4s	v0, v6, v0
	add.4s	v2, v16, v2
	add.4s	v3, v18, v3
	mov	x11, x12
	subs	x10, x10, #16
	b.ne	LBB0_6
; %bb.7:
	add.4s	v0, v0, v1
	add.4s	v0, v2, v0
	add.4s	v0, v3, v0
	addv.4s	s0, v0
	fmov	w23, s0
LBB0_8:
	add	x10, x19, x9, lsl #3
	sub	x8, x8, x9
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w9, [x10], #8
	add	w23, w9, w23
	subs	x8, x8, #1
	b.ne	LBB0_9
LBB0_10:
	mov	x0, x21
	mov	x1, x22
	mov	x2, x23
	mov	w3, #0
	bl	_ff_alloc_packet2
	tbnz	w0, #31, LBB0_20
; %bb.11:
	ldr	x22, [x22]
	cmp	w20, #1
	b.lt	LBB0_16
; %bb.12:
	ldr	w2, [x24]
	cmp	w2, #1
	b.lt	LBB0_16
; %bb.13:
	cmp	w2, w23
	b.le	LBB0_15
; %bb.14:
Lloh0:
	adrp	x8, _AV_LOG_ERROR@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
Lloh3:
	adrp	x2, l_.str@PAGE
Lloh4:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x21
	bl	_av_log
	mov	w0, #-1
	b	LBB0_20
LBB0_15:
	mov	x21, x24
	ldr	w1, [x21, #4]!
	mov	x0, x22
	bl	_memcpy
	ldrsw	x8, [x24]
	add	x22, x22, x8, lsl #2
	str	wzr, [x24]
	mov	x0, x21
	bl	_av_freep
LBB0_16:
	cmp	w20, #1
	b.lt	LBB0_19
; %bb.17:
	mov	w20, w20
LBB0_18:                                ; =>This Inner Loop Header: Depth=1
	ldp	w2, w1, [x19]
	mov	x0, x22
	bl	_memcpy
	ldrsw	x8, [x19]
	add	x22, x22, x8, lsl #2
	add	x19, x19, #8
	subs	x20, x20, #1
	b.ne	LBB0_18
LBB0_19:
	mov	w0, #1
LBB0_20:
	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
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_AV_LOG_ERROR,4,2               ; @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Error: nal buffer is too small\n"

	.no_dead_strip	_encode_nals
.subsections_via_symbols
