	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function write_ts_header2
_write_ts_header2:                      ## @write_ts_header2
	.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
	movl	%r8d, %r15d
	movq	%rcx, %r14
	xorl	%eax, %eax
	testl	%edx, %edx
	setne	%al
	movq	___stack_chk_guard@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movq	%rcx, -48(%rbp)
	movaps	L___const.write_ts_header2.tshead(%rip), %xmm0
	movaps	%xmm0, -64(%rbp)
	movq	_TS_SIZE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r12d
	leal	-4(%r12), %ebx
	shll	$6, %eax
	xorl	%ecx, %ecx
	cmpl	%r8d, %ebx
	setne	%cl
	shll	$5, %ecx
	movzbl	%dil, %edx
	shrl	$8, %edi
	andl	$31, %edi
	orl	%eax, %edi
	movl	%edi, -60(%rbp)
	movl	%edx, -56(%rbp)
	movl	(%rsi), %eax
	leal	1(%rax), %edx
	movl	%edx, (%rsi)
	andl	$15, %eax
	addl	%ecx, %eax
	addl	$16, %eax
	movl	%eax, -52(%rbp)
	leaq	-64(%rbp), %rsi
	movl	$4, %r13d
	movq	%r14, %rdi
	movl	$4, %edx
	callq	_memcpy
	subl	%r15d, %ebx
	je	LBB0_4
## %bb.1:
	leal	-1(%rbx), %eax
	movl	%eax, 16(%r14)
	movl	$5, %r13d
	cmpl	$2, %ebx
	jl	LBB0_4
## %bb.2:
	movl	$0, 20(%r14)
	movl	$6, %r13d
	je	LBB0_4
## %bb.3:
	addq	$24, %r14
	notl	%r15d
	addl	%r15d, %r12d
	cmpl	$7, %r12d
	movl	$6, %r13d
	cmovgel	%r12d, %r13d
	leal	-5(%r13), %edx
	shlq	$2, %rdx
	leaq	L_.memset_pattern(%rip), %rsi
	movq	%r14, %rdi
	callq	_memset_pattern16
	incl	%r13d
LBB0_4:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_6
## %bb.5:
	movl	%r13d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## @__const.write_ts_header2.tshead
L___const.write_ts_header2.tshead:
	.long	71                              ## 0x47
	.long	0                               ## 0x0
	.long	0                               ## 0x0
	.long	16                              ## 0x10

	.comm	_TS_SIZE,4,2                    ## @TS_SIZE
	.p2align	4                               ## @.memset_pattern
L_.memset_pattern:
	.long	255                             ## 0xff
	.long	255                             ## 0xff
	.long	255                             ## 0xff
	.long	255                             ## 0xff

	.no_dead_strip	_write_ts_header2
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function write_ts_header2
_write_ts_header2:                      ; @write_ts_header2
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	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
	mov	x19, x4
	mov	x20, x3
	cmp	w2, #0
	cset	w8, ne
Lloh0:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	str	x9, [sp, #24]
Lloh3:
	adrp	x9, _TS_SIZE@GOTPAGE
Lloh4:
	ldr	x9, [x9, _TS_SIZE@GOTPAGEOFF]
Lloh5:
	ldr	w22, [x9]
	sub	w23, w22, #4
	mov	w9, #48
	mov	w10, #16
	cmp	w23, w4
	csel	w9, w10, w9, eq
	ubfx	w10, w0, #8, #5
	bfi	w10, w8, #6, #1
	mov	w8, #71
	stp	w8, w10, [sp, #8]
	and	w8, w0, #0xff
	ldr	w10, [x1]
	add	w11, w10, #1
	str	w11, [x1]
	bfxil	w9, w10, #0, #4
	stp	w8, w9, [sp, #16]
	mov	w21, #4
	add	x1, sp, #8
	mov	x0, x3
	mov	w2, #4
	bl	_memcpy
	subs	w8, w23, w19
	b.eq	LBB0_5
; %bb.1:
	sub	w9, w8, #1
	str	w9, [x20, #16]
	cmp	w8, #2
	b.lt	LBB0_4
; %bb.2:
	str	wzr, [x20, #20]
	mov	w21, #6
	cmp	w8, #2
	b.eq	LBB0_5
; %bb.3:
	add	x0, x20, #24
	mvn	w8, w19
	add	w8, w22, w8
	cmp	w8, #6
	csel	w19, w8, w21, gt
	sub	w8, w19, #5
	lsl	x2, x8, #2
Lloh6:
	adrp	x1, l_.memset_pattern@PAGE
Lloh7:
	add	x1, x1, l_.memset_pattern@PAGEOFF
	bl	_memset_pattern16
	add	w21, w19, #1
	b	LBB0_5
LBB0_4:
	mov	w21, #5
LBB0_5:
	ldr	x8, [sp, #24]
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_7
; %bb.6:
	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
	add	sp, sp, #96
	ret
LBB0_7:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_TS_SIZE,4,2                    ; @TS_SIZE
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ; @.memset_pattern
l_.memset_pattern:
	.long	255                             ; 0xff
	.long	255                             ; 0xff
	.long	255                             ; 0xff
	.long	255                             ; 0xff

	.no_dead_strip	_write_ts_header2
.subsections_via_symbols
