	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function write_headers
_write_headers:                         ## @write_headers
	.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, %r14
	movq	%rdi, %r15
	movq	(%rdi), %r12
	movq	_ff_nut_metadata_conv@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%edx, %edx
	callq	_ff_metadata_conv_ctx
	leaq	-48(%rbp), %rdi
	callq	_avio_open_dyn_buf
	testl	%eax, %eax
	js	LBB0_25
## %bb.1:
	movq	-48(%rbp), %rsi
	movq	%r12, %rdi
	callq	_write_mainheader
	movq	-48(%rbp), %rdx
	movq	_MAIN_STARTCODE@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	%r12, %rdi
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	_put_packet
	movq	8(%r12), %rax
	cmpl	$0, (%rax)
	jle	LBB0_6
## %bb.2:
	xorl	%r13d, %r13d
	leaq	-48(%rbp), %r14
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	callq	_avio_open_dyn_buf
	testl	%eax, %eax
	js	LBB0_25
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	-48(%rbp), %rsi
	movq	8(%r12), %rax
	movq	8(%rax), %rax
	movl	(%rax,%r13,4), %edx
	movq	%r15, %rdi
	movl	%r13d, %ecx
	callq	_write_streamheader
	testl	%eax, %eax
	js	LBB0_21
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	-48(%rbp), %rdx
	movq	_STREAM_STARTCODE@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	%r12, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movl	$1, %ecx
	callq	_put_packet
	incq	%r13
	movq	8(%r12), %rax
	movslq	(%rax), %rax
	cmpq	%rax, %r13
	jl	LBB0_3
LBB0_6:
	leaq	-48(%rbp), %rdi
	callq	_avio_open_dyn_buf
	testl	%eax, %eax
	js	LBB0_25
## %bb.7:
	movq	-48(%rbp), %rsi
	movq	%r12, %rdi
	callq	_write_globalinfo
	movq	-48(%rbp), %rdx
	movq	_INFO_STARTCODE@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	%r12, %rdi
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	_put_packet
	movq	8(%r12), %rax
	cmpl	$0, (%rax)
	jle	LBB0_15
## %bb.8:
	xorl	%r15d, %r15d
	leaq	-48(%rbp), %r13
	jmp	LBB0_11
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_11 Depth=1
	movq	-48(%rbp), %rdx
	movq	_INFO_STARTCODE@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	%r12, %rdi
	movq	%r14, %rsi
	movl	$1, %ecx
	callq	_put_packet
LBB0_10:                                ##   in Loop: Header=BB0_11 Depth=1
	incl	%r15d
	movq	8(%r12), %rax
	cmpl	(%rax), %r15d
	jge	LBB0_15
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	movq	%r13, %rdi
	callq	_avio_open_dyn_buf
	testl	%eax, %eax
	js	LBB0_25
## %bb.12:                              ##   in Loop: Header=BB0_11 Depth=1
	movq	-48(%rbp), %rsi
	movq	%r12, %rdi
	movl	%r15d, %edx
	callq	_write_streaminfo
	testl	%eax, %eax
	jg	LBB0_9
## %bb.13:                              ##   in Loop: Header=BB0_11 Depth=1
	movl	%eax, %ebx
	movq	%r13, %rdi
	callq	_ffio_free_dyn_buf
	testl	%ebx, %ebx
	jns	LBB0_10
	jmp	LBB0_26
LBB0_15:
	cmpl	$0, 4(%rax)
	jle	LBB0_20
## %bb.16:
	xorl	%r14d, %r14d
	leaq	-48(%rbp), %r15
	.p2align	4, 0x90
LBB0_17:                                ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	callq	_avio_open_dyn_buf
	testl	%eax, %eax
	js	LBB0_25
## %bb.18:                              ##   in Loop: Header=BB0_17 Depth=1
	movq	-48(%rbp), %rsi
	movq	%r12, %rdi
	movl	%r14d, %edx
	callq	_write_chapter
	testl	%eax, %eax
	js	LBB0_21
## %bb.19:                              ##   in Loop: Header=BB0_17 Depth=1
	movq	-48(%rbp), %rdx
	movq	_INFO_STARTCODE@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	%r12, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movl	$1, %ecx
	callq	_put_packet
	incl	%r14d
	movq	8(%r12), %rax
	cmpl	4(%rax), %r14d
	jl	LBB0_17
LBB0_20:
	movq	_INT_MIN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 4(%r12)
	incl	(%r12)
	xorl	%ebx, %ebx
	jmp	LBB0_26
LBB0_25:
	movl	%eax, %ebx
LBB0_26:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_21:
	movl	%eax, %ebx
	leaq	-48(%rbp), %rdi
	callq	_ffio_free_dyn_buf
	jmp	LBB0_26
	.cfi_endproc
                                        ## -- End function
	.comm	_ff_nut_metadata_conv,4,2       ## @ff_nut_metadata_conv
	.comm	_MAIN_STARTCODE,4,2             ## @MAIN_STARTCODE
	.comm	_STREAM_STARTCODE,4,2           ## @STREAM_STARTCODE
	.comm	_INFO_STARTCODE,4,2             ## @INFO_STARTCODE
	.comm	_INT_MIN,4,2                    ## @INT_MIN
	.no_dead_strip	_write_headers
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function write_headers
_write_headers:                         ; @write_headers
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
	mov	x20, x1
	mov	x21, x0
	ldr	x19, [x0]
Lloh0:
	adrp	x8, _ff_nut_metadata_conv@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ff_nut_metadata_conv@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x2, #0
	bl	_ff_metadata_conv_ctx
	add	x0, sp, #8
	bl	_avio_open_dyn_buf
	tbnz	w0, #31, LBB0_20
