	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function avi_write_legacy_index_chunk
_avi_write_legacy_index_chunk:          ## @avi_write_legacy_index_chunk
	.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
	movl	%esi, %r15d
	movq	%rdi, %r14
	movq	(%rdi), %rax
	movq	(%rax), %r12
	callq	_avi_num_chunks
	movl	%eax, %ebx
	movl	$16, %edi
	callq	_INT64_C
	imull	%ebx, %eax
	addl	$8, %eax
	movq	_ULONG_MAX@GOTPCREL(%rip), %rcx
	xorl	%edi, %edi
	cmpl	(%rcx), %eax
	setle	%dil
	callq	_vc_container_assert
	cmpq	$0, 8(%r12)
	je	LBB0_1
## %bb.8:
	movq	%r14, %rdi
	callq	_avi_num_chunks
                                        ## kill: def $eax killed $eax def $rax
	movq	_AVI_INDEX_ENTRY_SIZE@GOTPCREL(%rip), %rcx
	imull	(%rcx), %eax
	leal	8(%rax), %edx
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_WRITE_BYTES
	movq	%r14, %rdi
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_STREAM_STATUS                  ## TAILCALL
LBB0_1:
	movq	%r14, %rdi
	callq	_STREAM_POSITION
	movl	%eax, 4(%r12)
	movl	$105, %edi
	movl	$100, %esi
	movl	$120, %edx
	movl	$49, %ecx
	callq	_VC_FOURCC
	leaq	L_.str(%rip), %rdx
	movq	%r14, %rdi
	movl	%eax, %esi
	callq	_WRITE_FOURCC
	leaq	L_.str.1(%rip), %rdx
	movq	%r14, %rdi
	movl	%r15d, %esi
	callq	_WRITE_U32
	movl	(%r12), %ebx
	xorl	%edi, %edi
	callq	_INT64_C
	movl	%ebx, %edi
	movl	%eax, %esi
	callq	_vc_container_io_seek
	movq	%r14, %rdi
	callq	_STREAM_STATUS
	movq	_VC_CONTAINER_SUCCESS@GOTPCREL(%rip), %r12
	cmpl	(%r12), %eax
	jne	LBB0_7
## %bb.2:
	movl	$4, %ebx
	leaq	L_.str.4(%rip), %r13
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_3 Depth=1
	notl	%ecx
	andl	%ecx, %eax
	movl	%eax, -44(%rbp)
	movl	-48(%rbp), %esi
	movq	%r14, %rdi
	leaq	L_.str(%rip), %rdx
	callq	_WRITE_FOURCC
	movq	%r14, %rdi
	movl	%r15d, %esi
	leaq	L_.str.2(%rip), %rdx
	callq	_WRITE_U32
	movq	%r14, %rdi
	movl	%ebx, %esi
	leaq	L_.str.3(%rip), %rdx
	callq	_WRITE_U32
	movl	-44(%rbp), %esi
	movq	%r14, %rdi
	movq	%r13, %rdx
	callq	_WRITE_U32
	movl	-44(%rbp), %eax
	addl	$9, %eax
	andl	$-2, %eax
	addl	%eax, %ebx
	movq	%r14, %rdi
	callq	_STREAM_STATUS
	cmpl	(%r12), %eax
	jne	LBB0_7
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	leaq	-52(%rbp), %rsi
	leaq	-44(%rbp), %rdx
	callq	_avi_read_index_entry
	cmpl	(%r12), %eax
	jne	LBB0_7
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	-52(%rbp), %edx
	movq	%r14, %rdi
	leaq	-48(%rbp), %rsi
	callq	_avi_chunk_id_from_track_num
	movl	-44(%rbp), %eax
	movq	_AVI_INDEX_DELTAFRAME@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	xorl	%r15d, %r15d
	testl	%eax, %ecx
	jne	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	_AVIIF_KEYFRAME@GOTPCREL(%rip), %rdx
	movl	(%rdx), %r15d
	jmp	LBB0_6
LBB0_7:
	movq	%r14, %rdi
	callq	_AVI_END_CHUNK
	movq	%r14, %rdi
	callq	_STREAM_STATUS
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ULONG_MAX,8,3                  ## @ULONG_MAX
	.comm	_AVI_INDEX_ENTRY_SIZE,8,3       ## @AVI_INDEX_ENTRY_SIZE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Chunk ID"

L_.str.1:                               ## @.str.1
	.asciz	"Chunk Size"

	.comm	_VC_CONTAINER_SUCCESS,4,2       ## @VC_CONTAINER_SUCCESS
	.comm	_AVI_INDEX_DELTAFRAME,4,2       ## @AVI_INDEX_DELTAFRAME
	.comm	_AVIIF_KEYFRAME,4,2             ## @AVIIF_KEYFRAME
L_.str.2:                               ## @.str.2
	.asciz	"dwFlags"

L_.str.3:                               ## @.str.3
	.asciz	"dwOffset"

L_.str.4:                               ## @.str.4
	.asciz	"dwSize"

	.no_dead_strip	_avi_write_legacy_index_chunk
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function avi_write_legacy_index_chunk
_avi_write_legacy_index_chunk:          ; @avi_write_legacy_index_chunk
	.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	x20, x1
	mov	x19, x0
	ldr	x8, [x0]
	ldr	x22, [x8]
	bl	_avi_num_chunks
	mov	x21, x0
	mov	w0, #16
	bl	_INT64_C
	orr	w23, wzr, #0x8
	madd	w8, w0, w21, w23
