	.file	"585617.c"
	.intel_syntax noprefix
	.text
	.globl	bp
	.bss
	.align 4
	.type	bp, @object
	.size	bp, 4
bp:
	.zero	4
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 100
buf:
	.zero	100
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	add	rsp, -128
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	lea	rax, -112[rbp]
	mov	esi, 100
	mov	rdi, rax
	call	mgetline
	lea	rax, -112[rbp]
	mov	rdi, rax
	call	ungets
	jmp	.L2
.L3:
	movsx	eax, BYTE PTR -113[rbp]
	mov	edi, eax
	call	putchar@PLT
.L2:
	call	getch
	mov	BYTE PTR -113[rbp], al
	cmp	BYTE PTR -113[rbp], -1
	jne	.L3
	mov	edi, 10
	call	putchar@PLT
	mov	eax, 0
	mov	rdx, QWORD PTR -8[rbp]
	sub	rdx, QWORD PTR fs:40
	je	.L5
	call	__stack_chk_fail@PLT
.L5:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.globl	mgetline
	.type	mgetline, @function
mgetline:
.LFB7:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 32
	mov	QWORD PTR -24[rbp], rdi
	mov	DWORD PTR -28[rbp], esi
	mov	DWORD PTR -8[rbp], 0
	mov	DWORD PTR -4[rbp], 0
	jmp	.L7
.L9:
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	mov	rax, QWORD PTR -24[rbp]
	add	rax, rdx
	mov	edx, DWORD PTR -8[rbp]
	mov	BYTE PTR [rax], dl
	add	DWORD PTR -4[rbp], 1
.L7:
	mov	eax, DWORD PTR -28[rbp]
	sub	eax, 1
	cmp	DWORD PTR -4[rbp], eax
	jge	.L8
	call	getch
	mov	DWORD PTR -8[rbp], eax
	cmp	DWORD PTR -8[rbp], -1
	je	.L8
	cmp	DWORD PTR -8[rbp], 10
	jne	.L9
.L8:
	cmp	DWORD PTR -8[rbp], 10
	jne	.L10
	mov	eax, DWORD PTR -4[rbp]
	lea	edx, 1[rax]
	mov	DWORD PTR -4[rbp], edx
	movsx	rdx, eax
	mov	rax, QWORD PTR -24[rbp]
	add	rax, rdx
	mov	edx, DWORD PTR -8[rbp]
	mov	BYTE PTR [rax], dl
