	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_strbuf_utf8_replace            ## -- Begin function strbuf_utf8_replace
	.p2align	4, 0x90
_strbuf_utf8_replace:                   ## @strbuf_utf8_replace
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, -52(%rbp)                 ## 4-byte Spill
	movl	%esi, -56(%rbp)                 ## 4-byte Spill
	movq	_STRBUF_INIT@GOTPCREL(%rip), %rax
	movups	(%rax), %xmm0
	movaps	%xmm0, -96(%rbp)
	movq	(%rdi), %r14
	movq	%r14, -48(%rbp)
	movslq	8(%rdi), %r12
	testq	%rcx, %rcx
	movq	%rdi, -112(%rbp)                ## 8-byte Spill
	movq	%rcx, -64(%rbp)                 ## 8-byte Spill
	je	LBB0_1
## %bb.2:
	movq	%rdi, %rbx
	movq	%rcx, %rdi
	callq	_strlen
	movl	%eax, %r15d
	movl	8(%rbx), %esi
	jmp	LBB0_3
LBB0_1:
	xorl	%r15d, %r15d
	movl	%r12d, %esi
LBB0_3:
	movq	%r12, %rbx
	addl	%r15d, %esi
	leaq	-96(%rbp), %rdi
	callq	_strbuf_grow
	movq	-96(%rbp), %r13
	testl	%ebx, %ebx
	jle	LBB0_4
## %bb.5:
	addq	%r14, %rbx
	movl	-56(%rbp), %eax                 ## 4-byte Reload
	addl	%eax, -52(%rbp)                 ## 4-byte Folded Spill
	movslq	%r15d, %rax
	movq	%rax, -104(%rbp)                ## 8-byte Spill
	xorl	%ecx, %ecx
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_17:                                ##   in Loop: Header=BB0_6 Depth=1
	subl	%r12d, %r14d
	movq	%r13, %rdi
	movq	%r12, %rsi
	movl	%r14d, %edx
	callq	_memcpy
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	movq	-48(%rbp), %r14
	movq	%r14, %rax
	subq	%r12, %rax
	addq	%rax, %r13
LBB0_18:                                ##   in Loop: Header=BB0_6 Depth=1
	addl	%r15d, %ecx
	cmpq	%rbx, %r14
	jae	LBB0_19
LBB0_6:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_8 Depth 2
	movq	%rcx, -72(%rbp)                 ## 8-byte Spill
	movq	%rbx, %r15
	movq	%r14, %rdi
	callq	_display_mode_esc_sequence_len
	testq	%rax, %rax
	je	LBB0_9
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	%rax, %rbx
	.p2align	4, 0x90
LBB0_8:                                 ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	-48(%rbp), %rsi
	movq	%r13, %rdi
	movl	%ebx, %edx
	callq	_memcpy
	addq	%rbx, %r13
	addq	-48(%rbp), %rbx
	movq	%rbx, -48(%rbp)
	movq	%rbx, %rdi
	callq	_display_mode_esc_sequence_len
	movq	%rax, %rbx
	testq	%rax, %rax
	jne	LBB0_8
LBB0_9:                                 ##   in Loop: Header=BB0_6 Depth=1
	movq	-48(%rbp), %r12
	cmpq	%r15, %r12
	jae	LBB0_19
## %bb.10:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	%r15, %rbx
	leaq	-48(%rbp), %rdi
	xorl	%esi, %esi
	callq	_utf8_width
	movq	-48(%rbp), %r14
	testq	%r14, %r14
	je	LBB0_21
## %bb.11:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	%rax, %r15
	testq	%rax, %rax
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	je	LBB0_17
## %bb.12:                              ##   in Loop: Header=BB0_6 Depth=1
	cmpl	-56(%rbp), %ecx                 ## 4-byte Folded Reload
	jl	LBB0_17
## %bb.13:                              ##   in Loop: Header=BB0_6 Depth=1
	cmpl	-52(%rbp), %ecx                 ## 4-byte Folded Reload
	jge	LBB0_17
## %bb.14:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	testq	%rsi, %rsi
	je	LBB0_15
## %bb.16:                              ##   in Loop: Header=BB0_6 Depth=1
	movq	%r13, %rdi
	movq	-104(%rbp), %r14                ## 8-byte Reload
	movl	%r14d, %edx
	callq	_memcpy
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	addq	%r14, %r13
	movq	-48(%rbp), %r14
LBB0_15:                                ##   in Loop: Header=BB0_6 Depth=1
	xorl	%eax, %eax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	jmp	LBB0_18
LBB0_4:
	movq	%r13, %rsi
	jmp	LBB0_20
LBB0_19:
	movq	%r13, %rsi
	movq	-96(%rbp), %r13
