	.file	"211080499.c"
	.intel_syntax noprefix
	.text
	.globl	ntouts
	.bss
	.align 4
	.type	ntouts, @object
	.size	ntouts, 4
ntouts:
	.zero	4
	.section	.rodata
.LC0:
	.string	"bg routine running\n"
	.text
	.globl	bg_routine
	.type	bg_routine, @function
bg_routine:
.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, 32
	mov	QWORD PTR -24[rbp], rdi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	edx, 19
	lea	rsi, .LC0[rip]
	mov	edi, 1
	mov	eax, 0
	call	write@PLT
.L4:
	mov	BYTE PTR -13[rbp], 46
	mov	eax, 0
	call	pthread_yield@PLT
	lea	rax, -13[rbp]
	mov	edx, 1
	mov	rsi, rax
	mov	edi, 1
	mov	eax, 0
	call	write@PLT
	mov	eax, 0
	call	pthread_yield@PLT
	mov	DWORD PTR -12[rbp], 1000
	jmp	.L2
.L3:
	mov	eax, 0
	call	pthread_yield@PLT
.L2:
	mov	eax, DWORD PTR -12[rbp]
	lea	edx, -1[rax]
	mov	DWORD PTR -12[rbp], edx
	test	eax, eax
	jg	.L3
	jmp	.L4
	.cfi_endproc
.LFE6:
	.size	bg_routine, .-bg_routine
	.section	.rodata
.LC1:
	.string	"select>"
.LC2:
	.string	"select"
.LC3:
	.string	"=> select returned: %d\n"
.LC4:
	.string	"read %d: |%s|\n"
.LC5:
	.string	"=> out of read loop: %d / %d\n"
.LC6:
	.string	"read"
	.text
	.globl	fg_routine
	.type	fg_routine, @function
fg_routine:
.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, 304
	mov	QWORD PTR -296[rbp], rdi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
.L13:
	mov	eax, 0
	mov	ecx, 16
	lea	rdx, -272[rbp]
	mov	rdi, rdx
#APP
# 65 "the_stack_data/211080499.c" 1
	cld; rep; stosq
