	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function EDIT_EM_ReplaceSel
_EDIT_EM_ReplaceSel:                    ## @EDIT_EM_ReplaceSel
	.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
	movq	%r9, -96(%rbp)                  ## 8-byte Spill
	movq	%r8, %r12
	movq	%rcx, %r15
	movq	%rdx, %r13
	movq	%rsi, %rbx
	movq	%rdi, %r14
	callq	_get_text_length
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	%r13, -112(%rbp)                ## 8-byte Spill
	movq	%r13, %rdi
	movq	%r15, %rsi
	callq	_debugstr_wn
	leaq	L_.str(%rip), %rdi
	movl	%eax, %esi
	movq	%rbx, -104(%rbp)                ## 8-byte Spill
	movq	%rbx, %rdx
	movq	%r12, -64(%rbp)                 ## 8-byte Spill
	movq	%r12, %rcx
	xorl	%eax, %eax
	callq	_TRACE
	movq	(%r14), %rbx
	movq	8(%r14), %r12
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	movq	%r14, %rdi
	callq	_EDIT_InvalidateUniscribeData
	testq	%r15, %r15
	jne	LBB0_2
## %bb.1:
	cmpq	%rbx, %r12
	je	LBB0_13
LBB0_2:
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	_ORDER_UINT
	movq	%r12, -56(%rbp)                 ## 8-byte Spill
	movq	%r12, %rax
	movq	%r15, %r12
	movq	%rbx, -88(%rbp)                 ## 8-byte Spill
	subq	%rbx, %rax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	movq	-72(%rbp), %rbx                 ## 8-byte Reload
	subq	%rax, %rbx
	movq	%rbx, %rax
	addq	%r15, %rax
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	jne	LBB0_4
## %bb.3:
	movq	$0, 16(%r14)
LBB0_4:
	cmpq	$0, -96(%rbp)                   ## 8-byte Folded Reload
	je	LBB0_9
## %bb.5:
	cmpq	24(%r14), %rax
	jle	LBB0_9
## %bb.6:
	movq	_EN_MAXTEXT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	callq	_EDIT_NOTIFY_PARENT
	movq	24(%r14), %rsi
	subq	%rbx, %rsi
	jge	LBB0_8
## %bb.7:
	xorl	%r12d, %r12d
	jmp	LBB0_9
LBB0_8:
	movq	%r12, %rdi
	callq	_min
	movq	%rax, %r12
LBB0_9:
	addq	%r12, %rbx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_EDIT_MakeFit
	testl	%eax, %eax
	movq	-88(%rbp), %r13                 ## 8-byte Reload
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	je	LBB0_13
## %bb.10:
	cmpq	%r13, %rax
	je	LBB0_14
## %bb.11:
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_TRACE
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	leaq	1(%rax), %rdi
	callq	_heap_alloc
	movq	%rax, %r15
	testq	%rax, %rax
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	je	LBB0_13
## %bb.12:
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movq	32(%r14), %rsi
	addq	%r13, %rsi
	movq	%r15, %rdi
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdx
	movq	%r12, -72(%rbp)                 ## 8-byte Spill
	movq	%rax, %r12
	callq	_memcpy
	movb	$0, (%r15,%rbx)
	movq	%r15, %rbx
	movq	32(%r14), %rsi
	leaq	(%rsi,%r13), %rdi
	addq	%r12, %rsi
	movq	-72(%rbp), %r12                 ## 8-byte Reload
	movq	%r14, %r15
	callq	_strcpyW
	movq	%r14, %rdi
	callq	_text_buffer_changed
	jmp	LBB0_15
LBB0_13:
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_14:
	xorl	%ebx, %ebx
	movq	-48(%rbp), %r15                 ## 8-byte Reload
LBB0_15:
	testq	%r12, %r12
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movq	%rbx, %rax
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	je	LBB0_44
## %bb.16:
	movq	%r15, %rdi
	callq	_get_text_length
	movq	%rax, %rbx
	movq	32(%r15), %rdi
	addq	%r13, %rdi
	callq	_debugstr_w
	movl	%eax, %r13d
	movq	32(%r15), %rdi
	callq	_debugstr_w
	leaq	L_.str.2(%rip), %rdi
	movq	%rbx, %rsi
	movq	%r12, %rdx
	movq	-88(%rbp), %rcx                 ## 8-byte Reload
	movl	%r13d, %r8d
	movq	-88(%rbp), %r13                 ## 8-byte Reload
	movl	%eax, %r9d
	xorl	%eax, %eax
	callq	_TRACE
	movq	32(%r15), %rdi
	addq	%rdi, %rbx
	addq	%r13, %rdi
	cmpq	%rdi, %rbx
	movq	-112(%rbp), %r8                 ## 8-byte Reload
	jb	LBB0_18
	.p2align	4, 0x90
LBB0_17:                                ## =>This Inner Loop Header: Depth=1
	movzbl	(%rbx), %eax
	movb	%al, (%rbx,%r12)
	decq	%rbx
	movq	32(%r15), %rdi
	addq	%r13, %rdi
	cmpq	%rdi, %rbx
	jae	LBB0_17
LBB0_18:
	testq	%r12, %r12
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	jle	LBB0_39
## %bb.19:
	xorl	%eax, %eax
	cmpq	$8, %r12
	jb	LBB0_35
## %bb.20:
	movq	%rdi, %rcx
	subq	%r8, %rcx
	cmpq	$32, %rcx
	jb	LBB0_35
## %bb.21:
	cmpq	$32, %r12
	jae	LBB0_23
## %bb.22:
	xorl	%eax, %eax
	jmp	LBB0_32
LBB0_23:
	movq	%r12, %rax
	andq	$-32, %rax
	leaq	-32(%rax), %rsi
	movq	%rsi, %rdx
	shrq	$5, %rdx
	incq	%rdx
	movl	%edx, %ecx
	andl	$3, %ecx
	cmpq	$96, %rsi
	jae	LBB0_25
## %bb.24:
	xorl	%esi, %esi
	jmp	LBB0_27
LBB0_25:
	andq	$-4, %rdx
	xorl	%esi, %esi
	.p2align	4, 0x90
LBB0_26:                                ## =>This Inner Loop Header: Depth=1
	movups	(%r8,%rsi), %xmm0
	movups	16(%r8,%rsi), %xmm1
	movups	%xmm0, (%rdi,%rsi)
	movups	%xmm1, 16(%rdi,%rsi)
	movups	32(%r8,%rsi), %xmm0
	movups	48(%r8,%rsi), %xmm1
	movups	%xmm0, 32(%rdi,%rsi)
	movups	%xmm1, 48(%rdi,%rsi)
	movups	64(%r8,%rsi), %xmm0
	movups	80(%r8,%rsi), %xmm1
	movups	%xmm0, 64(%rdi,%rsi)
	movups	%xmm1, 80(%rdi,%rsi)
	movups	96(%r8,%rsi), %xmm0
	movups	112(%r8,%rsi), %xmm1
	movups	%xmm0, 96(%rdi,%rsi)
	movups	%xmm1, 112(%rdi,%rsi)
	subq	$-128, %rsi
	addq	$-4, %rdx
	jne	LBB0_26
