	.file	"389661.c"
	.intel_syntax noprefix
	.text
	.local	futex1
	.comm	futex1,8,8
	.local	futex2
	.comm	futex2,8,8
	.local	iaddr
	.comm	iaddr,8,8
	.type	futex, @function
futex:
.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, 48
	mov	QWORD PTR -8[rbp], rdi
	mov	DWORD PTR -12[rbp], esi
	mov	DWORD PTR -16[rbp], edx
	mov	QWORD PTR -24[rbp], rcx
	mov	QWORD PTR -32[rbp], r8
	mov	DWORD PTR -36[rbp], r9d
	mov	r8, QWORD PTR -32[rbp]
	mov	rdi, QWORD PTR -24[rbp]
	mov	ecx, DWORD PTR -16[rbp]
	mov	edx, DWORD PTR -12[rbp]
	mov	rax, QWORD PTR -8[rbp]
	sub	rsp, 8
	mov	esi, DWORD PTR -36[rbp]
	push	rsi
	mov	r9, r8
	mov	r8, rdi
	mov	rsi, rax
	mov	edi, 202
	mov	eax, 0
	call	syscall@PLT
	add	rsp, 16
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	futex, .-futex
	.section	.rodata
.LC0:
	.string	"futex-FUTEX_WAIT"
	.text
	.type	fwait, @function
fwait:
.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	QWORD PTR -40[rbp], rdi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
.L7:
	mov	DWORD PTR -28[rbp], 1
	mov	rax, QWORD PTR -40[rbp]
	mov	QWORD PTR -16[rbp], rax
	mov	DWORD PTR -24[rbp], 0
	mov	eax, DWORD PTR -24[rbp]
	mov	ecx, eax
	mov	rsi, QWORD PTR -16[rbp]
	lea	rdx, -28[rbp]
	mov	eax, DWORD PTR [rdx]
	lock cmpxchg	DWORD PTR [rsi], ecx
	mov	ecx, eax
	sete	al
	test	al, al
	jne	.L4
	mov	DWORD PTR [rdx], ecx
