	.file	"extr_n_tty.c_process_echoes.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	process_echoes, @function
process_echoes:
.LFB0:
	.cfi_startproc
	endbr64
	mov	eax, DWORD PTR [rdi]
	test	eax, eax
	jne	.L57
	ret
	.p2align 4,,10
	.p2align 3
.L57:
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	lea	rax, 40[rdi]
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	mov	r14, rdi
	mov	rdi, rax
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 40
	.cfi_def_cfa_offset 96
	mov	QWORD PTR 16[rsp], rax
	call	mutex_lock@PLT
	lea	rax, 44[r14]
	mov	rdi, rax
	mov	QWORD PTR 24[rsp], rax
	call	mutex_lock@PLT
	mov	rdi, r14
	call	tty_write_room@PLT
	mov	rcx, QWORD PTR 8[r14]
	movsx	r12, DWORD PTR N_TTY_BUF_SIZE[rip]
	movsx	rsi, DWORD PTR 16[r14]
	mov	ebx, DWORD PTR [r14]
	mov	ebp, eax
	mov	rax, r12
	add	r12, rcx
	mov	rdx, rsi
	lea	r15, [rcx+rsi]
	test	ebx, ebx
	jle	.L4
	lea	rax, 56[r14]
	mov	QWORD PTR 8[rsp], rax
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L60:
	lea	rax, 1[r15]
	cmp	r12, rax
	je	.L58
	movzx	r13d, BYTE PTR [rax]
	cmp	r13b, -126
	je	.L7
.L63:
	ja	.L8
	cmp	r13b, -128
	je	.L9
	cmp	r13b, -127
	jne	.L11
	mov	eax, DWORD PTR 24[r14]
	add	r15, 2
	sub	ebx, 2
	mov	DWORD PTR 20[r14], eax
	.p2align 4,,10
	.p2align 3
.L17:
	cmp	r15, r12
	jb	.L21
	movsx	rax, DWORD PTR N_TTY_BUF_SIZE[rip]
	sub	r15, rax
.L21:
	test	ebx, ebx
	jle	.L59
.L22:
	movzx	r13d, BYTE PTR [r15]
	cmp	r13b, -128
	je	.L60
	mov	rdi, r14
	call	O_OPOST@PLT
	test	rax, rax
	jne	.L61
.L19:
	test	ebp, ebp
	je	.L14
	movzx	esi, r13b
	mov	rdi, r14
	sub	ebp, 1
	call	tty_put_char@PLT
.L20:
	add	r15, 1
	sub	ebx, 1
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L8:
	cmp	r13b, -125
	jne	.L11
	add	rax, 1
	cmp	r12, rax
	je	.L62
.L12:
	movzx	eax, BYTE PTR [rax]
	test	al, al
	js	.L13
	add	eax, DWORD PTR 20[r14]
.L13:
	and	eax, 7
	mov	edx, 8
	sub	edx, eax
	cmp	ebp, edx
	jb	.L14
	mov	edx, 7
	lea	ebp, -8[rax+rbp]
	sub	edx, eax
	mov	r13d, edx
	.p2align 4,,10
	.p2align 3
.L16:
	mov	esi, 8
	mov	rdi, r14
	call	tty_put_char@PLT
	mov	eax, DWORD PTR 24[r14]
	test	eax, eax
	je	.L15
	sub	eax, 1
	mov	DWORD PTR 24[r14], eax
.L15:
	sub	r13d, 1
	cmp	r13d, -1
	jne	.L16
	add	r15, 3
	sub	ebx, 3
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L61:
	mov	rsi, QWORD PTR 8[rsp]
	mov	edi, DWORD PTR TTY_HW_COOK_OUT[rip]
	call	test_bit@PLT
	test	eax, eax
	jne	.L19
	movzx	edi, r13b
	mov	edx, ebp
	mov	rsi, r14
	call	do_output_char@PLT
	test	eax, eax
	js	.L14
	sub	ebp, eax
	jmp	.L20
	.p2align 4,,10
	.p2align 3
.L58:
	movsx	rax, DWORD PTR N_TTY_BUF_SIZE[rip]
	mov	rcx, r12
	sub	rcx, rax
	mov	rax, rcx
	movzx	r13d, BYTE PTR [rax]
	cmp	r13b, -126
	jne	.L63
