	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gxf_write_media_preamble
_gxf_write_media_preamble:              ## @gxf_write_media_preamble
	.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
                                        ## kill: def $edx killed $edx def $rdx
	movq	%rsi, %r13
	movq	16(%rdi), %rax
	movq	(%rdi), %rcx
	movq	8(%rdi), %rbx
	movq	(%rsi), %rsi
	movq	(%rcx,%rsi,8), %r15
	movq	8(%r15), %rcx
	movq	16(%r15), %r12
	movq	(%rcx), %rcx
	movq	_AVMEDIA_TYPE_VIDEO@GOTPCREL(%rip), %rsi
	cmpq	(%rsi), %rcx
	movq	%rdx, -48(%rbp)                 ## 8-byte Spill
	jne	LBB0_2
## %bb.1:
	movl	(%rax), %r14d
	jmp	LBB0_3
LBB0_2:
	movl	16(%r13), %edi
	movl	8(%rax), %esi
	imull	$48000, 4(%rax), %edx           ## imm = 0xBB80
	movq	_AV_ROUND_UP@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	callq	_av_rescale_rnd
	movl	%eax, %r14d
LBB0_3:
	movl	(%r12), %esi
	movq	%rbx, %rdi
	callq	_avio_w8
	movl	(%r15), %esi
	movq	%rbx, %rdi
	callq	_avio_w8
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_avio_wb32
	movq	8(%r15), %rax
	movq	(%rax), %rcx
	movq	_AVMEDIA_TYPE_AUDIO@GOTPCREL(%rip), %rdx
	cmpq	(%rdx), %rcx
	jne	LBB0_5
## %bb.4:
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_avio_wb16
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	%eax, %esi
	shrl	$31, %esi
	addl	%eax, %esi
	sarl	%esi
	movq	%rbx, %rdi
	callq	_avio_wb16
	jmp	LBB0_16
LBB0_5:
	movq	8(%rax), %rax
	movq	_AV_CODEC_ID_MPEG2VIDEO@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_8
## %bb.6:
	movl	8(%r13), %edx
	movl	12(%r13), %esi
	movq	%r12, %rdi
	callq	_gxf_parse_mpeg_frame
	movq	_AV_PICTURE_TYPE_I@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_10
## %bb.7:
	movq	%rbx, %rdi
	movl	$13, %esi
	callq	_avio_w8
	addq	$12, %r12
	jmp	LBB0_14
LBB0_8:
	movq	_AV_CODEC_ID_DVVIDEO@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_12
## %bb.9:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	leal	4095(%rax), %esi
	testl	%eax, %eax
	cmovnsl	%eax, %esi
	sarl	$12, %esi
	movq	%rbx, %rdi
	callq	_avio_w8
	movq	%rbx, %rdi
	xorl	%esi, %esi
	jmp	LBB0_15
LBB0_10:
	movq	_AV_PICTURE_TYPE_B@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_13
## %bb.11:
	movq	%rbx, %rdi
	movl	$15, %esi
	callq	_avio_w8
	addq	$8, %r12
	jmp	LBB0_14
LBB0_12:
	movq	%rbx, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_avio_wb32
	jmp	LBB0_16
LBB0_13:
	movq	%rbx, %rdi
	movl	$14, %esi
	callq	_avio_w8
	addq	$4, %r12
LBB0_14:
	incl	(%r12)
	movq	%rbx, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
                                        ## kill: def $esi killed $esi killed $rsi
LBB0_15:
	callq	_avio_wb24
