	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_utf8_to_ucs2                   ## -- Begin function utf8_to_ucs2
	.p2align	4, 0x90
_utf8_to_ucs2:                          ## @utf8_to_ucs2
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movq	%rsi, %r15
	movq	%rdi, %rbx
	movq	(%rsi), %r13
	callq	_strlen
                                        ## kill: def $eax killed $eax def $rax
	addl	%eax, %eax
	addl	$2, %eax
	movslq	%eax, %r12
	movq	(%r15), %rax
	testq	%rax, %rax
	jne	LBB0_2
## %bb.1:
	movq	%r12, %rdi
	callq	_malloc
	movq	%rax, (%r15)
	testq	%rax, %rax
	je	LBB0_27
LBB0_2:
	movq	%r12, (%r14)
	testl	%r12d, %r12d
	je	LBB0_20
## %bb.3:
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	jmp	LBB0_7
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_7 Depth=1
	andl	$7, %esi
	movl	$3, %edx
LBB0_5:                                 ##   in Loop: Header=BB0_7 Depth=1
	movl	%esi, %ecx
LBB0_6:                                 ##   in Loop: Header=BB0_7 Depth=1
	incq	%rbx
	cmpq	$1, %r12
	jbe	LBB0_20
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movzbl	(%rbx), %esi
	testl	%esi, %esi
	je	LBB0_26
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	movl	%esi, %edi
	andl	$-64, %edi
	cmpl	$128, %edi
	jne	LBB0_12
## %bb.9:                               ##   in Loop: Header=BB0_7 Depth=1
	testl	%edx, %edx
	jle	LBB0_23
## %bb.10:                              ##   in Loop: Header=BB0_7 Depth=1
	movl	%ecx, %edi
	shll	$6, %edi
	andl	$63, %esi
	movl	%esi, %ecx
	orl	%edi, %ecx
	decl	%edx
	jne	LBB0_6
## %bb.11:                              ##   in Loop: Header=BB0_7 Depth=1
	cmpl	$65535, %ecx                    ## imm = 0xFFFF
	jle	LBB0_19
	jmp	LBB0_23
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_7 Depth=1
	testl	%edx, %edx
	jne	LBB0_23
## %bb.13:                              ##   in Loop: Header=BB0_7 Depth=1
	movl	%esi, %ecx
	andl	$-8, %ecx
	cmpl	$240, %ecx
	je	LBB0_4
## %bb.14:                              ##   in Loop: Header=BB0_7 Depth=1
	movl	%esi, %ecx
	andl	$-16, %ecx
	cmpl	$224, %ecx
	jne	LBB0_16
## %bb.15:                              ##   in Loop: Header=BB0_7 Depth=1
	andl	$15, %esi
	movl	$2, %edx
	jmp	LBB0_5
LBB0_16:                                ##   in Loop: Header=BB0_7 Depth=1
	movl	%esi, %ecx
	andl	$-32, %ecx
	cmpl	$192, %ecx
	jne	LBB0_18
## %bb.17:                              ##   in Loop: Header=BB0_7 Depth=1
	andl	$31, %esi
	movl	$1, %edx
	jmp	LBB0_5
LBB0_18:                                ##   in Loop: Header=BB0_7 Depth=1
	andl	$127, %esi
	movl	%esi, %ecx
LBB0_19:                                ##   in Loop: Header=BB0_7 Depth=1
	movslq	%ecx, %rdx
	movq	%rdx, (%rax)
	addq	$8, %rax
	addq	$-2, %r12
	xorl	%edx, %edx
	jmp	LBB0_6
LBB0_20:
	testq	%r13, %r13
	jne	LBB0_22
## %bb.21:
	movq	%rax, %rdi
	callq	_free
	movq	$0, (%r15)
LBB0_22:
	movq	_EDOOFUS@GOTPCREL(%rip), %rax
	jmp	LBB0_28
LBB0_23:
	testq	%r13, %r13
	jne	LBB0_25
## %bb.24:
	movq	%rax, %rdi
	callq	_free
	movq	$0, (%r15)
LBB0_25:
	movq	_EILSEQ@GOTPCREL(%rip), %rax
	jmp	LBB0_28
LBB0_26:
	movq	$0, (%rax)
	movq	(%r14), %rax
	subq	%r12, %rax
	addq	$2, %rax
	movq	%rax, (%r14)
	xorl	%eax, %eax
	jmp	LBB0_29