.L7:
	mov	eax, DWORD PTR 24[r14]
	test	eax, eax
	je	.L55
	sub	eax, 1
	mov	DWORD PTR 24[r14], eax
	jmp	.L55
	.p2align 4,,10
	.p2align 3
.L11:
	cmp	ebp, 1
	jle	.L14
	mov	esi, 94
	mov	rdi, r14
	sub	ebp, 2
	add	r15, 2
	call	tty_put_char@PLT
	mov	edx, r13d
	mov	rdi, r14
	sub	ebx, 2
	xor	edx, 64
	movzx	esi, dl
	call	tty_put_char@PLT
	add	DWORD PTR 24[r14], 2
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L9:
	test	ebp, ebp
	je	.L14
	mov	esi, 128
	mov	rdi, r14
	sub	ebp, 1
	call	tty_put_char@PLT
	add	DWORD PTR 24[r14], 1
.L55:
	add	r15, 2
	sub	ebx, 2
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L62:
	movsx	rax, DWORD PTR N_TTY_BUF_SIZE[rip]
	mov	rcx, r12
	sub	rcx, rax
	mov	rax, rcx
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L14:
	mov	eax, DWORD PTR [r14]
	mov	edx, DWORD PTR 16[r14]
	mov	ecx, DWORD PTR N_TTY_BUF_SIZE[rip]
	mov	DWORD PTR [r14], ebx
	sub	eax, ebx
	add	edx, eax
	sub	ecx, 1
	and	edx, ecx
	mov	DWORD PTR 16[r14], edx
	test	eax, eax
	jle	.L23
	mov	QWORD PTR 48[r14], 0
.L23:
	mov	rdi, QWORD PTR 24[rsp]
	call	mutex_unlock@PLT
	mov	rdi, QWORD PTR 16[rsp]
	call	mutex_unlock@PLT
	mov	rax, QWORD PTR 32[r14]
	mov	rax, QWORD PTR [rax]
	test	rax, rax
	je	.L1
	add	rsp, 40
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	rdi, r14
	pop	rbx
	.cfi_restore 3
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_restore 6
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_restore 12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_restore 13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_restore 14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_restore 15
	.cfi_def_cfa_offset 8
	jmp	rax
	.p2align 4,,10
	.p2align 3
.L1:
	.cfi_restore_state
	add	rsp, 40
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L59:
	.cfi_restore_state
	jne	.L14
.L25:
	mov	DWORD PTR 16[r14], 0
	mov	DWORD PTR [r14], 0
	mov	QWORD PTR 48[r14], 0
	jmp	.L23
.L4:
	je	.L25
	sub	eax, 1
	and	eax, edx
	mov	DWORD PTR 16[r14], eax
	jmp	.L23
	.cfi_endproc
.LFE0:
	.size	process_echoes, .-process_echoes
	.comm	TTY_HW_COOK_OUT,4,4
	.comm	N_TTY_BUF_SIZE,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_n_tty.c_process_echoes.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	process_echoes, %function
