	.file	"118696.c"
	.intel_syntax noprefix
	.text
	.globl	g_thread
	.bss
	.align 8
	.type	g_thread, @object
	.size	g_thread, 8
g_thread:
	.zero	8
	.globl	g_should_exit
	.align 4
	.type	g_should_exit, @object
	.size	g_should_exit, 4
g_should_exit:
	.zero	4
	.section	.rodata
.LC0:
	.string	"/dev/ttyPS0"
	.align 8
.LC1:
	.string	"open_port: Unable to open /dev/ttyPS0"
.LC2:
	.string	"ioctl failed to set baudrate"
.LC3:
	.string	"read failed!"
.LC4:
	.string	"PULPino: %s\n"
	.text
	.globl	read_port
	.type	read_port, @function
read_port:
.LFB6:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 336
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	esi, 256
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	open@PLT
	mov	DWORD PTR -328[rbp], eax
	cmp	DWORD PTR -328[rbp], 0
	jns	.L2
	lea	rdi, .LC1[rip]
	call	perror@PLT
	jmp	.L1
.L2:
	lea	rdx, -320[rbp]
	mov	eax, DWORD PTR -328[rbp]
	mov	esi, 2150388778
	mov	edi, eax
	mov	eax, 0
	call	ioctl@PLT
	mov	eax, DWORD PTR -312[rbp]
	and	eax, -4112
	mov	DWORD PTR -312[rbp], eax
	mov	eax, DWORD PTR -312[rbp]
	or	ah, 16
	mov	DWORD PTR -312[rbp], eax
	mov	DWORD PTR -284[rbp], 156250
	mov	DWORD PTR -280[rbp], 156250
	lea	rdx, -320[rbp]
	mov	eax, DWORD PTR -328[rbp]
	mov	esi, 1076646955
	mov	edi, eax
	mov	eax, 0
	call	ioctl@PLT
	test	eax, eax
	je	.L4
	lea	rdi, .LC2[rip]
	call	perror@PLT
	jmp	.L1
.L4:
	mov	DWORD PTR -332[rbp], 0
	jmp	.L5
.L11:
	lea	rcx, -333[rbp]
	mov	eax, DWORD PTR -328[rbp]
	mov	edx, 1
	mov	rsi, rcx
	mov	edi, eax
	call	read@PLT
	mov	DWORD PTR -324[rbp], eax
	cmp	DWORD PTR -324[rbp], 4
	je	.L14
	cmp	DWORD PTR -324[rbp], 0
	jns	.L8
	lea	rdi, .LC3[rip]
	call	puts@PLT
	jmp	.L5
.L8:
	cmp	DWORD PTR -324[rbp], 0
	jle	.L5
	cmp	DWORD PTR -332[rbp], 255
	je	.L9
	movzx	eax, BYTE PTR -333[rbp]
	cmp	al, 10
	jne	.L10
.L9:
	mov	eax, DWORD PTR -332[rbp]
	mov	BYTE PTR -272[rbp+rax], 0
	lea	rax, -272[rbp]
	mov	rsi, rax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	mov	DWORD PTR -332[rbp], 0
	jmp	.L5
.L10:
	movzx	edx, BYTE PTR -333[rbp]
	mov	eax, DWORD PTR -332[rbp]
	mov	BYTE PTR -272[rbp+rax], dl
	add	DWORD PTR -332[rbp], 1
.L5:
	mov	eax, DWORD PTR g_should_exit[rip]
	test	eax, eax
	je	.L11
	jmp	.L7
.L14:
	nop
.L7:
	mov	eax, DWORD PTR -328[rbp]
	mov	edi, eax
	call	close@PLT
.L1:
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR fs:40
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	read_port, .-read_port
	.globl	console_thread
	.type	console_thread, @function
console_thread:
.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, 16
	mov	QWORD PTR -8[rbp], rdi
	mov	eax, 0
	call	read_port
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	console_thread, .-console_thread
	.section	.rodata
	.align 8
.LC5:
	.string	"Error creating console listening thread"
	.text
	.globl	console_thread_start
	.type	console_thread_start, @function
console_thread_start:
.LFB8:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	DWORD PTR g_should_exit[rip], 0
	mov	ecx, 0
	lea	rdx, console_thread[rip]
	mov	esi, 0
	lea	rdi, g_thread[rip]
	call	pthread_create@PLT
	test	eax, eax
	je	.L18
	lea	rdi, .LC5[rip]
	call	puts@PLT
.L18:
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	console_thread_start, .-console_thread_start
	.globl	console_thread_stop
	.type	console_thread_stop, @function
