	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function write_chapter
_write_chapter:                         ## @write_chapter
	.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	$184, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r14d
	movl	%edx, %r12d
	movq	%rsi, -216(%rbp)                ## 8-byte Spill
	movq	%rdi, %rbx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	8(%rdi), %rax
	movslq	%edx, %rcx
	movq	(%rax,%rcx,8), %r15
	movq	$0, -192(%rbp)
	movq	$0, -184(%rbp)
	leaq	-184(%rbp), %rdi
	callq	_avio_open_dyn_buf
	testl	%eax, %eax
	js	LBB0_3
## %bb.1:
	movq	%rbx, -208(%rbp)                ## 8-byte Spill
	movl	4(%r15), %esi
	movl	12(%r15), %edi
	movl	%r14d, %ebx
	movabsq	$4294967296001, %r14            ## imm = 0x3E800000001
	movq	%r14, %rdx
	callq	_av_rescale_q
	movl	%eax, -196(%rbp)                ## 4-byte Spill
	movl	4(%r15), %esi
	movl	8(%r15), %edi
	movq	%r14, %rdx
	callq	_av_rescale_q
	movl	%eax, %r14d
	leaq	L_.str(%rip), %rdx
	leaq	-176(%rbp), %r13
	movq	%r13, %rdi
	movl	$122, %esi
	movl	%r12d, %ecx
	callq	_snprintf
	movq	-184(%rbp), %rdi
	movq	%r13, %rsi
	callq	_avio_put_str
	movq	-216(%rbp), %r12                ## 8-byte Reload
	addl	%eax, (%r12)
	movq	-184(%rbp), %rdi
	movl	-196(%rbp), %esi                ## 4-byte Reload
	callq	_avio_wb32
	movq	-184(%rbp), %rdi
	movl	%r14d, %esi
	callq	_avio_wb32
	movq	-184(%rbp), %rdi
	movl	$-1, %esi
	callq	_avio_wb32
	movq	-184(%rbp), %rdi
	movl	$-1, %esi
	callq	_avio_wb32
	movq	-184(%rbp), %rdi
	movq	%r15, %rsi
	movq	%r12, %rdx
	movl	%ebx, %ecx
	callq	_write_metadata
	movl	%eax, %r13d
	testl	%eax, %eax
	js	LBB0_4
## %bb.2:
	movq	-184(%rbp), %rdi
	leaq	-192(%rbp), %rsi
	callq	_avio_close_dyn_buf
	movl	%eax, %r14d
	movq	_ID3v2_HEADER_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	(%r12), %ecx
	leal	16(%rax,%rcx), %eax
	movl	%eax, (%r12)
	movq	-208(%rbp), %rbx                ## 8-byte Reload
	movq	(%rbx), %r15
	movl	$67, %edi
	movl	$72, %esi
	movl	$65, %edx
	movl	$80, %ecx
	callq	_MKBETAG
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	_avio_wb32
	movq	(%rbx), %rdi
	movl	%r14d, %esi
	callq	_avio_wb32
	movq	(%rbx), %rdi
	xorl	%esi, %esi
	callq	_avio_wb16
	movq	(%rbx), %rdi
	movq	-192(%rbp), %rsi
	movl	%r14d, %edx
	callq	_avio_write
	cmpq	$0, -192(%rbp)
	setne	%al
	jmp	LBB0_5
LBB0_3:
	movl	%eax, %r13d
LBB0_4:
	xorl	%eax, %eax
LBB0_5:
	movq	-184(%rbp), %rdi
	testq	%rdi, %rdi
	je	LBB0_8
## %bb.6:
	testb	%al, %al
	jne	LBB0_8
## %bb.7:
	leaq	-192(%rbp), %rsi
	callq	_avio_close_dyn_buf