Lloh0:
	adrp	x9, _ULONG_MAX@GOTPAGE
Lloh1:
	ldr	x9, [x9, _ULONG_MAX@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	cmp	w8, w9
	cset	w0, le
	bl	_vc_container_assert
	ldr	x8, [x22, #8]
	cbz	x8, LBB0_2
; %bb.1:
	mov	x0, x19
	bl	_avi_num_chunks
Lloh3:
	adrp	x8, _AVI_INDEX_ENTRY_SIZE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _AVI_INDEX_ENTRY_SIZE@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	madd	w2, w0, w8, w23
	mov	x0, x19
	mov	x1, #0
	bl	_WRITE_BYTES
	mov	x0, x19
	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
	b	_STREAM_STATUS
LBB0_2:
	mov	x0, x19
	bl	_STREAM_POSITION
	str	w0, [x22, #4]
	mov	w0, #105
	mov	w1, #100
	mov	w2, #120
	mov	w3, #49
	bl	_VC_FOURCC
	mov	x1, x0
Lloh6:
	adrp	x2, l_.str@PAGE
Lloh7:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x19
	bl	_WRITE_FOURCC
Lloh8:
	adrp	x2, l_.str.1@PAGE
Lloh9:
	add	x2, x2, l_.str.1@PAGEOFF
	mov	x0, x19
	mov	x1, x20
	bl	_WRITE_U32
	ldr	w20, [x22]
	mov	w0, #0
	bl	_INT64_C
	mov	x1, x0
	mov	x0, x20
	bl	_vc_container_io_seek
	mov	x0, x19
	bl	_STREAM_STATUS
Lloh10:
	adrp	x26, _VC_CONTAINER_SUCCESS@GOTPAGE
Lloh11:
	ldr	x26, [x26, _VC_CONTAINER_SUCCESS@GOTPAGEOFF]
	ldr	w8, [x26]
	cmp	w0, w8
	b.ne	LBB0_6
; %bb.3:
	mov	w20, #4
Lloh12:
	adrp	x27, _AVI_INDEX_DELTAFRAME@GOTPAGE
Lloh13:
	ldr	x27, [x27, _AVI_INDEX_DELTAFRAME@GOTPAGEOFF]
Lloh14:
	adrp	x28, _AVIIF_KEYFRAME@GOTPAGE
Lloh15:
	ldr	x28, [x28, _AVIIF_KEYFRAME@GOTPAGEOFF]
Lloh16:
	adrp	x21, l_.str@PAGE
Lloh17:
	add	x21, x21, l_.str@PAGEOFF
Lloh18:
	adrp	x22, l_.str.2@PAGE
Lloh19:
	add	x22, x22, l_.str.2@PAGEOFF
Lloh20:
	adrp	x23, l_.str.3@PAGE
Lloh21:
	add	x23, x23, l_.str.3@PAGEOFF
Lloh22:
	adrp	x24, l_.str.4@PAGE
Lloh23:
	add	x24, x24, l_.str.4@PAGEOFF
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	add	x1, sp, #12
	add	x2, sp, #4
	mov	x0, x19
	bl	_avi_read_index_entry
	ldr	w8, [x26]
	cmp	w0, w8
	b.ne	LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w2, [sp, #12]
	add	x1, sp, #8
	mov	x0, x19
	bl	_avi_chunk_id_from_track_num
	ldp	w8, w1, [sp, #4]
	ldr	w9, [x27]
	ldr	w10, [x28]
	tst	w9, w8
	csel	w25, w10, wzr, eq
	bic	w8, w8, w9
	str	w8, [sp, #4]
	mov	x0, x19
	mov	x2, x21
	bl	_WRITE_FOURCC
	mov	x0, x19
	mov	x1, x25
	mov	x2, x22
	bl	_WRITE_U32
	mov	x0, x19
	mov	x1, x20
	mov	x2, x23
	bl	_WRITE_U32
	ldr	w1, [sp, #4]
	mov	x0, x19
	mov	x2, x24
	bl	_WRITE_U32
	ldr	w8, [sp, #4]
	add	w8, w8, #9
	and	w8, w8, #0xfffffffe
	add	w20, w8, w20
	mov	x0, x19
	bl	_STREAM_STATUS
	ldr	w8, [x26]
	cmp	w0, w8
	b.eq	LBB0_4
LBB0_6:
	mov	x0, x19
	bl	_AVI_END_CHUNK
	mov	x0, x19
	bl	_STREAM_STATUS
	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 AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_ULONG_MAX,8,3                  ; @ULONG_MAX
	.comm	_AVI_INDEX_ENTRY_SIZE,8,3       ; @AVI_INDEX_ENTRY_SIZE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Chunk ID"

l_.str.1:                               ; @.str.1
	.asciz	"Chunk Size"

	.comm	_VC_CONTAINER_SUCCESS,4,2       ; @VC_CONTAINER_SUCCESS
	.comm	_AVI_INDEX_DELTAFRAME,4,2       ; @AVI_INDEX_DELTAFRAME
	.comm	_AVIIF_KEYFRAME,4,2             ; @AVIIF_KEYFRAME
l_.str.2:                               ; @.str.2
	.asciz	"dwFlags"

l_.str.3:                               ; @.str.3
	.asciz	"dwOffset"

l_.str.4:                               ; @.str.4
	.asciz	"dwSize"

	.no_dead_strip	_avi_write_legacy_index_chunk
.subsections_via_symbols
