	.file	"140764858.c"
	.intel_syntax noprefix
	.text
	.globl	shared_val
	.bss
	.align 8
	.type	shared_val, @object
	.size	shared_val, 8
shared_val:
	.zero	8
	.text
	.globl	compare_and_swap
	.type	compare_and_swap, @function
compare_and_swap:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	QWORD PTR -8[rbp], rdi
	mov	QWORD PTR -16[rbp], rsi
	mov	QWORD PTR -24[rbp], rdx
	mov	rax, QWORD PTR -8[rbp]
	mov	rax, QWORD PTR [rax]
	cmp	QWORD PTR -16[rbp], rax
	je	.L2
	mov	eax, 0
	jmp	.L3
.L2:
	mov	rax, QWORD PTR -8[rbp]
	mov	rdx, QWORD PTR -24[rbp]
	mov	QWORD PTR [rax], rdx
	mov	eax, 1
.L3:
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	compare_and_swap, .-compare_and_swap
	.section	.rodata
.LC0:
	.string	"worker: start."
.LC1:
	.string	"worker: exit."
	.text
	.globl	worker
	.type	worker, @function
worker:
.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	BYTE PTR -1[rbp], 0
	lea	rdi, .LC0[rip]
	call	puts@PLT
	jmp	.L5
.L6:
	mov	edx, 2
	mov	esi, 1
	lea	rdi, shared_val[rip]
	call	compare_and_swap
	mov	BYTE PTR -1[rbp], al
.L5:
	movzx	eax, BYTE PTR -1[rbp]
	xor	eax, 1
	test	al, al
	jne	.L6
	lea	rdi, .LC1[rip]
	call	puts@PLT
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	worker, .-worker
	.section	.rodata
.LC2:
	.string	"pthread_create"
	.align 8
.LC3:
	.string	"main: shared_val 0to1.shared_val = %llu\n"
.LC4:
	.string	"pthread_join"
	.align 8
.LC5:
	.string	"pthread_join exit shared_val = %llu\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.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 fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	lea	rax, -16[rbp]
	mov	ecx, 0
	lea	rdx, worker[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	test	eax, eax
	je	.L9
	lea	rdi, .LC2[rip]
	call	perror@PLT
	mov	eax, -1
	jmp	.L12
.L9:
	mov	edi, 5
	mov	eax, 0
	call	sleep@PLT
	mov	QWORD PTR shared_val[rip], 1
	mov	rax, QWORD PTR shared_val[rip]
	mov	rsi, rax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	rax, QWORD PTR -16[rbp]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	test	eax, eax
	je	.L11
	lea	rdi, .LC4[rip]
	call	perror@PLT
	mov	eax, -1
	jmp	.L12
.L11:
	mov	rax, QWORD PTR shared_val[rip]
	mov	rsi, rax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
.L12:
	mov	rdx, QWORD PTR -8[rbp]
	sub	rdx, QWORD PTR fs:40
	je	.L13
	call	__stack_chk_fail@PLT
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.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	"140764858.c"
	.text
	.global	shared_val
	.bss
	.align	3
	.type	shared_val, %object
	.size	shared_val, 8
shared_val:
	.space	8
	.text
	.align	2
	.global	compare_and_swap
	.syntax unified
	.arm
	.fpu softvfp
	.type	compare_and_swap, %function
compare_and_swap:
	@ args = 8, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	sub	sp, sp, #20
	str	r0, [fp, #-8]
	str	r2, [fp, #-20]
	str	r3, [fp, #-16]
	ldr	r3, [fp, #-8]
	ldmia	r3, {r2-r3}
	sub	r1, fp, #20
	ldmia	r1, {r0-r1}
	cmp	r1, r3
	cmpeq	r0, r2
	beq	.L2
	mov	r3, #0
	b	.L3
.L2:
	ldr	r1, [fp, #-8]
	ldmib	fp, {r2-r3}
	stm	r1, {r2-r3}
	mov	r3, #1
.L3:
	mov	r0, r3
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
	.size	compare_and_swap, .-compare_and_swap
	.section	.rodata
	.align	2
.LC0:
	.ascii	"worker: start.\000"
	.align	2
.LC1:
	.ascii	"worker: exit.\000"
	.text
	.align	2
	.global	worker
	.syntax unified
	.arm
	.fpu softvfp
	.type	worker, %function
worker:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #24
	str	r0, [fp, #-16]
	mov	r3, #0
	strb	r3, [fp, #-5]
	ldr	r0, .L8
	bl	puts
	b	.L5
.L6:
	mov	r2, #2
	mov	r3, #0
	stm	sp, {r2-r3}
	mov	r2, #1
	mov	r3, #0
	ldr	r0, .L8+4
	bl	compare_and_swap
	mov	r3, r0
	strb	r3, [fp, #-5]
.L5:
	ldrb	r3, [fp, #-5]
	eor	r3, r3, #1
	and	r3, r3, #255
	cmp	r3, #0
	bne	.L6
	ldr	r0, .L8+8
	bl	puts
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L9:
	.align	2
.L8:
	.word	.LC0
	.word	shared_val
	.word	.LC1
	.size	worker, .-worker
	.section	.rodata
	.align	2
.LC2:
	.ascii	"pthread_create\000"
	.align	2
.LC3:
	.ascii	"main: shared_val 0to1.shared_val = %llu\012\000"
	.align	2
.LC4:
	.ascii	"pthread_join\000"
	.align	2
.LC5:
	.ascii	"pthread_join exit shared_val = %llu\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 = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #16
	str	r0, [fp, #-16]
	str	r1, [fp, #-20]
	ldr	r3, .L16
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	sub	r0, fp, #12
	mov	r3, #0
	ldr	r2, .L16+4
	mov	r1, #0
	bl	pthread_create
	mov	r3, r0
	cmp	r3, #0
	beq	.L11
	ldr	r0, .L16+8
	bl	perror
	mvn	r3, #0
	b	.L14
.L11:
	mov	r0, #5
	bl	sleep
	ldr	r1, .L16+12
	mov	r2, #1
	mov	r3, #0
	stm	r1, {r2-r3}
	ldr	r3, .L16+12
	ldmia	r3, {r2-r3}
	ldr	r0, .L16+16
	bl	printf
	ldr	r3, [fp, #-12]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	mov	r3, r0
	cmp	r3, #0
	beq	.L13
	ldr	r0, .L16+20
	bl	perror
	mvn	r3, #0
	b	.L14
.L13:
	ldr	r3, .L16+12
	ldmia	r3, {r2-r3}
	ldr	r0, .L16+24
	bl	printf
	mov	r3, #0
.L14:
	ldr	r2, .L16
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L15
	bl	__stack_chk_fail
.L15:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L17:
	.align	2
.L16:
	.word	.LC6
	.word	worker
	.word	.LC2
	.word	shared_val
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
