	.file	"705600.c"
	.intel_syntax noprefix
	.text
	.globl	number
	.data
	.align 4
	.type	number, @object
	.size	number, 4
number:
	.long	1
	.globl	lock
	.bss
	.align 32
	.type	lock, @object
	.size	lock, 40
lock:
	.zero	40
	.globl	three
	.align 32
	.type	three, @object
	.size	three, 48
three:
	.zero	48
	.globl	two
	.align 32
	.type	two, @object
	.size	two, 48
two:
	.zero	48
	.globl	four
	.align 32
	.type	four, @object
	.size	four, 48
four:
	.zero	48
	.section	.rodata
	.align 8
.LC0:
	.string	"%d wants to enter the critical section\n"
	.align 8
.LC1:
	.string	"%d is finished with the critical section\n"
	.text
	.globl	thread
	.type	thread, @function
thread:
.LFB0:
	.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	eax, DWORD PTR [rax]
	mov	esi, eax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, lock[rip]
	call	pthread_mutex_lock@PLT
	jmp	.L2
.L5:
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	cmp	eax, 2
	jne	.L3
	lea	rsi, lock[rip]
	lea	rdi, two[rip]
	call	pthread_cond_wait@PLT
	jmp	.L2
.L3:
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	cmp	eax, 3
	jne	.L4
	lea	rsi, lock[rip]
	lea	rdi, three[rip]
	call	pthread_cond_wait@PLT
	jmp	.L2
.L4:
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	cmp	eax, 4
	jne	.L2
	lea	rsi, lock[rip]
	lea	rdi, four[rip]
	call	pthread_cond_wait@PLT
.L2:
	mov	rax, QWORD PTR -8[rbp]
	mov	edx, DWORD PTR [rax]
	mov	eax, DWORD PTR number[rip]
	cmp	edx, eax
	jne	.L5
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR number[rip]
	add	eax, 1
	mov	DWORD PTR number[rip], eax
	mov	eax, DWORD PTR number[rip]
	cmp	eax, 2
	jne	.L6
	lea	rdi, two[rip]
	call	pthread_cond_signal@PLT
	jmp	.L7
.L6:
	mov	eax, DWORD PTR number[rip]
	cmp	eax, 3
	jne	.L8
	lea	rdi, three[rip]
	call	pthread_cond_signal@PLT
	jmp	.L7
.L8:
	mov	eax, DWORD PTR number[rip]
	cmp	eax, 4
	jne	.L7
	lea	rdi, four[rip]
	call	pthread_cond_signal@PLT
.L7:
	lea	rdi, lock[rip]
	call	pthread_mutex_unlock@PLT
	mov	eax, 0
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	thread, .-thread
	.section	.rodata
.LC2:
	.string	"Everything finished"
	.text
	.globl	main
	.type	main, @function
