	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal16,16byte_literals
	.p2align	4                               ## -- Begin function sanitize_utf8
LCPI0_0:
	.quad	8                               ## 0x8
	.quad	8                               ## 0x8
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	4, 0x90
_sanitize_utf8:                         ## @sanitize_utf8
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %ebx
	movq	%rdi, %r14
	movl	$128, -68(%rbp)
	movl	$0, -72(%rbp)
	leal	1(%rbx), %edi
	movl	$1, %esi
	callq	_xcalloc
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	testl	%ebx, %ebx
	jle	LBB0_39
## %bb.1:
	movq	%r14, %r10
	leaq	48(%r14), %rax
	movq	%rax, -96(%rbp)                 ## 8-byte Spill
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	addq	$48, %rax
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	movl	$128, %eax
	xorl	%r15d, %r15d
	xorl	%r13d, %r13d
	xorl	%r12d, %r12d
	movq	%rbx, -80(%rbp)                 ## 8-byte Spill
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_37:                                ##   in Loop: Header=BB0_2 Depth=1
	incl	%r15d
	movq	-56(%rbp), %r10                 ## 8-byte Reload
LBB0_38:                                ##   in Loop: Header=BB0_2 Depth=1
	movl	-68(%rbp), %eax
	incl	%r12d
	cmpl	%ebx, %r12d
	jge	LBB0_39
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_12 Depth 2
                                        ##     Child Loop BB0_14 Depth 2
                                        ##     Child Loop BB0_19 Depth 2
                                        ##     Child Loop BB0_30 Depth 2
                                        ##     Child Loop BB0_35 Depth 2
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movslq	%r12d, %r14
	movzbl	(%r10,%r14), %edx
	leaq	-68(%rbp), %rdi
	leaq	-72(%rbp), %rsi
	callq	_utf8_decode
	cmpl	$128, %eax
	je	LBB0_22
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	cmpl	$129, %eax
	jne	LBB0_37
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	testl	%r15d, %r15d
	je	LBB0_40
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	jle	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	%r12d, %ebx
	subl	%r15d, %ebx
	movslq	%r13d, %r13
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	leaq	(%rax,%r13), %rdi
	leal	1(%rbx), %r14d
	cmpl	%r14d, %r12d
	cmovgl	%r12d, %r14d
	addl	%r15d, %r14d
	subl	%r12d, %r14d
	leal	-1(%r14), %edx
	incq	%rdx
	movl	$63, %esi
	callq	_memset
	cmpl	$4, %r14d
	jae	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	-56(%rbp), %r10                 ## 8-byte Reload
	jmp	LBB0_18
	.p2align	4, 0x90
LBB0_22:                                ##   in Loop: Header=BB0_2 Depth=1
	testl	%r15d, %r15d
	jle	LBB0_23
## %bb.24:                              ##   in Loop: Header=BB0_2 Depth=1
	movl	%r14d, %eax
	subl	%r15d, %eax
	cltq
	movslq	%r13d, %r13
	leaq	1(%rax), %rcx
	cmpq	%r14, %rcx
	cmovleq	%r14, %rcx
	subq	%rax, %rcx
	cmpq	$32, %rcx
	movq	-56(%rbp), %r10                 ## 8-byte Reload
	jae	LBB0_26
## %bb.25:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	-64(%rbp), %r11                 ## 8-byte Reload
	jmp	LBB0_35
LBB0_40:                                ##   in Loop: Header=BB0_2 Depth=1
	movslq	%r13d, %rax
	incl	%r13d
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movb	$63, (%rcx,%rax)
LBB0_6:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	-56(%rbp), %r10                 ## 8-byte Reload
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	jmp	LBB0_21
LBB0_23:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	-56(%rbp), %r10                 ## 8-byte Reload
	movq	-64(%rbp), %r11                 ## 8-byte Reload
	jmp	LBB0_36
LBB0_26:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	-64(%rbp), %r11                 ## 8-byte Reload
	leaq	(%r11,%r13), %rdx
	subq	%r10, %rdx
	subq	%rax, %rdx
	cmpq	$32, %rdx
	jb	LBB0_35
