	.file	"644865.c"
	.intel_syntax noprefix
	.text
	.globl	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 100
buf:
	.zero	100
	.globl	bufp
	.align 4
	.type	bufp, @object
	.size	bufp, 4
bufp:
	.zero	4
	.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, 64
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	movabs	rax, 4050765991979987505
	movabs	rdx, 8388271159141146681
	mov	QWORD PTR -48[rbp], rax
	mov	QWORD PTR -40[rbp], rdx
	movabs	rax, 7237125650469909287
	mov	QWORD PTR -32[rbp], rax
	mov	WORD PTR -24[rbp], 10
	lea	rax, -48[rbp]
	mov	rdi, rax
	call	ungets
	jmp	.L2
.L3:
	mov	eax, DWORD PTR -52[rbp]
	mov	edi, eax
	call	putchar@PLT
.L2:
	mov	eax, 0
	call	getch
	mov	DWORD PTR -52[rbp], eax
	cmp	DWORD PTR -52[rbp], -1
	jne	.L3
	mov	eax, 0
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L5
	call	__stack_chk_fail@PLT
.L5:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	getch
	.type	getch, @function
getch:
.LFB1:
	.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 bufp[rip]
	test	eax, eax
	jle	.L7
	mov	eax, DWORD PTR bufp[rip]
	sub	eax, 1
	mov	DWORD PTR bufp[rip], eax
	mov	eax, DWORD PTR bufp[rip]
	cdqe
	lea	rdx, buf[rip]
	movzx	eax, BYTE PTR [rax+rdx]
	movsx	eax, al
	jmp	.L9
.L7:
	call	getchar@PLT
.L9:
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	getch, .-getch
	.section	.rodata
	.align 8
.LC0:
	.string	"error: stack is full, can't execute ungetch()"
	.text
	.globl	ungetch
	.type	ungetch, @function
ungetch:
.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	DWORD PTR -4[rbp], edi
	mov	eax, DWORD PTR bufp[rip]
	cmp	eax, 99
	jle	.L11
	lea	rdi, .LC0[rip]
	call	puts@PLT
	jmp	.L13
.L11:
	mov	eax, DWORD PTR bufp[rip]
	lea	edx, 1[rax]
	mov	DWORD PTR bufp[rip], edx
	mov	edx, DWORD PTR -4[rbp]
	mov	ecx, edx
	cdqe
	lea	rdx, buf[rip]
	mov	BYTE PTR [rax+rdx], cl
.L13:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	ungetch, .-ungetch
	.section	.rodata
	.align 8
.LC1:
	.string	"error: not enough buffer space, can't execute ungets()"
	.text
	.globl	ungets
	.type	ungets, @function
ungets:
.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, 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
	mov	edx, DWORD PTR bufp[rip]
	mov	eax, 100
	sub	eax, edx
	cmp	DWORD PTR -4[rbp], eax
	jg	.L15
	mov	rax, QWORD PTR -24[rbp]
	mov	rdi, rax
	call	strlen@PLT
	sub	eax, 1
	mov	DWORD PTR -8[rbp], eax
	jmp	.L16
.L17:
	mov	eax, DWORD PTR -8[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
	sub	DWORD PTR -8[rbp], 1
.L16:
	cmp	DWORD PTR -8[rbp], 0
	jns	.L17
	jmp	.L19
.L15:
	lea	rdi, .LC1[rip]
	call	puts@PLT
.L19:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.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	"644865.c"
	.text
	.comm	buf,100,4
	.global	bufp
	.bss
	.align	2
	.type	bufp, %object
	.size	bufp, 4
bufp:
	.space	4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"123456789 C - it's goood\012\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 = 40
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #40
	ldr	r3, .L6
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, .L6+4
	sub	ip, fp, #36
	mov	lr, r3
	ldmia	lr!, {r0, r1, r2, r3}
	stmia	ip!, {r0, r1, r2, r3}
	ldm	lr, {r0, r1, r2}
	stmia	ip!, {r0, r1}
	strh	r2, [ip]	@ movhi
	sub	r3, fp, #36
	mov	r0, r3
	bl	ungets
	b	.L2
.L3:
	ldr	r0, [fp, #-40]
	bl	putchar
.L2:
	bl	getch
	str	r0, [fp, #-40]
	ldr	r3, [fp, #-40]
	cmn	r3, #1
	bne	.L3
	mov	r3, #0
	ldr	r2, .L6
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L5
	bl	__stack_chk_fail
.L5:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L7:
	.align	2
.L6:
	.word	.LC1
	.word	.LC0
	.size	main, .-main
	.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, .L12
	ldr	r3, [r3]
	cmp	r3, #0
	ble	.L9
	ldr	r3, .L12
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L12
	str	r3, [r2]
	ldr	r3, .L12
	ldr	r3, [r3]
	ldr	r2, .L12+4
	ldrb	r3, [r2, r3]	@ zero_extendqisi2
	b	.L11
.L9:
	bl	getchar
	mov	r3, r0
.L11:
	mov	r0, r3
	pop	{fp, pc}
.L13:
	.align	2
.L12:
	.word	bufp
	.word	buf
	.size	getch, .-getch
	.section	.rodata
	.align	2
.LC2:
	.ascii	"error: stack is full, can't execute ungetch()\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, .L18
	ldr	r3, [r3]
	cmp	r3, #99
	ble	.L15
	ldr	r0, .L18+4
	bl	puts
	b	.L17
.L15:
	ldr	r3, .L18
	ldr	r3, [r3]
	add	r2, r3, #1
	ldr	r1, .L18
	str	r2, [r1]
	ldr	r2, [fp, #-8]
	and	r1, r2, #255
	ldr	r2, .L18+8
	strb	r1, [r2, r3]
.L17:
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L19:
	.align	2
.L18:
	.word	bufp
	.word	.LC2
	.word	buf
	.size	ungetch, .-ungetch
	.section	.rodata
	.align	2
.LC3:
	.ascii	"error: not enough buffer space, can't execute unget"
	.ascii	"s()\000"
	.text
	.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]
	ldr	r3, .L26
	ldr	r3, [r3]
	rsb	r3, r3, #100
	ldr	r2, [fp, #-8]
	cmp	r2, r3
	bgt	.L21
	ldr	r0, [fp, #-16]
	bl	strlen
	mov	r3, r0
	sub	r3, r3, #1
	str	r3, [fp, #-12]
	b	.L22
.L23:
	ldr	r3, [fp, #-12]
	ldr	r2, [fp, #-16]
	add	r3, r2, r3
	ldrb	r3, [r3]	@ zero_extendqisi2
	mov	r0, r3
	bl	ungetch
	ldr	r3, [fp, #-12]
	sub	r3, r3, #1
	str	r3, [fp, #-12]
.L22:
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	bge	.L23
	b	.L25
.L21:
	ldr	r0, .L26+4
	bl	puts
.L25:
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L27:
	.align	2
.L26:
	.word	bufp
	.word	.LC3
	.size	ungets, .-ungets
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