; %bb.1:
	ldr	x1, [sp, #8]
	mov	x0, x19
	bl	_write_mainheader
	ldr	x2, [sp, #8]
Lloh3:
	adrp	x8, _MAIN_STARTCODE@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MAIN_STARTCODE@GOTPAGEOFF]
Lloh5:
	ldr	w4, [x8]
	mov	x0, x19
	mov	x1, x20
	mov	w3, #1
	bl	_put_packet
	ldr	x8, [x19, #8]
	ldr	w8, [x8]
	cmp	w8, #1
	b.lt	LBB0_6
; %bb.2:
	mov	x23, #0
Lloh6:
	adrp	x24, _STREAM_STARTCODE@GOTPAGE
Lloh7:
	ldr	x24, [x24, _STREAM_STARTCODE@GOTPAGEOFF]
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	add	x0, sp, #8
	bl	_avio_open_dyn_buf
	tbnz	w0, #31, LBB0_20
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x1, [sp, #8]
	ldr	x8, [x19, #8]
	ldr	x8, [x8, #8]
	ldr	w2, [x8, x23, lsl #2]
	mov	x0, x21
	mov	x3, x23
	bl	_write_streamheader
	tbnz	w0, #31, LBB0_22
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x2, [sp, #8]
	ldr	w4, [x24]
	mov	x0, x19
	mov	x1, x20
	mov	w3, #1
	bl	_put_packet
	add	x23, x23, #1
	ldr	x8, [x19, #8]
	ldrsw	x8, [x8]
	cmp	x23, x8
	b.lt	LBB0_3
LBB0_6:
	add	x0, sp, #8
	bl	_avio_open_dyn_buf
	tbnz	w0, #31, LBB0_20
; %bb.7:
	ldr	x1, [sp, #8]
	mov	x0, x19
	bl	_write_globalinfo
	ldr	x2, [sp, #8]
Lloh8:
	adrp	x23, _INFO_STARTCODE@GOTPAGE
Lloh9:
	ldr	x23, [x23, _INFO_STARTCODE@GOTPAGEOFF]
	ldr	w4, [x23]
	mov	x0, x19
	mov	x1, x20
	mov	w3, #1
	bl	_put_packet
	ldr	x8, [x19, #8]
	ldr	w9, [x8]
	cmp	w9, #1
	b.lt	LBB0_14
; %bb.8:
	mov	w21, #0
	b	LBB0_11
LBB0_9:                                 ;   in Loop: Header=BB0_11 Depth=1
	ldr	x2, [sp, #8]
	ldr	w4, [x23]
	mov	x0, x19
	mov	x1, x20
	mov	w3, #1
	bl	_put_packet
LBB0_10:                                ;   in Loop: Header=BB0_11 Depth=1
	add	w21, w21, #1
	ldr	x8, [x19, #8]
	ldr	w9, [x8]
	cmp	w21, w9
	b.ge	LBB0_14
LBB0_11:                                ; =>This Inner Loop Header: Depth=1
	add	x0, sp, #8
	bl	_avio_open_dyn_buf
	tbnz	w0, #31, LBB0_20
; %bb.12:                               ;   in Loop: Header=BB0_11 Depth=1
	ldr	x1, [sp, #8]
	mov	x0, x19
	mov	x2, x21
	bl	_write_streaminfo
	cmp	w0, #1
	b.ge	LBB0_9
; %bb.13:                               ;   in Loop: Header=BB0_11 Depth=1
	mov	x22, x0
	add	x0, sp, #8
	bl	_ffio_free_dyn_buf
	tbz	w22, #31, LBB0_10
	b	LBB0_21
LBB0_14:
	ldr	w8, [x8, #4]
	cmp	w8, #1
	b.lt	LBB0_19
; %bb.15:
	mov	w21, #0
LBB0_16:                                ; =>This Inner Loop Header: Depth=1
	add	x0, sp, #8
	bl	_avio_open_dyn_buf
	tbnz	w0, #31, LBB0_20
; %bb.17:                               ;   in Loop: Header=BB0_16 Depth=1
	ldr	x1, [sp, #8]
	mov	x0, x19
	mov	x2, x21
	bl	_write_chapter
	tbnz	w0, #31, LBB0_22
; %bb.18:                               ;   in Loop: Header=BB0_16 Depth=1
	ldr	x2, [sp, #8]
	ldr	w4, [x23]
	mov	x0, x19
	mov	x1, x20
	mov	w3, #1
	bl	_put_packet
	add	w21, w21, #1
	ldr	x8, [x19, #8]
	ldr	w8, [x8, #4]
	cmp	w21, w8
	b.lt	LBB0_16
LBB0_19:
	mov	w22, #0
Lloh10:
	adrp	x8, _INT_MIN@GOTPAGE
Lloh11:
	ldr	x8, [x8, _INT_MIN@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	ldr	w9, [x19]
	add	w9, w9, #1
	stp	w9, w8, [x19]
	b	LBB0_21
LBB0_20:
	mov	x22, x0
LBB0_21:
	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
	add	sp, sp, #80
	ret
LBB0_22:
	mov	x22, x0
	add	x0, sp, #8
	bl	_ffio_free_dyn_buf
	b	LBB0_21
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_ff_nut_metadata_conv,4,2       ; @ff_nut_metadata_conv
	.comm	_MAIN_STARTCODE,4,2             ; @MAIN_STARTCODE
	.comm	_STREAM_STARTCODE,4,2           ; @STREAM_STARTCODE
	.comm	_INFO_STARTCODE,4,2             ; @INFO_STARTCODE
	.comm	_INT_MIN,4,2                    ; @INT_MIN
	.no_dead_strip	_write_headers
.subsections_via_symbols