LBB0_20:
	subl	%r13d, %esi
	leaq	-96(%rbp), %rbx
	movq	%rbx, %rdi
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_strbuf_setlen
	movq	-112(%rbp), %rdi                ## 8-byte Reload
	movq	%rbx, %rsi
	callq	_strbuf_swap
LBB0_21:
	leaq	-96(%rbp), %rdi
	callq	_strbuf_release
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_STRBUF_INIT,16,3               ## @STRBUF_INIT
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_strbuf_utf8_replace            ; -- Begin function strbuf_utf8_replace
	.p2align	2
_strbuf_utf8_replace:                   ; @strbuf_utf8_replace
	.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	x21, x3
	mov	x25, x2
	mov	x20, x1
	mov	x26, x0
Lloh0:
	adrp	x8, _STRBUF_INIT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _STRBUF_INIT@GOTPAGEOFF]
Lloh2:
	ldr	q0, [x8]
	str	q0, [sp, #32]
	ldr	x24, [x0]
	str	x24, [sp, #24]
	ldrsw	x19, [x0, #8]
	cbz	x3, LBB0_2
; %bb.1:
	mov	x0, x21
	bl	_strlen
	mov	x22, x0
	ldr	w8, [x26, #8]
	b	LBB0_3
LBB0_2:
	mov	w22, #0
	mov	x8, x19
LBB0_3:
	add	w1, w8, w22
	add	x0, sp, #32
	bl	_strbuf_grow
	ldr	x23, [sp, #32]
	cmp	w19, #1
	b.lt	LBB0_18
; %bb.4:
	mov	w27, #0
	add	x28, x24, x19
	add	w19, w25, w20
	sxtw	x8, w22
	stp	x26, x8, [sp, #8]               ; 16-byte Folded Spill
	b	LBB0_8
LBB0_5:                                 ;   in Loop: Header=BB0_8 Depth=1
	sub	w2, w24, w26
	mov	x0, x23
	mov	x1, x26
	bl	_memcpy
	ldr	x24, [sp, #24]
	sub	x8, x24, x26
LBB0_6:                                 ;   in Loop: Header=BB0_8 Depth=1
	add	x23, x23, x8
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=1
	add	w27, w27, w25
	cmp	x24, x28
	b.hs	LBB0_19
LBB0_8:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_10 Depth 2
	mov	x0, x24
	bl	_display_mode_esc_sequence_len
	cbz	x0, LBB0_11
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	mov	x24, x0
LBB0_10:                                ;   Parent Loop BB0_8 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x1, [sp, #24]
	mov	x0, x23
	mov	x2, x24
	bl	_memcpy
	ldr	x8, [sp, #24]
	add	x0, x8, x24
	str	x0, [sp, #24]
	add	x23, x23, x24
	bl	_display_mode_esc_sequence_len
	mov	x24, x0
	cbnz	x0, LBB0_10
LBB0_11:                                ;   in Loop: Header=BB0_8 Depth=1
	ldr	x26, [sp, #24]
	cmp	x26, x28
	b.hs	LBB0_19
; %bb.12:                               ;   in Loop: Header=BB0_8 Depth=1
	add	x0, sp, #24
	mov	x1, #0
	bl	_utf8_width
	ldr	x24, [sp, #24]
	cbz	x24, LBB0_21
; %bb.13:                               ;   in Loop: Header=BB0_8 Depth=1
	mov	x25, x0
	cbz	x0, LBB0_5
; %bb.14:                               ;   in Loop: Header=BB0_8 Depth=1
	cmp	w27, w20
	b.lt	LBB0_5
; %bb.15:                               ;   in Loop: Header=BB0_8 Depth=1
	cmp	w27, w19
	b.ge	LBB0_5
; %bb.16:                               ;   in Loop: Header=BB0_8 Depth=1
	cbz	x21, LBB0_7
; %bb.17:                               ;   in Loop: Header=BB0_8 Depth=1
	mov	x0, x23
	mov	x1, x21
	mov	x2, x22
	bl	_memcpy
	mov	x21, #0
	ldp	x8, x24, [sp, #16]              ; 8-byte Folded Reload
	b	LBB0_6
LBB0_18:
	mov	x8, x23
	b	LBB0_20
LBB0_19:
	mov	x8, x23
	ldr	x23, [sp, #32]
	ldr	x26, [sp, #8]                   ; 8-byte Folded Reload
LBB0_20:
	sub	w1, w8, w23
	add	x0, sp, #32
	bl	_strbuf_setlen
	add	x1, sp, #32
	mov	x0, x26
	bl	_strbuf_swap
LBB0_21:
	add	x0, sp, #32
	bl	_strbuf_release
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_STRBUF_INIT,16,3               ; @STRBUF_INIT
.subsections_via_symbols
