	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function wmemstream_write
_wmemstream_write:                      ## @wmemstream_write
	.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
	movl	%edx, %ebx
	movq	%rsi, %r15
	movq	%rdi, %r14
	leaq	24(%rdi), %r12
	movq	%r12, %rdi
	callq	_wbuflen
	testq	%rax, %rax
	js	LBB0_1
## %bb.2:
	addq	(%r14), %rax
	movq	%r14, %rdi
	movq	%rax, %rsi
	callq	_wmemstream_grow
	movl	$-1, %ecx
	testl	%eax, %eax
	je	LBB0_11
## %bb.3:
	xorl	%r13d, %r13d
	testl	%ebx, %ebx
	jle	LBB0_10
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r14), %rdi
	cmpq	8(%r14), %rdi
	jge	LBB0_10
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	16(%r14), %rax
	addq	(%rax), %rdi
	movq	%r15, %rsi
	movl	%ebx, %edx
	movq	%r12, %rcx
	callq	_mbrtowc
	cmpq	$-1, %rax
	je	LBB0_7
## %bb.8:                               ##   in Loop: Header=BB0_5 Depth=1
	testq	%rax, %rax
	movl	$1, %ecx
	cmoveq	%rcx, %rax
	cmpq	$-2, %rax
	je	LBB0_9
## %bb.12:                              ##   in Loop: Header=BB0_5 Depth=1
	incq	(%r14)
	addq	%rax, %r15
	subl	%eax, %ebx
	addq	%rax, %r13
	testl	%ebx, %ebx
	jg	LBB0_5
	jmp	LBB0_10
LBB0_7:
	testq	%r13, %r13
	jne	LBB0_10
LBB0_1:
	movq	_EILSEQ@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_errno@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	movl	$-1, %ecx
	jmp	LBB0_11
LBB0_9:
	movl	%ebx, %eax
	addq	%rax, %r13
LBB0_10:
	movq	%r14, %rdi
	callq	_wmemstream_update
	movl	%r13d, %ecx
LBB0_11:
	movl	%ecx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EILSEQ,4,2                     ## @EILSEQ
	.comm	_errno,4,2                      ## @errno
	.comm	_stderr,4,2                     ## @stderr
	.no_dead_strip	_wmemstream_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function wmemstream_write
_wmemstream_write:                      ; @wmemstream_write
	.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	x21, x2
	mov	x22, x1
	mov	x19, x0
	add	x23, x0, #24
	mov	x0, x23
	bl	_wbuflen
	tbnz	x0, #63, LBB0_11
; %bb.1:
	ldr	x8, [x19]
	add	x1, x8, x0
	mov	x0, x19
	bl	_wmemstream_grow
	cbz	w0, LBB0_8
; %bb.2:
	cmp	w21, #1
	b.lt	LBB0_9
; %bb.3:
	mov	x20, #0
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldp	x8, x9, [x19]
	cmp	x8, x9
	b.ge	LBB0_13
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	x9, [x19, #16]
	ldr	x9, [x9]
	add	x0, x9, x8
	mov	x1, x22
	mov	x2, x21
	mov	x3, x23
	bl	_mbrtowc
	cmn	x0, #1
	b.eq	LBB0_10
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	cmp	x0, #0
	csinc	x8, x0, xzr, ne
	cmn	x8, #2
	b.eq	LBB0_12
; %bb.7:                                ;   in Loop: Header=BB0_4 Depth=1
	add	x22, x22, x8
	sub	w21, w21, w8
	ldr	x9, [x19]
	add	x9, x9, #1
	str	x9, [x19]
	add	x20, x8, x20
	cmp	w21, #0
	b.gt	LBB0_4
	b	LBB0_13
LBB0_8:
	mov	w20, #-1
	b	LBB0_14
LBB0_9:
	mov	x20, #0
	b	LBB0_13
LBB0_10:
	cbnz	x20, LBB0_13
LBB0_11:
Lloh0:
	adrp	x8, _EILSEQ@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EILSEQ@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _errno@GOTPAGE
Lloh4:
	ldr	x9, [x9, _errno@GOTPAGEOFF]
Lloh5:
	str	w8, [x9]
	mov	w20, #-1
	b	LBB0_14
LBB0_12:
	add	x20, x20, w21, uxtw
LBB0_13:
	mov	x0, x19
	bl	_wmemstream_update
LBB0_14:
	mov	x0, x20
	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 AdrpLdrGotStr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_EILSEQ,4,2                     ; @EILSEQ
	.comm	_errno,4,2                      ; @errno
	.comm	_stderr,4,2                     ; @stderr
	.no_dead_strip	_wmemstream_write
.subsections_via_symbols
