	.file	"127998.c"
	.intel_syntax noprefix
	.text
	.globl	work_mutex
	.bss
	.align 32
	.type	work_mutex, @object
	.size	work_mutex, 40
work_mutex:
	.zero	40
	.globl	work_area
	.align 32
	.type	work_area, @object
	.size	work_area, 1024
work_area:
	.zero	1024
	.globl	time_to_exit
	.align 4
	.type	time_to_exit, @object
	.size	time_to_exit, 4
time_to_exit:
	.zero	4
	.section	.rodata
.LC0:
	.string	"you input %d characters \n"
.LC1:
	.string	"end"
	.text
	.globl	thread_function
	.type	thread_function, @function
thread_function:
.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, 16
	mov	QWORD PTR -8[rbp], rdi
	mov	edi, 1
	call	sleep@PLT
	lea	rdi, work_mutex[rip]
	call	pthread_mutex_lock@PLT
	jmp	.L2
.L5:
	lea	rdi, work_area[rip]
	call	strlen@PLT
	sub	rax, 1
	mov	rsi, rax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	mov	BYTE PTR work_area[rip], 0
	lea	rdi, work_mutex[rip]
	call	pthread_mutex_unlock@PLT
	mov	edi, 1
	call	sleep@PLT
	lea	rdi, work_mutex[rip]
	call	pthread_mutex_lock@PLT
	jmp	.L3
.L4:
	lea	rdi, work_mutex[rip]
	call	pthread_mutex_unlock@PLT
	mov	edi, 1
	call	sleep@PLT
	lea	rdi, work_mutex[rip]
	call	pthread_mutex_lock@PLT
.L3:
	movzx	eax, BYTE PTR work_area[rip]
	test	al, al
	je	.L4
.L2:
	mov	edx, 3
	lea	rsi, work_area[rip]
	lea	rdi, .LC1[rip]
	call	strncmp@PLT
	test	eax, eax
	jne	.L5
	mov	DWORD PTR time_to_exit[rip], 1
	mov	BYTE PTR work_area[rip], 0
	lea	rdi, work_mutex[rip]
	call	pthread_mutex_unlock@PLT
	mov	edi, 0
	call	pthread_exit@PLT
	.cfi_endproc
.LFE6:
	.size	thread_function, .-thread_function
	.section	.rodata
	.align 8
.LC2:
	.string	">> Semaphore initialization failed: %d\n"
	.align 8
.LC3:
	.string	">> Thread creation failed: %d\n"
	.align 8
.LC4:
	.string	">>Input some test. enter 'end' to finish "
	.align 8
.LC5:
	.string	">> Waiting for thread to finish..."
.LC6:
	.string	">> Thread join failed: %d\n"
	.align 8
.LC7:
	.string	">> Thread joined, result is: %s\n"
	.text
	.globl	main
	.type	main, @function
main:
.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, 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	esi, 0
	lea	rdi, work_mutex[rip]
	call	pthread_mutex_init@PLT
	mov	DWORD PTR -28[rbp], eax
	cmp	DWORD PTR -28[rbp], 0
	je	.L7
	mov	eax, DWORD PTR -28[rbp]
	mov	esi, eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 1
	call	exit@PLT