## %bb.27:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	%rcx, %r8
	andq	$-32, %r8
	leaq	-32(%r8), %rdx
	movq	%rdx, %r9
	shrq	$5, %r9
	incq	%r9
	testq	%rdx, %rdx
	je	LBB0_28
## %bb.29:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	%r9, %rsi
	andq	$-2, %rsi
	movq	-96(%rbp), %rdx                 ## 8-byte Reload
	addq	%rax, %rdx
	movq	-88(%rbp), %rdi                 ## 8-byte Reload
	leaq	(%rdi,%r13), %rbx
	xorl	%edi, %edi
	.p2align	4, 0x90
LBB0_30:                                ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movups	-48(%rdx,%rdi), %xmm0
	movups	-32(%rdx,%rdi), %xmm1
	movups	%xmm0, -48(%rbx,%rdi)
	movups	%xmm1, -32(%rbx,%rdi)
	movdqu	-16(%rdx,%rdi), %xmm0
	movdqu	(%rdx,%rdi), %xmm1
	movdqu	%xmm0, -16(%rbx,%rdi)
	movdqu	%xmm1, (%rbx,%rdi)
	addq	$64, %rdi
	addq	$-2, %rsi
	jne	LBB0_30
## %bb.31:                              ##   in Loop: Header=BB0_2 Depth=1
	testb	$1, %r9b
	je	LBB0_33
LBB0_32:                                ##   in Loop: Header=BB0_2 Depth=1
	leaq	(%rdi,%rax), %rdx
	addq	%r13, %rdi
	movdqu	(%r10,%rdx), %xmm0
	movdqu	16(%r10,%rdx), %xmm1
	movdqu	%xmm0, (%r11,%rdi)
	movdqu	%xmm1, 16(%r11,%rdi)
LBB0_33:                                ##   in Loop: Header=BB0_2 Depth=1
	addq	%r8, %r13
	cmpq	%r8, %rcx
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
	je	LBB0_36
## %bb.34:                              ##   in Loop: Header=BB0_2 Depth=1
	addq	%r8, %rax
	.p2align	4, 0x90
LBB0_35:                                ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movzbl	(%r10,%rax), %ecx
	movb	%cl, (%r11,%r13)
	incq	%r13
	incq	%rax
	cmpq	%r14, %rax
	jl	LBB0_35
LBB0_36:                                ##   in Loop: Header=BB0_2 Depth=1
	movb	(%r10,%r14), %al
	movslq	%r13d, %rcx
	incl	%r13d
	movb	%al, (%r11,%rcx)
	xorl	%r15d, %r15d
	jmp	LBB0_38
LBB0_9:                                 ##   in Loop: Header=BB0_2 Depth=1
	movl	%r14d, %eax
	andl	$-4, %eax
	movq	%r13, %xmm0
	leal	-4(%rax), %esi
	movl	%esi, %edx
	shrl	$2, %edx
	incl	%edx
	movl	%edx, %ecx
	andl	$7, %ecx
	pxor	%xmm1, %xmm1
	cmpl	$28, %esi
	jae	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_2 Depth=1
	movq	-56(%rbp), %r10                 ## 8-byte Reload
	pcmpeqd	%xmm2, %xmm2
	jmp	LBB0_13
LBB0_11:                                ##   in Loop: Header=BB0_2 Depth=1
	andl	$-8, %edx
	pxor	%xmm1, %xmm1
	movq	-56(%rbp), %r10                 ## 8-byte Reload
	pcmpeqd	%xmm2, %xmm2
	movdqa	LCPI0_0(%rip), %xmm3            ## xmm3 = [8,8]
	.p2align	4, 0x90
LBB0_12:                                ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	paddq	%xmm3, %xmm0
	paddq	%xmm3, %xmm1
	addl	$-8, %edx
	jne	LBB0_12
LBB0_13:                                ##   in Loop: Header=BB0_2 Depth=1
	testl	%ecx, %ecx
	je	LBB0_15
	.p2align	4, 0x90
