	.file	"extr_open_wmemstream.c_wmemstream_write.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	wmemstream_write, @function
wmemstream_write:
.LFB0:
	.cfi_startproc
	endbr64
	push	r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	mov	r14, rsi
	push	r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	mov	r13d, edx
	push	r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	mov	r12, rdi
	push	rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	lea	rbp, 24[rdi]
	push	rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	mov	rdi, rbp
	call	wbuflen@PLT
	test	rax, rax
	js	.L7
	add	rax, QWORD PTR [r12]
	mov	rdi, r12
	mov	rsi, rax
	call	wmemstream_grow@PLT
	test	eax, eax
	je	.L11
	test	r13d, r13d
	jle	.L12
	mov	rdi, QWORD PTR [r12]
	xor	ebx, ebx
	.p2align 4,,10
	.p2align 3
.L5:
	cmp	QWORD PTR 8[r12], rdi
	jle	.L17
	mov	rax, QWORD PTR 16[r12]
	mov	rcx, rbp
	mov	edx, r13d
	mov	rsi, r14
	add	rdi, QWORD PTR [rax]
	call	mbrtowc@PLT
	cmp	rax, -1
	je	.L19
	test	rax, rax
	je	.L13
	cmp	rax, -2
	je	.L9
	mov	edx, eax
.L8:
	add	rbx, rax
	add	r14, rax
	mov	rax, QWORD PTR [r12]
	sub	r13d, edx
	lea	rdi, 1[rax]
	mov	QWORD PTR [r12], rdi
	test	r13d, r13d
	jg	.L5
	.p2align 4,,10
	.p2align 3
.L17:
	mov	r13d, ebx
.L4:
	mov	rdi, r12
	call	wmemstream_update@PLT
.L1:
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	mov	eax, r13d
	pop	rbp
	.cfi_def_cfa_offset 32
	pop	r12
	.cfi_def_cfa_offset 24
	pop	r13
	.cfi_def_cfa_offset 16
	pop	r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L13:
	.cfi_restore_state
	mov	edx, 1
	mov	eax, 1
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L9:
	add	r13d, ebx
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L19:
	test	rbx, rbx
	jne	.L17
.L7:
	mov	eax, DWORD PTR EILSEQ[rip]
	mov	r13d, -1
	mov	DWORD PTR errno[rip], eax
	jmp	.L1
.L11:
	mov	r13d, -1
	jmp	.L1
.L12:
	xor	r13d, r13d
	jmp	.L4
	.cfi_endproc
.LFE0:
	.size	wmemstream_write, .-wmemstream_write
	.comm	stderr,4,4
	.comm	errno,4,4
	.comm	EILSEQ,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_open_wmemstream.c_wmemstream_write.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	wmemstream_write, %function
wmemstream_write:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, lr}
	add	r8, r0, #12
	mov	r4, r0
	mov	r0, r8
	mov	r6, r1
	mov	r5, r2
	bl	wbuflen
	subs	r1, r0, #0
	blt	.L13
	ldr	r3, [r4]
	mov	r0, r4
	add	r1, r1, r3
	bl	wmemstream_grow
	cmp	r0, #0
	beq	.L9
	cmp	r5, #0
	ble	.L10
	mov	r7, #0
	ldr	ip, [r4]
.L5:
	ldr	r3, [r4, #4]
	cmp	r3, ip
	ble	.L4
	ldr	r2, [r4, #8]
	mov	r3, r8
	ldr	r0, [r2]
	mov	r1, r6
	mov	r2, r5
	add	r0, ip, r0
	bl	mbrtowc
	cmn	r0, #1
	beq	.L15
	cmp	r0, #0
	beq	.L11
	cmn	r0, #2
	beq	.L16
.L7:
	ldr	ip, [r4]
	sub	r5, r5, r0
	add	ip, ip, #1
	cmp	r5, #0
	add	r7, r7, r0
	add	r6, r6, r0
	str	ip, [r4]
	bgt	.L5
.L4:
	mov	r0, r4
	bl	wmemstream_update
.L1:
	mov	r0, r7
	pop	{r4, r5, r6, r7, r8, pc}
.L11:
	mov	r0, #1
	b	.L7
.L16:
	add	r7, r7, r5
	b	.L4
.L15:
	cmp	r7, #0
	bne	.L4
.L13:
	ldr	r2, .L17
	ldr	r3, .L17+4
	ldr	r2, [r2]
	mvn	r7, #0
	str	r2, [r3]
	b	.L1
.L9:
	mvn	r7, #0
	b	.L1
.L10:
	mov	r7, #0
	b	.L4
.L18:
	.align	2
.L17:
	.word	EILSEQ
	.word	errno
	.size	wmemstream_write, .-wmemstream_write
	.comm	stderr,4,4
	.comm	errno,4,4
	.comm	EILSEQ,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