process_echoes:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	ldr	r2, [r0]
	cmp	r2, #0
	bxeq	lr
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	mov	r10, r0
	sub	sp, sp, #12
	add	r3, r0, #24
	mov	r0, r3
	str	r3, [sp]
	add	r3, r10, #28
	mov	r4, r3
	str	r3, [sp, #4]
	bl	mutex_lock
	mov	r0, r4
	bl	mutex_lock
	mov	r0, r10
	bl	tty_write_room
	ldr	r8, .L61
	ldr	r5, [r10]
	ldr	r4, [r10, #4]
	ldr	r2, [r8]
	ldr	r1, [r10, #8]
	cmp	r5, #0
	add	r7, r4, r2
	mov	r6, r0
	add	r4, r4, r1
	ble	.L4
	add	r9, r10, #36
.L23:
	ldrb	fp, [r4]	@ zero_extendqisi2
	cmp	fp, #128
	bne	.L5
	add	r3, r4, #1
	cmp	r7, r3
	ldreq	r3, [r8]
	subeq	r3, r7, r3
	ldrb	fp, [r3]	@ zero_extendqisi2
	sub	r2, fp, #128
	cmp	r2, #3
	ldrls	pc, [pc, r2, asl #2]
	b	.L7
.L9:
	.word	.L12
	.word	.L11
	.word	.L10
	.word	.L8
.L8:
	add	r3, r3, #1
	cmp	r7, r3
	ldreq	r3, [r8]
	subeq	r3, r7, r3
	ldrb	fp, [r3]	@ zero_extendqisi2
	tst	fp, #128
	ldreq	r3, [r10, #12]
	addeq	fp, fp, r3
	and	fp, fp, #7
	rsb	r3, fp, #8
	cmp	r6, r3
	bcc	.L15
	sub	r6, r6, #8
	add	r6, r6, fp
	rsb	fp, fp, #7
.L17:
	mov	r1, #8
	mov	r0, r10
	bl	tty_put_char
	ldr	r3, [r10, #16]
	sub	fp, fp, #1
	cmp	r3, #0
	subne	r3, r3, #1
	strne	r3, [r10, #16]
	cmn	fp, #1
	bne	.L17
	add	r4, r4, #3
	sub	r5, r5, #3
	b	.L18
.L10:
	ldr	r3, [r10, #16]
	add	r4, r4, #2
	cmp	r3, #0
	subne	r3, r3, #1
	strne	r3, [r10, #16]
	sub	r5, r5, #2
.L18:
	cmp	r4, r7
	ldrcs	r3, [r8]
	subcs	r4, r4, r3
	cmp	r5, #0
	bgt	.L23
	bne	.L15
.L26:
	mov	r2, #0
	str	r2, [r10, #8]
	str	r2, [r10]
	str	r2, [r10, #32]
.L24:
	ldr	r0, [sp, #4]
	bl	mutex_unlock
	ldr	r0, [sp]
	bl	mutex_unlock
	ldr	r2, [r10, #20]
	ldr	r2, [r2]
	cmp	r2, #0
	beq	.L1
	mov	r0, r10
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	bx	r2
.L11:
	ldr	r3, [r10, #16]
	add	r4, r4, #2
	sub	r5, r5, #2
	str	r3, [r10, #12]
	b	.L18
.L12:
	cmp	r6, #0
	beq	.L15
	mov	r1, #128
	mov	r0, r10
	bl	tty_put_char
	ldr	r3, [r10, #16]
	sub	r6, r6, #1
	add	r3, r3, #1
	add	r4, r4, #2
	sub	r5, r5, #2
	str	r3, [r10, #16]
	b	.L18
.L5:
	mov	r0, r10
	bl	O_OPOST
	cmp	r0, #0
	bne	.L59
.L20:
	cmp	r6, #0
	beq	.L15
	mov	r1, fp
	mov	r0, r10
	bl	tty_put_char
	sub	r6, r6, #1
.L21:
	add	r4, r4, #1
	sub	r5, r5, #1
	b	.L18
.L59:
	ldr	r3, .L61+4
	mov	r1, r9
	ldr	r0, [r3]
	bl	test_bit
	cmp	r0, #0
	bne	.L20
	mov	r0, fp
	mov	r2, r6
	mov	r1, r10
	bl	do_output_char
	cmp	r0, #0
	blt	.L15
	sub	r6, r6, r0
	b	.L21
.L1:
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L7:
	cmp	r6, #1
	bgt	.L60
.L15:
	ldr	r1, [r10]
	ldr	r0, [r8]
	ldr	r2, [r10, #8]
	sub	r1, r1, r5
	sub	r0, r0, #1
	add	r2, r1, r2
	and	r2, r2, r0
	cmp	r1, #0
	str	r2, [r10, #8]
	movgt	r2, #0
	str	r5, [r10]
	strgt	r2, [r10, #32]
	b	.L24
.L4:
	beq	.L26
	sub	r2, r2, #1
	and	r2, r2, r1
	str	r2, [r10, #8]
	b	.L24
.L60:
	mov	r1, #94
	mov	r0, r10
	bl	tty_put_char
	mov	r0, r10
	eor	r1, fp, #64
	bl	tty_put_char
	ldr	r3, [r10, #16]
	sub	r6, r6, #2
	add	r3, r3, #2
	add	r4, r4, #2
	sub	r5, r5, #2
	str	r3, [r10, #16]
	b	.L18
.L62:
	.align	2
.L61:
	.word	N_TTY_BUF_SIZE
	.word	TTY_HW_COOK_OUT
	.size	process_echoes, .-process_echoes
	.comm	TTY_HW_COOK_OUT,4,4
	.comm	N_TTY_BUF_SIZE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
