	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function unicode_to_utf8
_unicode_to_utf8:                       ## @unicode_to_utf8
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	movq	_UNICODE_MAX@GOTPCREL(%rip), %rax
	cmpl	%edx, (%rax)
	jge	LBB0_2
## %bb.1:
	movq	_UNICODE_R_CHAR@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
LBB0_2:
	cmpl	$127, %edx
	jg	LBB0_5
## %bb.3:
	testq	%rsi, %rsi
	je	LBB0_11
## %bb.4:
	leaq	1(%rdi), %rax
	movb	%dl, (%rdi)
	jmp	LBB0_17
LBB0_5:
	cmpl	$2047, %edx                     ## imm = 0x7FF
	ja	LBB0_8
## %bb.6:
	cmpq	$2, %rsi
	jb	LBB0_11
## %bb.12:
	movl	%edx, %eax
	shrl	$6, %eax
	orb	$-64, %al
	movb	%al, (%rdi)
	andb	$63, %dl
	orb	$-128, %dl
	leaq	2(%rdi), %rax
	movb	%dl, 1(%rdi)
	jmp	LBB0_17
LBB0_8:
	cmpl	$65535, %edx                    ## imm = 0xFFFF
	ja	LBB0_13
## %bb.9:
	cmpq	$3, %rsi
	jb	LBB0_11
## %bb.15:
	movl	%edx, %eax
	shrl	$12, %eax
	orb	$-32, %al
	movb	%al, (%rdi)
	movl	%edx, %eax
	shrl	$6, %eax
	andb	$63, %al
	orb	$-128, %al
	movb	%al, 1(%rdi)
	andb	$63, %dl
	orb	$-128, %dl
	leaq	3(%rdi), %rax
	movb	%dl, 2(%rdi)
	jmp	LBB0_17
LBB0_13:
	cmpq	$4, %rsi
	jae	LBB0_16
LBB0_11:
	xorl	%eax, %eax
	popq	%rbp
	retq
LBB0_16:
	movl	%edx, %eax
	shrl	$18, %eax
	andb	$7, %al
	orb	$-16, %al
	movb	%al, (%rdi)
	movl	%edx, %eax
	shrl	$12, %eax
	andb	$63, %al
	orb	$-128, %al
	movb	%al, 1(%rdi)
	movl	%edx, %eax
	shrl	$6, %eax
	andb	$63, %al
	orb	$-128, %al
	movb	%al, 2(%rdi)
	andb	$63, %dl
	orb	$-128, %dl
	leaq	4(%rdi), %rax
	movb	%dl, 3(%rdi)
LBB0_17:
	subq	%rdi, %rax
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_UNICODE_MAX,4,2                ## @UNICODE_MAX
	.comm	_UNICODE_R_CHAR,4,2             ## @UNICODE_R_CHAR
	.no_dead_strip	_unicode_to_utf8
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function unicode_to_utf8
_unicode_to_utf8:                       ; @unicode_to_utf8
	.cfi_startproc
; %bb.0:
Lloh0:
	adrp	x8, _UNICODE_MAX@GOTPAGE
Lloh1:
	ldr	x8, [x8, _UNICODE_MAX@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _UNICODE_R_CHAR@GOTPAGE
Lloh4:
	ldr	x9, [x9, _UNICODE_R_CHAR@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	cmp	w8, w2
	csel	w8, w9, w2, lt
	cmp	w8, #127
	b.gt	LBB0_3
; %bb.1:
	cbz	x1, LBB0_11
; %bb.2:
	mov	x9, x0
	strb	w8, [x9], #1
	sub	x0, x9, x0
	ret
LBB0_3:
	cmp	w8, #2047
	b.hi	LBB0_6
; %bb.4:
	cmp	x1, #2
	b.hs	LBB0_9
; %bb.5:
	mov	x0, #0
	ret
LBB0_6:
	lsr	w9, w8, #16
	cbnz	w9, LBB0_10
; %bb.7:
	cmp	x1, #3
	b.lo	LBB0_11
; %bb.8:
	lsr	w9, w8, #12
	orr	w9, w9, #0xe0
	strb	w9, [x0]
	mov	w10, #128
	mov	w9, #128
	bfxil	w9, w8, #6, #6
	strb	w9, [x0, #1]
	bfxil	w10, w8, #0, #6
	add	x9, x0, #3
	strb	w10, [x0, #2]
	sub	x0, x9, x0
	ret
LBB0_9:
	lsr	w9, w8, #6
	orr	w9, w9, #0xc0
	strb	w9, [x0]
	mov	w10, #128
	bfxil	w10, w8, #0, #6
	add	x9, x0, #2
	strb	w10, [x0, #1]
	sub	x0, x9, x0
	ret
LBB0_10:
	cmp	x1, #4
	b.hs	LBB0_12
LBB0_11:
	mov	x0, #0
	ret
LBB0_12:
	mov	w9, #240
	bfxil	w9, w8, #18, #3
	strb	w9, [x0]
	mov	w10, #128
	mov	w9, #128
	bfxil	w9, w8, #12, #6
	strb	w9, [x0, #1]
	mov	w9, #128
	bfxil	w9, w8, #6, #6
	strb	w9, [x0, #2]
	bfxil	w10, w8, #0, #6
	add	x9, x0, #4
	strb	w10, [x0, #3]
	sub	x0, x9, x0
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_UNICODE_MAX,4,2                ; @UNICODE_MAX
	.comm	_UNICODE_R_CHAR,4,2             ; @UNICODE_R_CHAR
	.no_dead_strip	_unicode_to_utf8
.subsections_via_symbols
