	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gxf_write_packet
_gxf_write_packet:                      ## @gxf_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	16(%rdi), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	(%rdi), %rax
	movq	8(%rdi), %r12
	movq	(%rsi), %rcx
	movq	(%rax,%rcx,8), %rbx
	movq	%r12, %rdi
	callq	_avio_tell
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	%r12, %rdi
	callq	_avio_tell
                                        ## kill: def $eax killed $eax def $rax
	leal	1023(%rax), %r15d
	testl	%eax, %eax
	cmovnsl	%eax, %r15d
	movq	_PKT_MEDIA@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_gxf_write_packet_header
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movq	(%rbx), %rax
	movq	(%rax), %rcx
	movq	_AV_CODEC_ID_MPEG2VIDEO@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	jne	LBB0_3
## %bb.1:
	movl	8(%r13), %edx
	leal	3(%rdx), %esi
	testl	%edx, %edx
	cmovnsl	%edx, %esi
	andl	$-4, %esi
	movl	%edx, %ecx
	subl	%esi, %ecx
	je	LBB0_3
## %bb.2:
	movl	$4, %ebx
	subl	%ecx, %ebx
	jmp	LBB0_6
LBB0_3:
	movq	8(%rax), %rax
	movq	_AVMEDIA_TYPE_AUDIO@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_4
## %bb.5:
	movq	_GXF_AUDIO_PACKET_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movl	8(%r13), %edx
	subl	%edx, %ebx
	jmp	LBB0_6
LBB0_4:
	movl	8(%r13), %edx
	xorl	%ebx, %ebx
LBB0_6:
	addl	%ebx, %edx
	movq	%r14, %rdi
	movq	%r13, %rsi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_gxf_write_media_preamble
	movl	8(%r13), %edx
	movl	12(%r13), %esi
	movq	%r12, %rdi
	callq	_avio_write
	movq	%r12, %rdi
	movl	%ebx, %esi
	callq	_gxf_write_padding
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rax
	movq	8(%rax), %rax
	movq	_AVMEDIA_TYPE_VIDEO@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	jne	LBB0_11
## %bb.7:
	movl	(%rbx), %esi
	imull	$652835029, %esi, %eax          ## imm = 0x26E978D5
	addl	$17179868, %eax                 ## imm = 0x10624DC
	rorl	$2, %eax
	cmpl	$8589934, %eax                  ## imm = 0x83126E
	ja	LBB0_10
## %bb.8:
	leaq	8(%rbx), %rdi
	addl	$500, %esi                      ## imm = 0x1F4
                                        ## kill: def $esi killed $esi killed $rsi
	movl	$4, %edx
	callq	_av_reallocp_array
	testl	%eax, %eax
	js	LBB0_16
## %bb.9:
	movl	(%rbx), %esi
LBB0_10:
	sarl	$10, %r15d
	movq	8(%rbx), %rax
	leal	1(%rsi), %ecx
	movl	%ecx, (%rbx)
	movslq	%esi, %rcx
	movl	%r15d, (%rax,%rcx,4)
	addq	$2, 24(%rbx)
LBB0_11:
	movq	%r12, %rdi
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	callq	_updatePacketSize
	movl	16(%rbx), %eax
	incl	%eax
	movl	%eax, 16(%rbx)
	xorl	%r13d, %r13d
	cmpl	$100, %eax
	jne	LBB0_15
## %bb.12:
	xorl	%r13d, %r13d
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_gxf_write_map_packet
	testl	%eax, %eax
	js	LBB0_13
## %bb.14:
	movl	$0, 16(%rbx)
	jmp	LBB0_15
LBB0_13:
	movl	%eax, %r13d
	jmp	LBB0_15
LBB0_16:
	movl	%eax, %r13d
	movl	$0, (%rbx)
	movq	$0, 24(%rbx)
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdx
	movq	%r14, %rdi
	callq	_av_log
