	.file	"683290.c"
	.intel_syntax noprefix
	.text
	.local	var
	.comm	var,4,4
	.type	prepare, @function
prepare:
.LFB8:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	eax, DWORD PTR var[rip]
	or	eax, 1
	mov	DWORD PTR var[rip], eax
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	prepare, .-prepare
	.type	parent, @function
parent:
.LFB9:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	eax, DWORD PTR var[rip]
	or	eax, 2
	mov	DWORD PTR var[rip], eax
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	parent, .-parent
	.type	child, @function
child:
.LFB10:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	eax, DWORD PTR var[rip]
	or	eax, 4
	mov	DWORD PTR var[rip], eax
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	child, .-child
	.section	.rodata
.LC0:
	.string	"cannot create thread"
.LC1:
	.string	"pthread_join res != 0"
.LC2:
	.string	"all ok"
	.text
	.globl	main
	.type	main, @function
main:
.LFB11:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 64
	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
	lea	rax, -40[rbp]
	mov	ecx, 0
	lea	rdx, thread[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	test	eax, eax
	je	.L5
	mov	DWORD PTR -56[rbp], 1
	mov	DWORD PTR -52[rbp], 0
	lea	rax, .LC0[rip]
	mov	QWORD PTR -24[rbp], rax
	mov	rdx, QWORD PTR -24[rbp]
	mov	ecx, DWORD PTR -52[rbp]
	mov	eax, DWORD PTR -56[rbp]
	mov	esi, ecx
	mov	edi, eax
	mov	eax, 0
	call	error@PLT
	nop
.L5:
	mov	rax, QWORD PTR -40[rbp]
	lea	rdx, -32[rbp]
	mov	rsi, rdx
	mov	rdi, rax
	call	pthread_join@PLT
	mov	rax, QWORD PTR -32[rbp]
	test	eax, eax
	je	.L6
	mov	DWORD PTR -48[rbp], 1
	mov	DWORD PTR -44[rbp], 0
	lea	rax, .LC1[rip]
	mov	QWORD PTR -16[rbp], rax
	mov	rdx, QWORD PTR -16[rbp]
	mov	ecx, DWORD PTR -44[rbp]
	mov	eax, DWORD PTR -48[rbp]
	mov	esi, ecx
	mov	edi, eax
	mov	eax, 0
	call	error@PLT
	nop
.L6:
	lea	rdi, .LC2[rip]
	call	puts@PLT
	mov	eax, 0
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	main, .-main
	.section	.rodata
.LC3:
	.string	"cannot fork"
.LC4:
	.string	"wrong child"
.LC5:
	.string	"Child terminated incorrectly"
	.text
	.type	thread, @function
thread:
.LFB12:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	sub	rsp, 80
	mov	QWORD PTR -72[rbp], rdi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	call	fork@PLT
	mov	DWORD PTR -60[rbp], eax
	cmp	DWORD PTR -60[rbp], 0
	jne	.L10
	mov	eax, DWORD PTR var[rip]
	cmp	eax, 5
	setne	al
	movzx	eax, al
	mov	edi, eax
	call	exit@PLT
.L10:
	cmp	DWORD PTR -60[rbp], -1
	jne	.L11
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	DWORD PTR -56[rbp], 1
	mov	DWORD PTR -52[rbp], eax
	lea	rax, .LC3[rip]
	mov	QWORD PTR -32[rbp], rax
	mov	rdx, QWORD PTR -32[rbp]
	mov	ecx, DWORD PTR -52[rbp]
	mov	eax, DWORD PTR -56[rbp]
	mov	esi, ecx
	mov	edi, eax
	mov	eax, 0
	call	error@PLT
	nop
.L11:
	lea	rcx, -64[rbp]
	mov	eax, DWORD PTR -60[rbp]
	mov	edx, 0
	mov	rsi, rcx
	mov	edi, eax
	call	waitpid@PLT
	cmp	DWORD PTR -60[rbp], eax
	je	.L12
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	DWORD PTR -48[rbp], 1
	mov	DWORD PTR -44[rbp], eax
	lea	rax, .LC4[rip]
	mov	QWORD PTR -24[rbp], rax
	mov	rdx, QWORD PTR -24[rbp]
	mov	ecx, DWORD PTR -44[rbp]
	mov	eax, DWORD PTR -48[rbp]
	mov	esi, ecx
	mov	edi, eax
	mov	eax, 0
	call	error@PLT
	nop
.L12:
	mov	eax, DWORD PTR -64[rbp]
	and	eax, 127
	test	eax, eax
	je	.L13
	mov	DWORD PTR -40[rbp], 1
	mov	DWORD PTR -36[rbp], 0
	lea	rax, .LC5[rip]
	mov	QWORD PTR -16[rbp], rax
	mov	rdx, QWORD PTR -16[rbp]
	mov	ecx, DWORD PTR -36[rbp]
	mov	eax, DWORD PTR -40[rbp]
	mov	esi, ecx
	mov	edi, eax
	mov	eax, 0
	call	error@PLT
	nop
.L13:
	mov	eax, DWORD PTR -64[rbp]
	sar	eax, 8
	movzx	eax, al
	mov	DWORD PTR -64[rbp], eax
	mov	eax, DWORD PTR -64[rbp]
	test	eax, eax
	jne	.L14
	mov	eax, DWORD PTR var[rip]
	cmp	eax, 3
	setne	al
	movzx	eax, al
	mov	DWORD PTR -64[rbp], eax
.L14:
	mov	eax, DWORD PTR -64[rbp]
	cdqe
	mov	rsi, QWORD PTR -8[rbp]
	sub	rsi, QWORD PTR fs:40
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	thread, .-thread
	.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	"683290.c"
	.text
	.local	var
	.comm	var,4,4
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	prepare, %function
prepare:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	ldr	r3, .L2
	ldr	r3, [r3]
	orr	r3, r3, #1
	ldr	r2, .L2
	str	r3, [r2]
	nop
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
.L3:
	.align	2
.L2:
	.word	var
	.size	prepare, .-prepare
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	parent, %function
parent:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	ldr	r3, .L5
	ldr	r3, [r3]
	orr	r3, r3, #2
	ldr	r2, .L5
	str	r3, [r2]
	nop
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
.L6:
	.align	2
.L5:
	.word	var
	.size	parent, .-parent
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	child, %function
child:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	ldr	r3, .L8
	ldr	r3, [r3]
	orr	r3, r3, #4
	ldr	r2, .L8
	str	r3, [r2]
	nop
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
.L9:
	.align	2
.L8:
	.word	var
	.size	child, .-child
	.section	.rodata
	.align	2
.LC0:
	.ascii	"cannot create thread\000"
	.align	2
.LC1:
	.ascii	"pthread_join res != 0\000"
	.align	2
.LC2:
	.ascii	"all ok\000"
	.align	2
.LC3:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 40
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #40
	ldr	r3, .L15
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r2, .L15+4
	ldr	r1, .L15+8
	ldr	r0, .L15+12
	bl	pthread_atfork
	sub	r0, fp, #40
	mov	r3, #0
	ldr	r2, .L15+16
	mov	r1, #0
	bl	pthread_create
	mov	r3, r0
	cmp	r3, #0
	beq	.L11
	mov	r3, #1
	str	r3, [fp, #-32]
	mov	r3, #0
	str	r3, [fp, #-28]
	ldr	r3, .L15+20
	str	r3, [fp, #-24]
	ldr	r2, [fp, #-24]
	ldr	r1, [fp, #-28]
	ldr	r0, [fp, #-32]
	bl	error
	nop
.L11:
	ldr	r3, [fp, #-40]
	sub	r2, fp, #36
	mov	r1, r2
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-36]
	cmp	r3, #0
	beq	.L12
	mov	r3, #1
	str	r3, [fp, #-20]
	mov	r3, #0
	str	r3, [fp, #-16]
	ldr	r3, .L15+24
	str	r3, [fp, #-12]
	ldr	r2, [fp, #-12]
	ldr	r1, [fp, #-16]
	ldr	r0, [fp, #-20]
	bl	error
	nop
.L12:
	ldr	r0, .L15+28
	bl	puts
	mov	r3, #0
	ldr	r2, .L15
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L14
	bl	__stack_chk_fail
.L14:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L16:
	.align	2
.L15:
	.word	.LC3
	.word	child
	.word	parent
	.word	prepare
	.word	thread
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.size	main, .-main
	.section	.rodata
	.align	2
.LC4:
	.ascii	"cannot fork\000"
	.align	2
.LC5:
	.ascii	"wrong child\000"
	.align	2
.LC6:
	.ascii	"Child terminated incorrectly\000"
	.align	2
.LC7:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	thread, %function
thread:
	@ args = 0, pretend = 0, frame = 56
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #56
	str	r0, [fp, #-56]
	ldr	r3, .L25
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	bl	fork
	mov	r3, r0
	str	r3, [fp, #-48]
	ldr	r3, [fp, #-48]
	cmp	r3, #0
	bne	.L18
	ldr	r3, .L25+4
	ldr	r3, [r3]
	cmp	r3, #5
	movne	r3, #1
	moveq	r3, #0
	and	r3, r3, #255
	mov	r0, r3
	bl	exit
.L18:
	ldr	r3, [fp, #-48]
	cmn	r3, #1
	bne	.L19
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r2, #1
	str	r2, [fp, #-44]
	str	r3, [fp, #-40]
	ldr	r3, .L25+8
	str	r3, [fp, #-36]
	ldr	r2, [fp, #-36]
	ldr	r1, [fp, #-40]
	ldr	r0, [fp, #-44]
	bl	error
	nop
.L19:
	sub	r3, fp, #52
	mov	r2, #0
	mov	r1, r3
	ldr	r0, [fp, #-48]
	bl	waitpid
	mov	r2, r0
	ldr	r3, [fp, #-48]
	cmp	r3, r2
	beq	.L20
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r2, #1
	str	r2, [fp, #-32]
	str	r3, [fp, #-28]
	ldr	r3, .L25+12
	str	r3, [fp, #-24]
	ldr	r2, [fp, #-24]
	ldr	r1, [fp, #-28]
	ldr	r0, [fp, #-32]
	bl	error
	nop
.L20:
	ldr	r3, [fp, #-52]
	and	r3, r3, #127
	cmp	r3, #0
	beq	.L21
	mov	r3, #1
	str	r3, [fp, #-20]
	mov	r3, #0
	str	r3, [fp, #-16]
	ldr	r3, .L25+16
	str	r3, [fp, #-12]
	ldr	r2, [fp, #-12]
	ldr	r1, [fp, #-16]
	ldr	r0, [fp, #-20]
	bl	error
	nop
.L21:
	ldr	r3, [fp, #-52]
	asr	r3, r3, #8
	and	r3, r3, #255
	str	r3, [fp, #-52]
	ldr	r3, [fp, #-52]
	cmp	r3, #0
	bne	.L22
	ldr	r3, .L25+4
	ldr	r3, [r3]
	cmp	r3, #3
	movne	r3, #1
	moveq	r3, #0
	and	r3, r3, #255
	str	r3, [fp, #-52]
.L22:
	ldr	r3, [fp, #-52]
	ldr	r2, .L25
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L24
	bl	__stack_chk_fail
.L24:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L26:
	.align	2
.L25:
	.word	.LC7
	.word	var
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.size	thread, .-thread
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
