	.file	"115764319.c"
	.intel_syntax noprefix
	.text
	.globl	thd_var
	.bss
	.align 32
	.type	thd_var, @object
	.size	thd_var, 40
thd_var:
	.zero	40
	.globl	mutex
	.align 32
	.type	mutex, @object
	.size	mutex, 40
mutex:
	.zero	40
	.section	.rodata
.LC0:
	.string	"Unable to initialize mutex\n"
.LC1:
	.string	"\n\nMain Thread Finished.\n"
	.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, 176
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	esi, 0
	lea	rdi, mutex[rip]
	call	pthread_mutex_init@PLT
	test	eax, eax
	je	.L2
	mov	rax, QWORD PTR stderr[rip]
	mov	rcx, rax
	mov	edx, 27
	mov	esi, 1
	lea	rdi, .LC0[rip]
	call	fwrite@PLT
	mov	eax, 1
	jmp	.L3
.L2:
	lea	rax, -160[rbp]
	mov	rdi, rax
	call	pthread_attr_init@PLT
	mov	DWORD PTR -164[rbp], 0
	jmp	.L4
.L5:
	mov	eax, DWORD PTR -164[rbp]
	cdqe
	lea	rcx, 0[0+rax*4]
	lea	rdx, thd_var[rip]
	mov	eax, DWORD PTR -164[rbp]
	mov	DWORD PTR [rcx+rdx], eax
	mov	eax, DWORD PTR -164[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, thd_var[rip]
	add	rdx, rax
	lea	rcx, -96[rbp]
	mov	eax, DWORD PTR -164[rbp]
	cdqe
	sal	rax, 3
	lea	rdi, [rcx+rax]
	lea	rax, -160[rbp]
	mov	rcx, rdx
	lea	rdx, runner[rip]
	mov	rsi, rax
	call	pthread_create@PLT
	add	DWORD PTR -164[rbp], 1
.L4:
	cmp	DWORD PTR -164[rbp], 9
	jle	.L5
	mov	DWORD PTR -164[rbp], 0
	jmp	.L6
.L7:
	mov	eax, DWORD PTR -164[rbp]
	cdqe
	mov	rax, QWORD PTR -96[rbp+rax*8]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	add	DWORD PTR -164[rbp], 1
.L6:
	cmp	DWORD PTR -164[rbp], 9
	jle	.L7
	lea	rdi, mutex[rip]
	call	pthread_mutex_destroy@PLT
	lea	rdi, .LC1[rip]
	call	puts@PLT
	mov	eax, 0
.L3:
	mov	rsi, QWORD PTR -8[rbp]
	sub	rsi, QWORD PTR fs:40
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.section	.rodata
.LC2:
	.string	"Unable to acquire lock\n"
.LC3:
	.string	"\nMutex acquired by Thread %d\n"
.LC4:
	.string	"a"
.LC5:
	.string	"1.txt"
.LC6:
	.string	"\nText 1 written by Thread %d"
.LC7:
	.string	"\nText 2 written by Thread %d"
.LC8:
	.string	"\nText 3 written by Thread %d\n"
.LC9:
	.string	"Unable to release mutex\n"
.LC10:
	.string	"Mutex released by Thread %d\n"
	.text
	.globl	runner
	.type	runner, @function
runner:
.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	rax, QWORD PTR -24[rbp]
	mov	QWORD PTR -16[rbp], rax
	lea	rdi, mutex[rip]
	call	pthread_mutex_lock@PLT
	test	eax, eax
	je	.L10
	mov	rax, QWORD PTR stderr[rip]
	mov	rcx, rax
	mov	edx, 23
	mov	esi, 1
	lea	rdi, .LC2[rip]
	call	fwrite@PLT
	mov	edi, 2
	call	_exit@PLT
.L10:
	mov	rax, QWORD PTR -16[rbp]
	mov	edx, DWORD PTR [rax]
	mov	rax, QWORD PTR stdout[rip]
	lea	rsi, .LC3[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	edi, 1
	call	sleep@PLT
	lea	rsi, .LC4[rip]
	lea	rdi, .LC5[rip]
	call	fopen@PLT
	mov	QWORD PTR -8[rbp], rax
	mov	rax, QWORD PTR -16[rbp]
	mov	edx, DWORD PTR [rax]
	mov	rax, QWORD PTR -8[rbp]
	lea	rsi, .LC6[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	rax, QWORD PTR -16[rbp]
	mov	edx, DWORD PTR [rax]
	mov	rax, QWORD PTR -8[rbp]
	lea	rsi, .LC7[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	rax, QWORD PTR -16[rbp]
	mov	edx, DWORD PTR [rax]
	mov	rax, QWORD PTR -8[rbp]
	lea	rsi, .LC8[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	fclose@PLT
	lea	rdi, mutex[rip]
	call	pthread_mutex_unlock@PLT
	test	eax, eax
	je	.L11
	mov	rax, QWORD PTR stderr[rip]
	mov	rcx, rax
	mov	edx, 24
	mov	esi, 1
	lea	rdi, .LC9[rip]
	call	fwrite@PLT
	mov	edi, 3
	call	_exit@PLT
.L11:
	mov	rax, QWORD PTR -16[rbp]
	mov	edx, DWORD PTR [rax]
	mov	rax, QWORD PTR stdout[rip]
	lea	rsi, .LC10[rip]
	mov	rdi, rax
	mov	eax, 0
	call	fprintf@PLT
	mov	edi, 1
	call	sleep@PLT
	mov	edi, 0
	call	pthread_exit@PLT
	.cfi_endproc
.LFE1:
	.size	runner, .-runner
	.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	"115764319.c"
	.text
	.comm	thd_var,40,4
	.comm	mutex,24,4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Unable to initialize mutex\012\000"
	.align	2
.LC1:
	.ascii	"\012\012Main Thread Finished.\012\000"
	.align	2
.LC2:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 88
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #88
	ldr	r3, .L9
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r1, #0
	ldr	r0, .L9+4
	bl	pthread_mutex_init
	mov	r3, r0
	cmp	r3, #0
	beq	.L2
	ldr	r3, .L9+8
	ldr	r3, [r3]
	mov	r2, #27
	mov	r1, #1
	ldr	r0, .L9+12
	bl	fwrite
	mov	r3, #1
	b	.L3
.L2:
	sub	r3, fp, #84
	mov	r0, r3
	bl	pthread_attr_init
	mov	r3, #0
	str	r3, [fp, #-88]
	b	.L4
.L5:
	ldr	r1, .L9+16
	ldr	r3, [fp, #-88]
	ldr	r2, [fp, #-88]
	str	r2, [r1, r3, lsl #2]
	sub	r2, fp, #48
	ldr	r3, [fp, #-88]
	lsl	r3, r3, #2
	add	r0, r2, r3
	ldr	r3, [fp, #-88]
	lsl	r3, r3, #2
	ldr	r2, .L9+16
	add	r3, r3, r2
	sub	r1, fp, #84
	ldr	r2, .L9+20
	bl	pthread_create
	ldr	r3, [fp, #-88]
	add	r3, r3, #1
	str	r3, [fp, #-88]
.L4:
	ldr	r3, [fp, #-88]
	cmp	r3, #9
	ble	.L5
	mov	r3, #0
	str	r3, [fp, #-88]
	b	.L6
.L7:
	ldr	r3, [fp, #-88]
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r3, [r3, #-44]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-88]
	add	r3, r3, #1
	str	r3, [fp, #-88]
.L6:
	ldr	r3, [fp, #-88]
	cmp	r3, #9
	ble	.L7
	ldr	r0, .L9+4
	bl	pthread_mutex_destroy
	ldr	r0, .L9+24
	bl	puts
	mov	r3, #0
.L3:
	ldr	r2, .L9
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L8
	bl	__stack_chk_fail
.L8:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L10:
	.align	2
.L9:
	.word	.LC2
	.word	mutex
	.word	stderr
	.word	.LC0
	.word	thd_var
	.word	runner
	.word	.LC1
	.size	main, .-main
	.section	.rodata
	.align	2
.LC3:
	.ascii	"Unable to acquire lock\012\000"
	.align	2
.LC4:
	.ascii	"\012Mutex acquired by Thread %d\012\000"
	.align	2
.LC5:
	.ascii	"a\000"
	.align	2
.LC6:
	.ascii	"1.txt\000"
	.align	2
.LC7:
	.ascii	"\012Text 1 written by Thread %d\000"
	.align	2
.LC8:
	.ascii	"\012Text 2 written by Thread %d\000"
	.align	2
.LC9:
	.ascii	"\012Text 3 written by Thread %d\012\000"
	.align	2
.LC10:
	.ascii	"Unable to release mutex\012\000"
	.align	2
.LC11:
	.ascii	"Mutex released by Thread %d\012\000"
	.text
	.align	2
	.global	runner
	.syntax unified
	.arm
	.fpu softvfp
	.type	runner, %function
runner:
	@ 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	r3, [fp, #-16]
	str	r3, [fp, #-12]
	ldr	r0, .L14
	bl	pthread_mutex_lock
	mov	r3, r0
	cmp	r3, #0
	beq	.L12
	ldr	r3, .L14+4
	ldr	r3, [r3]
	mov	r2, #23
	mov	r1, #1
	ldr	r0, .L14+8
	bl	fwrite
	mov	r0, #2
	bl	_exit
.L12:
	ldr	r3, .L14+12
	ldr	r0, [r3]
	ldr	r3, [fp, #-12]
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, .L14+16
	bl	fprintf
	mov	r0, #1
	bl	sleep
	ldr	r1, .L14+20
	ldr	r0, .L14+24
	bl	fopen
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-12]
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, .L14+28
	ldr	r0, [fp, #-8]
	bl	fprintf
	ldr	r3, [fp, #-12]
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, .L14+32
	ldr	r0, [fp, #-8]
	bl	fprintf
	ldr	r3, [fp, #-12]
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, .L14+36
	ldr	r0, [fp, #-8]
	bl	fprintf
	ldr	r0, [fp, #-8]
	bl	fclose
	ldr	r0, .L14
	bl	pthread_mutex_unlock
	mov	r3, r0
	cmp	r3, #0
	beq	.L13
	ldr	r3, .L14+4
	ldr	r3, [r3]
	mov	r2, #24
	mov	r1, #1
	ldr	r0, .L14+40
	bl	fwrite
	mov	r0, #3
	bl	_exit
.L13:
	ldr	r3, .L14+12
	ldr	r0, [r3]
	ldr	r3, [fp, #-12]
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, .L14+44
	bl	fprintf
	mov	r0, #1
	bl	sleep
	mov	r0, #0
	bl	pthread_exit
.L15:
	.align	2
.L14:
	.word	mutex
	.word	stderr
	.word	.LC3
	.word	stdout
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.word	.LC8
	.word	.LC9
	.word	.LC10
	.word	.LC11
	.size	runner, .-runner
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
