	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function avi_write_packet_internal
_avi_write_packet_internal:             ## @avi_write_packet_internal
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r12
	movq	%rdi, %rbx
	movslq	(%rsi), %rcx
	movl	4(%rsi), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	16(%rdi), %r13
	movq	(%rdi), %r15
	movq	8(%rdi), %rax
	movq	%rcx, -72(%rbp)                 ## 8-byte Spill
	movq	(%rax,%rcx,8), %rax
	movq	(%rax), %r14
	movq	8(%rax), %rdx
	movq	8(%rsi), %rax
	movq	_AV_NOPTS_VALUE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_2
## %bb.1:
	addq	16(%r12), %rax
	movq	%rax, (%rdx)
LBB0_2:
	movq	%rdx, -64(%rbp)                 ## 8-byte Spill
	incl	12(%rdx)
	movq	_AVIO_SEEKABLE_NORMAL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r15)
	je	LBB0_7
## %bb.3:
	movq	%r15, %rdi
	callq	_avio_tell
	subq	(%r13), %rax
	movq	_AVI_MAX_RIFF_SIZE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jle	LBB0_7
## %bb.4:
	movq	%rbx, %rdi
	callq	_avi_write_ix
	movq	8(%r13), %rsi
	movq	%r15, %rdi
	callq	_ff_end_tag
	cmpl	$1, 16(%r13)
	jne	LBB0_6
## %bb.5:
	movq	%rbx, %rdi
	callq	_avi_write_idx1
LBB0_6:
	movq	(%r13), %rsi
	movq	%r15, %rdi
	callq	_ff_end_tag
	leaq	L_.str(%rip), %rdx
	leaq	L_.str.1(%rip), %rcx
	movq	%rbx, %rdi
	movq	%r15, %rsi
	callq	_avi_start_new_riff
	movq	%rax, 8(%r13)
LBB0_7:
	movq	(%r14), %rdx
	leaq	-49(%rbp), %rdi
	movq	-72(%rbp), %r13                 ## 8-byte Reload
	movl	%r13d, %esi
	callq	_avi_stream2fourcc
	movq	_AV_PKT_FLAG_KEY@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	xorl	%ecx, %ecx
	testl	%eax, 24(%r12)
	setne	%al
	movq	(%r14), %rdx
	movq	_AVMEDIA_TYPE_AUDIO@GOTPCREL(%rip), %rsi
	cmpq	(%rsi), %rdx
	movl	-44(%rbp), %r14d                ## 4-byte Reload
	jne	LBB0_9
## %bb.8:
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	addl	%r14d, 8(%rdx)
LBB0_9:
	movq	(%rbx), %rdx
	movq	_AVIO_SEEKABLE_NORMAL@GOTPCREL(%rip), %rsi
	movl	(%rsi), %esi
	testl	%esi, (%rdx)
	je	LBB0_12
## %bb.10:
	movb	%al, %cl
	shll	$4, %ecx
	movq	%rbx, %rdi
	movl	%r13d, %esi
	xorl	%edx, %edx
	movl	%r14d, %r8d
	callq	_avi_add_ientry
	testl	%eax, %eax
	js	LBB0_11
LBB0_12:
	leaq	-49(%rbp), %rsi
	movq	%r15, %rdi
	movl	$4, %edx
	callq	_avio_write
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_avio_wl32
	movq	32(%r12), %rsi
	movq	%r15, %rdi
	movl	%r14d, %edx
	callq	_avio_write
	xorl	%ebx, %ebx
	testb	$1, %r14b
	je	LBB0_14
## %bb.13:
	xorl	%ebx, %ebx
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_avio_w8
	jmp	LBB0_14
LBB0_11:
	movl	%eax, %ebx
LBB0_14:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AV_NOPTS_VALUE,8,3             ## @AV_NOPTS_VALUE
	.comm	_AVIO_SEEKABLE_NORMAL,4,2       ## @AVIO_SEEKABLE_NORMAL
	.comm	_AVI_MAX_RIFF_SIZE,8,3          ## @AVI_MAX_RIFF_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"AVIX"