LBB0_27:
	testq	%rcx, %rcx
	je	LBB0_30
## %bb.28:
	leaq	(%rdi,%rsi), %rdx
	addq	$16, %rdx
	addq	%r8, %rsi
	addq	$16, %rsi
	shlq	$5, %rcx
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_29:                                ## =>This Inner Loop Header: Depth=1
	movups	-16(%rsi,%rbx), %xmm0
	movups	(%rsi,%rbx), %xmm1
	movups	%xmm0, -16(%rdx,%rbx)
	movups	%xmm1, (%rdx,%rbx)
	addq	$32, %rbx
	cmpq	%rbx, %rcx
	jne	LBB0_29
LBB0_30:
	cmpq	%rax, %r12
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	je	LBB0_39
## %bb.31:
	testb	$24, %r12b
	je	LBB0_35
LBB0_32:
	movq	%rax, %rcx
	movq	%r12, %rax
	andq	$-8, %rax
	.p2align	4, 0x90
LBB0_33:                                ## =>This Inner Loop Header: Depth=1
	movq	(%r8,%rcx), %rdx
	movq	%rdx, (%rdi,%rcx)
	addq	$8, %rcx
	cmpq	%rcx, %rax
	jne	LBB0_33
## %bb.34:
	cmpq	%rax, %r12
	je	LBB0_39
LBB0_35:
	movq	%rax, %rcx
	notq	%rcx
	addq	%r12, %rcx
	movq	%r12, %rdx
	andq	$3, %rdx
	je	LBB0_37
	.p2align	4, 0x90
LBB0_36:                                ## =>This Inner Loop Header: Depth=1
	movzbl	(%r8,%rax), %ebx
	movb	%bl, (%rdi,%rax)
	incq	%rax
	decq	%rdx
	jne	LBB0_36
LBB0_37:
	cmpq	$3, %rcx
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	jb	LBB0_39
	.p2align	4, 0x90
LBB0_38:                                ## =>This Inner Loop Header: Depth=1
	movzbl	(%r8,%rax), %ecx
	movb	%cl, (%rdi,%rax)
	movzbl	1(%r8,%rax), %ecx
	movb	%cl, 1(%rdi,%rax)
	movzbl	2(%r8,%rax), %ecx
	movb	%cl, 2(%rdi,%rax)
	movzbl	3(%r8,%rax), %ecx
	movb	%cl, 3(%rdi,%rax)
	addq	$4, %rax
	cmpq	%rax, %r12
	jne	LBB0_38
LBB0_39:
	movl	40(%r15), %eax
	movq	_ES_UPPERCASE@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_41
## %bb.40:
	movq	%r12, %rsi
	callq	_CharUpperBuffW
	jmp	LBB0_43
LBB0_41:
	movq	_ES_LOWERCASE@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_43
## %bb.42:
	movq	%r12, %rsi
	callq	_CharLowerBuffW
LBB0_43:
	movq	%r15, %rdi
	callq	_text_buffer_changed
LBB0_44:
	movq	_ES_MULTILINE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 40(%r15)
	je	LBB0_49
## %bb.45:
	movq	(%r15), %rdi
	movq	8(%r15), %rsi
	callq	_min
	movq	%rax, %rbx
	movq	%r15, %rdi
	callq	_get_vertical_line_count
	movq	%rax, %r14
	xorl	%edi, %edi
	xorl	%esi, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_CreateRectRgn
	movq	%rax, %r8
	leaq	(%rbx,%r12), %rdx
	movq	8(%r15), %rax
	subq	(%r15), %rax
	movq	%rax, %rcx
	negq	%rcx
	cmovnsq	%rax, %rcx
	addq	%r12, %rcx
	movq	%r15, %rdi
	movq	%rbx, %rsi
	movq	%r8, -72(%rbp)                  ## 8-byte Spill
	callq	_EDIT_BuildLineDefs_ML
	cmpq	$0, -96(%rbp)                   ## 8-byte Folded Reload
	je	LBB0_47
## %bb.46:
	movq	_ES_AUTOVSCROLL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 40(%r15)
	je	LBB0_68
LBB0_47:
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
LBB0_48:
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	jmp	LBB0_53
LBB0_49:
	movq	%r14, %rbx
	movq	104(%r15), %r14
	subq	112(%r15), %r14
	movq	%r15, %rdi
	callq	_EDIT_InvalidateUniscribeData
	movq	%r15, %rdi
	callq	_EDIT_CalcLineWidth_SL
	cmpq	$0, -96(%rbp)                   ## 8-byte Folded Reload
	je	LBB0_51
## %bb.50:
	movq	_ES_AUTOHSCROLL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 40(%r15)
	je	LBB0_78
LBB0_51:
	xorl	%eax, %eax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	-56(%rbp), %rax                 ## 8-byte Reload
LBB0_52:
	movq	%rbx, %r14
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
LBB0_53:
	cmpq	%r13, %rax
	je	LBB0_59
## %bb.54:
	cmpq	$0, -104(%rbp)                  ## 8-byte Folded Reload
	je	LBB0_66
## %bb.55:
	movq	64(%r15), %rdi
	callq	_strlenW
	cmpq	$0, 72(%r15)
	je	LBB0_75
LBB0_56:
	movq	%r15, %rdi
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rsi
	callq	_EDIT_MakeUndoFit
	movq	64(%r15), %rdi
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rsi
	movq	%rbx, %rdx
	callq	_memcpy
	movq	64(%r15), %rax
	movb	$0, (%rax,%rbx)
	movq	%r14, %rbx
	movq	%r13, 80(%r15)
LBB0_57:
	movq	-64(%rbp), %r14                 ## 8-byte Reload
LBB0_58:
	movq	$0, 72(%r15)
LBB0_59:
	testq	%r12, %r12
	je	LBB0_65
## %bb.60:
	cmpq	$0, -104(%rbp)                  ## 8-byte Folded Reload
	je	LBB0_67
## %bb.61:
	movq	72(%r15), %rax
	movq	80(%r15), %rcx
	cmpq	%rcx, %r13
	je	LBB0_64
## %bb.62:
	testq	%rax, %rax
	je	LBB0_84
## %bb.63:
	addq	%rax, %rcx
	cmpq	%rcx, %r13
	jne	LBB0_84
LBB0_64:
	addq	%r12, %rax
	movq	%rax, 72(%r15)
	jmp	LBB0_120
LBB0_66:
	movq	%r15, %rdi
	callq	_EDIT_EM_EmptyUndoBuffer
	testq	%r12, %r12
	je	LBB0_65