LBB0_16:
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_avio_wb32
	movq	%rbx, %rdi
	movl	$1, %esi
	callq	_avio_w8
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_avio_w8
	movl	$16, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AVMEDIA_TYPE_VIDEO,8,3         ## @AVMEDIA_TYPE_VIDEO
	.comm	_AV_ROUND_UP,4,2                ## @AV_ROUND_UP
	.comm	_AVMEDIA_TYPE_AUDIO,8,3         ## @AVMEDIA_TYPE_AUDIO
	.comm	_AV_CODEC_ID_MPEG2VIDEO,8,3     ## @AV_CODEC_ID_MPEG2VIDEO
	.comm	_AV_PICTURE_TYPE_I,4,2          ## @AV_PICTURE_TYPE_I
	.comm	_AV_PICTURE_TYPE_B,4,2          ## @AV_PICTURE_TYPE_B
	.comm	_AV_CODEC_ID_DVVIDEO,8,3        ## @AV_CODEC_ID_DVVIDEO
	.no_dead_strip	_gxf_write_media_preamble
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gxf_write_media_preamble
_gxf_write_media_preamble:              ; @gxf_write_media_preamble
	.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, x2
	mov	x23, x1
	ldp	x19, x8, [x0, #8]
	ldr	x9, [x0]
	ldr	x10, [x1]
	ldr	x24, [x9, x10, lsl #3]
	ldp	x9, x22, [x24, #8]
	ldr	x9, [x9]
Lloh0:
	adrp	x10, _AVMEDIA_TYPE_VIDEO@GOTPAGE
Lloh1:
	ldr	x10, [x10, _AVMEDIA_TYPE_VIDEO@GOTPAGEOFF]
Lloh2:
	ldr	x10, [x10]
	cmp	x9, x10
	b.ne	LBB0_2
; %bb.1:
	ldr	w21, [x8]
	b	LBB0_3
LBB0_2:
	ldr	w0, [x23, #16]
	ldp	w8, w1, [x8, #4]
	mov	w9, #48000
	mul	w2, w8, w9
Lloh3:
	adrp	x8, _AV_ROUND_UP@GOTPAGE
Lloh4:
	ldr	x8, [x8, _AV_ROUND_UP@GOTPAGEOFF]
Lloh5:
	ldr	w3, [x8]
	bl	_av_rescale_rnd
	mov	x21, x0
LBB0_3:
	ldr	w1, [x22]
	mov	x0, x19
	bl	_avio_w8
	ldr	w1, [x24]
	mov	x0, x19
	bl	_avio_w8
	mov	x0, x19
	mov	x1, x21
	bl	_avio_wb32
	ldr	x8, [x24, #8]
	ldr	x9, [x8]
Lloh6:
	adrp	x10, _AVMEDIA_TYPE_AUDIO@GOTPAGE
Lloh7:
	ldr	x10, [x10, _AVMEDIA_TYPE_AUDIO@GOTPAGEOFF]
Lloh8:
	ldr	x10, [x10]
	cmp	x9, x10
	b.ne	LBB0_5
; %bb.4:
	mov	x0, x19
	mov	w1, #0
	bl	_avio_wb16
	cmp	w20, #0
	cinc	w8, w20, lt
	asr	w1, w8, #1
	mov	x0, x19
	bl	_avio_wb16
	b	LBB0_16
LBB0_5:
	ldr	x8, [x8, #8]
Lloh9:
	adrp	x9, _AV_CODEC_ID_MPEG2VIDEO@GOTPAGE
Lloh10:
	ldr	x9, [x9, _AV_CODEC_ID_MPEG2VIDEO@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_8
; %bb.6:
	ldp	w2, w1, [x23, #8]
	mov	x0, x22
	bl	_gxf_parse_mpeg_frame
Lloh12:
	adrp	x8, _AV_PICTURE_TYPE_I@GOTPAGE
Lloh13:
	ldr	x8, [x8, _AV_PICTURE_TYPE_I@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	cmp	w0, w8
	b.ne	LBB0_10
; %bb.7:
	mov	x0, x19
	mov	w1, #13
	bl	_avio_w8
	add	x8, x22, #12
	b	LBB0_14
LBB0_8:
Lloh15:
	adrp	x9, _AV_CODEC_ID_DVVIDEO@GOTPAGE
Lloh16:
	ldr	x9, [x9, _AV_CODEC_ID_DVVIDEO@GOTPAGEOFF]
Lloh17:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_12
; %bb.9:
	add	w8, w20, #4095
	cmp	w20, #0
	csel	w8, w8, w20, lt
	asr	w1, w8, #12
	mov	x0, x19
	bl	_avio_w8
	mov	x0, x19
	mov	w1, #0
	b	LBB0_15
LBB0_10:
Lloh18:
	adrp	x8, _AV_PICTURE_TYPE_B@GOTPAGE
Lloh19:
	ldr	x8, [x8, _AV_PICTURE_TYPE_B@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
	cmp	w0, w8
	b.ne	LBB0_13
; %bb.11:
	mov	x0, x19
	mov	w1, #15
	bl	_avio_w8
	add	x8, x22, #8
	b	LBB0_14
LBB0_12:
	mov	x0, x19
	mov	x1, x20
	bl	_avio_wb32
	b	LBB0_16
LBB0_13:
	mov	x0, x19
	mov	w1, #14
	bl	_avio_w8
	add	x8, x22, #4
LBB0_14:
	ldr	w9, [x8]
	add	w9, w9, #1
	str	w9, [x8]
	mov	x0, x19
	mov	x1, x20
LBB0_15:
	bl	_avio_wb24
LBB0_16:
	mov	x0, x19
	mov	x1, x21
	bl	_avio_wb32
	mov	x0, x19
	mov	w1, #1
	bl	_avio_w8
	mov	x0, x19
	mov	w1, #0
	bl	_avio_w8
	mov	w0, #16
	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 AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_AVMEDIA_TYPE_VIDEO,8,3         ; @AVMEDIA_TYPE_VIDEO
	.comm	_AV_ROUND_UP,4,2                ; @AV_ROUND_UP
	.comm	_AVMEDIA_TYPE_AUDIO,8,3         ; @AVMEDIA_TYPE_AUDIO
	.comm	_AV_CODEC_ID_MPEG2VIDEO,8,3     ; @AV_CODEC_ID_MPEG2VIDEO
	.comm	_AV_PICTURE_TYPE_I,4,2          ; @AV_PICTURE_TYPE_I
	.comm	_AV_PICTURE_TYPE_B,4,2          ; @AV_PICTURE_TYPE_B
	.comm	_AV_CODEC_ID_DVVIDEO,8,3        ; @AV_CODEC_ID_DVVIDEO
	.no_dead_strip	_gxf_write_media_preamble
.subsections_via_symbols
