	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_utf8_strnwidth                 ## -- Begin function utf8_strnwidth
	.p2align	4, 0x90
_utf8_strnwidth:                        ## @utf8_strnwidth
	.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	%edx, %r12d
	movq	%rdi, %rbx
	movq	%rdi, -56(%rbp)
	cmpl	$-1, %esi
	jne	LBB0_2
## %bb.1:
	movq	%rbx, %rdi
	callq	_strlen
	movl	%eax, %esi
LBB0_2:
	xorl	%r13d, %r13d
	testq	%rbx, %rbx
	setne	%al
	movl	%esi, -44(%rbp)                 ## 4-byte Spill
	je	LBB0_11
## %bb.3:
	testl	%esi, %esi
	jle	LBB0_11
## %bb.4:
	movslq	-44(%rbp), %r14                 ## 4-byte Folded Reload
	addq	%rbx, %r14
	xorl	%r13d, %r13d
	leaq	-56(%rbp), %r15
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_8 Depth 2
	testl	%r12d, %r12d
	je	LBB0_9
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	%rbx, %rdi
	.p2align	4, 0x90
LBB0_8:                                 ##   Parent Loop BB0_5 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	callq	_display_mode_esc_sequence_len
	testl	%eax, %eax
	je	LBB0_9
## %bb.7:                               ##   in Loop: Header=BB0_8 Depth=2
	movslq	%eax, %rdi
	addq	-56(%rbp), %rdi
	movq	%rdi, -56(%rbp)
	jmp	LBB0_8
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_5 Depth=1
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_utf8_width
	addl	%eax, %r13d
	movq	-56(%rbp), %rbx
	testq	%rbx, %rbx
	setne	%al
	je	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_5 Depth=1
	cmpq	%r14, %rbx
	jb	LBB0_5
LBB0_11:
	testb	%al, %al
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	cmovnel	%r13d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_utf8_strnwidth                 ; -- Begin function utf8_strnwidth
	.p2align	2
_utf8_strnwidth:                        ; @utf8_strnwidth
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x20, x2
	mov	x19, x1
	mov	x21, x0
	str	x0, [sp, #8]
	cmn	w1, #1
	b.ne	LBB0_2
; %bb.1:
	mov	x0, x21
	bl	_strlen
	mov	x19, x0
LBB0_2:
	mov	w22, #0
	cmp	x21, #0
	cset	w8, ne
	cbz	x21, LBB0_9
; %bb.3:
	cmp	w19, #1
	b.lt	LBB0_9
; %bb.4:
	mov	w22, #0
	add	x23, x21, w19, sxtw
	b	LBB0_6
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	add	x0, sp, #8
	mov	x1, #0
	bl	_utf8_width
	add	w22, w22, w0
	ldr	x21, [sp, #8]
	cmp	x21, #0
	cset	w8, ne
	ccmp	x21, x23, #2, ne
	b.hs	LBB0_9
LBB0_6:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_8 Depth 2
	cbz	w20, LBB0_5
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	x0, x21
	bl	_display_mode_esc_sequence_len
	cbz	w0, LBB0_5
LBB0_8:                                 ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	x8, [sp, #8]
	add	x0, x8, w0, sxtw
	str	x0, [sp, #8]
	bl	_display_mode_esc_sequence_len
	cbnz	w0, LBB0_8
	b	LBB0_5
LBB0_9:
	cmp	w8, #0
	csel	w0, w22, w19, ne
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.cfi_endproc
                                        ; -- End function
.subsections_via_symbols