.L10:
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	mov	rax, QWORD PTR -24[rbp]
	add	rax, rdx
	mov	BYTE PTR [rax], 0
	mov	eax, DWORD PTR -4[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	mgetline, .-mgetline
	.globl	getch
	.type	getch, @function
getch:
.LFB8:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	eax, DWORD PTR bp[rip]
	test	eax, eax
	jle	.L13
	mov	eax, DWORD PTR bp[rip]
	sub	eax, 1
	mov	DWORD PTR bp[rip], eax
	mov	eax, DWORD PTR bp[rip]
	cdqe
	lea	rdx, buf[rip]
	movzx	eax, BYTE PTR [rax+rdx]
	movsx	eax, al
	jmp	.L14
.L13:
	call	getchar@PLT
.L14:
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	getch, .-getch
	.section	.rodata
.LC0:
	.string	"ungetch: too many characters"
	.text
	.globl	ungetch
	.type	ungetch, @function
ungetch:
.LFB9:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 16
	mov	DWORD PTR -4[rbp], edi
	mov	eax, DWORD PTR bp[rip]
	cmp	eax, 99
	jle	.L16
	lea	rdi, .LC0[rip]
	call	puts@PLT
	jmp	.L18
.L16:
	mov	eax, DWORD PTR bp[rip]
	lea	edx, 1[rax]
	mov	DWORD PTR bp[rip], edx
	mov	edx, DWORD PTR -4[rbp]
	mov	ecx, edx
	cdqe
	lea	rdx, buf[rip]
	mov	BYTE PTR [rax+rdx], cl
.L18:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	ungetch, .-ungetch
	.globl	ungets
	.type	ungets, @function
ungets:
.LFB10:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 32
	mov	QWORD PTR -24[rbp], rdi
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	call	strlen@PLT
	mov	DWORD PTR -4[rbp], eax
	jmp	.L20
.L21:
	sub	DWORD PTR -4[rbp], 1
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	mov	rax, QWORD PTR -24[rbp]
	add	rax, rdx
	movzx	eax, BYTE PTR [rax]
	movsx	eax, al
	mov	edi, eax
	call	ungetch
.L20:
	cmp	DWORD PTR -4[rbp], 0
	jg	.L21
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	ungets, .-ungets
	.ident	"GCC: (Ubuntu 10.5.0-1ubuntu1~20.04) 10.5.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, 6
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"585617.c"
	.text
	.global	bp
	.bss
	.align	2
	.type	bp, %object
	.size	bp, 4
bp:
	.space	4
	.comm	buf,100,4
	.section	.rodata
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 112
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #112
	ldr	r3, .L6
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	sub	r3, fp, #108
	mov	r1, #100
	mov	r0, r3
	bl	mgetline
	sub	r3, fp, #108
	mov	r0, r3
	bl	ungets
	b	.L2
.L5:
	ldrb	r3, [fp, #-109]	@ zero_extendqisi2
	mov	r0, r3
	bl	putchar
.L2:
	bl	getch
	mov	r3, r0
	strb	r3, [fp, #-109]
	b	.L5
.L7:
	.align	2
.L6:
	.word	.LC0
	.size	main, .-main
	.align	2
	.global	mgetline
	.syntax unified
	.arm
	.fpu softvfp
	.type	mgetline, %function
mgetline:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #16
	str	r0, [fp, #-16]
	str	r1, [fp, #-20]
	mov	r3, #0
	str	r3, [fp, #-12]
	mov	r3, #0
	str	r3, [fp, #-8]
	b	.L9
.L11:
	ldr	r3, [fp, #-8]
	ldr	r2, [fp, #-16]
	add	r3, r2, r3
	ldr	r2, [fp, #-12]
	and	r2, r2, #255
	strb	r2, [r3]
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L9:
	ldr	r3, [fp, #-20]
	sub	r3, r3, #1
	ldr	r2, [fp, #-8]
	cmp	r2, r3
	bge	.L10
	bl	getch
	str	r0, [fp, #-12]
	ldr	r3, [fp, #-12]
	cmn	r3, #1
	beq	.L10
	ldr	r3, [fp, #-12]
	cmp	r3, #10
	bne	.L11
.L10:
	ldr	r3, [fp, #-12]
	cmp	r3, #10
	bne	.L12
	ldr	r3, [fp, #-8]
	add	r2, r3, #1
	str	r2, [fp, #-8]
	mov	r2, r3
	ldr	r3, [fp, #-16]
	add	r3, r3, r2
	ldr	r2, [fp, #-12]
	and	r2, r2, #255
	strb	r2, [r3]
.L12:
	ldr	r3, [fp, #-8]
	ldr	r2, [fp, #-16]
	add	r3, r2, r3
	mov	r2, #0
	strb	r2, [r3]
	ldr	r3, [fp, #-8]
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	mgetline, .-mgetline
	.align	2
	.global	getch
	.syntax unified
	.arm
	.fpu softvfp
	.type	getch, %function
getch:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	ldr	r3, .L17
	ldr	r3, [r3]
	cmp	r3, #0
	ble	.L15
	ldr	r3, .L17
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L17
	str	r3, [r2]
	ldr	r3, .L17
	ldr	r3, [r3]
	ldr	r2, .L17+4
	ldrb	r3, [r2, r3]	@ zero_extendqisi2
	b	.L16
.L15:
	bl	getchar
	mov	r3, r0
.L16:
	mov	r0, r3
	pop	{fp, pc}
.L18:
	.align	2
.L17:
	.word	bp
	.word	buf
	.size	getch, .-getch
	.section	.rodata
	.align	2
.LC1:
	.ascii	"ungetch: too many characters\000"
	.text
	.align	2
	.global	ungetch
	.syntax unified
	.arm
	.fpu softvfp
	.type	ungetch, %function
ungetch:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	str	r0, [fp, #-8]
	ldr	r3, .L23
	ldr	r3, [r3]
	cmp	r3, #99
	ble	.L20
	ldr	r0, .L23+4
	bl	puts
	b	.L22
.L20:
	ldr	r3, .L23
	ldr	r3, [r3]
	add	r2, r3, #1
	ldr	r1, .L23
	str	r2, [r1]
	ldr	r2, [fp, #-8]
	and	r1, r2, #255
	ldr	r2, .L23+8
	strb	r1, [r2, r3]
.L22:
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L24:
	.align	2
.L23:
	.word	bp
	.word	.LC1
	.word	buf
	.size	ungetch, .-ungetch
	.align	2
	.global	ungets
	.syntax unified
	.arm
	.fpu softvfp
	.type	ungets, %function
ungets:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #16
	str	r0, [fp, #-16]
	ldr	r0, [fp, #-16]
	bl	strlen
	mov	r3, r0
	str	r3, [fp, #-8]
	b	.L26
.L27:
	ldr	r3, [fp, #-8]
	sub	r3, r3, #1
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-8]
	ldr	r2, [fp, #-16]
	add	r3, r2, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r0, r3
	bl	ungetch
.L26:
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bgt	.L27
	nop
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	ungets, .-ungets
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