main:
.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, 96
	mov	DWORD PTR -84[rbp], edi
	mov	QWORD PTR -96[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	DWORD PTR -64[rbp], 2
	mov	DWORD PTR -60[rbp], 1
	mov	DWORD PTR -56[rbp], 4
	mov	DWORD PTR -52[rbp], 3
	mov	DWORD PTR -68[rbp], 0
	jmp	.L11
.L13:
	lea	rdx, -64[rbp]
	mov	eax, DWORD PTR -68[rbp]
	cdqe
	sal	rax, 2
	add	rdx, rax
	lea	rcx, -48[rbp]
	mov	eax, DWORD PTR -68[rbp]
	cdqe
	sal	rax, 3
	add	rax, rcx
	mov	rcx, rdx
	lea	rdx, thread[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	cmp	DWORD PTR -68[rbp], 2
	jne	.L12
	mov	edi, 3
	call	sleep@PLT
.L12:
	add	DWORD PTR -68[rbp], 1
.L11:
	cmp	DWORD PTR -68[rbp], 3
	jle	.L13
	mov	DWORD PTR -68[rbp], 0
	jmp	.L14
.L15:
	mov	eax, DWORD PTR -68[rbp]
	cdqe
	mov	rax, QWORD PTR -48[rbp+rax*8]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	add	DWORD PTR -68[rbp], 1
.L14:
	cmp	DWORD PTR -68[rbp], 3
	jle	.L15
	lea	rdi, .LC2[rip]
	call	puts@PLT
	mov	eax, 0
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L17
	call	__stack_chk_fail@PLT
.L17:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	"705600.c"
	.text
	.global	number
	.data
	.align	2
	.type	number, %object
	.size	number, 4
number:
	.word	1
	.global	lock
	.bss
	.align	2
	.type	lock, %object
	.size	lock, 24
lock:
	.space	24
	.global	three
	.align	3
	.type	three, %object
	.size	three, 48
three:
	.space	48
	.global	two
	.align	3
	.type	two, %object
	.size	two, 48
two:
	.space	48
	.global	four
	.align	3
	.type	four, %object
	.size	four, 48
four:
	.space	48
	.section	.rodata
	.align	2
.LC1:
	.ascii	"%d wants to enter the critical section\012\000"
	.align	2
.LC2:
	.ascii	"%d is finished with the critical section\012\000"
	.text
	.align	2
	.global	thread
	.syntax unified
	.arm
	.fpu softvfp
	.type	thread, %function
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]
	ldr	r3, [fp, #-16]
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-8]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L10
	bl	printf
	ldr	r0, .L10+4
	bl	pthread_mutex_lock
	b	.L2
.L5:
	ldr	r3, [fp, #-8]
	ldr	r3, [r3]
	cmp	r3, #2
	bne	.L3
	ldr	r1, .L10+4
	ldr	r0, .L10+8
	bl	pthread_cond_wait
	b	.L2
.L3:
	ldr	r3, [fp, #-8]
	ldr	r3, [r3]
	cmp	r3, #3
	bne	.L4
	ldr	r1, .L10+4
	ldr	r0, .L10+12
	bl	pthread_cond_wait
	b	.L2
.L4:
	ldr	r3, [fp, #-8]
	ldr	r3, [r3]
	cmp	r3, #4
	bne	.L2
	ldr	r1, .L10+4
	ldr	r0, .L10+16
	bl	pthread_cond_wait
.L2:
	ldr	r3, [fp, #-8]
	ldr	r2, [r3]
	ldr	r3, .L10+20
	ldr	r3, [r3]
	cmp	r2, r3
	bne	.L5
	ldr	r3, [fp, #-8]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L10+24
	bl	printf
	ldr	r3, .L10+20
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L10+20
	str	r3, [r2]
	ldr	r3, .L10+20
	ldr	r3, [r3]
	cmp	r3, #2
	bne	.L6
	ldr	r0, .L10+8
	bl	pthread_cond_signal
	b	.L7
.L6:
	ldr	r3, .L10+20
	ldr	r3, [r3]
	cmp	r3, #3
	bne	.L8
	ldr	r0, .L10+12
	bl	pthread_cond_signal
	b	.L7
.L8:
	ldr	r3, .L10+20
	ldr	r3, [r3]
	cmp	r3, #4
	bne	.L7
	ldr	r0, .L10+16
	bl	pthread_cond_signal
.L7:
	ldr	r0, .L10+4
	bl	pthread_mutex_unlock
	mov	r3, #0
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L11:
	.align	2
.L10:
	.word	.LC1
	.word	lock
	.word	two
	.word	three
	.word	four
	.word	number
	.word	.LC2
	.size	thread, .-thread
	.section	.rodata
	.align	2
.LC3:
	.ascii	"Everything finished\000"
	.align	2
.LC0:
	.word	2
	.word	1
	.word	4
	.word	3
	.align	2
.LC4:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 48
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #48
	str	r0, [fp, #-48]
	str	r1, [fp, #-52]
	ldr	r3, .L20
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	ldr	r3, .L20+4
	sub	ip, fp, #24
	ldm	r3, {r0, r1, r2, r3}
	stm	ip, {r0, r1, r2, r3}
	mov	r3, #0
	str	r3, [fp, #-44]
	b	.L13
.L15:
	sub	r2, fp, #40
	ldr	r3, [fp, #-44]
	lsl	r3, r3, #2
	add	r0, r2, r3
	sub	r2, fp, #24
	ldr	r3, [fp, #-44]
	lsl	r3, r3, #2
	add	r3, r2, r3
	ldr	r2, .L20+8
	mov	r1, #0
	bl	pthread_create
	ldr	r3, [fp, #-44]
	cmp	r3, #2
	bne	.L14
	mov	r0, #3
	bl	sleep
.L14:
	ldr	r3, [fp, #-44]
	add	r3, r3, #1
	str	r3, [fp, #-44]
.L13:
	ldr	r3, [fp, #-44]
	cmp	r3, #3
	ble	.L15
	mov	r3, #0
	str	r3, [fp, #-44]
	b	.L16
.L17:
	ldr	r3, [fp, #-44]
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r3, [r3, #-36]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	ldr	r3, [fp, #-44]
	add	r3, r3, #1
	str	r3, [fp, #-44]
.L16:
	ldr	r3, [fp, #-44]
	cmp	r3, #3
	ble	.L17
	ldr	r0, .L20+12
	bl	puts
	mov	r3, #0
	ldr	r2, .L20
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L19
	bl	__stack_chk_fail
.L19:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L21:
	.align	2
.L20:
	.word	.LC4
	.word	.LC0
	.word	thread
	.word	.LC3
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