LBB0_8:
	leaq	-192(%rbp), %rdi
	callq	_av_freep
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_10
## %bb.9:
	movl	%r13d, %eax
	addq	$184, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ch%d"

	.comm	_ID3v2_HEADER_SIZE,8,3          ## @ID3v2_HEADER_SIZE
	.no_dead_strip	_write_chapter
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function write_chapter
_write_chapter:                         ; @write_chapter
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #240
	.cfi_def_cfa_offset 240
	stp	x26, x25, [sp, #160]            ; 16-byte Folded Spill
	stp	x24, x23, [sp, #176]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #192]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #208]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #224]            ; 16-byte Folded Spill
	add	x29, sp, #224
	.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, x3
	mov	x24, x2
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-72]
	ldr	x8, [x0, #8]
	ldr	x23, [x8, w2, sxtw #3]
	stp	xzr, xzr, [sp, #8]
	add	x0, sp, #8
	bl	_avio_open_dyn_buf
	tbnz	w0, #31, LBB0_3
; %bb.1:
	ldr	w0, [x23, #12]
	ldr	w1, [x23, #4]
	mov	x2, #1
	movk	x2, #1000, lsl #32
	bl	_av_rescale_q
	mov	x21, x0
	ldp	w1, w0, [x23, #4]
	mov	x2, #1
	movk	x2, #1000, lsl #32
	bl	_av_rescale_q
	mov	x25, x0
Lloh3:
	adrp	x2, l_.str@PAGE
Lloh4:
	add	x2, x2, l_.str@PAGEOFF
	add	x0, sp, #29
	mov	w1, #122
	mov	x3, x24
	bl	_snprintf
	ldr	x0, [sp, #8]
	add	x1, sp, #29
	bl	_avio_put_str
	ldr	w8, [x20]
	add	w8, w8, w0
	str	w8, [x20]
	ldr	x0, [sp, #8]
	mov	x1, x21
	bl	_avio_wb32
	ldr	x0, [sp, #8]
	mov	x1, x25
	bl	_avio_wb32
	ldr	x0, [sp, #8]
	mov	w1, #-1
	bl	_avio_wb32
	ldr	x0, [sp, #8]
	mov	w1, #-1
	bl	_avio_wb32
	ldr	x0, [sp, #8]
	mov	x1, x23
	mov	x2, x20
	mov	x3, x22
	bl	_write_metadata
	mov	x21, x0
	tbnz	w0, #31, LBB0_4
; %bb.2:
	ldr	x0, [sp, #8]
	add	x1, sp, #16
	bl	_avio_close_dyn_buf
	mov	x22, x0
Lloh5:
	adrp	x8, _ID3v2_HEADER_SIZE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ID3v2_HEADER_SIZE@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	ldr	w9, [x20]
	add	w8, w8, w9
	add	w8, w8, #16
	str	w8, [x20]
	ldr	x20, [x19]
	mov	w0, #67
	mov	w1, #72
	mov	w2, #65
	mov	w3, #80
	bl	_MKBETAG
	mov	x1, x0
	mov	x0, x20
	bl	_avio_wb32
	ldr	x0, [x19]
	mov	x1, x22
	bl	_avio_wb32
	ldr	x0, [x19]
	mov	w1, #0
	bl	_avio_wb16
	ldr	x0, [x19]
	ldr	x1, [sp, #16]
	mov	x2, x22
	bl	_avio_write
	ldr	x8, [sp, #16]
	cmp	x8, #0
	cset	w8, ne
	ldr	x0, [sp, #8]
	cbnz	x0, LBB0_5
	b	LBB0_7
LBB0_3:
	mov	x21, x0
LBB0_4:
	mov	w8, #0
	ldr	x0, [sp, #8]
	cbz	x0, LBB0_7
LBB0_5:
	tbnz	w8, #0, LBB0_7
; %bb.6:
	add	x1, sp, #16
	bl	_avio_close_dyn_buf
LBB0_7:
	add	x0, sp, #16
	bl	_av_freep
	ldur	x8, [x29, #-72]
Lloh8:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh9:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_9
; %bb.8:
	mov	x0, x21
	ldp	x29, x30, [sp, #224]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #208]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #192]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #176]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #160]            ; 16-byte Folded Reload
	add	sp, sp, #240
	ret
LBB0_9:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ch%d"

	.comm	_ID3v2_HEADER_SIZE,8,3          ; @ID3v2_HEADER_SIZE
	.no_dead_strip	_write_chapter
.subsections_via_symbols
