	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function avi_writer_close
_avi_writer_close:                      ## @avi_writer_close
	.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	%rdi, %r12
	movq	_VC_CONTAINER_SUCCESS@GOTPCREL(%rip), %rbx
	movq	16(%rdi), %rax
	movq	(%rax), %r14
	movq	64(%r14), %rsi
	testq	%rsi, %rsi
	je	LBB0_1
## %bb.2:
	movq	8(%r12), %rax
	movq	(%r14), %rcx
	movq	(%rax,%rcx,8), %rax
	movq	(%rax), %rax
	movq	(%rax), %r13
	movq	%r12, %rdi
	callq	_avi_finish_data_chunk
	movq	%rax, %r15
	cmpq	(%rbx), %rax
	je	LBB0_4
## %bb.3:
	leaq	L_.str(%rip), %rsi
	movq	%r12, %rdi
	callq	_LOG_DEBUG
LBB0_4:
	movq	(%r14), %rsi
	movq	64(%r14), %rdx
	movq	%r12, %rdi
	xorl	%ecx, %ecx
	callq	_avi_write_index_entry
	incl	16(%r13)
	movq	64(%r14), %rsi
	addq	%rsi, 8(%r13)
	movl	(%r13), %edi
	callq	_MAX
	movl	%eax, (%r13)
	movq	$0, 64(%r14)
	jmp	LBB0_5
LBB0_1:
	movq	(%rbx), %r15
LBB0_5:
	movq	%r12, %rdi
	callq	_STREAM_SEEKABLE
	testq	%rax, %rax
	je	LBB0_16
## %bb.6:
	movq	%r12, %rdi
	callq	_avi_write_standard_index_data
	cmpq	(%rbx), %rax
	je	LBB0_8
## %bb.7:
	movq	%rax, 56(%r14)
	leaq	L_.str.1(%rip), %rsi
	movq	%r12, %rdi
	callq	_LOG_DEBUG
LBB0_8:
	movq	%r12, %rdi
	callq	_STREAM_POSITION
	movslq	8(%r14), %rcx
	subq	%rcx, %rax
	addq	$-8, %rax
	movq	%rax, 40(%r14)
	movq	%r12, %rdi
	callq	_avi_write_legacy_index_data
	cmpq	(%rbx), %rax
	je	LBB0_10
## %bb.9:
	movq	%rax, 56(%r14)
	leaq	L_.str.2(%rip), %rsi
	movq	%r12, %rdi
	callq	_LOG_DEBUG
LBB0_10:
	movq	%r12, %rdi
	callq	_STREAM_POSITION
	movq	%rax, %r15
	movq	%r12, %rdi
	movl	$4, %esi
	callq	_SEEK
	leaq	L_.str.3(%rip), %rdx
	movq	%r12, %rdi
	movq	%r15, %rsi
	callq	_WRITE_U32
	movq	%r12, %rdi
	callq	_STREAM_STATUS
	cmpq	(%rbx), %rax
	je	LBB0_12
## %bb.11:
	leaq	L_.str.4(%rip), %rsi
	movq	%r12, %rdi
	callq	_LOG_DEBUG
LBB0_12:
	movl	12(%r14), %esi
	movq	%r12, %rdi
	callq	_SEEK
	movl	48(%r14), %esi
	movq	%r12, %rdi
	callq	_avi_write_header_list
	movq	%rax, %r15
	cmpq	(%rbx), %rax
	je	LBB0_14
## %bb.13:
	leaq	L_.str.5(%rip), %rsi
	movq	%r12, %rdi
	callq	_LOG_DEBUG
LBB0_14:
	movl	8(%r14), %esi
	addl	$4, %esi
	movq	%r12, %rdi
	callq	_SEEK
	movq	40(%r14), %rsi
	leaq	L_.str.6(%rip), %rdx
	movq	%r12, %rdi
	callq	_WRITE_U32
	movq	%r12, %rdi
	callq	_STREAM_STATUS
	cmpq	(%rbx), %rax
	je	LBB0_16
## %bb.15:
	leaq	L_.str.7(%rip), %rsi
	movq	%r12, %rdi
	callq	_LOG_DEBUG
