	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function encode_utf8
_encode_utf8:                           ## @encode_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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movq	%rdi, %r14
	cmpq	$127, %rsi
	ja	LBB0_2
## %bb.1:
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_pushchar
	movq	%rax, %r15
	jmp	LBB0_17
LBB0_2:
	cmpq	$2047, %rbx                     ## imm = 0x7FF
	ja	LBB0_6
## %bb.3:
	movq	%rbx, %rsi
	shrq	$6, %rsi
	orq	$192, %rsi
	movq	%r14, %rdi
	callq	_pushchar
	movl	$1, %r15d
	testq	%rax, %rax
	jne	LBB0_17
LBB0_5:
	andl	$63, %ebx
	orq	$128, %rbx
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_pushchar
	xorl	%r15d, %r15d
	testq	%rax, %rax
	setne	%r15b
	jmp	LBB0_17
LBB0_6:
	cmpq	$65535, %rbx                    ## imm = 0xFFFF
	ja	LBB0_12
## %bb.7:
	movq	%rbx, %rax
	andq	$-2048, %rax                    ## imm = 0xF800
	cmpq	$55296, %rax                    ## imm = 0xD800
	jne	LBB0_9
## %bb.8:
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_16
LBB0_12:
	cmpq	$1114111, %rbx                  ## imm = 0x10FFFF
	ja	LBB0_15
## %bb.13:
	movq	%rbx, %rsi
	shrq	$18, %rsi
	orq	$240, %rsi
	movq	%r14, %rdi
	callq	_pushchar
	movl	$1, %r15d
	testq	%rax, %rax
	jne	LBB0_17
## %bb.14:
	movl	%ebx, %esi
	shrl	$12, %esi
	andl	$63, %esi
	orq	$128, %rsi
	movq	%r14, %rdi
	callq	_pushchar
	jmp	LBB0_10
LBB0_9:
	movq	%rbx, %rsi
	shrq	$12, %rsi
	orq	$224, %rsi
	movq	%r14, %rdi
	callq	_pushchar
	movl	$1, %r15d
LBB0_10:
	testq	%rax, %rax
	jne	LBB0_17
## %bb.11:
	movl	%ebx, %esi
	shrl	$6, %esi
	andl	$63, %esi
	orq	$128, %rsi
	movq	%r14, %rdi
	callq	_pushchar
	testq	%rax, %rax
	jne	LBB0_17
	jmp	LBB0_5
LBB0_15:
	leaq	L_.str.1(%rip), %rsi
LBB0_16:
	movq	%r14, %rdi
	movq	%rbx, %rdx
	callq	_json_error
	movl	$-1, %r15d
LBB0_17:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"invalid codepoint %06lx"

L_.str.1:                               ## @.str.1
	.asciz	"can't encode UTF-8 for %06lx"

	.no_dead_strip	_encode_utf8
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function encode_utf8
_encode_utf8:                           ; @encode_utf8
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x20, x1
	mov	x19, x0
	cmp	x1, #127
	b.hi	LBB0_2
; %bb.1:
	mov	x0, x19
	mov	x1, x20
	bl	_pushchar
	b	LBB0_17
LBB0_2:
	cmp	x20, #2047
	b.hi	LBB0_6
; %bb.3:
	lsr	x8, x20, #6
	orr	x1, x8, #0xc0
LBB0_4:
	mov	x0, x19
	bl	_pushchar
	cbnz	x0, LBB0_14
; %bb.5:
	mov	w1, #128
	bfxil	x1, x20, #0, #6
	mov	x0, x19
	bl	_pushchar
	cmp	x0, #0
	cset	w0, ne
	b	LBB0_17
LBB0_6:
	lsr	x8, x20, #16
	cbnz	x8, LBB0_9
; %bb.7:
	lsr	x8, x20, #11
	cmp	x8, #27
	b.ne	LBB0_12
; %bb.8:
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_16
LBB0_9:
	cmp	x8, #16
	b.hi	LBB0_15
; %bb.10:
	lsr	x8, x20, #18
	orr	x1, x8, #0xf0
	mov	x0, x19
	bl	_pushchar
	cbnz	x0, LBB0_14
; %bb.11:
	mov	w1, #128
	bfxil	x1, x20, #12, #6
	b	LBB0_13
LBB0_12:
	lsr	x8, x20, #12
	orr	x1, x8, #0xe0
LBB0_13:
	mov	x0, x19
	bl	_pushchar
	cbz	x0, LBB0_18
LBB0_14:
	mov	w0, #1
	b	LBB0_17
LBB0_15:
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_16:
	mov	x0, x19
	mov	x2, x20
	bl	_json_error
	mov	w0, #-1
LBB0_17:
                                        ; kill: def $w0 killed $w0 killed $x0
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
LBB0_18:
	mov	w1, #128
	bfxil	x1, x20, #6, #6
	b	LBB0_4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"invalid codepoint %06lx"

l_.str.1:                               ; @.str.1
	.asciz	"can't encode UTF-8 for %06lx"

	.no_dead_strip	_encode_utf8
.subsections_via_symbols
