	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mkv_write_packet
_mkv_write_packet:                      ## @mkv_write_packet
	.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
	movq	%rsi, %r13
	movq	%rdi, %r14
	movq	(%rdi), %rax
	movq	16(%rdi), %r15
	movq	(%rsi), %rcx
	movq	(%rax,%rcx,8), %rax
	movq	8(%rax), %rax
	movl	(%rax), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	_AV_PKT_FLAG_KEY@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	andl	8(%rsi), %r12d
	callq	_mkv_check_new_extra_data
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_28
## %bb.1:
	movl	%r12d, -52(%rbp)                ## 4-byte Spill
	testl	%r12d, %r12d
	setne	-48(%rbp)                       ## 1-byte Folded Spill
	movq	96(%r15), %rax
	movq	(%r13), %rcx
	shlq	$4, %rcx
	xorl	%edx, %edx
	cmpq	$0, 8(%rax,%rcx)
	sete	%dl
	movq	16(%r13,%rdx,8), %r12
	subq	(%r15), %r12
	addq	(%rax,%rcx), %r12
	movl	88(%r15), %edi
	callq	_avio_tell
	movq	72(%r15), %rdx
	movq	_AVMEDIA_TYPE_VIDEO@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testq	%rdx, %rdx
	je	LBB0_4
## %bb.2:
	cmpl	%ecx, -44(%rbp)                 ## 4-byte Folded Reload
	jne	LBB0_4
## %bb.3:
	xorl	%edx, %edx
	movb	-48(%rbp), %al                  ## 1-byte Reload
	movb	%al, %dl
LBB0_8:
	movl	8(%r15), %eax
	cmpl	$-1, %eax
	je	LBB0_19
## %bb.9:
	testl	%edx, %edx
	je	LBB0_19
## %bb.10:
	leaq	8(%r15), %r12
	movq	%r14, %rdi
	callq	_mkv_end_cluster
	movl	$1, %edx
	jmp	LBB0_18
LBB0_4:
	testq	%rdx, %rdx
	je	LBB0_11
## %bb.5:
	movq	_AVMEDIA_TYPE_AUDIO@GOTPCREL(%rip), %rsi
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	cmpl	(%rsi), %edi
	jne	LBB0_11
## %bb.6:
	movl	$1, %edx
	cmpl	$-1, 8(%r15)
	je	LBB0_8
## %bb.7:
	cmpq	16(%r15), %r12
	jg	LBB0_8
	jmp	LBB0_17
LBB0_11:
	testq	%rdx, %rdx
	je	LBB0_12
LBB0_17:
	leaq	8(%r15), %r12
	xorl	%edx, %edx
LBB0_18:
	movl	(%r12), %eax
LBB0_19:
	testl	%eax, %eax
	jne	LBB0_25
