	.file	"43887488.c"
	.intel_syntax noprefix
	.text
	.globl	lock1
	.bss
	.align 32
	.type	lock1, @object
	.size	lock1, 40
lock1:
	.zero	40
	.globl	lock2
	.align 32
	.type	lock2, @object
	.size	lock2, 40
lock2:
	.zero	40
	.section	.rodata
.LC0:
	.string	"Preparing locks..."
	.align 8
.LC1:
	.string	"can't lock lock1 in prepare handler"
	.align 8
.LC2:
	.string	"can't lock lock2 in prepare handler"
	.text
	.globl	prepare
	.type	prepare, @function
prepare:
.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
	lea	rdi, .LC0[rip]
	call	puts@PLT
	lea	rdi, lock1[rip]
	call	pthread_mutex_lock@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], 0
	je	.L2
	lea	rdi, .LC1[rip]
	call	puts@PLT
	mov	edi, 1
	call	exit@PLT
.L2:
	lea	rdi, lock2[rip]
	call	pthread_mutex_lock@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], 0
	je	.L4
	lea	rdi, .LC2[rip]
	call	puts@PLT
	mov	edi, 1
	call	exit@PLT
.L4:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	prepare, .-prepare
	.section	.rodata
.LC3:
	.string	"parent unlocking locks..."
	.align 8
.LC4:
	.string	"can't unlock lock1 in parent handler"
	.align 8
.LC5:
	.string	"can't unlock lock2 in parent handler"
	.text
	.globl	parent
	.type	parent, @function
parent:
.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
	lea	rdi, .LC3[rip]
	call	puts@PLT
	lea	rdi, lock1[rip]
	call	pthread_mutex_unlock@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], 0
	je	.L6
	lea	rdi, .LC4[rip]
	call	puts@PLT
	mov	edi, 1
	call	exit@PLT
.L6:
	lea	rdi, lock2[rip]
	call	pthread_mutex_unlock@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], 0
	je	.L8
	lea	rdi, .LC5[rip]
	call	puts@PLT
	mov	edi, 1
	call	exit@PLT
.L8:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	parent, .-parent
	.section	.rodata
.LC6:
	.string	"child unlocking locks..."
	.align 8
.LC7:
	.string	"can't unlock lock1 in child handler"
	.align 8
.LC8:
	.string	"can't unlock lock2 in child handler"
	.text
	.globl	child
	.type	child, @function
child:
.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, 16
	lea	rdi, .LC6[rip]
	call	puts@PLT
	lea	rdi, lock1[rip]
	call	pthread_mutex_unlock@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], 0
	je	.L10
	lea	rdi, .LC7[rip]
	call	puts@PLT
	mov	edi, 1
	call	exit@PLT
.L10:
	lea	rdi, lock2[rip]
	call	pthread_mutex_unlock@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], 0
	je	.L12
	lea	rdi, .LC8[rip]
	call	puts@PLT
	mov	edi, 1
	call	exit@PLT
.L12:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	child, .-child
	.section	.rodata
.LC9:
	.string	"thread started..."
	.text
	.globl	thr_fn
	.type	thr_fn, @function
thr_fn:
.LFB9:
	.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
	lea	rdi, .LC9[rip]
	call	puts@PLT
	call	pause@PLT
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	thr_fn, .-thr_fn
	.section	.rodata
.LC10:
	.string	"can't install fork handlers"
.LC11:
	.string	"can't create thread"
.LC12:
	.string	"parent about to fork..."
.LC13:
	.string	"fork failed"
.LC14:
	.string	"child returned from fork"
.LC15:
	.string	"parent returned from fork"
	.text
	.globl	main
	.type	main, @function
main:
.LFB10:
	.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	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	lea	rdx, child[rip]
	lea	rsi, parent[rip]
	lea	rdi, prepare[rip]
	call	pthread_atfork@PLT
	mov	DWORD PTR -24[rbp], eax
	cmp	DWORD PTR -24[rbp], 0
	je	.L16
	lea	rdi, .LC10[rip]
	call	puts@PLT
	mov	edi, 1
	call	exit@PLT