.L4:
	test	al, al
	jne	.L10
	mov	rax, QWORD PTR -40[rbp]
	mov	r9d, 0
	mov	r8d, 0
	mov	ecx, 0
	mov	edx, 0
	mov	esi, 0
	mov	rdi, rax
	call	futex
	mov	DWORD PTR -20[rbp], eax
	cmp	DWORD PTR -20[rbp], -1
	jne	.L7
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	cmp	eax, 11
	je	.L7
	lea	rdi, .LC0[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L10:
	nop
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR fs:40
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	fwait, .-fwait
	.section	.rodata
.LC1:
	.string	"futex-FUTEX_WAKE"
	.text
	.type	fpost, @function
fpost:
.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	QWORD PTR -40[rbp], rdi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	DWORD PTR -28[rbp], 0
	mov	rax, QWORD PTR -40[rbp]
	mov	QWORD PTR -16[rbp], rax
	mov	DWORD PTR -24[rbp], 1
	mov	eax, DWORD PTR -24[rbp]
	mov	ecx, eax
	mov	rsi, QWORD PTR -16[rbp]
	lea	rdx, -28[rbp]
	mov	eax, DWORD PTR [rdx]
	lock cmpxchg	DWORD PTR [rsi], ecx
	mov	ecx, eax
	sete	al
	test	al, al
	jne	.L12
	mov	DWORD PTR [rdx], ecx
.L12:
	test	al, al
	je	.L15
	mov	rax, QWORD PTR -40[rbp]
	mov	r9d, 0
	mov	r8d, 0
	mov	ecx, 0
	mov	edx, 1
	mov	esi, 1
	mov	rdi, rax
	call	futex
	mov	DWORD PTR -20[rbp], eax
	cmp	DWORD PTR -20[rbp], -1
	jne	.L15
	lea	rdi, .LC1[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L15:
	nop
	mov	rax, QWORD PTR -8[rbp]
	sub	rax, QWORD PTR fs:40
	je	.L14
	call	__stack_chk_fail@PLT
.L14:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	fpost, .-fpost
	.section	.rodata
.LC2:
	.string	"mmap"
.LC3:
	.string	"fork"
.LC4:
	.string	"Child  (%ld) %d\n"
.LC5:
	.string	"Parent (%ld) %d\n"
	.text
	.globl	main
	.type	main, @function
main:
.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, 32
	mov	DWORD PTR -20[rbp], edi
	mov	QWORD PTR -32[rbp], rsi
	mov	rax, QWORD PTR stdout[rip]
	mov	esi, 0
	mov	rdi, rax
	call	setbuf@PLT
	cmp	DWORD PTR -20[rbp], 1
	jle	.L17
	mov	rax, QWORD PTR -32[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atoi@PLT
	jmp	.L18
.L17:
	mov	eax, 5
.L18:
	mov	DWORD PTR -8[rbp], eax
	mov	r9d, 0
	mov	r8d, -1
	mov	ecx, 33
	mov	edx, 3
	mov	esi, 8
	mov	edi, 0
	call	mmap@PLT
	mov	QWORD PTR iaddr[rip], rax
	mov	rax, QWORD PTR iaddr[rip]
	cmp	rax, -1
	jne	.L19
	lea	rdi, .LC2[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L19:
	mov	rax, QWORD PTR iaddr[rip]
	mov	QWORD PTR futex1[rip], rax
	mov	rax, QWORD PTR iaddr[rip]
	add	rax, 4
	mov	QWORD PTR futex2[rip], rax
	mov	rax, QWORD PTR futex1[rip]
	mov	DWORD PTR [rax], 0
	mov	rax, QWORD PTR futex2[rip]
	mov	DWORD PTR [rax], 1
	call	fork@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], -1
	jne	.L20
	lea	rdi, .LC3[rip]
	call	perror@PLT
	mov	edi, 1
	call	exit@PLT
.L20:
	cmp	DWORD PTR -4[rbp], 0
	jne	.L21
	mov	DWORD PTR -12[rbp], 0
	jmp	.L22
.L23:
	mov	rax, QWORD PTR futex1[rip]
	mov	rdi, rax
	call	fwait
	call	getpid@PLT
	cdqe
	mov	edx, DWORD PTR -12[rbp]
	mov	rsi, rax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR futex2[rip]
	mov	rdi, rax
	call	fpost
	add	DWORD PTR -12[rbp], 1
.L22:
	mov	eax, DWORD PTR -12[rbp]
	cmp	eax, DWORD PTR -8[rbp]
	jl	.L23
	mov	edi, 0
	call	exit@PLT
.L21:
	mov	DWORD PTR -12[rbp], 0
	jmp	.L24
.L25:
	mov	rax, QWORD PTR futex2[rip]
	mov	rdi, rax
	call	fwait
	call	getpid@PLT
	cdqe
	mov	edx, DWORD PTR -12[rbp]
	mov	rsi, rax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR futex1[rip]
	mov	rdi, rax
	call	fpost
	add	DWORD PTR -12[rbp], 1
.L24:
	mov	eax, DWORD PTR -12[rbp]
	cmp	eax, DWORD PTR -8[rbp]
	jl	.L25
	mov	edi, 0
	call	wait@PLT
	mov	edi, 0
	call	exit@PLT
	.cfi_endproc
.LFE9:
	.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	"389661.c"
	.text
	.local	futex1
	.comm	futex1,4,4
	.local	futex2
	.comm	futex2,4,4
	.local	iaddr
	.comm	iaddr,4,4
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	futex, %function
futex:
	@ args = 8, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #32
	str	r0, [fp, #-8]
	str	r1, [fp, #-12]
	str	r2, [fp, #-16]
	str	r3, [fp, #-20]
	ldr	r3, [fp, #8]
	str	r3, [sp, #8]
	ldr	r3, [fp, #4]
	str	r3, [sp, #4]
	ldr	r3, [fp, #-20]
	str	r3, [sp]
	ldr	r3, [fp, #-16]
	ldr	r2, [fp, #-12]
	ldr	r1, [fp, #-8]
	mov	r0, #240
	bl	syscall
	mov	r3, r0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	futex, .-futex
	.global	__sync_val_compare_and_swap_4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"futex-FUTEX_WAIT\000"
	.align	2
.LC1:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	fwait, %function
fwait:
	@ args = 0, pretend = 0, frame = 32
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, fp, lr}
	add	fp, sp, #12
	sub	sp, sp, #40
	str	r0, [fp, #-40]
	ldr	r3, .L11
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	mov	r3,#0
.L7:
	mov	r3, #1
	str	r3, [fp, #-32]
	ldr	r3, [fp, #-40]
	str	r3, [fp, #-24]
	mov	r3, #0
	str	r3, [fp, #-28]
	ldr	r3, [fp, #-28]
	mov	r2, r3
	ldr	r3, [fp, #-24]
	sub	r4, fp, #32
	ldr	r5, [r4]
	mov	r1, r5
	mov	r0, r3
	bl	__sync_val_compare_and_swap_4
	mov	r3, r0
	cmp	r3, r5
	moveq	r2, #1
	movne	r2, #0
	cmp	r2, #0
	bne	.L4
	str	r3, [r4]
.L4:
	mov	r3, r2
	cmp	r3, #0
	bne	.L10
	mov	r3, #0
	str	r3, [sp, #4]
	mov	r3, #0
	str	r3, [sp]
	mov	r3, #0
	mov	r2, #0
	mov	r1, #0
	ldr	r0, [fp, #-40]
	bl	futex
	str	r0, [fp, #-20]
	ldr	r3, [fp, #-20]
	cmn	r3, #1
	bne	.L7
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	cmp	r3, #11
	beq	.L7
	ldr	r0, .L11+4
	bl	perror
	mov	r0, #1
	bl	exit
.L10:
	nop
	ldr	r3, .L11
	ldr	r2, [r3]
	ldr	r3, [fp, #-16]
	eors	r2, r3, r2
	mov	r3, #0
	beq	.L8
	bl	__stack_chk_fail
.L8:
	sub	sp, fp, #12
	@ sp needed
	pop	{r4, r5, fp, pc}
.L12:
	.align	2
.L11:
	.word	.LC1
	.word	.LC0
	.size	fwait, .-fwait
	.section	.rodata
	.align	2
.LC2:
	.ascii	"futex-FUTEX_WAKE\000"
	.align	2
.LC3:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	fpost, %function
fpost:
	@ args = 0, pretend = 0, frame = 32
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, fp, lr}
	add	fp, sp, #12
	sub	sp, sp, #40
	str	r0, [fp, #-40]
	ldr	r3, .L18
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	mov	r3,#0
	mov	r3, #0
	str	r3, [fp, #-32]
	ldr	r3, [fp, #-40]
	str	r3, [fp, #-24]
	mov	r3, #1
	str	r3, [fp, #-28]
	ldr	r3, [fp, #-28]
	mov	r2, r3
	ldr	r3, [fp, #-24]
	sub	r4, fp, #32
	ldr	r5, [r4]
	mov	r1, r5
	mov	r0, r3
	bl	__sync_val_compare_and_swap_4
	mov	r3, r0
	cmp	r3, r5
	moveq	r2, #1
	movne	r2, #0
	cmp	r2, #0
	bne	.L14
	str	r3, [r4]
.L14:
	mov	r3, r2
	cmp	r3, #0
	beq	.L17
	mov	r3, #0
	str	r3, [sp, #4]
	mov	r3, #0
	str	r3, [sp]
	mov	r3, #0
	mov	r2, #1
	mov	r1, #1
	ldr	r0, [fp, #-40]
	bl	futex
	str	r0, [fp, #-20]
	ldr	r3, [fp, #-20]
	cmn	r3, #1
	bne	.L17
	ldr	r0, .L18+4
	bl	perror
	mov	r0, #1
	bl	exit
.L17:
	nop
	ldr	r3, .L18
	ldr	r2, [r3]
	ldr	r3, [fp, #-16]
	eors	r2, r3, r2
	mov	r3, #0
	beq	.L16
	bl	__stack_chk_fail
.L16:
	sub	sp, fp, #12
	@ sp needed
	pop	{r4, r5, fp, pc}
.L19:
	.align	2
.L18:
	.word	.LC3
	.word	.LC2
	.size	fpost, .-fpost
	.section	.rodata
	.align	2
.LC4:
	.ascii	"mmap\000"
	.align	2
.LC5:
	.ascii	"fork\000"
	.align	2
.LC6:
	.ascii	"Child  (%ld) %d\012\000"
	.align	2
.LC7:
	.ascii	"Parent (%ld) %d\012\000"
	.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, #32
	str	r0, [fp, #-24]
	str	r1, [fp, #-28]
	ldr	r3, .L30
	ldr	r3, [r3]
	mov	r1, #0
	mov	r0, r3
	bl	setbuf
	ldr	r3, [fp, #-24]
	cmp	r3, #1
	ble	.L21
	ldr	r3, [fp, #-28]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r0, r3
	bl	atoi
	mov	r3, r0
	b	.L22
.L21:
	mov	r3, #5
.L22:
	str	r3, [fp, #-12]
	mov	r3, #0
	str	r3, [sp, #4]
	mvn	r3, #0
	str	r3, [sp]
	mov	r3, #33
	mov	r2, #3
	mov	r1, #8
	mov	r0, #0
	bl	mmap
	mov	r3, r0
	ldr	r2, .L30+4
	str	r3, [r2]
	ldr	r3, .L30+4
	ldr	r3, [r3]
	cmn	r3, #1
	bne	.L23
	ldr	r0, .L30+8
	bl	perror
	mov	r0, #1
	bl	exit
.L23:
	ldr	r3, .L30+4
	ldr	r3, [r3]
	ldr	r2, .L30+12
	str	r3, [r2]
	ldr	r3, .L30+4
	ldr	r3, [r3]
	add	r3, r3, #4
	ldr	r2, .L30+16
	str	r3, [r2]
	ldr	r3, .L30+12
	ldr	r3, [r3]
	mov	r2, #0
	str	r2, [r3]
	ldr	r3, .L30+16
	ldr	r3, [r3]
	mov	r2, #1
	str	r2, [r3]
	bl	fork
	mov	r3, r0
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmn	r3, #1
	bne	.L24
	ldr	r0, .L30+20
	bl	perror
	mov	r0, #1
	bl	exit
.L24:
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L25
	mov	r3, #0
	str	r3, [fp, #-16]
	b	.L26
.L27:
	ldr	r3, .L30+12
	ldr	r3, [r3]
	mov	r0, r3
	bl	fwait
	bl	getpid
	mov	r3, r0
	ldr	r2, [fp, #-16]
	mov	r1, r3
	ldr	r0, .L30+24
	bl	printf
	ldr	r3, .L30+16
	ldr	r3, [r3]
	mov	r0, r3
	bl	fpost
	ldr	r3, [fp, #-16]
	add	r3, r3, #1
	str	r3, [fp, #-16]
.L26:
	ldr	r2, [fp, #-16]
	ldr	r3, [fp, #-12]
	cmp	r2, r3
	blt	.L27
	mov	r0, #0
	bl	exit
.L25:
	mov	r3, #0
	str	r3, [fp, #-16]
	b	.L28
.L29:
	ldr	r3, .L30+16
	ldr	r3, [r3]
	mov	r0, r3
	bl	fwait
	bl	getpid
	mov	r3, r0
	ldr	r2, [fp, #-16]
	mov	r1, r3
	ldr	r0, .L30+28
	bl	printf
	ldr	r3, .L30+12
	ldr	r3, [r3]
	mov	r0, r3
	bl	fpost
	ldr	r3, [fp, #-16]
	add	r3, r3, #1
	str	r3, [fp, #-16]
.L28:
	ldr	r2, [fp, #-16]
	ldr	r3, [fp, #-12]
	cmp	r2, r3
	blt	.L29
	mov	r0, #0
	bl	wait
	mov	r0, #0
	bl	exit
.L31:
	.align	2
.L30:
	.word	stdout
	.word	iaddr
	.word	.LC4
	.word	futex1
	.word	futex2
	.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