## %bb.20:
	movl	%edx, %r12d
	movl	8(%r14), %eax
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movq	(%r13), %rax
	movq	16(%r13), %rdi
	movq	(%r14), %rcx
	movq	(%rcx,%rax,8), %rax
	movl	(%rax), %esi
	movq	_AV_TIME_BASE_Q@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_av_rescale_q
	cmpl	$0, -52(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_23
## %bb.21:
	cmpq	$0, 80(%r15)
	movq	_AVIO_DATA_MARKER_SYNC_POINT@GOTPCREL(%rip), %rcx
	je	LBB0_24
## %bb.22:
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	movq	_AVMEDIA_TYPE_VIDEO@GOTPCREL(%rip), %rsi
	cmpl	(%rsi), %edx
	je	LBB0_24
LBB0_23:
	movq	_AVIO_DATA_MARKER_BOUNDARY_POINT@GOTPCREL(%rip), %rcx
LBB0_24:
	movl	(%rcx), %edx
	movl	-48(%rbp), %edi                 ## 4-byte Reload
	movl	%eax, %esi
	callq	_avio_write_marker
	movl	%r12d, %edx
LBB0_25:
	leaq	32(%r15), %r12
	cmpq	$0, 64(%r15)
	jle	LBB0_29
## %bb.26:
	xorl	%eax, %eax
	cmpq	$0, 72(%r15)
	cmovel	%eax, %edx
	movq	%r14, %rdi
	movq	%r12, %rsi
	callq	_mkv_write_packet_internal
	movl	%eax, %ebx
	movq	%r12, %rdi
	callq	_av_packet_unref
	testl	%ebx, %ebx
	js	LBB0_27
LBB0_29:
	movq	_AVMEDIA_TYPE_AUDIO@GOTPCREL(%rip), %rax
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	cmpl	(%rax), %ecx
	jne	LBB0_32
## %bb.30:
	cmpq	$0, 32(%r13)
	jle	LBB0_28
## %bb.31:
	movq	%r12, %rdi
	movq	%r13, %rsi
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_av_packet_ref                  ## TAILCALL
LBB0_32:
	movq	%r14, %rdi
	movq	%r13, %rsi
	xorl	%edx, %edx
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_mkv_write_packet_internal      ## TAILCALL
LBB0_27:
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdx
	movq	%r14, %rdi
	movl	%ebx, %ecx
	callq	_av_log
LBB0_28:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	movl	$1, %edx
	cmpl	24(%r15), %eax
	jg	LBB0_8
## %bb.13:
	cmpq	16(%r15), %r12
	jg	LBB0_8
## %bb.14:
	cmpl	%ecx, -44(%rbp)                 ## 4-byte Folded Reload
	jne	LBB0_17
## %bb.15:
	cmpl	$0, -52(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_17
## %bb.16:
	cmpl	$4096, %eax                     ## imm = 0x1000
	jg	LBB0_8
	jmp	LBB0_17
	.cfi_endproc
                                        ## -- End function
	.comm	_AV_PKT_FLAG_KEY,4,2            ## @AV_PKT_FLAG_KEY
	.comm	_AVMEDIA_TYPE_VIDEO,4,2         ## @AVMEDIA_TYPE_VIDEO
	.comm	_AVMEDIA_TYPE_AUDIO,4,2         ## @AVMEDIA_TYPE_AUDIO
	.comm	_AV_TIME_BASE_Q,4,2             ## @AV_TIME_BASE_Q
	.comm	_AVIO_DATA_MARKER_SYNC_POINT,4,2 ## @AVIO_DATA_MARKER_SYNC_POINT
	.comm	_AVIO_DATA_MARKER_BOUNDARY_POINT,4,2 ## @AVIO_DATA_MARKER_BOUNDARY_POINT
	.comm	_AV_LOG_ERROR,4,2               ## @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Could not write cached audio packet ret:%d\n"

	.no_dead_strip	_mkv_write_packet
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mkv_write_packet
_mkv_write_packet:                      ; @mkv_write_packet
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	x19, x1
	mov	x20, x0
	ldr	x24, [x0, #16]
	ldr	x8, [x0]
	ldr	x9, [x1]
	ldr	x8, [x8, x9, lsl #3]
	ldr	x8, [x8, #8]
	ldr	w23, [x8]
	ldr	w22, [x1, #8]
Lloh0:
	adrp	x8, _AV_PKT_FLAG_KEY@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AV_PKT_FLAG_KEY@GOTPAGEOFF]
Lloh2:
	ldr	w25, [x8]
	bl	_mkv_check_new_extra_data
	mov	x21, x0
	tbnz	w0, #31, LBB0_31
; %bb.1:
	and	w26, w25, w22
	cmp	w26, #0
	cset	w27, ne
	ldr	x8, [x24, #96]
	ldr	x9, [x19]
	add	x8, x8, x9, lsl #4
	mov	w9, #16
	mov	w10, #24
	ldp	x22, x11, [x8]
	cmp	x11, #0
	csel	x8, x10, x9, eq
	ldr	x25, [x19, x8]
	ldr	x28, [x24]
	ldr	w0, [x24, #88]
	bl	_avio_tell
	ldr	x10, [x24, #72]
Lloh3:
	adrp	x8, _AVMEDIA_TYPE_VIDEO@GOTPAGE
Lloh4:
	ldr	x8, [x8, _AVMEDIA_TYPE_VIDEO@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cbz	x10, LBB0_3
; %bb.2:
	cmp	w23, w8
	b.eq	LBB0_14
LBB0_3:
	sub	x9, x25, x28
	add	x9, x22, x9
	cbz	x10, LBB0_7
; %bb.4:
Lloh6:
	adrp	x11, _AVMEDIA_TYPE_AUDIO@GOTPAGE
Lloh7:
	ldr	x11, [x11, _AVMEDIA_TYPE_AUDIO@GOTPAGEOFF]
Lloh8:
	ldr	w11, [x11]
	cmp	w23, w11
	b.ne	LBB0_7
; %bb.5:
	ldr	w8, [x24, #8]
	cmn	w8, #1
	b.eq	LBB0_13
; %bb.6:
	ldr	x8, [x24, #16]
	cmp	x9, x8
	b.le	LBB0_8
	b	LBB0_13
LBB0_7:
	cbz	x10, LBB0_9
LBB0_8:
	mov	w27, #0
	add	x22, x24, #8
	b	LBB0_17
LBB0_9:
	ldr	w10, [x24, #24]
	cmp	w0, w10
	b.gt	LBB0_13
; %bb.10:
	ldr	x10, [x24, #16]
	cmp	x9, x10
	b.gt	LBB0_13
; %bb.11:
	cmp	w23, w8
	ccmp	w26, #0, #4, eq
	b.eq	LBB0_8
; %bb.12:
	cmp	w0, #1, lsl #12                 ; =4096
	b.le	LBB0_8
LBB0_13:
	mov	w27, #1
LBB0_14:
	mov	x22, x24
	ldr	w8, [x22, #8]!
	cmn	w8, #1
	b.eq	LBB0_18
; %bb.15:
	cbz	w27, LBB0_18
; %bb.16:
	mov	x0, x20
	bl	_mkv_end_cluster
	mov	w27, #1
LBB0_17:
	ldr	w8, [x22]
LBB0_18:
	cbnz	w8, LBB0_24
; %bb.19:
	ldr	w22, [x20, #8]
	ldr	x0, [x19, #16]
	ldr	x8, [x20]
	ldr	x9, [x19]
	ldr	x8, [x8, x9, lsl #3]
	ldr	w1, [x8]
Lloh9:
	adrp	x8, _AV_TIME_BASE_Q@GOTPAGE
Lloh10:
	ldr	x8, [x8, _AV_TIME_BASE_Q@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
	bl	_av_rescale_q
	mov	x1, x0
	cbz	w26, LBB0_22
; %bb.20:
	ldr	x9, [x24, #80]
Lloh12:
	adrp	x8, _AVIO_DATA_MARKER_SYNC_POINT@GOTPAGE
Lloh13:
	ldr	x8, [x8, _AVIO_DATA_MARKER_SYNC_POINT@GOTPAGEOFF]
	cbz	x9, LBB0_23
; %bb.21:
Lloh14:
	adrp	x9, _AVMEDIA_TYPE_VIDEO@GOTPAGE
Lloh15:
	ldr	x9, [x9, _AVMEDIA_TYPE_VIDEO@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	cmp	w23, w9
	b.eq	LBB0_23
LBB0_22:
Lloh17:
	adrp	x8, _AVIO_DATA_MARKER_BOUNDARY_POINT@GOTPAGE
Lloh18:
	ldr	x8, [x8, _AVIO_DATA_MARKER_BOUNDARY_POINT@GOTPAGEOFF]
LBB0_23:
	ldr	w2, [x8]
	mov	x0, x22
	bl	_avio_write_marker
LBB0_24:
	add	x22, x24, #32
	ldr	x8, [x24, #64]
	cmp	x8, #1
	b.lt	LBB0_26
; %bb.25:
	ldr	x8, [x24, #72]
	cmp	x8, #0
	csel	w2, wzr, w27, eq
	mov	x0, x20
	mov	x1, x22
	bl	_mkv_write_packet_internal
	mov	x21, x0
	mov	x0, x22
	bl	_av_packet_unref
	tbnz	w21, #31, LBB0_30
LBB0_26:
Lloh19:
	adrp	x8, _AVMEDIA_TYPE_AUDIO@GOTPAGE
Lloh20:
	ldr	x8, [x8, _AVMEDIA_TYPE_AUDIO@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	cmp	w23, w8
	b.ne	LBB0_29
; %bb.27:
	ldr	x8, [x19, #32]
	cmp	x8, #1
	b.lt	LBB0_31
; %bb.28:
	mov	x0, x22
	mov	x1, x19
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	b	_av_packet_ref
LBB0_29:
	mov	x0, x20
	mov	x1, x19
	mov	w2, #0
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	b	_mkv_write_packet_internal
LBB0_30:
Lloh22:
	adrp	x8, _AV_LOG_ERROR@GOTPAGE
Lloh23:
	ldr	x8, [x8, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh24:
	ldr	w1, [x8]
Lloh25:
	adrp	x2, l_.str@PAGE
Lloh26:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x20
	mov	x3, x21
	bl	_av_log
LBB0_31:
	mov	x0, x21
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_AV_PKT_FLAG_KEY,4,2            ; @AV_PKT_FLAG_KEY
	.comm	_AVMEDIA_TYPE_VIDEO,4,2         ; @AVMEDIA_TYPE_VIDEO
	.comm	_AVMEDIA_TYPE_AUDIO,4,2         ; @AVMEDIA_TYPE_AUDIO
	.comm	_AV_TIME_BASE_Q,4,2             ; @AV_TIME_BASE_Q
	.comm	_AVIO_DATA_MARKER_SYNC_POINT,4,2 ; @AVIO_DATA_MARKER_SYNC_POINT
	.comm	_AVIO_DATA_MARKER_BOUNDARY_POINT,4,2 ; @AVIO_DATA_MARKER_BOUNDARY_POINT
	.comm	_AV_LOG_ERROR,4,2               ; @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Could not write cached audio packet ret:%d\n"

	.no_dead_strip	_mkv_write_packet
.subsections_via_symbols