L_.str.1:                               ## @.str.1
	.asciz	"movi"

	.comm	_AV_PKT_FLAG_KEY,4,2            ## @AV_PKT_FLAG_KEY
	.comm	_AVMEDIA_TYPE_AUDIO,8,3         ## @AVMEDIA_TYPE_AUDIO
	.no_dead_strip	_avi_write_packet_internal
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function avi_write_packet_internal
_avi_write_packet_internal:             ; @avi_write_packet_internal
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x21, x1
	mov	x22, x0
	ldp	w23, w20, [x1]
                                        ; kill: def $w23 killed $w23 def $x23
	sxtw	x23, w23
	ldp	x8, x27, [x0, #8]
	ldr	x19, [x0]
	ldr	x8, [x8, x23, lsl #3]
	ldp	x25, x24, [x8]
	ldr	x8, [x1, #8]
Lloh0:
	adrp	x9, _AV_NOPTS_VALUE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _AV_NOPTS_VALUE@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.eq	LBB0_2
; %bb.1:
	ldr	x9, [x21, #16]
	add	x8, x9, x8
	str	x8, [x24]
LBB0_2:
	ldr	w8, [x24, #12]
	add	w8, w8, #1
	str	w8, [x24, #12]
	ldr	w8, [x19]
Lloh3:
	adrp	x26, _AVIO_SEEKABLE_NORMAL@GOTPAGE
Lloh4:
	ldr	x26, [x26, _AVIO_SEEKABLE_NORMAL@GOTPAGEOFF]
	ldr	w9, [x26]
	tst	w9, w8
	b.eq	LBB0_7
; %bb.3:
	mov	x0, x19
	bl	_avio_tell
	ldr	x8, [x27]
Lloh5:
	adrp	x9, _AVI_MAX_RIFF_SIZE@GOTPAGE
Lloh6:
	ldr	x9, [x9, _AVI_MAX_RIFF_SIZE@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
	sub	x8, x0, x8
	cmp	x8, x9
	b.le	LBB0_7
; %bb.4:
	mov	x0, x22
	bl	_avi_write_ix
	ldr	x1, [x27, #8]
	mov	x0, x19
	bl	_ff_end_tag
	ldr	w8, [x27, #16]
	cmp	w8, #1
	b.ne	LBB0_6
; %bb.5:
	mov	x0, x22
	bl	_avi_write_idx1
LBB0_6:
	ldr	x1, [x27]
	mov	x0, x19
	bl	_ff_end_tag
Lloh8:
	adrp	x2, l_.str@PAGE
Lloh9:
	add	x2, x2, l_.str@PAGEOFF
Lloh10:
	adrp	x3, l_.str.1@PAGE
Lloh11:
	add	x3, x3, l_.str.1@PAGEOFF
	mov	x0, x22
	mov	x1, x19
	bl	_avi_start_new_riff
	str	x0, [x27, #8]
LBB0_7:
	ldr	x2, [x25]
	add	x0, sp, #11
	mov	x1, x23
	bl	_avi_stream2fourcc
	ldr	w8, [x21, #24]
Lloh12:
	adrp	x9, _AV_PKT_FLAG_KEY@GOTPAGE
Lloh13:
	ldr	x9, [x9, _AV_PKT_FLAG_KEY@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	tst	w9, w8
	cset	w8, ne
	ldr	x9, [x25]
Lloh15:
	adrp	x10, _AVMEDIA_TYPE_AUDIO@GOTPAGE
Lloh16:
	ldr	x10, [x10, _AVMEDIA_TYPE_AUDIO@GOTPAGEOFF]
Lloh17:
	ldr	x10, [x10]
	cmp	x9, x10
	b.ne	LBB0_9
; %bb.8:
	ldr	w9, [x24, #8]
	add	w9, w9, w20
	str	w9, [x24, #8]
LBB0_9:
	ldr	x9, [x22]
	ldr	w9, [x9]
	ldr	w10, [x26]
	tst	w10, w9
	b.eq	LBB0_11
; %bb.10:
	lsl	w3, w8, #4
	mov	x0, x22
	mov	x1, x23
	mov	x2, #0
	mov	x4, x20
	bl	_avi_add_ientry
	tbnz	w0, #31, LBB0_14
LBB0_11:
	add	x1, sp, #11
	mov	x0, x19
	mov	w2, #4
	bl	_avio_write
	mov	x0, x19
	mov	x1, x20
	bl	_avio_wl32
	ldr	x1, [x21, #32]
	mov	x0, x19
	mov	x2, x20
	bl	_avio_write
	tbz	w20, #0, LBB0_13
; %bb.12:
	mov	x0, x19
	mov	w1, #0
	bl	_avio_w8
LBB0_13:
	mov	w0, #0
LBB0_14:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_AV_NOPTS_VALUE,8,3             ; @AV_NOPTS_VALUE
	.comm	_AVIO_SEEKABLE_NORMAL,4,2       ; @AVIO_SEEKABLE_NORMAL
	.comm	_AVI_MAX_RIFF_SIZE,8,3          ; @AVI_MAX_RIFF_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"AVIX"

l_.str.1:                               ; @.str.1
	.asciz	"movi"

	.comm	_AV_PKT_FLAG_KEY,4,2            ; @AV_PKT_FLAG_KEY
	.comm	_AVMEDIA_TYPE_AUDIO,8,3         ; @AVMEDIA_TYPE_AUDIO
	.no_dead_strip	_avi_write_packet_internal
.subsections_via_symbols
