	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_WriteExtraChunk                ## -- Begin function WriteExtraChunk
	.p2align	4, 0x90
_WriteExtraChunk:                       ## @WriteExtraChunk
	.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, %r12
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	xorl	%edi, %edi
	testq	%rbx, %rbx
	setne	%dil
	callq	_assert
	xorl	%edi, %edi
	testq	%r14, %r14
	setne	%dil
	callq	_assert
	xorl	%edi, %edi
	testq	%r12, %r12
	setg	%dil
	callq	_assert
	movq	8(%rbx), %r13
	xorl	%eax, %eax
	callq	_GetProcessHeap
	movq	_HEAP_ZERO_MEMORY@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	testq	%r13, %r13
	je	LBB0_2
## %bb.1:
	movq	(%rbx), %rcx
	movq	8(%rbx), %rdx
	addq	%r12, %rcx
	addq	$8, %rcx
	movl	%eax, %edi
	callq	_HeapReAlloc
	testq	%rax, %rax
	je	LBB0_4
LBB0_5:
	movq	(%rbx), %rdi
	movq	%rax, 8(%rbx)
	leaq	(%r12,%rdi), %rcx
	addq	$8, %rcx
	movq	%rcx, (%rbx)
	movq	%r15, (%rdi,%rax)
	movq	%r12, 8(%rdi,%rax)
	movq	_AVIERR_OK@GOTPCREL(%rip), %rbx
	testq	%r14, %r14
	je	LBB0_8
## %bb.6:
	testq	%r12, %r12
	jle	LBB0_8
## %bb.7:
	addq	%rax, %rdi
	addq	$16, %rdi
	movq	%r14, %rsi
	movq	%r12, %rdx
	callq	_memcpy
	jmp	LBB0_8
LBB0_2:
	leal	8(%r12), %edx
	movl	%eax, %edi
	callq	_HeapAlloc
	testq	%rax, %rax
	jne	LBB0_5
LBB0_4:
	movq	_AVIERR_MEMORY@GOTPCREL(%rip), %rbx
LBB0_8:
	movl	(%rbx), %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_HEAP_ZERO_MEMORY,4,2           ## @HEAP_ZERO_MEMORY
	.comm	_AVIERR_MEMORY,4,2              ## @AVIERR_MEMORY
	.comm	_AVIERR_OK,4,2                  ## @AVIERR_OK
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_WriteExtraChunk                ; -- Begin function WriteExtraChunk
	.p2align	2
_WriteExtraChunk:                       ; @WriteExtraChunk
	.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	x19, x3
	mov	x20, x2
	mov	x21, x1
	mov	x22, x0
	cmp	x0, #0
	cset	w0, ne
	bl	_assert
	cmp	x20, #0
	cset	w0, ne
	bl	_assert
	cmp	x19, #0
	cset	w0, gt
	bl	_assert
	ldr	x23, [x22, #8]
	bl	_GetProcessHeap
Lloh0:
	adrp	x8, _HEAP_ZERO_MEMORY@GOTPAGE
Lloh1:
	ldr	x8, [x8, _HEAP_ZERO_MEMORY@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	cbz	x23, LBB0_5
; %bb.1:
	ldp	x8, x2, [x22]
	add	x8, x19, x8
	add	x3, x8, #8
	bl	_HeapReAlloc
	cbz	x0, LBB0_6
LBB0_2:
	ldr	x8, [x22]
	add	x9, x8, x0
	add	x8, x19, x8
	add	x8, x8, #8
	stp	x8, x0, [x22]
	stp	x21, x19, [x9]
Lloh3:
	adrp	x8, _AVIERR_OK@GOTPAGE
Lloh4:
	ldr	x8, [x8, _AVIERR_OK@GOTPAGEOFF]
	cbz	x20, LBB0_7
; %bb.3:
	cmp	x19, #1
	b.lt	LBB0_7
; %bb.4:
	add	x0, x9, #16
	mov	x1, x20
	mov	x2, x19
	bl	_memcpy
Lloh5:
	adrp	x8, _AVIERR_OK@GOTPAGE
Lloh6:
	ldr	x8, [x8, _AVIERR_OK@GOTPAGEOFF]
	b	LBB0_7
LBB0_5:
	add	w2, w19, #8
	bl	_HeapAlloc
	cbnz	x0, LBB0_2
LBB0_6:
Lloh7:
	adrp	x8, _AVIERR_MEMORY@GOTPAGE
Lloh8:
	ldr	x8, [x8, _AVIERR_MEMORY@GOTPAGEOFF]
LBB0_7:
	ldr	w0, [x8]
	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 AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.cfi_endproc
                                        ; -- End function
	.comm	_HEAP_ZERO_MEMORY,4,2           ; @HEAP_ZERO_MEMORY
	.comm	_AVIERR_MEMORY,4,2              ; @AVIERR_MEMORY
	.comm	_AVIERR_OK,4,2                  ; @AVIERR_OK
.subsections_via_symbols