LBB0_67:
	movq	%r15, %rdi
	callq	_EDIT_EM_EmptyUndoBuffer
	jmp	LBB0_120
LBB0_65:
	xorl	%r12d, %r12d
LBB0_120:
	movq	%rbx, %rdi
	callq	_heap_free
	addq	%r12, %r13
	movq	_ES_RIGHT@GOTPCREL(%rip), %rax
	movq	_ES_CENTER@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	testl	%ecx, 40(%r15)
	je	LBB0_124
## %bb.121:
	movq	8(%r15), %rax
	subq	(%r15), %rax
	movq	%rax, %rcx
	negq	%rcx
	cmovsq	%rax, %rcx
	subq	%rcx, %r12
	jns	LBB0_124
## %bb.122:
	movq	88(%r15), %rax
	testq	%rax, %rax
	je	LBB0_124
## %bb.123:
	leaq	(%rax,%r12), %rcx
	negq	%r12
	xorl	%edx, %edx
	cmpq	%r12, %rax
	cmovgeq	%rcx, %rdx
	movq	%rdx, 88(%r15)
LBB0_124:
	movq	_FALSE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r15, %rdi
	movq	%r13, %rsi
	movq	%r13, %rdx
	callq	_EDIT_EM_SetSel
	movq	_EF_MODIFIED@GOTPCREL(%rip), %rcx
	movl	96(%r15), %eax
	orl	(%rcx), %eax
	movl	%eax, 96(%r15)
	testq	%r14, %r14
	je	LBB0_126
## %bb.125:
	movq	_EF_UPDATE@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%eax, 96(%r15)
LBB0_126:
	movq	_TRUE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	-72(%rbp), %rbx                 ## 8-byte Reload
	movq	%r15, %rdi
	testq	%rbx, %rbx
	je	LBB0_128
## %bb.127:
	movq	%rbx, %rsi
	callq	_EDIT_UpdateTextRegion
	movq	%rbx, %rdi
	callq	_DeleteObject
	jmp	LBB0_129
LBB0_128:
	xorl	%esi, %esi
	callq	_EDIT_UpdateText
LBB0_129:
	movq	%r15, %rdi
	callq	_EDIT_EM_ScrollCaret
	movq	%r15, %rdi
	callq	_EDIT_UpdateScrollInfo
	testq	%r14, %r14
	je	LBB0_131
## %bb.130:
	movq	_EF_UPDATE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	96(%r15), %eax
	jmp	LBB0_132
LBB0_131:
	movl	96(%r15), %eax
	movq	_EF_UPDATE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%eax, %ecx
	je	LBB0_133
LBB0_132:
	notl	%ecx
	andl	%eax, %ecx
	movl	%ecx, 96(%r15)
	movq	_EN_CHANGE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_EDIT_NOTIFY_PARENT
LBB0_133:
	movq	%r15, %rdi
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_EDIT_InvalidateUniscribeData   ## TAILCALL
LBB0_68:
	cmpq	%r14, 48(%r15)
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	jle	LBB0_53
## %bb.69:
	testq	%r12, %r12
	movq	-80(%rbp), %r14                 ## 8-byte Reload
	je	LBB0_71
## %bb.70:
	movq	32(%r15), %rdi
	addq	%rax, %rdi
	leaq	(%rdi,%r12), %rsi
	callq	_strcpyW
	movq	-56(%rbp), %rax                 ## 8-byte Reload
LBB0_71:
	cmpq	%r13, %rax
	je	LBB0_119
## %bb.72:
	testq	%r14, %r14
	jle	LBB0_119
## %bb.73:
	movq	32(%r15), %rax
	cmpq	$8, %r14
	jb	LBB0_74
## %bb.93:
	leaq	(%rax,%r13), %r9
	movq	%r9, %rcx
	subq	%rbx, %rcx
	cmpq	$32, %rcx
	jae	LBB0_101
LBB0_74:
	xorl	%ecx, %ecx
LBB0_117:
	addq	%r13, %rax
LBB0_118:                               ## =>This Inner Loop Header: Depth=1
	movzbl	(%rbx,%rcx), %edx
	movb	%dl, (%rax,%rcx)
	incq	%rcx
	cmpq	%rcx, %r14
	jne	LBB0_118
LBB0_119:
	movq	%r15, %rdi
	callq	_text_buffer_changed
	movq	8(%r15), %rax
	subq	(%r15), %rax
	movq	%rax, %rcx
	negq	%rcx
	cmovsq	%rax, %rcx
	subq	%r12, %rcx
	movq	%r15, %rdi
	movq	%r13, %rsi
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movq	-72(%rbp), %r8                  ## 8-byte Reload
	callq	_EDIT_BuildLineDefs_ML
	xorl	%r12d, %r12d
	xorl	%edi, %edi
	xorl	%esi, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_CreateRectRgn
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movq	_EN_MAXTEXT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_EDIT_NOTIFY_PARENT
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	jmp	LBB0_120
LBB0_75:
	movq	%rax, %r14
	movq	64(%r15), %rax
	cmpb	$0, (%rax)
	je	LBB0_56
## %bb.76:
	movq	80(%r15), %rax
	cmpq	%rax, %r13
	jne	LBB0_87