LBB0_27:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
LBB0_28:
	movl	(%rax), %eax
LBB0_29:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_EDOOFUS,4,2                    ## @EDOOFUS
	.comm	_EILSEQ,4,2                     ## @EILSEQ
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_utf8_to_ucs2                   ; -- Begin function utf8_to_ucs2
	.p2align	2
_utf8_to_ucs2:                          ; @utf8_to_ucs2
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	ldr	x23, [x1]
	bl	_strlen
	lsl	w8, w0, #1
	add	w8, w8, #2
	sxtw	x22, w8
	ldr	x0, [x19]
	cbnz	x0, LBB0_2
; %bb.1:
	mov	x0, x22
	bl	_malloc
	str	x0, [x19]
	cbz	x0, LBB0_26
LBB0_2:
	str	x22, [x20]
	cbz	w22, LBB0_19
; %bb.3:
	mov	w9, #0
	mov	w10, #0
	b	LBB0_6
LBB0_4:                                 ;   in Loop: Header=BB0_6 Depth=1
	and	w8, w8, #0x7
	mov	w9, #3
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	add	x21, x21, #1
	mov	x10, x8
	cmp	x22, #1
	b.ls	LBB0_19
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldrb	w8, [x21]
	cbz	w8, LBB0_25
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	and	w11, w8, #0xc0
	cmp	w11, #128
	b.ne	LBB0_11
; %bb.8:                                ;   in Loop: Header=BB0_6 Depth=1
	subs	w9, w9, #1
	b.lt	LBB0_22
; %bb.9:                                ;   in Loop: Header=BB0_6 Depth=1
	bfi	w8, w10, #6, #26
	b.ne	LBB0_5
; %bb.10:                               ;   in Loop: Header=BB0_6 Depth=1
	cmp	w8, #16, lsl #12                ; =65536
	b.lt	LBB0_18
	b	LBB0_22
LBB0_11:                                ;   in Loop: Header=BB0_6 Depth=1
	cbnz	w9, LBB0_22
; %bb.12:                               ;   in Loop: Header=BB0_6 Depth=1
	and	w9, w8, #0xf8
	cmp	w9, #240
	b.eq	LBB0_4
; %bb.13:                               ;   in Loop: Header=BB0_6 Depth=1
	and	w9, w8, #0xf0
	cmp	w9, #224
	b.ne	LBB0_15
; %bb.14:                               ;   in Loop: Header=BB0_6 Depth=1
	and	w8, w8, #0xf
	mov	w9, #2
	b	LBB0_5
LBB0_15:                                ;   in Loop: Header=BB0_6 Depth=1
	and	w9, w8, #0xe0
	cmp	w9, #192
	b.ne	LBB0_17
; %bb.16:                               ;   in Loop: Header=BB0_6 Depth=1
	and	w8, w8, #0x1f
	mov	w9, #1
	b	LBB0_5
LBB0_17:                                ;   in Loop: Header=BB0_6 Depth=1
	and	w8, w8, #0x7f
LBB0_18:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	w9, #0
	sxtw	x10, w8
	str	x10, [x0], #8
	sub	x22, x22, #2
	b	LBB0_5
LBB0_19:
	cbnz	x23, LBB0_21
; %bb.20:
	bl	_free
	str	xzr, [x19]
LBB0_21:
Lloh0:
	adrp	x8, _EDOOFUS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EDOOFUS@GOTPAGEOFF]
	b	LBB0_27
LBB0_22:
	cbnz	x23, LBB0_24
; %bb.23:
	bl	_free
	str	xzr, [x19]
LBB0_24:
Lloh2:
	adrp	x8, _EILSEQ@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EILSEQ@GOTPAGEOFF]
	b	LBB0_27
LBB0_25:
	str	xzr, [x0]
	ldr	x9, [x20]
	sub	x9, x9, x22
	add	x9, x9, #2
	str	x9, [x20]
	b	LBB0_28
LBB0_26:
Lloh4:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh5:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
LBB0_27:
	ldr	w8, [x8]
LBB0_28:
	mov	x0, x8
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_EDOOFUS,4,2                    ; @EDOOFUS
	.comm	_EILSEQ,4,2                     ; @EILSEQ
.subsections_via_symbols
