	.file	"781007.c"
	.intel_syntax noprefix
	.text
	.section	.rodata
.LC0:
	.string	"done"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	edi, 14
	call	print_header
	jmp	.L2
.L4:
	mov	edx, DWORD PTR -28[rbp]
	lea	rax, -22[rbp]
	mov	esi, edx
	mov	rdi, rax
	call	print_fetched
.L2:
	lea	rax, -22[rbp]
	mov	esi, 14
	mov	rdi, rax
	call	fetch
	mov	DWORD PTR -28[rbp], eax
	cmp	DWORD PTR -28[rbp], 0
	je	.L3
	movzx	eax, BYTE PTR -22[rbp]
	cmp	al, 10
	jne	.L4
.L3:
	lea	rdi, .LC0[rip]
	call	puts@PLT
	mov	eax, 0
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L6
	call	__stack_chk_fail@PLT
.L6:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	fetch
	.type	fetch, @function
fetch:
.LFB1:
	.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
	jmp	.L8
.L10:
	mov	eax, DWORD PTR -8[rbp]
	movsx	rdx, eax
	mov	rax, QWORD PTR -24[rbp]
	add	rax, rdx
	mov	edx, DWORD PTR -4[rbp]
	mov	BYTE PTR [rax], dl
	add	DWORD PTR -8[rbp], 1
.L8:
	mov	eax, DWORD PTR -8[rbp]
	cmp	eax, DWORD PTR -28[rbp]
	jge	.L9
	call	getchar@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], -1
	je	.L9
	cmp	DWORD PTR -4[rbp], 32
	je	.L9
	cmp	DWORD PTR -4[rbp], 9
	je	.L9
	cmp	DWORD PTR -4[rbp], 10
	jne	.L10
.L9:
	mov	eax, DWORD PTR -8[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	fetch, .-fetch
	.globl	print_fetched
	.type	print_fetched, @function
print_fetched:
.LFB2:
	.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	QWORD PTR -8[rbp], rdi
	mov	DWORD PTR -12[rbp], esi
	jmp	.L13
.L14:
	mov	rax, QWORD PTR -8[rbp]
	lea	rdx, 1[rax]
	mov	QWORD PTR -8[rbp], rdx
	movzx	eax, BYTE PTR [rax]
	movsx	eax, al
	mov	edi, eax
	call	putchar@PLT
	sub	DWORD PTR -12[rbp], 1
.L13:
	cmp	DWORD PTR -12[rbp], 0
	jne	.L14
	mov	edi, 10
	call	putchar@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	print_fetched, .-print_fetched
	.section	.rodata
.LC1:
	.string	"Test the fetch() function. "
	.align 8
.LC2:
	.string	"It saves up to %d characters from input.\n"
	.align 8
.LC3:
	.string	"Enter a string (newline to quit):"
	.text
	.globl	print_header
	.type	print_header, @function
print_header:
.LFB3:
	.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
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, .LC3[rip]
	call	puts@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	print_header, .-print_header
	.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	"781007.c"
	.text
	.section	.rodata
	.align	2
.LC0:
	.ascii	"done\000"
	.align	2
.LC1:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #24
	ldr	r3, .L7
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r0, #14
	bl	print_header
	b	.L2
.L4:
	sub	r3, fp, #24
	ldr	r1, [fp, #-28]
	mov	r0, r3
	bl	print_fetched
.L2:
	sub	r3, fp, #24
	mov	r1, #14
	mov	r0, r3
	bl	fetch
	str	r0, [fp, #-28]
	ldr	r3, [fp, #-28]
	cmp	r3, #0
	beq	.L3
	ldrb	r3, [fp, #-24]	@ zero_extendqisi2
	cmp	r3, #10
	bne	.L4
.L3:
	ldr	r0, .L7+4
	bl	puts
	mov	r3, #0
	ldr	r2, .L7
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L6
	bl	__stack_chk_fail
.L6:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L8:
	.align	2
.L7:
	.word	.LC1
	.word	.LC0
	.size	main, .-main
	.align	2
	.global	fetch
	.syntax unified
	.arm
	.fpu softvfp
	.type	fetch, %function
fetch:
	@ 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]
	b	.L10
.L12:
	ldr	r3, [fp, #-12]
	ldr	r2, [fp, #-16]
	add	r3, r2, r3
	ldr	r2, [fp, #-8]
	and	r2, r2, #255
	strb	r2, [r3]
	ldr	r3, [fp, #-12]
	add	r3, r3, #1
	str	r3, [fp, #-12]
.L10:
	ldr	r2, [fp, #-12]
	ldr	r3, [fp, #-20]
	cmp	r2, r3
	bge	.L11
	bl	getchar
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmn	r3, #1
	beq	.L11
	ldr	r3, [fp, #-8]
	cmp	r3, #32
	beq	.L11
	ldr	r3, [fp, #-8]
	cmp	r3, #9
	beq	.L11
	ldr	r3, [fp, #-8]
	cmp	r3, #10
	bne	.L12
.L11:
	ldr	r3, [fp, #-12]
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	fetch, .-fetch
	.align	2
	.global	print_fetched
	.syntax unified
	.arm
	.fpu softvfp
	.type	print_fetched, %function
print_fetched:
	@ 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]
	str	r1, [fp, #-12]
	b	.L15
.L16:
	ldr	r3, [fp, #-8]
	add	r2, r3, #1
	str	r2, [fp, #-8]
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r0, r3
	bl	putchar
	ldr	r3, [fp, #-12]
	sub	r3, r3, #1
	str	r3, [fp, #-12]
.L15:
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	bne	.L16
	mov	r0, #10
	bl	putchar
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	print_fetched, .-print_fetched
	.section	.rodata
	.align	2
.LC2:
	.ascii	"Test the fetch() function. \000"
	.align	2
.LC3:
	.ascii	"It saves up to %d characters from input.\012\000"
	.align	2
.LC4:
	.ascii	"Enter a string (newline to quit):\000"
	.text
	.align	2
	.global	print_header
	.syntax unified
	.arm
	.fpu softvfp
	.type	print_header, %function
print_header:
	@ 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	r0, .L18
	bl	printf
	ldr	r1, [fp, #-8]
	ldr	r0, .L18+4
	bl	printf
	ldr	r0, .L18+8
	bl	puts
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L19:
	.align	2
.L18:
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.size	print_header, .-print_header
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
