	.file	"54824182.c"
	.intel_syntax noprefix
	.text
	.globl	mutex
	.bss
	.align 32
	.type	mutex, @object
	.size	mutex, 40
mutex:
	.zero	40
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	last
	.data
	.align 4
	.type	last, @object
	.size	last, 4
last:
	.long	-1
	.globl	ids
	.bss
	.align 8
	.type	ids, @object
	.size	ids, 8
ids:
	.zero	8
	.globl	token
	.align 4
	.type	token, @object
	.size	token, 4
token:
	.zero	4
	.section	.rodata
	.align 8
.LC0:
	.string	"Wrong numbers of parameters. Add n."
.LC1:
	.string	"Error of allocating memory"
.LC2:
	.string	"Error of creating thread: %s\n"
.LC3:
	.string	"Error of joining thread: %s\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	r15
	push	r14
	push	r13
	push	r12
	push	rbx
	sub	rsp, 56
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	mov	DWORD PTR -84[rbp], edi
	mov	QWORD PTR -96[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -56[rbp], rax
	xor	eax, eax
	mov	rax, rsp
	mov	rbx, rax
	cmp	DWORD PTR -84[rbp], 2
	je	.L2
	lea	rdi, .LC0[rip]
	call	puts@PLT
	mov	eax, -1
	jmp	.L3
.L2:
	mov	rax, QWORD PTR -96[rbp]
	add	rax, 8
	mov	rax, QWORD PTR [rax]
	mov	rdi, rax
	call	atoi@PLT
	mov	DWORD PTR n[rip], eax
	mov	DWORD PTR -76[rbp], 0
	mov	eax, DWORD PTR n[rip]
	cdqe
	sal	rax, 2
	mov	rdi, rax
	call	malloc@PLT
	mov	QWORD PTR ids[rip], rax
	mov	rax, QWORD PTR ids[rip]
	test	rax, rax
	jne	.L4
	lea	rdi, .LC1[rip]
	call	puts@PLT
	mov	eax, -1
	jmp	.L3
.L4:
	mov	eax, DWORD PTR n[rip]
	movsx	rdx, eax
	sub	rdx, 1
	mov	QWORD PTR -72[rbp], rdx
	movsx	rdx, eax
	mov	r14, rdx
	mov	r15d, 0
	movsx	rdx, eax
	mov	r12, rdx
	mov	r13d, 0
	cdqe
	lea	rdx, 0[0+rax*8]
	mov	eax, 16
	sub	rax, 1
	add	rax, rdx
	mov	esi, 16
	mov	edx, 0
	div	rsi
	imul	rax, rax, 16
	mov	rcx, rax
	and	rcx, -4096
	mov	rdx, rsp
	sub	rdx, rcx
.L5:
	cmp	rsp, rdx
	je	.L6
	sub	rsp, 4096
	or	QWORD PTR 4088[rsp], 0
	jmp	.L5
.L6:
	mov	rdx, rax
	and	edx, 4095
	sub	rsp, rdx
	mov	rdx, rax
	and	edx, 4095
	test	rdx, rdx
	je	.L7
	and	eax, 4095
	sub	rax, 8
	add	rax, rsp
	or	QWORD PTR [rax], 0
.L7:
	mov	rax, rsp
	add	rax, 7
	shr	rax, 3
	sal	rax, 3
	mov	QWORD PTR -64[rbp], rax
	mov	DWORD PTR -76[rbp], 0
	jmp	.L8
.L10:
	mov	rdx, QWORD PTR ids[rip]
	mov	eax, DWORD PTR -76[rbp]
	cdqe
	sal	rax, 2
	add	rdx, rax
	mov	eax, DWORD PTR -76[rbp]
	mov	DWORD PTR [rdx], eax
	mov	rdx, QWORD PTR ids[rip]
	mov	eax, DWORD PTR -76[rbp]
	cdqe
	sal	rax, 2
	add	rdx, rax
	mov	eax, DWORD PTR -76[rbp]
	cdqe
	lea	rcx, 0[0+rax*8]
	mov	rax, QWORD PTR -64[rbp]
	add	rax, rcx
	mov	rcx, rdx
	lea	rdx, Number[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	test	eax, eax
	je	.L9
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	strerror@PLT
	mov	rsi, rax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, -1
	jmp	.L3
.L9:
	add	DWORD PTR -76[rbp], 1
.L8:
	mov	eax, DWORD PTR n[rip]
	cmp	DWORD PTR -76[rbp], eax
	jl	.L10
	mov	DWORD PTR -76[rbp], 0
	jmp	.L11
.L13:
	mov	rax, QWORD PTR -64[rbp]
	mov	edx, DWORD PTR -76[rbp]
	movsx	rdx, edx
	mov	rax, QWORD PTR [rax+rdx*8]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	test	eax, eax
	je	.L12
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	mov	edi, eax
	call	strerror@PLT
	mov	rsi, rax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, -1
	call	exit@PLT
.L12:
	add	DWORD PTR -76[rbp], 1
.L11:
	mov	eax, DWORD PTR n[rip]
	cmp	DWORD PTR -76[rbp], eax
	jl	.L13
	mov	eax, 0
.L3:
	mov	rsp, rbx
	mov	rbx, QWORD PTR -56[rbp]
	sub	rbx, QWORD PTR fs:40
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	lea	rsp, -40[rbp]
	pop	rbx
	pop	r12
	pop	r13
	pop	r14
	pop	r15
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC4:
	.string	"Thread %d received token %d from thread %d\n"
	.text
	.globl	Number
	.type	Number, @function
Number:
.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	QWORD PTR -24[rbp], rdi
	mov	rax, QWORD PTR -24[rbp]
	mov	eax, DWORD PTR [rax]
	mov	DWORD PTR -4[rbp], eax
	cmp	DWORD PTR -4[rbp], 0
	jne	.L19
	lea	rdi, mutex[rip]
	call	pthread_mutex_lock@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	DWORD PTR last[rip], eax
	mov	DWORD PTR token[rip], 123
	lea	rdi, mutex[rip]
	call	pthread_mutex_unlock@PLT
	jmp	.L18
.L20:
	nop
.L19:
	mov	eax, DWORD PTR -4[rbp]
	lea	edx, -1[rax]
	mov	eax, DWORD PTR last[rip]
	cmp	edx, eax
	jg	.L20
	mov	eax, DWORD PTR -4[rbp]
	lea	ecx, -1[rax]
	mov	edx, DWORD PTR token[rip]
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, mutex[rip]
	call	pthread_mutex_lock@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	DWORD PTR last[rip], eax
	mov	eax, DWORD PTR token[rip]
	add	eax, 1
	mov	DWORD PTR token[rip], eax
	lea	rdi, mutex[rip]
	call	pthread_mutex_unlock@PLT
.L18:
	cmp	DWORD PTR -4[rbp], 0
	jne	.L21
	jmp	.L22
.L23:
	nop
.L22:
	mov	eax, DWORD PTR n[rip]
	lea	edx, -1[rax]
	mov	eax, DWORD PTR last[rip]
	cmp	edx, eax
	jg	.L23
	mov	eax, DWORD PTR n[rip]
	lea	ecx, -1[rax]
	mov	edx, DWORD PTR token[rip]
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
.L21:
	mov	edi, 0
	call	pthread_exit@PLT
	.cfi_endproc
.LFE7:
	.size	Number, .-Number
	.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	"54824182.c"
	.text
	.global	mutex
	.bss
	.align	2
	.type	mutex, %object
	.size	mutex, 24
mutex:
	.space	24
	.comm	i,4,4
	.comm	n,4,4
	.global	last
	.data
	.align	2
	.type	last, %object
	.size	last, 4
last:
	.word	-1
	.comm	ids,4,4
	.comm	token,4,4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Wrong numbers of parameters. Add n.\000"
	.align	2
.LC1:
	.ascii	"Error of allocating memory\000"
	.align	2
.LC2:
	.ascii	"Error of creating thread: %s\012\000"
	.align	2
.LC3:
	.ascii	"Error of joining thread: %s\012\000"
	.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 = 24
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #28
	str	r0, [fp, #-32]
	str	r1, [fp, #-36]
	ldr	r3, .L13
	ldr	r3, [r3]
	str	r3, [fp, #-16]
	mov	r3,#0
	mov	r3, sp
	mov	r4, r3
	ldr	r3, [fp, #-32]
	cmp	r3, #2
	beq	.L2
	ldr	r0, .L13+4
	bl	puts
	mvn	r3, #0
	b	.L3
.L2:
	ldr	r3, [fp, #-36]
	add	r3, r3, #4
	ldr	r3, [r3]
	mov	r0, r3
	bl	atoi
	mov	r3, r0
	ldr	r2, .L13+8
	str	r3, [r2]
	mov	r3, #0
	str	r3, [fp, #-28]
	ldr	r3, .L13+8
	ldr	r3, [r3]
	lsl	r3, r3, #2
	mov	r0, r3
	bl	malloc
	mov	r3, r0
	mov	r2, r3
	ldr	r3, .L13+12
	str	r2, [r3]
	ldr	r3, .L13+12
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L4
	ldr	r0, .L13+16
	bl	puts
	mvn	r3, #0
	b	.L3
.L4:
	ldr	r3, .L13+8
	ldr	ip, [r3]
	sub	r3, ip, #1
	str	r3, [fp, #-24]
	mov	r3, ip
	mov	r0, r3
	mov	r1, #0
	mov	r2, #0
	mov	r3, #0
	lsl	r3, r1, #5
	orr	r3, r3, r0, lsr #27
	lsl	r2, r0, #5
	mov	r3, ip
	mov	r0, r3
	mov	r1, #0
	mov	r2, #0
	mov	r3, #0
	lsl	r3, r1, #5
	orr	r3, r3, r0, lsr #27
	lsl	r2, r0, #5
	mov	r3, ip
	lsl	r3, r3, #2
	add	r3, r3, #7
	lsr	r3, r3, #3
	lsl	r3, r3, #3
	sub	sp, sp, r3
	mov	r3, sp
	add	r3, r3, #3
	lsr	r3, r3, #2
	lsl	r3, r3, #2
	str	r3, [fp, #-20]
	mov	r3, #0
	str	r3, [fp, #-28]
	b	.L5
.L7:
	ldr	r3, .L13+12
	ldr	r2, [r3]
	ldr	r3, [fp, #-28]
	lsl	r3, r3, #2
	add	r3, r2, r3
	ldr	r2, [fp, #-28]
	str	r2, [r3]
	ldr	r3, [fp, #-28]
	lsl	r3, r3, #2
	ldr	r2, [fp, #-20]
	add	r0, r2, r3
	ldr	r3, .L13+12
	ldr	r2, [r3]
	ldr	r3, [fp, #-28]
	lsl	r3, r3, #2
	add	r3, r2, r3
	ldr	r2, .L13+20
	mov	r1, #0
	bl	pthread_create
	mov	r3, r0
	cmp	r3, #0
	beq	.L6
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	strerror
	mov	r3, r0
	mov	r1, r3
	ldr	r0, .L13+24
	bl	printf
	mvn	r3, #0
	b	.L3
.L6:
	ldr	r3, [fp, #-28]
	add	r3, r3, #1
	str	r3, [fp, #-28]
.L5:
	ldr	r3, .L13+8
	ldr	r3, [r3]
	ldr	r2, [fp, #-28]
	cmp	r2, r3
	blt	.L7
	mov	r3, #0
	str	r3, [fp, #-28]
	b	.L8
.L10:
	ldr	r3, [fp, #-20]
	ldr	r2, [fp, #-28]
	ldr	r3, [r3, r2, lsl #2]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	mov	r3, r0
	cmp	r3, #0
	beq	.L9
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	mov	r0, r3
	bl	strerror
	mov	r3, r0
	mov	r1, r3
	ldr	r0, .L13+28
	bl	printf
	mvn	r0, #0
	bl	exit
.L9:
	ldr	r3, [fp, #-28]
	add	r3, r3, #1
	str	r3, [fp, #-28]
.L8:
	ldr	r3, .L13+8
	ldr	r3, [r3]
	ldr	r2, [fp, #-28]
	cmp	r2, r3
	blt	.L10
	mov	r3, #0
.L3:
	mov	sp, r4
	ldr	r2, .L13
	ldr	r1, [r2]
	ldr	r2, [fp, #-16]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L12
	bl	__stack_chk_fail
.L12:
	mov	r0, r3
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
.L14:
	.align	2
.L13:
	.word	.LC4
	.word	.LC0
	.word	n
	.word	ids
	.word	.LC1
	.word	Number
	.word	.LC2
	.word	.LC3
	.size	main, .-main
	.section	.rodata
	.align	2
.LC5:
	.ascii	"Thread %d received token %d from thread %d\012\000"
	.text
	.align	2
	.global	Number
	.syntax unified
	.arm
	.fpu softvfp
	.type	Number, %function
Number:
	@ 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]
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L18
	ldr	r0, .L23
	bl	pthread_mutex_lock
	ldr	r2, .L23+4
	ldr	r3, [fp, #-8]
	str	r3, [r2]
	ldr	r3, .L23+8
	mov	r2, #123
	str	r2, [r3]
	ldr	r0, .L23
	bl	pthread_mutex_unlock
	b	.L17
.L19:
	nop
.L18:
	ldr	r3, [fp, #-8]
	sub	r2, r3, #1
	ldr	r3, .L23+4
	ldr	r3, [r3]
	cmp	r2, r3
	bgt	.L19
	ldr	r3, .L23+8
	ldr	r2, [r3]
	ldr	r3, [fp, #-8]
	sub	r3, r3, #1
	ldr	r1, [fp, #-8]
	ldr	r0, .L23+12
	bl	printf
	ldr	r0, .L23
	bl	pthread_mutex_lock
	ldr	r2, .L23+4
	ldr	r3, [fp, #-8]
	str	r3, [r2]
	ldr	r3, .L23+8
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L23+8
	str	r3, [r2]
	ldr	r0, .L23
	bl	pthread_mutex_unlock
.L17:
	ldr	r3, [fp, #-8]
	cmp	r3, #0
	bne	.L20
	b	.L21
.L22:
	nop
.L21:
	ldr	r3, .L23+16
	ldr	r3, [r3]
	sub	r2, r3, #1
	ldr	r3, .L23+4
	ldr	r3, [r3]
	cmp	r2, r3
	bgt	.L22
	ldr	r3, .L23+8
	ldr	r2, [r3]
	ldr	r3, .L23+16
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r1, [fp, #-8]
	ldr	r0, .L23+12
	bl	printf
.L20:
	mov	r0, #0
	bl	pthread_exit
.L24:
	.align	2
.L23:
	.word	mutex
	.word	last
	.word	token
	.word	.LC5
	.word	n
	.size	Number, .-Number
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