LBB0_15:
	movl	%r13d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PKT_MEDIA,4,2                  ## @PKT_MEDIA
	.comm	_AV_CODEC_ID_MPEG2VIDEO,8,3     ## @AV_CODEC_ID_MPEG2VIDEO
	.comm	_AVMEDIA_TYPE_AUDIO,8,3         ## @AVMEDIA_TYPE_AUDIO
	.comm	_GXF_AUDIO_PACKET_SIZE,4,2      ## @GXF_AUDIO_PACKET_SIZE
	.comm	_AVMEDIA_TYPE_VIDEO,8,3         ## @AVMEDIA_TYPE_VIDEO
	.comm	_AV_LOG_ERROR,4,2               ## @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"could not reallocate flt entries\n"

	.no_dead_strip	_gxf_write_packet
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gxf_write_packet
_gxf_write_packet:                      ; @gxf_write_packet
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x22, x1
	mov	x19, x0
	ldp	x20, x24, [x0, #8]
	ldr	x8, [x0]
	ldr	x9, [x1]
	ldr	x26, [x8, x9, lsl #3]
	mov	x0, x20
	bl	_avio_tell
	mov	x21, x0
	mov	x0, x20
	bl	_avio_tell
	add	w8, w0, #1023
	cmp	w0, #0
	csel	w25, w8, w0, lt
Lloh0:
	adrp	x8, _PKT_MEDIA@GOTPAGE
Lloh1:
	ldr	x8, [x8, _PKT_MEDIA@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_gxf_write_packet_header
	ldr	x9, [x26]
	ldr	x8, [x9]
Lloh3:
	adrp	x10, _AV_CODEC_ID_MPEG2VIDEO@GOTPAGE
Lloh4:
	ldr	x10, [x10, _AV_CODEC_ID_MPEG2VIDEO@GOTPAGEOFF]
Lloh5:
	ldr	x10, [x10]
	cmp	x8, x10
	b.ne	LBB0_3
; %bb.1:
	ldr	w8, [x22, #8]
	negs	w10, w8
	and	w10, w10, #0x3
	and	w11, w8, #0x3
	csneg	w10, w11, w10, mi
	cbz	w10, LBB0_3
; %bb.2:
	mov	w9, #4
	sub	w23, w9, w10
	b	LBB0_6
LBB0_3:
	ldr	x8, [x9, #8]
Lloh6:
	adrp	x9, _AVMEDIA_TYPE_AUDIO@GOTPAGE
Lloh7:
	ldr	x9, [x9, _AVMEDIA_TYPE_AUDIO@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_5
; %bb.4:
Lloh9:
	adrp	x8, _GXF_AUDIO_PACKET_SIZE@GOTPAGE
Lloh10:
	ldr	x8, [x8, _GXF_AUDIO_PACKET_SIZE@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x8]
	ldr	w8, [x22, #8]
	sub	w23, w9, w8
	b	LBB0_6
LBB0_5:
	mov	w23, #0
	ldr	w8, [x22, #8]
LBB0_6:
	add	w2, w8, w23
	mov	x0, x19
	mov	x1, x22
	bl	_gxf_write_media_preamble
	ldp	w2, w1, [x22, #8]
	mov	x0, x20
	bl	_avio_write
	mov	x0, x20
	mov	x1, x23
	bl	_gxf_write_padding
	ldr	x8, [x26]
	ldr	x8, [x8, #8]
Lloh12:
	adrp	x9, _AVMEDIA_TYPE_VIDEO@GOTPAGE
Lloh13:
	ldr	x9, [x9, _AVMEDIA_TYPE_VIDEO@GOTPAGEOFF]
Lloh14:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_11
; %bb.7:
	ldr	w8, [x24]
	mov	w9, #30933
	movk	w9, #9961, lsl #16
	mov	w10, #9436
	movk	w10, #262, lsl #16
	madd	w9, w8, w9, w10
	ror	w9, w9, #2
	mov	w10, #4718
	movk	w10, #131, lsl #16
	cmp	w9, w10
	b.hi	LBB0_10
; %bb.8:
	add	x0, x24, #8
	add	w1, w8, #500
	mov	w2, #4
	bl	_av_reallocp_array
	tbnz	w0, #31, LBB0_16
; %bb.9:
	ldr	w8, [x24]
LBB0_10:
	asr	w9, w25, #10
	ldr	x10, [x24, #8]
	add	w11, w8, #1
	str	w11, [x24]
	str	w9, [x10, w8, sxtw #2]
	ldr	x8, [x24, #24]
	add	x8, x8, #2
	str	x8, [x24, #24]
LBB0_11:
	mov	x0, x20
	mov	x1, x21
	bl	_updatePacketSize
	ldr	w8, [x24, #16]
	add	w8, w8, #1
	str	w8, [x24, #16]
	cmp	w8, #100
	b.ne	LBB0_14
; %bb.12:
	mov	x0, x19
	mov	w1, #0
	bl	_gxf_write_map_packet
	tbnz	w0, #31, LBB0_15
; %bb.13:
	mov	w22, #0
	str	wzr, [x24, #16]
	b	LBB0_17
LBB0_14:
	mov	w22, #0
	b	LBB0_17
LBB0_15:
	mov	x22, x0
	b	LBB0_17
LBB0_16:
	mov	x22, x0
	str	wzr, [x24]
	str	xzr, [x24, #24]
Lloh15:
	adrp	x8, _AV_LOG_ERROR@GOTPAGE
Lloh16:
	ldr	x8, [x8, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
Lloh18:
	adrp	x2, l_.str@PAGE
Lloh19:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x19
	bl	_av_log
LBB0_17:
	mov	x0, x22
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_PKT_MEDIA,4,2                  ; @PKT_MEDIA
	.comm	_AV_CODEC_ID_MPEG2VIDEO,8,3     ; @AV_CODEC_ID_MPEG2VIDEO
	.comm	_AVMEDIA_TYPE_AUDIO,8,3         ; @AVMEDIA_TYPE_AUDIO
	.comm	_GXF_AUDIO_PACKET_SIZE,4,2      ; @GXF_AUDIO_PACKET_SIZE
	.comm	_AVMEDIA_TYPE_VIDEO,8,3         ; @AVMEDIA_TYPE_VIDEO
	.comm	_AV_LOG_ERROR,4,2               ; @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"could not reallocate flt entries\n"

	.no_dead_strip	_gxf_write_packet
.subsections_via_symbols