console_thread_stop:
.LFB9:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	DWORD PTR g_should_exit[rip], 1
	mov	rax, QWORD PTR g_thread[rip]
	mov	esi, 2
	mov	rdi, rax
	call	pthread_kill@PLT
	mov	rax, QWORD PTR g_thread[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	console_thread_stop, .-console_thread_stop
	.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	"118696.c"
	.text
	.comm	g_thread,4,4
	.comm	g_should_exit,4,4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"/dev/ttyPS0\000"
	.align	2
.LC1:
	.ascii	"open_port: Unable to open /dev/ttyPS0\000"
	.align	2
.LC2:
	.ascii	"ioctl failed to set baudrate\000"
	.align	2
.LC3:
	.ascii	"read failed!\000"
	.align	2
.LC4:
	.ascii	"PULPino: %s\012\000"
	.align	2
.LC5:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	read_port
	.syntax unified
	.arm
	.fpu softvfp
	.type	read_port, %function
read_port:
	@ args = 0, pretend = 0, frame = 320
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #320
	ldr	r3, .L15
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r1, #256
	ldr	r0, .L15+4
	bl	open
	str	r0, [fp, #-316]
	ldr	r3, [fp, #-316]
	cmp	r3, #0
	bge	.L2
	ldr	r0, .L15+8
	bl	perror
	b	.L1
.L2:
	sub	r3, fp, #308
	mov	r2, r3
	ldr	r1, .L15+12
	ldr	r0, [fp, #-316]
	bl	ioctl
	ldr	r3, [fp, #-300]
	bic	r3, r3, #4096
	bic	r3, r3, #15
	str	r3, [fp, #-300]
	ldr	r3, [fp, #-300]
	orr	r3, r3, #4096
	str	r3, [fp, #-300]
	ldr	r3, .L15+16
	str	r3, [fp, #-272]
	ldr	r3, .L15+16
	str	r3, [fp, #-268]
	sub	r3, fp, #308
	mov	r2, r3
	ldr	r1, .L15+20
	ldr	r0, [fp, #-316]
	bl	ioctl
	mov	r3, r0
	cmp	r3, #0
	beq	.L4
	ldr	r0, .L15+24
	bl	perror
	b	.L1
.L4:
	mov	r3, #0
	str	r3, [fp, #-320]
	b	.L5
.L11:
	sub	r3, fp, #320
	sub	r3, r3, #1
	mov	r2, #1
	mov	r1, r3
	ldr	r0, [fp, #-316]
	bl	read
	str	r0, [fp, #-312]
	ldr	r3, [fp, #-312]
	cmp	r3, #4
	beq	.L14
	ldr	r3, [fp, #-312]
	cmp	r3, #0
	bge	.L8
	ldr	r0, .L15+28
	bl	puts
	b	.L5
.L8:
	ldr	r3, [fp, #-312]
	cmp	r3, #0
	ble	.L5
	ldr	r3, [fp, #-320]
	cmp	r3, #255
	beq	.L9
	ldrb	r3, [fp, #-321]	@ zero_extendqisi2
	cmp	r3, #10
	bne	.L10
.L9:
	sub	r2, fp, #264
	ldr	r3, [fp, #-320]
	add	r3, r2, r3
	mov	r2, #0
	strb	r2, [r3]
	sub	r3, fp, #264
	mov	r1, r3
	ldr	r0, .L15+32
	bl	printf
	mov	r3, #0
	str	r3, [fp, #-320]
	b	.L5
.L10:
	ldrb	r1, [fp, #-321]	@ zero_extendqisi2
	sub	r2, fp, #264
	ldr	r3, [fp, #-320]
	add	r3, r2, r3
	mov	r2, r1
	strb	r2, [r3]
	ldr	r3, [fp, #-320]
	add	r3, r3, #1
	str	r3, [fp, #-320]
.L5:
	ldr	r3, .L15+36
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L11
	b	.L7
.L14:
	nop
.L7:
	ldr	r0, [fp, #-316]
	bl	close
.L1:
	ldr	r3, .L15
	ldr	r2, [r3]
	ldr	r3, [fp, #-8]
	eors	r2, r3, r2
	mov	r3, #0
	beq	.L13
	bl	__stack_chk_fail
.L13:
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L16:
	.align	2
.L15:
	.word	.LC5
	.word	.LC0
	.word	.LC1
	.word	-2144578518
	.word	156250
	.word	1076646955
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	g_should_exit
	.size	read_port, .-read_port
	.align	2
	.global	console_thread
	.syntax unified
	.arm
	.fpu softvfp
	.type	console_thread, %function
console_thread:
	@ 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]
	bl	read_port
	nop
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	console_thread, .-console_thread
	.section	.rodata
	.align	2
.LC6:
	.ascii	"Error creating console listening thread\000"
	.text
	.align	2
	.global	console_thread_start
	.syntax unified
	.arm
	.fpu softvfp
	.type	console_thread_start, %function
console_thread_start:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	ldr	r3, .L21
	mov	r2, #0
	str	r2, [r3]
	mov	r3, #0
	ldr	r2, .L21+4
	mov	r1, #0
	ldr	r0, .L21+8
	bl	pthread_create
	mov	r3, r0
	cmp	r3, #0
	beq	.L20
	ldr	r0, .L21+12
	bl	puts
.L20:
	nop
	pop	{fp, pc}
.L22:
	.align	2
.L21:
	.word	g_should_exit
	.word	console_thread
	.word	g_thread
	.word	.LC6
	.size	console_thread_start, .-console_thread_start
	.align	2
	.global	console_thread_stop
	.syntax unified
	.arm
	.fpu softvfp
	.type	console_thread_stop, %function
console_thread_stop:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	ldr	r3, .L24
	mov	r2, #1
	str	r2, [r3]
	ldr	r3, .L24+4
	ldr	r3, [r3]
	mov	r1, #2
	mov	r0, r3
	bl	pthread_kill
	ldr	r3, .L24+4
	ldr	r3, [r3]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	nop
	pop	{fp, pc}
.L25:
	.align	2
.L24:
	.word	g_should_exit
	.word	g_thread
	.size	console_thread_stop, .-console_thread_stop
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