LBB0_16:
	leaq	32(%r14), %rsi
	movq	%r12, %rdi
	callq	_vc_container_writer_extraio_delete
	cmpq	$0, 24(%r14)
	je	LBB0_18
## %bb.17:
	leaq	24(%r14), %rsi
	movq	%r12, %rdi
	callq	_vc_container_writer_extraio_delete
LBB0_18:
	cmpl	$0, (%r12)
	je	LBB0_21
## %bb.19:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_20:                                ## =>This Inner Loop Header: Depth=1
	movq	8(%r12), %rax
	movq	(%rax,%rbx,8), %rsi
	movq	%r12, %rdi
	callq	_vc_container_free_track
	incq	%rbx
	movl	(%r12), %eax
	cmpq	%rax, %rbx
	jb	LBB0_20
LBB0_21:
	movl	$0, (%r12)
	movq	$0, 8(%r12)
	movq	16(%r14), %rdi
	testq	%rdi, %rdi
	je	LBB0_23
## %bb.22:
	callq	_free
LBB0_23:
	movq	%r14, %rdi
	callq	_free
	movq	%r15, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_VC_CONTAINER_SUCCESS,8,3       ## @VC_CONTAINER_SUCCESS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"warning, writing failed, last chunk truncated"

L_.str.1:                               ## @.str.1
	.asciz	"warning, writing standard index data failed, file will be malformed"

L_.str.2:                               ## @.str.2
	.asciz	"warning, writing legacy index data failed, file will be malformed"

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

L_.str.4:                               ## @.str.4
	.asciz	"warning, rewriting 'fileSize' failed, file will be malformed"

L_.str.5:                               ## @.str.5
	.asciz	"warning, rewriting 'hdrl' failed, file will be malformed"

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

L_.str.7:                               ## @.str.7
	.asciz	"warning, rewriting 'movi' list size failed, file will be malformed"

	.no_dead_strip	_avi_writer_close
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function avi_writer_close
_avi_writer_close:                      ; @avi_writer_close
	.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
	mov	x20, x0
Lloh0:
	adrp	x22, _VC_CONTAINER_SUCCESS@GOTPAGE