.L7:
	lea	rax, -24[rbp]
	mov	ecx, 0
	lea	rdx, thread_function[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	mov	DWORD PTR -28[rbp], eax
	cmp	DWORD PTR -28[rbp], 0
	je	.L8
	mov	eax, DWORD PTR -28[rbp]
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 1
	call	exit@PLT
.L8:
	lea	rdi, work_mutex[rip]
	call	pthread_mutex_lock@PLT
	lea	rdi, .LC4[rip]
	call	puts@PLT
	jmp	.L9
.L13:
	mov	rax, QWORD PTR stdin[rip]
	mov	rdx, rax
	mov	esi, 1024
	lea	rdi, work_area[rip]
	call	fgets@PLT
	lea	rdi, work_mutex[rip]
	call	pthread_mutex_unlock@PLT
.L12:
	lea	rdi, work_mutex[rip]
	call	pthread_mutex_lock@PLT
	movzx	eax, BYTE PTR work_area[rip]
	test	al, al
	jne	.L9
	lea	rdi, work_mutex[rip]
	call	pthread_mutex_unlock@PLT
	mov	edi, 1
	call	sleep@PLT
	jmp	.L12
.L9:
	mov	eax, DWORD PTR time_to_exit[rip]
	test	eax, eax
	je	.L13
	lea	rdi, work_mutex[rip]
	call	pthread_mutex_unlock@PLT
	lea	rdi, .LC5[rip]
	call	puts@PLT
	mov	rax, QWORD PTR -24[rbp]
	lea	rdx, -16[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	pthread_join@PLT
	mov	DWORD PTR -28[rbp], eax
	cmp	DWORD PTR -28[rbp], 0
	je	.L14
	mov	eax, DWORD PTR -28[rbp]
	mov	esi, eax
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 1
	call	exit@PLT
.L14:
	mov	rax, QWORD PTR -16[rbp]
	mov	rsi, rax
	lea	rdi, .LC7[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, work_mutex[rip]
	call	pthread_mutex_destroy@PLT
	mov	eax, 0
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	main, .-main
	.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	"127998.c"
	.text
	.comm	work_mutex,24,4
	.comm	work_area,1024,4
	.global	time_to_exit
	.bss
	.align	2
	.type	time_to_exit, %object
	.size	time_to_exit, 4
time_to_exit:
	.space	4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"you input %d characters \012\000"
	.align	2
.LC1:
	.ascii	"end\000"
	.text
	.align	2
	.global	thread_function
	.syntax unified
	.arm
	.fpu softvfp
	.type	thread_function, %function
thread_function:
	@ 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]
	mov	r0, #1
	bl	sleep
	ldr	r0, .L6
	bl	pthread_mutex_lock
	b	.L2
.L5:
	ldr	r0, .L6+4
	bl	strlen
	mov	r3, r0
	sub	r3, r3, #1
	mov	r1, r3
	ldr	r0, .L6+8
	bl	printf
	ldr	r3, .L6+4
	mov	r2, #0
	strb	r2, [r3]
	ldr	r0, .L6
	bl	pthread_mutex_unlock
	mov	r0, #1
	bl	sleep
	ldr	r0, .L6
	bl	pthread_mutex_lock
	b	.L3
.L4:
	ldr	r0, .L6
	bl	pthread_mutex_unlock
	mov	r0, #1
	bl	sleep
	ldr	r0, .L6
	bl	pthread_mutex_lock
.L3:
	ldr	r3, .L6+4
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #0
	beq	.L4
.L2:
	mov	r2, #3
	ldr	r1, .L6+4
	ldr	r0, .L6+12
	bl	strncmp
	mov	r3, r0
	cmp	r3, #0
	bne	.L5
	ldr	r3, .L6+16
	mov	r2, #1
	str	r2, [r3]
	ldr	r3, .L6+4
	mov	r2, #0
	strb	r2, [r3]
	ldr	r0, .L6
	bl	pthread_mutex_unlock
	mov	r0, #0
	bl	pthread_exit
.L7:
	.align	2
.L6:
	.word	work_mutex
	.word	work_area
	.word	.LC0
	.word	.LC1
	.word	time_to_exit
	.size	thread_function, .-thread_function
	.section	.rodata
	.align	2
.LC2:
	.ascii	">> Semaphore initialization failed: %d\012\000"
	.align	2
.LC3:
	.ascii	">> Thread creation failed: %d\012\000"
	.align	2
.LC4:
	.ascii	">>Input some test. enter 'end' to finish \000"
	.align	2
.LC5:
	.ascii	">> Waiting for thread to finish...\000"
	.align	2
.LC6:
	.ascii	">> Thread join failed: %d\012\000"
	.align	2
.LC7:
	.ascii	">> Thread joined, result is: %s\012\000"
	.align	2
.LC8:
	.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, .L20
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r1, #0
	ldr	r0, .L20+4
	bl	pthread_mutex_init
	str	r0, [fp, #-12]
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	beq	.L9
	ldr	r1, [fp, #-12]
	ldr	r0, .L20+8
	bl	printf
	mov	r0, #1
	bl	exit
.L9:
	sub	r0, fp, #20
	mov	r3, #0
	ldr	r2, .L20+12
	mov	r1, #0
	bl	pthread_create
	str	r0, [fp, #-12]
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	beq	.L10
	ldr	r1, [fp, #-12]
	ldr	r0, .L20+16
	bl	printf
	mov	r0, #1
	bl	exit
.L10:
	ldr	r0, .L20+4
	bl	pthread_mutex_lock
	ldr	r0, .L20+20
	bl	puts
	b	.L11
.L15:
	ldr	r3, .L20+24
	ldr	r3, [r3]
	mov	r2, r3
	mov	r1, #1024
	ldr	r0, .L20+28
	bl	fgets
	ldr	r0, .L20+4
	bl	pthread_mutex_unlock
.L14:
	ldr	r0, .L20+4
	bl	pthread_mutex_lock
	ldr	r3, .L20+28
	ldrb	r3, [r3]	@ zero_extendqisi2
	cmp	r3, #0
	bne	.L11
	ldr	r0, .L20+4
	bl	pthread_mutex_unlock
	mov	r0, #1
	bl	sleep
	b	.L14
.L11:
	ldr	r3, .L20+32
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L15
	ldr	r0, .L20+4
	bl	pthread_mutex_unlock
	ldr	r0, .L20+36
	bl	puts
	ldr	r3, [fp, #-20]
	sub	r2, fp, #16
	mov	r1, r2
	mov	r0, r3
	bl	pthread_join
	str	r0, [fp, #-12]
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	beq	.L16
	ldr	r1, [fp, #-12]
	ldr	r0, .L20+40
	bl	printf
	mov	r0, #1
	bl	exit
.L16:
	ldr	r3, [fp, #-16]
	mov	r1, r3
	ldr	r0, .L20+44
	bl	printf
	ldr	r0, .L20+4
	bl	pthread_mutex_destroy
	mov	r3, #0
	ldr	r2, .L20
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L18
	bl	__stack_chk_fail
.L18:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L21:
	.align	2
.L20:
	.word	.LC8
	.word	work_mutex
	.word	.LC2
	.word	thread_function
	.word	.LC3
	.word	.LC4
	.word	stdin
	.word	work_area
	.word	time_to_exit
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
