	.file	"951466.c"
	.intel_syntax noprefix
	.text
	.globl	perror_exit
	.type	perror_exit, @function
perror_exit:
.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	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	perror@PLT
	mov	edi, -1
	call	exit@PLT
	.cfi_endproc
.LFE6:
	.size	perror_exit, .-perror_exit
	.section	.rodata
.LC0:
	.string	"malloc failed"
	.text
	.globl	check_malloc
	.type	check_malloc, @function
check_malloc:
.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, 32
	mov	DWORD PTR -20[rbp], edi
	mov	eax, DWORD PTR -20[rbp]
	cdqe
	mov	rdi, rax
	call	malloc@PLT
	mov	QWORD PTR -8[rbp], rax
	cmp	QWORD PTR -8[rbp], 0
	jne	.L3
	lea	rdi, .LC0[rip]
	call	perror_exit
.L3:
	mov	rax, QWORD PTR -8[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	check_malloc, .-check_malloc
	.globl	make_shared
	.type	make_shared, @function
make_shared:
.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
	mov	edi, 4
	call	check_malloc
	mov	QWORD PTR -8[rbp], rax
	mov	rax, QWORD PTR -8[rbp]
	mov	DWORD PTR [rax], 0
	mov	rax, QWORD PTR -8[rbp]
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	make_shared, .-make_shared
	.section	.rodata
.LC1:
	.string	"pthread_create failed"
	.text
	.globl	make_thread
	.type	make_thread, @function
make_thread:
.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, 48
	mov	QWORD PTR -40[rbp], rdi
	mov	QWORD PTR -48[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	rcx, QWORD PTR -48[rbp]
	mov	rdx, QWORD PTR -40[rbp]
	lea	rax, -16[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	mov	DWORD PTR -20[rbp], eax
	cmp	DWORD PTR -20[rbp], 0
	je	.L8
	lea	rdi, .LC1[rip]
	call	perror_exit
.L8:
	mov	rax, QWORD PTR -16[rbp]
	mov	rsi, QWORD PTR -8[rbp]
	sub	rsi, QWORD PTR fs:40
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	make_thread, .-make_thread
	.section	.rodata
.LC2:
	.string	"pthread_join failed"
	.text
	.globl	join_thread
	.type	join_thread, @function
join_thread:
.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	QWORD PTR -24[rbp], rdi
	mov	rax, QWORD PTR -24[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], -1
	jne	.L13
	lea	rdi, .LC2[rip]
	call	perror_exit
.L13:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	join_thread, .-join_thread
	.section	.rodata
.LC3:
	.string	"counter = %d\n"
	.text
	.globl	child_code
	.type	child_code, @function
child_code:
.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, 16
	mov	QWORD PTR -8[rbp], rdi
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	lea	edx, 1[rax]
	mov	rax, QWORD PTR -8[rbp]
	mov	DWORD PTR [rax], edx
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	child_code, .-child_code
	.globl	entry
	.type	entry, @function
entry:
.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, 32
	mov	QWORD PTR -24[rbp], rdi
	mov	rax, QWORD PTR -24[rbp]
	mov	QWORD PTR -8[rbp], rax
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	child_code
	mov	edi, 0
	call	pthread_exit@PLT
	.cfi_endproc
.LFE12:
	.size	entry, .-entry
	.section	.rodata
.LC4:
	.string	"Final value of counter is %d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB13:
	.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	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	eax, 0
	call	make_shared
	mov	QWORD PTR -40[rbp], rax
	mov	DWORD PTR -44[rbp], 0
	jmp	.L17
.L18:
	mov	rax, QWORD PTR -40[rbp]
	mov	rsi, rax
	lea	rdi, entry[rip]
	call	make_thread
	mov	edx, DWORD PTR -44[rbp]
	movsx	rdx, edx
	mov	QWORD PTR -32[rbp+rdx*8], rax
	add	DWORD PTR -44[rbp], 1
.L17:
	cmp	DWORD PTR -44[rbp], 2
	jle	.L18
	mov	DWORD PTR -44[rbp], 0
	jmp	.L19
.L20:
	mov	eax, DWORD PTR -44[rbp]
	cdqe
	mov	rax, QWORD PTR -32[rbp+rax*8]
	mov	rdi, rax
	call	join_thread
	add	DWORD PTR -44[rbp], 1
.L19:
	cmp	DWORD PTR -44[rbp], 2
	jle	.L20
	mov	rax, QWORD PTR -40[rbp]
	mov	eax, DWORD PTR [rax]
	mov	esi, eax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.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	"951466.c"
	.text
	.align	2
	.global	perror_exit
	.syntax unified
	.arm
	.fpu softvfp
	.type	perror_exit, %function
perror_exit:
	@ 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, [fp, #-8]
	bl	perror
	mvn	r0, #0
	bl	exit
	.size	perror_exit, .-perror_exit
	.section	.rodata
	.align	2
.LC0:
	.ascii	"malloc failed\000"
	.text
	.align	2
	.global	check_malloc
	.syntax unified
	.arm
	.fpu softvfp
	.type	check_malloc, %function
check_malloc:
	@ 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]
	mov	r0, r3
	bl	malloc
	mov	r3, r0
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L3
	ldr	r0, .L5
	bl	perror_exit
.L3:
	ldr	r3, [fp, #-8]
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L6:
	.align	2
.L5:
	.word	.LC0
	.size	check_malloc, .-check_malloc
	.align	2
	.global	make_shared
	.syntax unified
	.arm
	.fpu softvfp
	.type	make_shared, %function
make_shared:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	mov	r0, #4
	bl	check_malloc
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	mov	r2, #0
	str	r2, [r3]
	ldr	r3, [fp, #-8]
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
	.size	make_shared, .-make_shared
	.section	.rodata
	.align	2
.LC1:
	.ascii	"pthread_create failed\000"
	.align	2
.LC2:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	make_thread
	.syntax unified
	.arm
	.fpu softvfp
	.type	make_thread, %function
make_thread:
	@ 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, .L13
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	sub	r0, fp, #16
	ldr	r3, [fp, #-28]
	ldr	r2, [fp, #-24]
	mov	r1, #0
	bl	pthread_create
	str	r0, [fp, #-12]
	ldr	r3, [fp, #-12]
	cmp	r3, #0
	beq	.L10
	ldr	r0, .L13+4
	bl	perror_exit
.L10:
	ldr	r3, [fp, #-16]
	ldr	r2, .L13
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L12
	bl	__stack_chk_fail
.L12:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L14:
	.align	2
.L13:
	.word	.LC2
	.word	.LC1
	.size	make_thread, .-make_thread
	.section	.rodata
	.align	2
.LC3:
	.ascii	"pthread_join failed\000"
	.text
	.align	2
	.global	join_thread
	.syntax unified
	.arm
	.fpu softvfp
	.type	join_thread, %function
join_thread:
	@ 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]
	mov	r1, #0
	ldr	r0, [fp, #-16]
	bl	pthread_join
	str	r0, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmn	r3, #1
	bne	.L17
	ldr	r0, .L18
	bl	perror_exit
.L17:
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L19:
	.align	2
.L18:
	.word	.LC3
	.size	join_thread, .-join_thread
	.section	.rodata
	.align	2
.LC4:
	.ascii	"counter = %d\012\000"
	.text
	.align	2
	.global	child_code
	.syntax unified
	.arm
	.fpu softvfp
	.type	child_code, %function
child_code:
	@ 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	r3, [fp, #-8]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L21
	bl	printf
	ldr	r3, [fp, #-8]
	ldr	r3, [r3]
	add	r2, r3, #1
	ldr	r3, [fp, #-8]
	str	r2, [r3]
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L22:
	.align	2
.L21:
	.word	.LC4
	.size	child_code, .-child_code
	.align	2
	.global	entry
	.syntax unified
	.arm
	.fpu softvfp
	.type	entry, %function
entry:
	@ 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, #-8]
	ldr	r0, [fp, #-8]
	bl	child_code
	mov	r0, #0
	bl	pthread_exit
	.size	entry, .-entry
	.section	.rodata
	.align	2
.LC5:
	.ascii	"Final value of counter is %d\012\000"
	.align	2
.LC6:
	.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
	ldr	r3, .L31
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	bl	make_shared
	str	r0, [fp, #-24]
	mov	r3, #0
	str	r3, [fp, #-28]
	b	.L25
.L26:
	ldr	r1, [fp, #-24]
	ldr	r0, .L31+4
	bl	make_thread
	mov	r2, r0
	ldr	r3, [fp, #-28]
	lsl	r3, r3, #2
	sub	r1, fp, #4
	add	r3, r1, r3
	str	r2, [r3, #-16]
	ldr	r3, [fp, #-28]
	add	r3, r3, #1
	str	r3, [fp, #-28]
.L25:
	ldr	r3, [fp, #-28]
	cmp	r3, #2
	ble	.L26
	mov	r3, #0
	str	r3, [fp, #-28]
	b	.L27
.L28:
	ldr	r3, [fp, #-28]
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r3, [r3, #-16]
	mov	r0, r3
	bl	join_thread
	ldr	r3, [fp, #-28]
	add	r3, r3, #1
	str	r3, [fp, #-28]
.L27:
	ldr	r3, [fp, #-28]
	cmp	r3, #2
	ble	.L28
	ldr	r3, [fp, #-24]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L31+8
	bl	printf
	mov	r3, #0
	ldr	r2, .L31
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L30
	bl	__stack_chk_fail
.L30:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L32:
	.align	2
.L31:
	.word	.LC6
	.word	entry
	.word	.LC5
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