LBB0_14:                                ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	psubq	%xmm2, %xmm0
	psubq	%xmm2, %xmm1
	decl	%ecx
	jne	LBB0_14
LBB0_15:                                ##   in Loop: Header=BB0_2 Depth=1
	paddq	%xmm1, %xmm0
	pshufd	$238, %xmm0, %xmm1              ## xmm1 = xmm0[2,3,2,3]
	paddq	%xmm0, %xmm1
	movq	%xmm1, %r13
	cmpl	%eax, %r14d
	jne	LBB0_17
## %bb.16:                              ##   in Loop: Header=BB0_2 Depth=1
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	jmp	LBB0_20
LBB0_17:                                ##   in Loop: Header=BB0_2 Depth=1
	addl	%eax, %ebx
LBB0_18:                                ##   in Loop: Header=BB0_2 Depth=1
	movl	-44(%rbp), %ecx                 ## 4-byte Reload
	.p2align	4, 0x90
LBB0_19:                                ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	incq	%r13
	incl	%ebx
	cmpl	%r12d, %ebx
	jl	LBB0_19
LBB0_20:                                ##   in Loop: Header=BB0_2 Depth=1
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
LBB0_21:                                ##   in Loop: Header=BB0_2 Depth=1
	movl	$128, -68(%rbp)
	xorl	%eax, %eax
	cmpl	$128, %ecx
	setne	%al
	subl	%eax, %r12d
	xorl	%r15d, %r15d
	jmp	LBB0_38
LBB0_28:                                ##   in Loop: Header=BB0_2 Depth=1
	xorl	%edi, %edi
	testb	$1, %r9b
	jne	LBB0_32
	jmp	LBB0_33