## %bb.77:
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	addq	%r14, %rsi
	subq	%r13, %rsi
	movq	%r15, %rdi
	callq	_EDIT_MakeUndoFit
	movq	64(%r15), %rdi
	addq	%r14, %rdi
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	movq	-80(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdx
	callq	_memcpy
	movq	64(%r15), %rax
	addq	%r14, %rax
	movb	$0, (%rbx,%rax)
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	jmp	LBB0_57
LBB0_78:
	cmpq	%r14, 16(%r15)
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	jle	LBB0_86
## %bb.79:
	testq	%r12, %r12
	js	LBB0_91
## %bb.80:
	movq	%r13, %rax
	movq	%r12, %r13
	negq	%r13
	addq	%rax, %r12
	movq	%r12, %rbx
	.p2align	4, 0x90
LBB0_81:                                ## =>This Inner Loop Header: Depth=1
	movq	32(%r15), %rax
	leaq	(%rbx,%rax), %rsi
	leaq	(%rbx,%rax), %rdi
	decq	%rdi
	callq	_strcpyW
	movl	$-1, 56(%r15)
	movq	%r15, %rdi
	callq	_EDIT_InvalidateUniscribeData
	movq	%r15, %rdi
	callq	_EDIT_CalcLineWidth_SL
	leaq	1(%r13), %r12
	cmpq	%r14, 16(%r15)
	jle	LBB0_83
## %bb.82:                              ##   in Loop: Header=BB0_81 Depth=1
	decq	%rbx
	testq	%r13, %r13
	movq	%r12, %r13
	jne	LBB0_81
LBB0_83:
	negq	%r12
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movq	-88(%rbp), %r13                 ## 8-byte Reload
	jmp	LBB0_92
LBB0_84:
	movq	%r13, 80(%r15)
	movq	%r12, 72(%r15)
	movq	64(%r15), %rax
	movb	$0, (%rax)
	jmp	LBB0_120
LBB0_86:
	xorl	%ecx, %ecx
	movq	%rcx, -72(%rbp)                 ## 8-byte Spill
	jmp	LBB0_52
LBB0_87:
	cmpq	%rax, -56(%rbp)                 ## 8-byte Folded Reload
	jne	LBB0_56
## %bb.88:
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	addq	%r14, %rsi
	subq	%r13, %rsi
	movq	%r15, %rdi
	callq	_EDIT_MakeUndoFit
	movq	64(%r15), %rax
	testq	%r14, %r14
	js	LBB0_95
## %bb.89:
	addq	%r14, %rax
	movq	%rax, %rcx
	movq	-80(%rbp), %r8                  ## 8-byte Reload
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
LBB0_90:                                ## =>This Inner Loop Header: Depth=1
	movzbl	(%rcx), %eax
	movb	%al, (%rcx,%r8)
	decq	%rcx
	movq	64(%r15), %rax
	cmpq	%rax, %rcx
	jae	LBB0_90
	jmp	LBB0_96
LBB0_91:
	movq	%rbx, %r14
LBB0_92:
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	movq	%r15, %rdi
	callq	_text_buffer_changed
	movq	_EN_MAXTEXT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_EDIT_NOTIFY_PARENT
	xorl	%eax, %eax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	jmp	LBB0_48
LBB0_95:
	movq	-80(%rbp), %r8                  ## 8-byte Reload
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
LBB0_96:
	testq	%r8, %r8
	jle	LBB0_145
## %bb.97:
	xorl	%ecx, %ecx
	cmpq	$8, %r8
	jb	LBB0_143
## %bb.98:
	movq	%rax, %rdx
	subq	%rbx, %rdx
	cmpq	$32, %rdx
	jb	LBB0_143
## %bb.99:
	cmpq	$32, %r8
	jae	LBB0_105
## %bb.100:
	xorl	%ecx, %ecx
	jmp	LBB0_141
LBB0_101:
	cmpq	$32, %r14
	jae	LBB0_103
## %bb.102:
	xorl	%ecx, %ecx
	jmp	LBB0_114
LBB0_103:
	movq	%r14, %rcx
	andq	$-32, %rcx
	leaq	-32(%rcx), %rsi
	movq	%rsi, %rdi
	shrq	$5, %rdi
	incq	%rdi
	movl	%edi, %r8d
	andl	$3, %r8d
	cmpq	$96, %rsi
	jae	LBB0_107
## %bb.104:
	xorl	%ebx, %ebx
	jmp	LBB0_109
LBB0_105:
	movq	%r8, %rcx
	andq	$-32, %rcx
	leaq	-32(%rcx), %rdi
	movq	%rdi, %rsi
	shrq	$5, %rsi
	incq	%rsi
	movl	%esi, %edx
	andl	$3, %edx
	cmpq	$96, %rdi
	jae	LBB0_134
## %bb.106:
	xorl	%edi, %edi
	jmp	LBB0_136
LBB0_107:
	andq	$-4, %rdi
	leaq	(%rax,%r13), %rsi
	addq	$112, %rsi
	xorl	%ebx, %ebx
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
LBB0_108:                               ## =>This Inner Loop Header: Depth=1
	movups	(%rdx,%rbx), %xmm0
	movups	16(%rdx,%rbx), %xmm1
	movups	%xmm0, -112(%rsi,%rbx)
	movups	%xmm1, -96(%rsi,%rbx)
	movups	32(%rdx,%rbx), %xmm0
	movups	48(%rdx,%rbx), %xmm1
	movups	%xmm0, -80(%rsi,%rbx)
	movups	%xmm1, -64(%rsi,%rbx)
	movups	64(%rdx,%rbx), %xmm0
	movups	80(%rdx,%rbx), %xmm1
	movups	%xmm0, -48(%rsi,%rbx)
	movups	%xmm1, -32(%rsi,%rbx)
	movups	96(%rdx,%rbx), %xmm0
	movups	112(%rdx,%rbx), %xmm1
	movups	%xmm0, -16(%rsi,%rbx)
	movups	%xmm1, (%rsi,%rbx)
	subq	$-128, %rbx
	addq	$-4, %rdi
	jne	LBB0_108
LBB0_109:
	testq	%r8, %r8
	je	LBB0_112
## %bb.110:
	leaq	(%rbx,%r13), %rsi
	addq	%rax, %rsi
	addq	$16, %rsi
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	leaq	(%rbx,%rdx), %rdi
	addq	$16, %rdi
	shlq	$5, %r8
	xorl	%ebx, %ebx
LBB0_111:                               ## =>This Inner Loop Header: Depth=1
	movups	-16(%rdi,%rbx), %xmm0
	movups	(%rdi,%rbx), %xmm1
	movups	%xmm0, -16(%rsi,%rbx)
	movups	%xmm1, (%rsi,%rbx)
	addq	$32, %rbx
	cmpq	%rbx, %r8
	jne	LBB0_111
LBB0_112:
	cmpq	%rcx, %r14
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	je	LBB0_119
## %bb.113:
	testb	$24, %r14b
	je	LBB0_117
LBB0_114:
	movq	%rcx, %rsi
	movq	%r14, %rcx
	andq	$-8, %rcx
LBB0_115:                               ## =>This Inner Loop Header: Depth=1
	movq	(%rbx,%rsi), %rdi
	movq	%rdi, (%r9,%rsi)
	addq	$8, %rsi
	cmpq	%rsi, %rcx
	jne	LBB0_115
## %bb.116:
	cmpq	%rcx, %r14
	je	LBB0_119
	jmp	LBB0_117
LBB0_134:
	andq	$-4, %rsi
	xorl	%edi, %edi
LBB0_135:                               ## =>This Inner Loop Header: Depth=1
	movups	(%rbx,%rdi), %xmm0
	movups	16(%rbx,%rdi), %xmm1
	movups	%xmm0, (%rax,%rdi)
	movups	%xmm1, 16(%rax,%rdi)
	movups	32(%rbx,%rdi), %xmm0
	movups	48(%rbx,%rdi), %xmm1
	movups	%xmm0, 32(%rax,%rdi)
	movups	%xmm1, 48(%rax,%rdi)
	movups	64(%rbx,%rdi), %xmm0
	movups	80(%rbx,%rdi), %xmm1
	movups	%xmm0, 64(%rax,%rdi)
	movups	%xmm1, 80(%rax,%rdi)
	movups	96(%rbx,%rdi), %xmm0
	movups	112(%rbx,%rdi), %xmm1
	movups	%xmm0, 96(%rax,%rdi)
	movups	%xmm1, 112(%rax,%rdi)
	subq	$-128, %rdi
	addq	$-4, %rsi
	jne	LBB0_135
LBB0_136:
	testq	%rdx, %rdx
	je	LBB0_139
## %bb.137:
	leaq	(%rax,%rdi), %rsi
	addq	$16, %rsi
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	addq	%rbx, %rdi
	addq	$16, %rdi
	shlq	$5, %rdx
	xorl	%ebx, %ebx
LBB0_138:                               ## =>This Inner Loop Header: Depth=1
	movups	-16(%rdi,%rbx), %xmm0
	movups	(%rdi,%rbx), %xmm1
	movups	%xmm0, -16(%rsi,%rbx)
	movups	%xmm1, (%rsi,%rbx)
	addq	$32, %rbx
	cmpq	%rbx, %rdx
	jne	LBB0_138
LBB0_139:
	cmpq	%rcx, %r8
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	je	LBB0_145
## %bb.140:
	testb	$24, %r8b
	je	LBB0_143
LBB0_141:
	movq	%rcx, %rdx
	movq	%r8, %rcx
	andq	$-8, %rcx
LBB0_142:                               ## =>This Inner Loop Header: Depth=1
	movq	(%rbx,%rdx), %rsi
	movq	%rsi, (%rax,%rdx)
	addq	$8, %rdx
	cmpq	%rdx, %rcx
	jne	LBB0_142
	jmp	LBB0_144
LBB0_143:
	movb	(%rbx,%rcx), %dl
	movb	%dl, (%rax,%rcx)
	incq	%rcx
LBB0_144:
	cmpq	%rcx, %r8
	jne	LBB0_143
LBB0_145:
	movq	%r13, 80(%r15)
	jmp	LBB0_58
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s, can_undo %d, send_update %d\n"

	.comm	_EN_MAXTEXT,4,2                 ## @EN_MAXTEXT
L_.str.1:                               ## @.str.1
	.asciz	"deleting stuff.\n"

L_.str.2:                               ## @.str.2
	.asciz	"inserting stuff (tl %d, strl %d, selstart %d (%s), text %s)\n"

	.comm	_ES_UPPERCASE,4,2               ## @ES_UPPERCASE
	.comm	_ES_LOWERCASE,4,2               ## @ES_LOWERCASE
	.comm	_ES_MULTILINE,4,2               ## @ES_MULTILINE
	.comm	_ES_AUTOVSCROLL,4,2             ## @ES_AUTOVSCROLL
	.comm	_ES_AUTOHSCROLL,4,2             ## @ES_AUTOHSCROLL
	.comm	_ES_RIGHT,4,2                   ## @ES_RIGHT
	.comm	_ES_CENTER,4,2                  ## @ES_CENTER
	.comm	_FALSE,4,2                      ## @FALSE
	.comm	_EF_MODIFIED,4,2                ## @EF_MODIFIED
	.comm	_EF_UPDATE,4,2                  ## @EF_UPDATE
	.comm	_TRUE,4,2                       ## @TRUE
	.comm	_EN_CHANGE,4,2                  ## @EN_CHANGE
	.no_dead_strip	_EDIT_EM_ReplaceSel
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function EDIT_EM_ReplaceSel
_EDIT_EM_ReplaceSel:                    ; @EDIT_EM_ReplaceSel
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #160
	.cfi_def_cfa_offset 160
	stp	x28, x27, [sp, #64]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #80]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #96]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #112]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #128]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #144]            ; 16-byte Folded Spill
	add	x29, sp, #144
	.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	x28, x5
	mov	x20, x4
	mov	x22, x3
	mov	x27, x2
	mov	x26, x1
	mov	x19, x0
	bl	_get_text_length
	mov	x23, x0
	mov	x0, x27
	mov	x1, x22
	bl	_debugstr_wn
                                        ; kill: def $w0 killed $w0 def $x0
	stp	x26, x20, [sp, #8]
	str	x0, [sp]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_TRACE
	ldp	x21, x24, [x19]
	mov	x0, x19
	bl	_EDIT_InvalidateUniscribeData
	cbnz	x22, LBB0_2
; %bb.1:
	cmp	x24, x21
	b.eq	LBB0_13
LBB0_2:
	mov	x0, x21
	mov	x1, x24
	bl	_ORDER_UINT
	sub	x25, x24, x21
	sub	x23, x23, x25
	adds	x8, x23, x22
	b.ne	LBB0_4
; %bb.3:
	str	xzr, [x19, #16]
LBB0_4:
	cbz	x28, LBB0_9
; %bb.5:
	ldr	x9, [x19, #24]
	cmp	x8, x9
	b.le	LBB0_9
; %bb.6:
Lloh2:
	adrp	x8, _EN_MAXTEXT@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EN_MAXTEXT@GOTPAGEOFF]
Lloh4:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_EDIT_NOTIFY_PARENT
	ldr	x8, [x19, #24]
	subs	x1, x8, x23
	b.ge	LBB0_8
; %bb.7:
	mov	x22, #0
	b	LBB0_9
LBB0_8:
	mov	x0, x22
	bl	_min
	mov	x22, x0
LBB0_9:
	add	x1, x22, x23
	mov	x0, x19
	bl	_EDIT_MakeFit
	cbz	w0, LBB0_13
; %bb.10:
	cmp	x24, x21
	b.eq	LBB0_14
; %bb.11:
Lloh5:
	adrp	x0, l_.str.1@PAGE
Lloh6:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_TRACE
	add	x0, x25, #1
	bl	_heap_alloc
	cbz	x0, LBB0_13
; %bb.12:
	ldr	x8, [x19, #32]
	add	x1, x8, x21
	mov	x23, x0
	mov	x2, x25
	bl	_memcpy
	str	x23, [sp, #56]                  ; 8-byte Folded Spill
	strb	wzr, [x23, x25]
	ldr	x8, [x19, #32]
	add	x0, x8, x21
	add	x1, x8, x24
	bl	_strcpyW
	mov	x0, x19
	bl	_text_buffer_changed
	str	x25, [sp, #48]                  ; 8-byte Folded Spill
	cbnz	x22, LBB0_15
	b	LBB0_37
LBB0_13:
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #80]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #160
	ret
LBB0_14:
	str	xzr, [sp, #56]                  ; 8-byte Folded Spill
	str	x25, [sp, #48]                  ; 8-byte Folded Spill
	cbz	x22, LBB0_37
LBB0_15:
	mov	x0, x19
	bl	_get_text_length
	mov	x23, x0
	ldr	x8, [x19, #32]
	add	x0, x8, x21
	bl	_debugstr_w
	mov	x25, x0
	ldr	x0, [x19, #32]
	bl	_debugstr_w
                                        ; kill: def $w0 killed $w0 def $x0
	stp	x25, x0, [sp, #24]
	stp	x22, x21, [sp, #8]
	str	x23, [sp]
Lloh7:
	adrp	x0, l_.str.2@PAGE
Lloh8:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_TRACE
	ldr	x9, [x19, #32]
	add	x8, x9, x23
LBB0_16:                                ; =>This Inner Loop Header: Depth=1
	add	x0, x9, x21
	cmp	x8, x0
	b.lo	LBB0_18
; %bb.17:                               ;   in Loop: Header=BB0_16 Depth=1
	ldrb	w9, [x8]
	strb	w9, [x8, x22]
	sub	x8, x8, #1
	ldr	x9, [x19, #32]
	b	LBB0_16
LBB0_18:
	cmp	x22, #1
	b.lt	LBB0_32
; %bb.19:
	mov	x8, #0
	cmp	x22, #8
	b.lo	LBB0_30
; %bb.20:
	sub	x9, x0, x27
	cmp	x9, #64
	b.lo	LBB0_30
; %bb.21:
	cmp	x22, #64
	b.hs	LBB0_23
; %bb.22:
	mov	x8, #0
	b	LBB0_27
LBB0_23:
	and	x8, x22, #0xffffffffffffffc0
	add	x9, x27, #32
	add	x10, x0, #32
	mov	x11, x8
LBB0_24:                                ; =>This Inner Loop Header: Depth=1
	ldp	q0, q1, [x9, #-32]
	ldp	q2, q3, [x9], #64
	stp	q0, q1, [x10, #-32]
	stp	q2, q3, [x10], #64
	subs	x11, x11, #64
	b.ne	LBB0_24
; %bb.25:
	cmp	x22, x8
	b.eq	LBB0_32
; %bb.26:
	tst	x22, #0x38
	b.eq	LBB0_30
LBB0_27:
	mov	x11, x8
	and	x8, x22, #0xfffffffffffffff8
	add	x9, x27, x11
	add	x10, x0, x11
	sub	x11, x11, x8
LBB0_28:                                ; =>This Inner Loop Header: Depth=1
	ldr	d0, [x9], #8
	str	d0, [x10], #8
	adds	x11, x11, #8
	b.ne	LBB0_28
; %bb.29:
	cmp	x22, x8
	b.eq	LBB0_32
LBB0_30:
	sub	x9, x22, x8
	add	x10, x0, x8
	add	x8, x27, x8
LBB0_31:                                ; =>This Inner Loop Header: Depth=1
	ldrb	w11, [x8], #1
	strb	w11, [x10], #1
	subs	x9, x9, #1
	b.ne	LBB0_31
LBB0_32:
	ldr	w8, [x19, #40]
Lloh9:
	adrp	x9, _ES_UPPERCASE@GOTPAGE
Lloh10:
	ldr	x9, [x9, _ES_UPPERCASE@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_34
; %bb.33:
	mov	x1, x22
	bl	_CharUpperBuffW
	b	LBB0_36
LBB0_34:
Lloh12:
	adrp	x9, _ES_LOWERCASE@GOTPAGE
Lloh13:
	ldr	x9, [x9, _ES_LOWERCASE@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_36
; %bb.35:
	mov	x1, x22
	bl	_CharLowerBuffW
LBB0_36:
	mov	x0, x19
	bl	_text_buffer_changed
LBB0_37:
	ldr	w8, [x19, #40]
Lloh15:
	adrp	x9, _ES_MULTILINE@GOTPAGE
Lloh16:
	ldr	x9, [x9, _ES_MULTILINE@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_51
; %bb.38:
	ldp	x0, x1, [x19]
	bl	_min
	mov	x25, x0
	mov	x0, x19
	bl	_get_vertical_line_count
	mov	x23, x0
	mov	w0, #0
	mov	w1, #0
	mov	w2, #0
	mov	w3, #0
	bl	_CreateRectRgn
	mov	x27, x0
	add	x2, x25, x22
	ldp	x9, x8, [x19]
	subs	x8, x8, x9
	cneg	x8, x8, mi
	sub	x3, x22, x8
	mov	x0, x19
	mov	x1, x25
	mov	x4, x27
	bl	_EDIT_BuildLineDefs_ML
	cbz	x28, LBB0_58
; %bb.39:
	ldr	w8, [x19, #40]
Lloh18:
	adrp	x9, _ES_AUTOVSCROLL@GOTPAGE
Lloh19:
	ldr	x9, [x9, _ES_AUTOVSCROLL@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	tst	w9, w8
	b.ne	LBB0_58
; %bb.40:
	ldr	x8, [x19, #48]
	cmp	x8, x23
	ldr	x23, [sp, #48]                  ; 8-byte Folded Reload
	b.le	LBB0_59
; %bb.41:
	cbz	x22, LBB0_43
; %bb.42:
	ldr	x8, [x19, #32]
	add	x0, x8, x24
	add	x1, x0, x22
	bl	_strcpyW
LBB0_43:
	cmp	x24, x21
	b.eq	LBB0_50
; %bb.44:
	cmp	x23, #1
	b.lt	LBB0_50
; %bb.45:
	ldr	x8, [x19, #32]
	cmp	x23, #8
	b.lo	LBB0_47
; %bb.46:
	add	x9, x21, x8
	ldr	x11, [sp, #56]                  ; 8-byte Folded Reload
	sub	x9, x9, x11
	cmp	x9, #64
	b.hs	LBB0_103
LBB0_47:
	mov	x9, #0
LBB0_48:
	add	x11, x9, x21
	sub	x10, x11, x24
	add	x8, x8, x11
	ldr	x11, [sp, #56]                  ; 8-byte Folded Reload
	add	x9, x11, x9
LBB0_49:                                ; =>This Inner Loop Header: Depth=1
	ldrb	w11, [x9], #1
	strb	w11, [x8], #1
	adds	x10, x10, #1
	b.lo	LBB0_49
LBB0_50:
	mov	x0, x19
	bl	_text_buffer_changed
	ldp	x9, x8, [x19]
	subs	x8, x8, x9
	cneg	x8, x8, mi
	sub	x3, x8, x22
	mov	x0, x19
	mov	x1, x21
	mov	x2, x24
	mov	x4, x27
	bl	_EDIT_BuildLineDefs_ML
	mov	w0, #0
	mov	w1, #0
	mov	w2, #0
	mov	w3, #0
	bl	_CreateRectRgn
	mov	x27, x0
Lloh21:
	adrp	x8, _EN_MAXTEXT@GOTPAGE
Lloh22:
	ldr	x8, [x8, _EN_MAXTEXT@GOTPAGEOFF]
Lloh23:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_EDIT_NOTIFY_PARENT
	mov	x22, #0
	b	LBB0_77
LBB0_51:
	ldp	x23, x25, [x19, #104]
	mov	x0, x19
	bl	_EDIT_InvalidateUniscribeData
	mov	x0, x19
	bl	_EDIT_CalcLineWidth_SL
	cbz	x28, LBB0_57
; %bb.52:
	ldr	w8, [x19, #40]
Lloh24:
	adrp	x9, _ES_AUTOHSCROLL@GOTPAGE
Lloh25:
	ldr	x9, [x9, _ES_AUTOHSCROLL@GOTPAGEOFF]
Lloh26:
	ldr	w9, [x9]
	tst	w9, w8
	b.ne	LBB0_57
; %bb.53:
	ldr	x8, [x19, #16]
	sub	x23, x23, x25
	cmp	x8, x23
	b.le	LBB0_57
; %bb.54:
	tbnz	x22, #63, LBB0_95
; %bb.55:
	mov	w27, #-1
LBB0_56:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19, #32]
	add	x9, x21, x22
	add	x1, x9, x8
	sub	x0, x1, #1
	bl	_strcpyW
	sub	x25, x22, #1
	str	w27, [x19, #56]
	mov	x0, x19
	bl	_EDIT_InvalidateUniscribeData
	mov	x0, x19
	bl	_EDIT_CalcLineWidth_SL
	ldr	x8, [x19, #16]
	cmp	x8, x23
	ccmp	x22, #0, #4, gt
	mov	x22, x25
	b.ne	LBB0_56
	b	LBB0_96
LBB0_57:
	mov	x27, #0
LBB0_58:
	ldr	x23, [sp, #48]                  ; 8-byte Folded Reload
LBB0_59:
	cmp	x24, x21
	b.eq	LBB0_65
; %bb.60:
	cbz	x26, LBB0_71
; %bb.61:
	ldr	x0, [x19, #64]
	bl	_strlenW
	ldr	x8, [x19, #72]
	cbz	x8, LBB0_73
LBB0_62:
	mov	x0, x19
	mov	x1, x23
	bl	_EDIT_MakeUndoFit
	ldr	x0, [x19, #64]
	ldr	x1, [sp, #56]                   ; 8-byte Folded Reload
	mov	x2, x23
	bl	_memcpy
	ldr	x8, [x19, #64]
	strb	wzr, [x8, x23]
LBB0_63:
	str	x21, [x19, #80]
LBB0_64:
	str	xzr, [x19, #72]
LBB0_65:
	cbz	x22, LBB0_77
; %bb.66:
	cbz	x26, LBB0_72
; %bb.67:
	ldp	x8, x9, [x19, #72]
	cmp	x21, x9
	b.eq	LBB0_70
; %bb.68:
	cbz	x8, LBB0_76
; %bb.69:
	add	x9, x8, x9
	cmp	x21, x9
	b.ne	LBB0_76
LBB0_70:
	add	x8, x8, x22
	str	x8, [x19, #72]
	b	LBB0_77
LBB0_71:
	mov	x0, x19
	bl	_EDIT_EM_EmptyUndoBuffer
	cbz	x22, LBB0_77
LBB0_72:
	mov	x0, x19
	bl	_EDIT_EM_EmptyUndoBuffer
	b	LBB0_77
LBB0_73:
	ldr	x8, [x19, #64]
	ldrb	w8, [x8]
	cbz	w8, LBB0_62
; %bb.74:
	mov	x28, x0
	ldr	x8, [x19, #80]
	cmp	x21, x8
	b.ne	LBB0_91
; %bb.75:
	add	x8, x28, x24
	sub	x1, x8, x21
	mov	x0, x19
	bl	_EDIT_MakeUndoFit
	ldr	x8, [x19, #64]
	add	x0, x8, x28
	ldr	x1, [sp, #56]                   ; 8-byte Folded Reload
	mov	x2, x23
	bl	_memcpy
	ldr	x8, [x19, #64]
	add	x8, x8, x28
	strb	wzr, [x8, x23]
	b	LBB0_64
LBB0_76:
	stp	x22, x21, [x19, #72]
	ldr	x8, [x19, #64]
	strb	wzr, [x8]
LBB0_77:
	ldr	x0, [sp, #56]                   ; 8-byte Folded Reload
	bl	_heap_free
	add	x1, x22, x21
	ldr	w8, [x19, #40]
Lloh27:
	adrp	x9, _ES_RIGHT@GOTPAGE
Lloh28:
	ldr	x9, [x9, _ES_RIGHT@GOTPAGEOFF]
Lloh29:
	ldr	w9, [x9]
Lloh30:
	adrp	x10, _ES_CENTER@GOTPAGE
Lloh31:
	ldr	x10, [x10, _ES_CENTER@GOTPAGEOFF]
Lloh32:
	ldr	w10, [x10]
	orr	w9, w10, w9
	tst	w9, w8
	b.eq	LBB0_81
; %bb.78:
	ldp	x9, x8, [x19]
	subs	x8, x8, x9
	cneg	x8, x8, mi
	subs	x8, x22, x8
	b.pl	LBB0_81
; %bb.79:
	ldr	x9, [x19, #88]
	cbz	x9, LBB0_81
; %bb.80:
	add	x10, x9, x8
	neg	x8, x8
	cmp	x9, x8
	csel	x8, xzr, x10, lt
	str	x8, [x19, #88]
LBB0_81:
Lloh33:
	adrp	x8, _FALSE@GOTPAGE
Lloh34:
	ldr	x8, [x8, _FALSE@GOTPAGEOFF]
Lloh35:
	ldr	w3, [x8]
	mov	x0, x19
	mov	x2, x1
	bl	_EDIT_EM_SetSel
Lloh36:
	adrp	x8, _EF_MODIFIED@GOTPAGE
Lloh37:
	ldr	x8, [x8, _EF_MODIFIED@GOTPAGEOFF]
Lloh38:
	ldr	w8, [x8]
	ldr	w9, [x19, #96]
	orr	w8, w9, w8
	str	w8, [x19, #96]
Lloh39:
	adrp	x21, _EF_UPDATE@GOTPAGE
Lloh40:
	ldr	x21, [x21, _EF_UPDATE@GOTPAGEOFF]
	cbz	x20, LBB0_83
; %bb.82:
	ldr	w9, [x21]
	orr	w8, w9, w8
	str	w8, [x19, #96]
LBB0_83:
Lloh41:
	adrp	x8, _TRUE@GOTPAGE
Lloh42:
	ldr	x8, [x8, _TRUE@GOTPAGEOFF]
Lloh43:
	ldr	w2, [x8]
	mov	x0, x19
	cbz	x27, LBB0_85
; %bb.84:
	mov	x1, x27
	bl	_EDIT_UpdateTextRegion
	mov	x0, x27
	bl	_DeleteObject
	b	LBB0_86
LBB0_85:
	mov	x1, #0
	bl	_EDIT_UpdateText
LBB0_86:
	mov	x0, x19
	bl	_EDIT_EM_ScrollCaret
	mov	x0, x19
	bl	_EDIT_UpdateScrollInfo
	cbz	x20, LBB0_88
; %bb.87:
	ldr	w8, [x21]
	ldr	w9, [x19, #96]
	b	LBB0_89
LBB0_88:
	ldr	w9, [x19, #96]
	ldr	w8, [x21]
	tst	w8, w9
	b.eq	LBB0_90
LBB0_89:
	bic	w8, w9, w8
	str	w8, [x19, #96]
Lloh44:
	adrp	x8, _EN_CHANGE@GOTPAGE
Lloh45:
	ldr	x8, [x8, _EN_CHANGE@GOTPAGEOFF]
Lloh46:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_EDIT_NOTIFY_PARENT
LBB0_90:
	mov	x0, x19
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #80]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #160
	b	_EDIT_InvalidateUniscribeData
LBB0_91:
	cmp	x24, x8
	b.ne	LBB0_62
; %bb.92:
	add	x8, x28, x24
	sub	x1, x8, x21
	mov	x0, x19
	bl	_EDIT_MakeUndoFit
	ldr	x8, [x19, #64]
	tbnz	x28, #63, LBB0_97
; %bb.93:
	add	x9, x8, x28
	ldr	x13, [sp, #56]                  ; 8-byte Folded Reload
LBB0_94:                                ; =>This Inner Loop Header: Depth=1
	ldrb	w8, [x9]
	strb	w8, [x9, x23]
	sub	x9, x9, #1
	ldr	x8, [x19, #64]
	cmp	x9, x8
	b.hs	LBB0_94
	b	LBB0_98
LBB0_95:
	mov	x25, x22
LBB0_96:
	mov	x0, x19
	bl	_text_buffer_changed
Lloh47:
	adrp	x8, _EN_MAXTEXT@GOTPAGE
Lloh48:
	ldr	x8, [x8, _EN_MAXTEXT@GOTPAGEOFF]
Lloh49:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_EDIT_NOTIFY_PARENT
	mov	x27, #0
	mov	x22, x25
	b	LBB0_58
LBB0_97:
	ldr	x13, [sp, #56]                  ; 8-byte Folded Reload
LBB0_98:
	cmp	x23, #1
	b.lt	LBB0_63
; %bb.99:
	mov	x9, #0
	cmp	x23, #8
	b.lo	LBB0_119
; %bb.100:
	sub	x10, x8, x13
	cmp	x10, #64
	b.lo	LBB0_119
; %bb.101:
	cmp	x23, #64
	b.hs	LBB0_112
; %bb.102:
	mov	x9, #0
	b	LBB0_116
LBB0_103:
	cmp	x23, #64
	b.hs	LBB0_105
; %bb.104:
	mov	x9, #0
	b	LBB0_109
LBB0_105:
	and	x9, x23, #0xffffffffffffffc0
	add	x10, x21, x8
	add	x10, x10, #32
	add	x11, x11, #32
	mov	x12, x9
LBB0_106:                               ; =>This Inner Loop Header: Depth=1
	ldp	q0, q1, [x11, #-32]
	ldp	q2, q3, [x11], #64
	stp	q0, q1, [x10, #-32]
	stp	q2, q3, [x10], #64
	subs	x12, x12, #64
	b.ne	LBB0_106
; %bb.107:
	cmp	x23, x9
	b.eq	LBB0_50
; %bb.108:
	tst	x23, #0x38
	b.eq	LBB0_48
LBB0_109:
	mov	x12, x9
	and	x9, x23, #0xfffffffffffffff8
	ldr	x10, [sp, #56]                  ; 8-byte Folded Reload
	add	x10, x10, x12
	add	x11, x12, x21
	add	x11, x8, x11
	sub	x12, x12, x9
LBB0_110:                               ; =>This Inner Loop Header: Depth=1
	ldr	d0, [x10], #8
	str	d0, [x11], #8
	adds	x12, x12, #8
	b.ne	LBB0_110
; %bb.111:
	cmp	x23, x9
	b.eq	LBB0_50
	b	LBB0_48
LBB0_112:
	and	x9, x23, #0xffffffffffffffc0
	add	x10, x8, #32
	add	x11, x13, #32
	mov	x12, x9
LBB0_113:                               ; =>This Inner Loop Header: Depth=1
	ldp	q0, q1, [x11, #-32]
	ldp	q2, q3, [x11], #64
	stp	q0, q1, [x10, #-32]
	stp	q2, q3, [x10], #64
	subs	x12, x12, #64
	b.ne	LBB0_113
; %bb.114:
	cmp	x23, x9
	b.eq	LBB0_63
; %bb.115:
	tst	x23, #0x38
	b.eq	LBB0_119
LBB0_116:
	mov	x12, x9
	and	x9, x23, #0xfffffffffffffff8
	add	x10, x13, x12
	add	x11, x8, x12
	sub	x12, x12, x9
LBB0_117:                               ; =>This Inner Loop Header: Depth=1
	ldr	d0, [x10], #8
	str	d0, [x11], #8
	adds	x12, x12, #8
	b.ne	LBB0_117
; %bb.118:
	cmp	x23, x9
	b.eq	LBB0_63
LBB0_119:
	add	x10, x9, x21
	sub	x10, x10, x24
	add	x8, x8, x9
	add	x9, x13, x9
LBB0_120:                               ; =>This Inner Loop Header: Depth=1
	ldrb	w11, [x9], #1
	strb	w11, [x8], #1
	adds	x10, x10, #1
	b.lo	LBB0_120
	b	LBB0_63
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh39, Lloh40
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh41, Lloh42, Lloh43
	.loh AdrpLdrGotLdr	Lloh44, Lloh45, Lloh46
	.loh AdrpLdrGotLdr	Lloh47, Lloh48, Lloh49
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s, can_undo %d, send_update %d\n"

	.comm	_EN_MAXTEXT,4,2                 ; @EN_MAXTEXT
l_.str.1:                               ; @.str.1
	.asciz	"deleting stuff.\n"

l_.str.2:                               ; @.str.2
	.asciz	"inserting stuff (tl %d, strl %d, selstart %d (%s), text %s)\n"

	.comm	_ES_UPPERCASE,4,2               ; @ES_UPPERCASE
	.comm	_ES_LOWERCASE,4,2               ; @ES_LOWERCASE
	.comm	_ES_MULTILINE,4,2               ; @ES_MULTILINE
	.comm	_ES_AUTOVSCROLL,4,2             ; @ES_AUTOVSCROLL
	.comm	_ES_AUTOHSCROLL,4,2             ; @ES_AUTOHSCROLL
	.comm	_ES_RIGHT,4,2                   ; @ES_RIGHT
	.comm	_ES_CENTER,4,2                  ; @ES_CENTER
	.comm	_FALSE,4,2                      ; @FALSE
	.comm	_EF_MODIFIED,4,2                ; @EF_MODIFIED
	.comm	_EF_UPDATE,4,2                  ; @EF_UPDATE
	.comm	_TRUE,4,2                       ; @TRUE
	.comm	_EN_CHANGE,4,2                  ; @EN_CHANGE
	.no_dead_strip	_EDIT_EM_ReplaceSel
.subsections_via_symbols