.L16:
	lea	rax, -16[rbp]
	mov	ecx, 0
	lea	rdx, thr_fn[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	mov	DWORD PTR -24[rbp], eax
	cmp	DWORD PTR -24[rbp], 0
	je	.L17
	lea	rdi, .LC11[rip]
	call	puts@PLT
	mov	edi, 1
	call	exit@PLT
.L17:
	mov	edi, 2
	call	sleep@PLT
	lea	rdi, .LC12[rip]
	call	puts@PLT
	call	fork@PLT
	mov	DWORD PTR -20[rbp], eax
	cmp	DWORD PTR -20[rbp], 0
	jns	.L18
	lea	rdi, .LC13[rip]
	call	puts@PLT
	mov	edi, 1
	call	exit@PLT
.L18:
	cmp	DWORD PTR -20[rbp], 0
	jne	.L19
	lea	rdi, .LC14[rip]
	call	puts@PLT
	jmp	.L20
.L19:
	lea	rdi, .LC15[rip]
	call	puts@PLT
.L20:
	mov	edi, 0
	call	exit@PLT
	.cfi_endproc
.LFE10:
	.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	"43887488.c"
	.text
	.global	lock1
	.bss
	.align	2
	.type	lock1, %object
	.size	lock1, 24
lock1:
	.space	24
	.global	lock2
	.align	2
	.type	lock2, %object
	.size	lock2, 24
lock2:
	.space	24
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Preparing locks...\000"
	.align	2
.LC1:
	.ascii	"can't lock lock1 in prepare handler\000"
	.align	2
.LC2:
	.ascii	"can't lock lock2 in prepare handler\000"
	.text
	.align	2
	.global	prepare
	.syntax unified
	.arm
	.fpu softvfp
	.type	prepare, %function
prepare:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	ldr	r0, .L5
	bl	puts
	ldr	r0, .L5+4
	bl	pthread_mutex_lock
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	beq	.L2
	ldr	r0, .L5+8
	bl	puts
	mov	r0, #1
	bl	exit
.L2:
	ldr	r0, .L5+12
	bl	pthread_mutex_lock
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	beq	.L4
	ldr	r0, .L5+16
	bl	puts
	mov	r0, #1
	bl	exit
.L4:
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L6:
	.align	2
.L5:
	.word	.LC0
	.word	lock1
	.word	.LC1
	.word	lock2
	.word	.LC2
	.size	prepare, .-prepare
	.section	.rodata
	.align	2
.LC3:
	.ascii	"parent unlocking locks...\000"
	.align	2
.LC4:
	.ascii	"can't unlock lock1 in parent handler\000"
	.align	2
.LC5:
	.ascii	"can't unlock lock2 in parent handler\000"
	.text
	.align	2
	.global	parent
	.syntax unified
	.arm
	.fpu softvfp
	.type	parent, %function
parent:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	ldr	r0, .L11
	bl	puts
	ldr	r0, .L11+4
	bl	pthread_mutex_unlock
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	beq	.L8
	ldr	r0, .L11+8
	bl	puts
	mov	r0, #1
	bl	exit
.L8:
	ldr	r0, .L11+12
	bl	pthread_mutex_unlock
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	beq	.L10
	ldr	r0, .L11+16
	bl	puts
	mov	r0, #1
	bl	exit
.L10:
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L12:
	.align	2
.L11:
	.word	.LC3
	.word	lock1
	.word	.LC4
	.word	lock2
	.word	.LC5
	.size	parent, .-parent
	.section	.rodata
	.align	2
.LC6:
	.ascii	"child unlocking locks...\000"
	.align	2
.LC7:
	.ascii	"can't unlock lock1 in child handler\000"
	.align	2
.LC8:
	.ascii	"can't unlock lock2 in child handler\000"
	.text
	.align	2
	.global	child
	.syntax unified
	.arm
	.fpu softvfp
	.type	child, %function
child:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	ldr	r0, .L17
	bl	puts
	ldr	r0, .L17+4
	bl	pthread_mutex_unlock
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	beq	.L14
	ldr	r0, .L17+8
	bl	puts
	mov	r0, #1
	bl	exit
.L14:
	ldr	r0, .L17+12
	bl	pthread_mutex_unlock
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	beq	.L16
	ldr	r0, .L17+16
	bl	puts
	mov	r0, #1
	bl	exit
.L16:
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L18:
	.align	2
.L17:
	.word	.LC6
	.word	lock1
	.word	.LC7
	.word	lock2
	.word	.LC8
	.size	child, .-child
	.section	.rodata
	.align	2
.LC9:
	.ascii	"thread started...\000"
	.text
	.align	2
	.global	thr_fn
	.syntax unified
	.arm
	.fpu softvfp
	.type	thr_fn, %function
thr_fn:
	@ 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	r0, .L21
	bl	puts
	bl	pause
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L22:
	.align	2
.L21:
	.word	.LC9
	.size	thr_fn, .-thr_fn
	.section	.rodata
	.align	2
.LC10:
	.ascii	"can't install fork handlers\000"
	.align	2
.LC11:
	.ascii	"can't create thread\000"
	.align	2
.LC12:
	.ascii	"parent about to fork...\000"
	.align	2
.LC13:
	.ascii	"fork failed\000"
	.align	2
.LC14:
	.ascii	"child returned from fork\000"
	.align	2
.LC15:
	.ascii	"parent returned from fork\000"
	.align	2
.LC16:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #16
	ldr	r3, .L30
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r2, .L30+4
	ldr	r1, .L30+8
	ldr	r0, .L30+12
	bl	pthread_atfork
	str	r0, [fp, #-16]
	ldr	r3, [fp, #-16]
	cmp	r3, #0
	beq	.L24
	ldr	r0, .L30+16
	bl	puts
	mov	r0, #1
	bl	exit
.L24:
	sub	r0, fp, #20
	mov	r3, #0
	ldr	r2, .L30+20
	mov	r1, #0
	bl	pthread_create
	str	r0, [fp, #-16]
	ldr	r3, [fp, #-16]
	cmp	r3, #0
	beq	.L25
	ldr	r0, .L30+24
	bl	puts
	mov	r0, #1
	bl	exit
.L25:
	mov	r0, #2
	bl	sleep
	ldr	r0, .L30+28
	bl	puts
	bl	fork
	mov	r3, r0
	str	r3, [fp, #-12]
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	bge	.L26
	ldr	r0, .L30+32
	bl	puts
	mov	r0, #1
	bl	exit
.L26:
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	bne	.L27
	ldr	r0, .L30+36
	bl	puts
	b	.L28
.L27:
	ldr	r0, .L30+40
	bl	puts
.L28:
	mov	r0, #0
	bl	exit
.L31:
	.align	2
.L30:
	.word	.LC16
	.word	child
	.word	parent
	.word	prepare
	.word	.LC10
	.word	thr_fn
	.word	.LC11
	.word	.LC12
	.word	.LC13
	.word	.LC14
	.word	.LC15
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