LBB0_39:
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_sanitize_utf8
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sanitize_utf8
_sanitize_utf8:                         ; @sanitize_utf8
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x1
	mov	x20, x0
	mov	w22, #128
	stp	wzr, w22, [sp, #40]
	add	w0, w1, #1
	mov	w1, #1
	bl	_xcalloc
	mov	x21, x0
	cmp	w19, #1
	b.lt	LBB0_25
; %bb.1:
	mov	w24, #0
	mov	w26, #0
	mov	w23, #0
	add	x8, x20, #32
	str	x8, [sp, #8]                    ; 8-byte Folded Spill
	add	x25, x21, #32
	mov	w8, #1
	dup.2d	v4, x8
	mov	w27, #128
	str	q4, [sp, #16]                   ; 16-byte Folded Spill
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	w24, w24, #1
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	ldr	w27, [sp, #44]
	add	w23, w23, #1
	cmp	w23, w19
	b.ge	LBB0_25
LBB0_4:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_10 Depth 2
                                        ;     Child Loop BB0_12 Depth 2
                                        ;     Child Loop BB0_18 Depth 2
                                        ;     Child Loop BB0_20 Depth 2
	sxtw	x28, w23
	ldrb	w2, [x20, x28]
	add	x0, sp, #44
	add	x1, sp, #40
	bl	_utf8_decode
	cmp	w0, #128
	b.eq	LBB0_14
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	cmp	w0, #129
	b.ne	LBB0_2
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	cbz	w24, LBB0_23
; %bb.7:                                ;   in Loop: Header=BB0_4 Depth=1
	cmp	w24, #1
	b.lt	LBB0_24
; %bb.8:                                ;   in Loop: Header=BB0_4 Depth=1
	sub	w28, w23, w24
	sxtw	x26, w26
	add	x0, x21, x26
	add	w8, w28, #1
	cmp	w23, w8
	csinc	w8, w23, w28, gt
	add	w8, w24, w8
	sub	w24, w8, w23
	sub	w8, w24, #1
	add	x2, x8, #1
	mov	w1, #63
	bl	_memset
	cmp	w24, #8
	b.lo	LBB0_12
; %bb.9:                                ;   in Loop: Header=BB0_4 Depth=1
	and	w8, w24, #0xfffffff8
	add	w28, w28, w8
	movi.2d	v0, #0000000000000000
	movi.2d	v1, #0000000000000000
	mov.d	v1[0], x26
	mov	x9, x8
	movi.2d	v2, #0000000000000000
	movi.2d	v3, #0000000000000000
	ldr	q4, [sp, #16]                   ; 16-byte Folded Reload
LBB0_10:                                ;   Parent Loop BB0_4 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	add.2d	v1, v1, v4
	add.2d	v0, v0, v4
	add.2d	v2, v2, v4
	add.2d	v3, v3, v4
	subs	w9, w9, #8
	b.ne	LBB0_10
; %bb.11:                               ;   in Loop: Header=BB0_4 Depth=1
	add.2d	v0, v0, v1
	add.2d	v0, v2, v0
	add.2d	v0, v3, v0
	addp.2d	d0, v0
	fmov	x26, d0
	cmp	w24, w8
	b.eq	LBB0_13
LBB0_12:                                ;   Parent Loop BB0_4 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	add	x26, x26, #1
	add	w28, w28, #1
	cmp	w28, w23
	b.lt	LBB0_12
LBB0_13:                                ;   in Loop: Header=BB0_4 Depth=1
                                        ; kill: def $w26 killed $w26 killed $x26 def $x26
	b	LBB0_24
LBB0_14:                                ;   in Loop: Header=BB0_4 Depth=1
	cmp	w24, #1
	b.lt	LBB0_22
; %bb.15:                               ;   in Loop: Header=BB0_4 Depth=1
	sub	w8, w23, w24
	sxtw	x8, w8
                                        ; kill: def $w26 killed $w26 killed $x26 def $x26
	sxtw	x10, w26
	add	x9, x8, #1
	cmp	x9, x28
	csinc	x9, x28, x8, le
	sub	x9, x9, x8
	cmp	x9, #64
	b.lo	LBB0_20
; %bb.16:                               ;   in Loop: Header=BB0_4 Depth=1
	add	x11, x21, x10
	add	x12, x20, x8
	sub	x11, x11, x12
	cmp	x11, #64
	b.lo	LBB0_20
; %bb.17:                               ;   in Loop: Header=BB0_4 Depth=1
	and	x11, x9, #0xffffffffffffffc0
	add	x26, x11, x10
	add	x12, x11, x8
	ldr	x13, [sp, #8]                   ; 8-byte Folded Reload
	add	x8, x13, x8
	add	x10, x25, x10
	mov	x13, x11
LBB0_18:                                ;   Parent Loop BB0_4 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldp	q0, q1, [x8, #-32]
	ldp	q2, q3, [x8], #64
	stp	q0, q1, [x10, #-32]
	stp	q2, q3, [x10], #64
	subs	x13, x13, #64
	b.ne	LBB0_18
; %bb.19:                               ;   in Loop: Header=BB0_4 Depth=1
	mov	x10, x26
	mov	x8, x12
	cmp	x9, x11
	b.eq	LBB0_21
LBB0_20:                                ;   Parent Loop BB0_4 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldrb	w9, [x20, x8]
	add	x26, x10, #1
	strb	w9, [x21, x10]
	add	x8, x8, #1
	mov	x10, x26
	cmp	x8, x28
	b.lt	LBB0_20
LBB0_21:                                ;   in Loop: Header=BB0_4 Depth=1
                                        ; kill: def $w26 killed $w26 killed $x26 def $x26
LBB0_22:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	w24, #0
	ldrb	w8, [x20, x28]
	strb	w8, [x21, w26, sxtw]
	add	w8, w26, #1
	mov	x26, x8
	b	LBB0_3
LBB0_23:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	w8, #63
	strb	w8, [x21, w26, sxtw]
	add	w8, w26, #1
	mov	x26, x8
LBB0_24:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	w24, #0
	str	w22, [sp, #44]
	cmp	w27, #128
	cset	w8, ne
	sub	w23, w23, w8
	b	LBB0_3
LBB0_25:
	mov	x0, x21
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_sanitize_utf8
.subsections_via_symbols