# 0 "" 2
#NO_APP
	mov	eax, edi
	mov	edx, ecx
	mov	DWORD PTR -288[rbp], edx
	mov	DWORD PTR -284[rbp], eax
	mov	rax, QWORD PTR -272[rbp]
	or	rax, 1
	mov	QWORD PTR -272[rbp], rax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rax, -272[rbp]
	mov	r8d, 0
	mov	ecx, 0
	mov	edx, 0
	mov	rsi, rax
	mov	edi, 1
	call	select@PLT
	mov	DWORD PTR -280[rbp], eax
	cmp	DWORD PTR -280[rbp], 0
	jns	.L7
	lea	rdi, .LC2[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L7:
	cmp	DWORD PTR -280[rbp], 0
	jle	.L8
	mov	eax, DWORD PTR -280[rbp]
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L9
.L10:
	mov	eax, DWORD PTR -276[rbp]
	cdqe
	mov	BYTE PTR -144[rbp+rax], 0
	lea	rdx, -144[rbp]
	mov	eax, DWORD PTR -276[rbp]
	mov	esi, eax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
.L9:
	lea	rax, -144[rbp]
	mov	edx, 127
	mov	rsi, rax
	mov	edi, 0
	mov	eax, 0
	call	read@PLT
	mov	DWORD PTR -276[rbp], eax
	cmp	DWORD PTR -276[rbp], 0
	jns	.L10
	call	__errno_location@PLT
	mov	edx, DWORD PTR [rax]
	mov	eax, DWORD PTR -276[rbp]
	mov	esi, eax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	cmp	DWORD PTR -276[rbp], 0
	jns	.L13
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	cmp	eax, 11
	je	.L13
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	cmp	eax, 11
	je	.L13
	lea	rdi, .LC6[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L8:
	mov	eax, DWORD PTR ntouts[rip]
	add	eax, 1
	mov	DWORD PTR ntouts[rip], eax
	jmp	.L13
	.cfi_endproc
.LFE7:
	.size	fg_routine, .-fg_routine
	.section	.rodata
	.align 8
.LC7:
	.string	"error: could not create bg thread"
	.align 8
.LC8:
	.string	"error: could not create fg thread"
	.align 8
.LC9:
	.string	"threads forked: bg=%lx fg=%lx\n"
	.align 8
.LC10:
	.string	"initial thread %lx joining fg...\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 48
	mov	DWORD PTR -36[rbp], edi
	mov	QWORD PTR -48[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	eax, 0
	call	pthread_init@PLT
	mov	rax, QWORD PTR stdout[rip]
	mov	esi, 0
	mov	rdi, rax
	call	setbuf@PLT
	mov	rax, QWORD PTR stderr[rip]
	mov	esi, 0
	mov	rdi, rax
	call	setbuf@PLT
	cmp	DWORD PTR -36[rbp], 1
	jle	.L16
	lea	rax, -24[rbp]
	mov	ecx, 0
	lea	rdx, bg_routine[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	test	eax, eax
	jns	.L16
	lea	rdi, .LC7[rip]
	call	puts@PLT
	mov	edi, 1
	call	exit@PLT
.L16:
	lea	rax, -16[rbp]
	mov	ecx, 0
	lea	rdx, fg_routine[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	test	eax, eax
	jns	.L17
	lea	rdi, .LC8[rip]
	call	puts@PLT
	mov	edi, 1
	call	exit@PLT
.L17:
	mov	rdx, QWORD PTR -16[rbp]
	mov	rax, QWORD PTR -24[rbp]
	mov	rsi, rax
	lea	rdi, .LC9[rip]
	mov	eax, 0
	call	printf@PLT
	call	pthread_self@PLT
	mov	rsi, rax
	lea	rdi, .LC10[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR -16[rbp]
	lea	rdx, -28[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	pthread_join@PLT
	mov	eax, 0
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	main, .-main
	.data
	.align 16
	.type	tout.0, @object
	.size	tout.0, 16
tout.0:
	.quad	0
	.quad	500000
	.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	"211080499.c"
	.text
	.global	ntouts
	.bss
	.align	2
	.type	ntouts, %object
	.size	ntouts, 4
ntouts:
	.space	4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"bg routine running\012\000"
	.align	2
.LC1:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	bg_routine
	.syntax unified
	.arm
	.fpu softvfp
	.type	bg_routine, %function
bg_routine:
	@ args = 0, pretend = 0, frame = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #24
	str	r0, [fp, #-24]
	ldr	r3, .L6
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r2, #19
	ldr	r1, .L6+4
	mov	r0, #1
	bl	write
.L4:
	mov	r3, #46
	strb	r3, [fp, #-13]
	bl	pthread_yield
	sub	r3, fp, #13
	mov	r2, #1
	mov	r1, r3
	mov	r0, #1
	bl	write
	bl	pthread_yield
	mov	r3, #1000
	str	r3, [fp, #-12]
	b	.L2
.L3:
	bl	pthread_yield
.L2:
	ldr	r3, [fp, #-12]
	sub	r2, r3, #1
	str	r2, [fp, #-12]
	cmp	r3, #0
	bgt	.L3
	b	.L4
.L7:
	.align	2
.L6:
	.word	.LC1
	.word	.LC0
	.size	bg_routine, .-bg_routine
	.section	.rodata
	.align	2
.LC2:
	.ascii	"select>\000"
	.align	2
.LC3:
	.ascii	"select\000"
	.align	2
.LC4:
	.ascii	"=> select returned: %d\012\000"
	.align	2
.LC5:
	.ascii	"read %d: |%s|\012\000"
	.align	2
.LC6:
	.ascii	"=> out of read loop: %d / %d\012\000"
	.align	2
.LC7:
	.ascii	"read\000"
	.align	2
.LC8:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	fg_routine
	.syntax unified
	.arm
	.fpu softvfp
	.type	fg_routine, %function
fg_routine:
	@ args = 0, pretend = 0, frame = 288
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #296
	str	r0, [fp, #-288]
	ldr	r3, .L19
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
.L17:
	sub	r3, fp, #264
	str	r3, [fp, #-276]
	mov	r3, #0
	str	r3, [fp, #-280]
	b	.L9
.L10:
	ldr	r3, [fp, #-276]
	ldr	r2, [fp, #-280]
	mov	r1, #0
	str	r1, [r3, r2, lsl #2]
	ldr	r3, [fp, #-280]
	add	r3, r3, #1
	str	r3, [fp, #-280]
.L9:
	ldr	r3, [fp, #-280]
	cmp	r3, #31
	bls	.L10
	ldr	r3, [fp, #-264]
	orr	r3, r3, #1
	str	r3, [fp, #-264]
	ldr	r0, .L19+4
	bl	printf
	sub	r1, fp, #264
	mov	r3, #0
	str	r3, [sp]
	mov	r3, #0
	mov	r2, #0
	mov	r0, #1
	bl	select
	str	r0, [fp, #-272]
	ldr	r3, [fp, #-272]
	cmp	r3, #0
	bge	.L11
	ldr	r0, .L19+8
	bl	perror
	mov	r0, #1
	bl	exit
.L11:
	ldr	r3, [fp, #-272]
	cmp	r3, #0
	ble	.L12
	ldr	r1, [fp, #-272]
	ldr	r0, .L19+12
	bl	printf
	b	.L13
.L14:
	sub	r2, fp, #136
	ldr	r3, [fp, #-268]
	add	r3, r2, r3
	mov	r2, #0
	strb	r2, [r3]
	sub	r3, fp, #136
	mov	r2, r3
	ldr	r1, [fp, #-268]
	ldr	r0, .L19+16
	bl	printf
.L13:
	sub	r3, fp, #136
	mov	r2, #127
	mov	r1, r3
	mov	r0, #0
	bl	read
	str	r0, [fp, #-268]
	ldr	r3, [fp, #-268]
	cmp	r3, #0
	bge	.L14
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, [fp, #-268]
	ldr	r0, .L19+20
	bl	printf
	ldr	r3, [fp, #-268]
	cmp	r3, #0
	bge	.L17
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	cmp	r3, #11
	beq	.L17
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	cmp	r3, #11
	beq	.L17
	ldr	r0, .L19+24
	bl	perror
	mov	r0, #1
	bl	exit
.L12:
	ldr	r3, .L19+28
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L19+28
	str	r3, [r2]
	b	.L17
.L20:
	.align	2
.L19:
	.word	.LC8
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.word	ntouts
	.size	fg_routine, .-fg_routine
	.section	.rodata
	.align	2
.LC9:
	.ascii	"error: could not create bg thread\000"
	.align	2
.LC10:
	.ascii	"error: could not create fg thread\000"
	.align	2
.LC11:
	.ascii	"threads forked: bg=%lx fg=%lx\012\000"
	.align	2
.LC12:
	.ascii	"initial thread %lx joining fg...\012\000"
	.align	2
.LC13:
	.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
	str	r0, [fp, #-24]
	str	r1, [fp, #-28]
	ldr	r3, .L26
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	bl	pthread_init
	ldr	r3, .L26+4
	ldr	r3, [r3]
	mov	r1, #0
	mov	r0, r3
	bl	setbuf
	ldr	r3, .L26+8
	ldr	r3, [r3]
	mov	r1, #0
	mov	r0, r3
	bl	setbuf
	ldr	r3, [fp, #-24]
	cmp	r3, #1
	ble	.L22
	sub	r0, fp, #20
	mov	r3, #0
	ldr	r2, .L26+12
	mov	r1, #0
	bl	pthread_create
	mov	r3, r0
	cmp	r3, #0
	bge	.L22
	ldr	r0, .L26+16
	bl	puts
	mov	r0, #1
	bl	exit
.L22:
	sub	r0, fp, #16
	mov	r3, #0
	ldr	r2, .L26+20
	mov	r1, #0
	bl	pthread_create
	mov	r3, r0
	cmp	r3, #0
	bge	.L23
	ldr	r0, .L26+24
	bl	puts
	mov	r0, #1
	bl	exit
.L23:
	ldr	r3, [fp, #-20]
	ldr	r2, [fp, #-16]
	mov	r1, r3
	ldr	r0, .L26+28
	bl	printf
	bl	pthread_self
	mov	r3, r0
	mov	r1, r3
	ldr	r0, .L26+32
	bl	printf
	ldr	r3, [fp, #-16]
	sub	r2, fp, #12
	mov	r1, r2
	mov	r0, r3
	bl	pthread_join
	mov	r3, #0
	ldr	r2, .L26
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L25
	bl	__stack_chk_fail
.L25:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L27:
	.align	2
.L26:
	.word	.LC13
	.word	stdout
	.word	stderr
	.word	bg_routine
	.word	.LC9
	.word	fg_routine
	.word	.LC10
	.word	.LC11
	.word	.LC12
	.size	main, .-main
	.data
	.align	2
	.type	tout.5386, %object
	.size	tout.5386, 8
tout.5386:
	.word	0
	.word	500000
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