Lloh1:
	ldr	x22, [x22, _VC_CONTAINER_SUCCESS@GOTPAGEOFF]
	ldr	x8, [x0, #16]
	ldr	x19, [x8]
	ldr	x1, [x19, #64]
	cbz	x1, LBB0_4
; %bb.1:
	ldr	x8, [x20, #8]
	ldr	x9, [x19]
	ldr	x8, [x8, x9, lsl #3]
	ldr	x8, [x8]
	ldr	x23, [x8]
	mov	x0, x20
	bl	_avi_finish_data_chunk
	mov	x21, x0
	ldr	x8, [x22]
	cmp	x0, x8
	b.eq	LBB0_3
; %bb.2:
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	bl	_LOG_DEBUG
LBB0_3:
	ldr	x1, [x19]
	ldr	x2, [x19, #64]
	mov	x0, x20
	mov	w3, #0
	bl	_avi_write_index_entry
	ldr	w8, [x23, #16]
	add	w8, w8, #1
	str	w8, [x23, #16]
	ldr	x1, [x19, #64]
	ldr	x8, [x23, #8]
	add	x8, x8, x1
	str	x8, [x23, #8]
	ldr	w0, [x23]
	bl	_MAX
	str	w0, [x23]
	str	xzr, [x19, #64]
	b	LBB0_5
LBB0_4:
	ldr	x21, [x22]
LBB0_5:
	mov	x0, x20
	bl	_STREAM_SEEKABLE
	cbz	x0, LBB0_16
; %bb.6:
	mov	x0, x20
	bl	_avi_write_standard_index_data
	ldr	x8, [x22]
	cmp	x0, x8
	b.eq	LBB0_8
; %bb.7:
	str	x0, [x19, #56]
Lloh4:
	adrp	x1, l_.str.1@PAGE
Lloh5:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x20
	bl	_LOG_DEBUG
LBB0_8:
	mov	x0, x20
	bl	_STREAM_POSITION
	ldrsw	x8, [x19, #8]
	sub	x8, x0, x8
	sub	x8, x8, #8
	str	x8, [x19, #40]
	mov	x0, x20
	bl	_avi_write_legacy_index_data
	ldr	x8, [x22]
	cmp	x0, x8
	b.eq	LBB0_10
; %bb.9:
	str	x0, [x19, #56]
Lloh6:
	adrp	x1, l_.str.2@PAGE
Lloh7:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x20
	bl	_LOG_DEBUG
LBB0_10:
	mov	x0, x20
	bl	_STREAM_POSITION
	mov	x21, x0
	mov	x0, x20
	mov	w1, #4
	bl	_SEEK
Lloh8:
	adrp	x2, l_.str.3@PAGE
Lloh9:
	add	x2, x2, l_.str.3@PAGEOFF
	mov	x0, x20
	mov	x1, x21
	bl	_WRITE_U32
	mov	x0, x20
	bl	_STREAM_STATUS
	ldr	x8, [x22]
	cmp	x0, x8
	b.eq	LBB0_12
; %bb.11:
Lloh10:
	adrp	x1, l_.str.4@PAGE
Lloh11:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x0, x20
	bl	_LOG_DEBUG
LBB0_12:
	ldr	w1, [x19, #12]
	mov	x0, x20
	bl	_SEEK
	ldr	w1, [x19, #48]
	mov	x0, x20
	bl	_avi_write_header_list
	mov	x21, x0
	ldr	x8, [x22]
	cmp	x0, x8
	b.eq	LBB0_14
; %bb.13:
Lloh12:
	adrp	x1, l_.str.5@PAGE
Lloh13:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	x0, x20
	bl	_LOG_DEBUG
LBB0_14:
	ldr	w8, [x19, #8]
	add	w1, w8, #4
	mov	x0, x20
	bl	_SEEK
	ldr	x1, [x19, #40]
Lloh14:
	adrp	x2, l_.str.6@PAGE
Lloh15:
	add	x2, x2, l_.str.6@PAGEOFF
	mov	x0, x20
	bl	_WRITE_U32
	mov	x0, x20
	bl	_STREAM_STATUS
	ldr	x8, [x22]
	cmp	x0, x8
	b.eq	LBB0_16
; %bb.15:
Lloh16:
	adrp	x1, l_.str.7@PAGE
Lloh17:
	add	x1, x1, l_.str.7@PAGEOFF
	mov	x0, x20
	bl	_LOG_DEBUG
LBB0_16:
	add	x1, x19, #32
	mov	x0, x20
	bl	_vc_container_writer_extraio_delete
	mov	x1, x19
	ldr	x8, [x1, #24]!
	cbz	x8, LBB0_18
; %bb.17:
	mov	x0, x20
	bl	_vc_container_writer_extraio_delete
LBB0_18:
	ldr	w8, [x20]
	cbz	w8, LBB0_21
; %bb.19:
	mov	x22, #0
LBB0_20:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x20, #8]
	ldr	x1, [x8, x22, lsl #3]
	mov	x0, x20
	bl	_vc_container_free_track
	add	x22, x22, #1
	ldr	w8, [x20]
	cmp	x22, x8
	b.lo	LBB0_20
LBB0_21:
	str	wzr, [x20]
	str	xzr, [x20, #8]
	ldr	x0, [x19, #16]
	cbz	x0, LBB0_23
; %bb.22:
	bl	_free
LBB0_23:
	mov	x0, x19
	bl	_free
	mov	x0, x21
	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 AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_VC_CONTAINER_SUCCESS,8,3       ; @VC_CONTAINER_SUCCESS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"warning, writing failed, last chunk truncated"

l_.str.1:                               ; @.str.1
	.asciz	"warning, writing standard index data failed, file will be malformed"

l_.str.2:                               ; @.str.2
	.asciz	"warning, writing legacy index data failed, file will be malformed"

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

l_.str.4:                               ; @.str.4
	.asciz	"warning, rewriting 'fileSize' failed, file will be malformed"

l_.str.5:                               ; @.str.5
	.asciz	"warning, rewriting 'hdrl' failed, file will be malformed"

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

l_.str.7:                               ; @.str.7
	.asciz	"warning, rewriting 'movi' list size failed, file will be malformed"

	.no_dead_strip	_avi_writer_close
.subsections_via_symbols
