	.file	"104829009.c"
	.intel_syntax noprefix
	.text
	.globl	max
	.data
	.align 32
	.type	max, @object
	.size	max, 128
max:
	.long	1
	.long	1
	.long	1
	.long	0
	.long	0
	.long	1
	.long	1
	.long	1
	.long	1
	.long	0
	.long	1
	.long	1
	.long	1
	.long	1
	.long	0
	.long	1
	.long	1
	.long	0
	.long	0
	.long	0
	.long	0
	.long	1
	.long	0
	.long	0
	.long	0
	.long	0
	.long	1
	.long	0
	.long	0
	.long	0
	.long	0
	.long	1
	.globl	available
	.bss
	.align 16
	.type	available, @object
	.size	available, 16
available:
	.zero	16
	.globl	allocation
	.align 32
	.type	allocation, @object
	.size	allocation, 128
allocation:
	.zero	128
	.globl	need
	.align 32
	.type	need, @object
	.size	need, 128
need:
	.zero	128
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	mutex1
	.align 32
	.type	mutex1, @object
	.size	mutex1, 32
mutex1:
	.zero	32
	.globl	mutex2
	.align 32
	.type	mutex2, @object
	.size	mutex2, 32
mutex2:
	.zero	32
	.globl	mutex3
	.align 32
	.type	mutex3, @object
	.size	mutex3, 32
mutex3:
	.zero	32
	.globl	mutex_array
	.align 32
	.type	mutex_array, @object
	.size	mutex_array, 256
mutex_array:
	.zero	256
	.globl	t
	.align 8
	.type	t, @object
	.size	t, 8
t:
	.zero	8
	.text
	.globl	sufficientResources
	.type	sufficientResources, @function
sufficientResources:
.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, 32
	mov	DWORD PTR -20[rbp], edi
	lea	rdi, mutex2[rip]
	call	sem_wait@PLT
	mov	DWORD PTR -8[rbp], 0
	jmp	.L2
.L5:
	mov	eax, DWORD PTR -8[rbp]
	movsx	rdx, eax
	mov	eax, DWORD PTR -20[rbp]
	cdqe
	sal	rax, 2
	add	rax, rdx
	lea	rdx, 0[0+rax*4]
	lea	rax, need[rip]
	mov	edx, DWORD PTR [rdx+rax]
	mov	eax, DWORD PTR -8[rbp]
	cdqe
	lea	rcx, 0[0+rax*4]
	lea	rax, available[rip]
	mov	eax, DWORD PTR [rcx+rax]
	cmp	edx, eax
	jle	.L3
	lea	rdi, mutex2[rip]
	call	sem_post@PLT
	mov	eax, 0
	jmp	.L4
.L3:
	add	DWORD PTR -8[rbp], 1
.L2:
	cmp	DWORD PTR -8[rbp], 3
	jle	.L5
	mov	DWORD PTR -4[rbp], 0
	jmp	.L6
.L7:
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	mov	eax, DWORD PTR -20[rbp]
	cdqe
	sal	rax, 2
	add	rax, rdx
	lea	rdx, 0[0+rax*4]
	lea	rax, allocation[rip]
	mov	ecx, DWORD PTR [rdx+rax]
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	mov	eax, DWORD PTR -20[rbp]
	cdqe
	sal	rax, 2
	add	rax, rdx
	lea	rdx, 0[0+rax*4]
	lea	rax, need[rip]
	mov	eax, DWORD PTR [rdx+rax]
	add	ecx, eax
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	mov	eax, DWORD PTR -20[rbp]
	cdqe
	sal	rax, 2
	add	rax, rdx
	lea	rdx, 0[0+rax*4]
	lea	rax, allocation[rip]
	mov	DWORD PTR [rdx+rax], ecx
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, available[rip]
	mov	eax, DWORD PTR [rdx+rax]
	mov	edx, DWORD PTR -4[rbp]
	movsx	rcx, edx
	mov	edx, DWORD PTR -20[rbp]
	movsx	rdx, edx
	sal	rdx, 2
	add	rdx, rcx
	lea	rcx, 0[0+rdx*4]
	lea	rdx, need[rip]
	mov	edx, DWORD PTR [rcx+rdx]
	sub	eax, edx
	mov	ecx, eax
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, available[rip]
	mov	DWORD PTR [rdx+rax], ecx
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	mov	eax, DWORD PTR -20[rbp]
	cdqe
	sal	rax, 2
	add	rax, rdx
	lea	rdx, 0[0+rax*4]
	lea	rax, need[rip]
	mov	DWORD PTR [rdx+rax], 0
	add	DWORD PTR -4[rbp], 1
.L6:
	cmp	DWORD PTR -4[rbp], 3
	jle	.L7
	lea	rdi, mutex2[rip]
	call	sem_post@PLT
	mov	eax, 1
.L4:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	sufficientResources, .-sufficientResources
	.section	.rodata
.LC0:
	.string	"Process %d is running\n"
	.text
	.globl	runProcess
	.type	runProcess, @function
runProcess:
.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, 16
	mov	DWORD PTR -4[rbp], edi
	lea	rdi, mutex1[rip]
	call	sem_wait@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, mutex1[rip]
	call	sem_post@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	runProcess, .-runProcess
	.section	.rodata
	.align 8
.LC1:
	.string	"Collecting resources from process %d\n"
	.align 8
.LC2:
	.string	"Resource A collected from process %d\n"
	.align 8
.LC3:
	.string	"Resource B collected from process %d\n"
	.align 8
.LC4:
	.string	"Resource C collected from process %d\n"
	.align 8
.LC5:
	.string	"Resource D collected from process %d\n"
	.align 8
.LC6:
	.string	"Finished execution of process %d\n"
	.text
	.globl	collectResources
	.type	collectResources, @function
collectResources:
.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	DWORD PTR -4[rbp], edi
	lea	rdi, mutex3[rip]
	call	sem_wait@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L11
.L15:
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	sal	rax, 4
	mov	rdx, rax
	lea	rax, allocation[rip]
	mov	eax, DWORD PTR [rdx+rax]
	test	eax, eax
	jle	.L12
	call	rand@PLT
	movsx	rdx, eax
	imul	rdx, rdx, 1374389535
	shr	rdx, 32
	sar	edx, 5
	mov	ecx, eax
	sar	ecx, 31
	sub	edx, ecx
	imul	ecx, edx, 100
	sub	eax, ecx
	mov	edx, eax
	cmp	edx, 66
	jg	.L12
	mov	ecx, DWORD PTR available[rip]
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	sal	rax, 4
	mov	rdx, rax
	lea	rax, allocation[rip]
	mov	eax, DWORD PTR [rdx+rax]
	add	eax, ecx
	mov	DWORD PTR available[rip], eax
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	sal	rax, 4
	mov	rdx, rax
	lea	rax, allocation[rip]
	mov	DWORD PTR [rdx+rax], 0
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	sal	rax, 4
	mov	rdx, rax
	lea	rax, max[rip]
	mov	eax, DWORD PTR [rdx+rax]
	mov	edx, DWORD PTR -4[rbp]
	movsx	rdx, edx
	mov	rcx, rdx
	sal	rcx, 4
	lea	rdx, need[rip]
	mov	DWORD PTR [rcx+rdx], eax
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
.L12:
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	sal	rax, 4
	mov	rdx, rax
	lea	rax, allocation[rip+4]
	mov	eax, DWORD PTR [rdx+rax]
	test	eax, eax
	jle	.L13
	call	rand@PLT
	movsx	rdx, eax
	imul	rdx, rdx, 1374389535
	shr	rdx, 32
	sar	edx, 5
	mov	ecx, eax
	sar	ecx, 31
	sub	edx, ecx
	imul	ecx, edx, 100
	sub	eax, ecx
	mov	edx, eax
	cmp	edx, 75
	jg	.L13
	mov	ecx, DWORD PTR available[rip+4]
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	sal	rax, 4
	mov	rdx, rax
	lea	rax, allocation[rip+4]
	mov	eax, DWORD PTR [rdx+rax]
	add	eax, ecx
	mov	DWORD PTR available[rip+4], eax
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	sal	rax, 4
	mov	rdx, rax
	lea	rax, allocation[rip+4]
	mov	DWORD PTR [rdx+rax], 0
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	sal	rax, 4
	mov	rdx, rax
	lea	rax, max[rip+4]
	mov	eax, DWORD PTR [rdx+rax]
	mov	edx, DWORD PTR -4[rbp]
	movsx	rdx, edx
	mov	rcx, rdx
	sal	rcx, 4
	lea	rdx, need[rip+4]
	mov	DWORD PTR [rcx+rdx], eax
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
.L13:
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	sal	rax, 4
	mov	rdx, rax
	lea	rax, allocation[rip+8]
	mov	eax, DWORD PTR [rdx+rax]
	test	eax, eax
	jle	.L14
	call	rand@PLT
	movsx	rdx, eax
	imul	rdx, rdx, 1374389535
	shr	rdx, 32
	sar	edx, 5
	mov	ecx, eax
	sar	ecx, 31
	sub	edx, ecx
	imul	ecx, edx, 100
	sub	eax, ecx
	mov	edx, eax
	cmp	edx, 60
	jg	.L14
	mov	ecx, DWORD PTR available[rip+8]
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	sal	rax, 4
	mov	rdx, rax
	lea	rax, allocation[rip+8]
	mov	eax, DWORD PTR [rdx+rax]
	add	eax, ecx
	mov	DWORD PTR available[rip+8], eax
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	sal	rax, 4
	mov	rdx, rax
	lea	rax, allocation[rip+8]
	mov	DWORD PTR [rdx+rax], 0
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	sal	rax, 4
	mov	rdx, rax
	lea	rax, max[rip+8]
	mov	eax, DWORD PTR [rdx+rax]
	mov	edx, DWORD PTR -4[rbp]
	movsx	rdx, edx
	mov	rcx, rdx
	sal	rcx, 4
	lea	rdx, need[rip+8]
	mov	DWORD PTR [rcx+rdx], eax
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
.L14:
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	sal	rax, 4
	mov	rdx, rax
	lea	rax, allocation[rip+12]
	mov	eax, DWORD PTR [rdx+rax]
	test	eax, eax
	jle	.L11
	call	rand@PLT
	movsx	rdx, eax
	imul	rdx, rdx, 1374389535
	shr	rdx, 32
	sar	edx, 5
	mov	ecx, eax
	sar	ecx, 31
	sub	edx, ecx
	imul	ecx, edx, 100
	sub	eax, ecx
	mov	edx, eax
	cmp	edx, 66
	jg	.L11
	mov	ecx, DWORD PTR available[rip+12]
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	sal	rax, 4
	mov	rdx, rax
	lea	rax, allocation[rip+12]
	mov	eax, DWORD PTR [rdx+rax]
	add	eax, ecx
	mov	DWORD PTR available[rip+12], eax
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	sal	rax, 4
	mov	rdx, rax
	lea	rax, allocation[rip+12]
	mov	DWORD PTR [rdx+rax], 0
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	sal	rax, 4
	mov	rdx, rax
	lea	rax, max[rip+12]
	mov	eax, DWORD PTR [rdx+rax]
	mov	edx, DWORD PTR -4[rbp]
	movsx	rdx, edx
	mov	rcx, rdx
	sal	rcx, 4
	lea	rdx, need[rip+12]
	mov	DWORD PTR [rcx+rdx], eax
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
.L11:
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	sal	rax, 4
	mov	rdx, rax
	lea	rax, allocation[rip]
	mov	eax, DWORD PTR [rdx+rax]
	test	eax, eax
	jg	.L15
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	sal	rax, 4
	mov	rdx, rax
	lea	rax, allocation[rip+4]
	mov	eax, DWORD PTR [rdx+rax]
	test	eax, eax
	jg	.L15
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	sal	rax, 4
	mov	rdx, rax
	lea	rax, allocation[rip+8]
	mov	eax, DWORD PTR [rdx+rax]
	test	eax, eax
	jg	.L15
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	sal	rax, 4
	mov	rdx, rax
	lea	rax, allocation[rip+12]
	mov	eax, DWORD PTR [rdx+rax]
	test	eax, eax
	jg	.L15
	lea	rdi, mutex3[rip]
	call	sem_post@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	printf@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	collectResources, .-collectResources
	.section	.rodata
	.align 8
.LC7:
	.string	"Execution of process %d is starting\n"
	.text
	.globl	processCode
	.type	processCode, @function
processCode:
.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, 32
	mov	QWORD PTR -24[rbp], rdi
	mov	rax, QWORD PTR -24[rbp]
	mov	eax, DWORD PTR [rax]
	mov	DWORD PTR -4[rbp], eax
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	sal	rax, 5
	mov	rdx, rax
	lea	rax, mutex_array[rip]
	add	rax, rdx
	mov	rdi, rax
	call	sem_wait@PLT
	nop
.L18:
	mov	eax, DWORD PTR -4[rbp]
	mov	edi, eax
	call	sufficientResources
	xor	eax, 1
	test	al, al
	jne	.L18
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC7[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	edi, eax
	call	runProcess
	mov	eax, DWORD PTR -4[rbp]
	mov	edi, eax
	call	collectResources
	mov	eax, DWORD PTR -4[rbp]
	cdqe
	sal	rax, 5
	mov	rdx, rax
	lea	rax, mutex_array[rip]
	add	rax, rdx
	mov	rdi, rax
	call	sem_post@PLT
	mov	edi, 0
	call	pthread_exit@PLT
	.cfi_endproc
.LFE9:
	.size	processCode, .-processCode
	.section	.rodata
.LC8:
	.string	"%d"
.LC9:
	.string	"%d %d %d %d"
.LC10:
	.string	"Error in creating thread %d\n"
	.text
	.globl	main
	.type	main, @function
main:
.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, 176
	mov	DWORD PTR -164[rbp], edi
	mov	QWORD PTR -176[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	edx, 1
	mov	esi, 0
	lea	rdi, mutex1[rip]
	call	sem_init@PLT
	mov	edx, 1
	mov	esi, 0
	lea	rdi, mutex2[rip]
	call	sem_init@PLT
	mov	edx, 1
	mov	esi, 0
	lea	rdi, mutex3[rip]
	call	sem_init@PLT
	lea	rdi, t[rip]
	call	time@PLT
	mov	edi, eax
	call	srand@PLT
	lea	rsi, k[rip]
	lea	rdi, .LC8[rip]
	mov	eax, 0
	call	__isoc99_scanf@PLT
	lea	rsi, -144[rbp]
	lea	rcx, -148[rbp]
	lea	rdx, -152[rbp]
	lea	rax, -156[rbp]
	mov	r8, rsi
	mov	rsi, rax
	lea	rdi, .LC9[rip]
	mov	eax, 0
	call	__isoc99_scanf@PLT
	mov	eax, DWORD PTR -156[rbp]
	mov	DWORD PTR available[rip], eax
	mov	eax, DWORD PTR -152[rbp]
	mov	DWORD PTR available[rip+4], eax
	mov	eax, DWORD PTR -148[rbp]
	mov	DWORD PTR available[rip+8], eax
	mov	eax, DWORD PTR -144[rbp]
	mov	DWORD PTR available[rip+12], eax
	mov	DWORD PTR -140[rbp], 0
	jmp	.L20
.L23:
	mov	DWORD PTR -136[rbp], 0
	jmp	.L21
.L22:
	mov	eax, DWORD PTR -136[rbp]
	movsx	rdx, eax
	mov	eax, DWORD PTR -140[rbp]
	cdqe
	sal	rax, 2
	add	rax, rdx
	lea	rdx, 0[0+rax*4]
	lea	rax, max[rip]
	mov	eax, DWORD PTR [rdx+rax]
	mov	edx, DWORD PTR -136[rbp]
	movsx	rcx, edx
	mov	edx, DWORD PTR -140[rbp]
	movsx	rdx, edx
	sal	rdx, 2
	add	rdx, rcx
	lea	rcx, 0[0+rdx*4]
	lea	rdx, allocation[rip]
	mov	edx, DWORD PTR [rcx+rdx]
	sub	eax, edx
	mov	ecx, eax
	mov	eax, DWORD PTR -136[rbp]
	movsx	rdx, eax
	mov	eax, DWORD PTR -140[rbp]
	cdqe
	sal	rax, 2
	add	rax, rdx
	lea	rdx, 0[0+rax*4]
	lea	rax, need[rip]
	mov	DWORD PTR [rdx+rax], ecx
	add	DWORD PTR -136[rbp], 1
.L21:
	cmp	DWORD PTR -136[rbp], 3
	jle	.L22
	add	DWORD PTR -140[rbp], 1
.L20:
	cmp	DWORD PTR -140[rbp], 7
	jle	.L23
	mov	DWORD PTR -132[rbp], 0
	jmp	.L24
.L25:
	mov	eax, DWORD PTR -132[rbp]
	cdqe
	mov	edx, DWORD PTR -132[rbp]
	mov	DWORD PTR -112[rbp+rax*4], edx
	mov	eax, DWORD PTR -132[rbp]
	cdqe
	sal	rax, 5
	mov	rdx, rax
	lea	rax, mutex_array[rip]
	add	rax, rdx
	mov	edx, 1
	mov	esi, 0
	mov	rdi, rax
	call	sem_init@PLT
	add	DWORD PTR -132[rbp], 1
.L24:
	cmp	DWORD PTR -132[rbp], 7
	jle	.L25
	mov	DWORD PTR -128[rbp], 0
	jmp	.L26
.L30:
	mov	eax, DWORD PTR -128[rbp]
	movsx	rdx, eax
	mov	eax, DWORD PTR -128[rbp]
	cdqe
	mov	QWORD PTR -80[rbp+rax*8], rdx
	mov	DWORD PTR -124[rbp], 0
	jmp	.L27
.L29:
	lea	rdx, -112[rbp]
	mov	eax, DWORD PTR -128[rbp]
	cdqe
	sal	rax, 2
	add	rdx, rax
	lea	rcx, -80[rbp]
	mov	eax, DWORD PTR -128[rbp]
	cdqe
	sal	rax, 3
	add	rax, rcx
	mov	rcx, rdx
	lea	rdx, processCode[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	mov	DWORD PTR -116[rbp], eax
	cmp	DWORD PTR -116[rbp], 0
	je	.L28
	mov	eax, DWORD PTR -128[rbp]
	mov	esi, eax
	lea	rdi, .LC10[rip]
	mov	eax, 0
	call	printf@PLT
.L28:
	add	DWORD PTR -124[rbp], 1
.L27:
	mov	eax, DWORD PTR k[rip]
	cmp	DWORD PTR -124[rbp], eax
	jl	.L29
	add	DWORD PTR -128[rbp], 1
.L26:
	cmp	DWORD PTR -128[rbp], 7
	jle	.L30
	mov	DWORD PTR -120[rbp], 0
	jmp	.L31
.L32:
	mov	eax, DWORD PTR -120[rbp]
	cdqe
	mov	rax, QWORD PTR -80[rbp+rax*8]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	add	DWORD PTR -120[rbp], 1
.L31:
	cmp	DWORD PTR -120[rbp], 7
	jle	.L32
	mov	eax, 0
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L34
	call	__stack_chk_fail@PLT
.L34:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.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	"104829009.c"
	.text
	.global	max
	.data
	.align	2
	.type	max, %object
	.size	max, 128
max:
	.word	1
	.word	1
	.word	1
	.word	0
	.word	0
	.word	1
	.word	1
	.word	1
	.word	1
	.word	0
	.word	1
	.word	1
	.word	1
	.word	1
	.word	0
	.word	1
	.word	1
	.word	0
	.word	0
	.word	0
	.word	0
	.word	1
	.word	0
	.word	0
	.word	0
	.word	0
	.word	1
	.word	0
	.word	0
	.word	0
	.word	0
	.word	1
	.comm	available,16,4
	.global	allocation
	.bss
	.align	2
	.type	allocation, %object
	.size	allocation, 128
allocation:
	.space	128
	.comm	need,128,4
	.comm	k,4,4
	.comm	mutex1,16,4
	.comm	mutex2,16,4
	.comm	mutex3,16,4
	.comm	mutex_array,128,4
	.comm	t,4,4
	.text
	.align	2
	.global	sufficientResources
	.syntax unified
	.arm
	.fpu softvfp
	.type	sufficientResources, %function
sufficientResources:
	@ 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	r0, .L8
	bl	sem_wait
	mov	r3, #0
	str	r3, [fp, #-12]
	b	.L2
.L5:
	ldr	r1, .L8+4
	ldr	r3, [fp, #-16]
	lsl	r2, r3, #2
	ldr	r3, [fp, #-12]
	add	r3, r2, r3
	ldr	r2, [r1, r3, lsl #2]
	ldr	r1, .L8+8
	ldr	r3, [fp, #-12]
	ldr	r3, [r1, r3, lsl #2]
	cmp	r2, r3
	ble	.L3
	ldr	r0, .L8
	bl	sem_post
	mov	r3, #0
	b	.L4
.L3:
	ldr	r3, [fp, #-12]
	add	r3, r3, #1
	str	r3, [fp, #-12]
.L2:
	ldr	r3, [fp, #-12]
	cmp	r3, #3
	ble	.L5
	mov	r3, #0
	str	r3, [fp, #-8]
	b	.L6
.L7:
	ldr	r1, .L8+12
	ldr	r3, [fp, #-16]
	lsl	r2, r3, #2
	ldr	r3, [fp, #-8]
	add	r3, r2, r3
	ldr	r2, [r1, r3, lsl #2]
	ldr	r0, .L8+4
	ldr	r3, [fp, #-16]
	lsl	r1, r3, #2
	ldr	r3, [fp, #-8]
	add	r3, r1, r3
	ldr	r3, [r0, r3, lsl #2]
	add	r2, r2, r3
	ldr	r0, .L8+12
	ldr	r3, [fp, #-16]
	lsl	r1, r3, #2
	ldr	r3, [fp, #-8]
	add	r3, r1, r3
	str	r2, [r0, r3, lsl #2]
	ldr	r2, .L8+8
	ldr	r3, [fp, #-8]
	ldr	r2, [r2, r3, lsl #2]
	ldr	r0, .L8+4
	ldr	r3, [fp, #-16]
	lsl	r1, r3, #2
	ldr	r3, [fp, #-8]
	add	r3, r1, r3
	ldr	r3, [r0, r3, lsl #2]
	sub	r2, r2, r3
	ldr	r1, .L8+8
	ldr	r3, [fp, #-8]
	str	r2, [r1, r3, lsl #2]
	ldr	r1, .L8+4
	ldr	r3, [fp, #-16]
	lsl	r2, r3, #2
	ldr	r3, [fp, #-8]
	add	r3, r2, r3
	mov	r2, #0
	str	r2, [r1, r3, lsl #2]
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L6:
	ldr	r3, [fp, #-8]
	cmp	r3, #3
	ble	.L7
	ldr	r0, .L8
	bl	sem_post
	mov	r3, #1
.L4:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L9:
	.align	2
.L8:
	.word	mutex2
	.word	need
	.word	available
	.word	allocation
	.size	sufficientResources, .-sufficientResources
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Process %d is running\012\000"
	.text
	.align	2
	.global	runProcess
	.syntax unified
	.arm
	.fpu softvfp
	.type	runProcess, %function
runProcess:
	@ 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, .L12
	bl	sem_wait
	ldr	r1, [fp, #-8]
	ldr	r0, .L12+4
	bl	printf
	ldr	r0, .L12
	bl	sem_post
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L13:
	.align	2
.L12:
	.word	mutex1
	.word	.LC0
	.size	runProcess, .-runProcess
	.section	.rodata
	.align	2
.LC1:
	.ascii	"Collecting resources from process %d\012\000"
	.align	2
.LC2:
	.ascii	"Resource A collected from process %d\012\000"
	.align	2
.LC3:
	.ascii	"Resource B collected from process %d\012\000"
	.align	2
.LC4:
	.ascii	"Resource C collected from process %d\012\000"
	.align	2
.LC5:
	.ascii	"Resource D collected from process %d\012\000"
	.align	2
.LC6:
	.ascii	"Finished execution of process %d\012\000"
	.text
	.align	2
	.global	collectResources
	.syntax unified
	.arm
	.fpu softvfp
	.type	collectResources, %function
collectResources:
	@ 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, .L21
	bl	sem_wait
	ldr	r1, [fp, #-8]
	ldr	r0, .L21+4
	bl	printf
	b	.L15
.L19:
	ldr	r2, .L21+8
	ldr	r3, [fp, #-8]
	ldr	r3, [r2, r3, lsl #4]
	cmp	r3, #0
	ble	.L16
	bl	rand
	mov	r1, r0
	ldr	r3, .L21+12
	smull	r2, r3, r1, r3
	asr	r2, r3, #5
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r2, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #2
	sub	r2, r1, r3
	cmp	r2, #66
	bgt	.L16
	ldr	r3, .L21+16
	ldr	r2, [r3]
	ldr	r1, .L21+8
	ldr	r3, [fp, #-8]
	ldr	r3, [r1, r3, lsl #4]
	add	r3, r2, r3
	ldr	r2, .L21+16
	str	r3, [r2]
	ldr	r2, .L21+8
	ldr	r3, [fp, #-8]
	mov	r1, #0
	str	r1, [r2, r3, lsl #4]
	ldr	r2, .L21+20
	ldr	r3, [fp, #-8]
	ldr	r2, [r2, r3, lsl #4]
	ldr	r1, .L21+24
	ldr	r3, [fp, #-8]
	str	r2, [r1, r3, lsl #4]
	ldr	r1, [fp, #-8]
	ldr	r0, .L21+28
	bl	printf
.L16:
	ldr	r2, .L21+8
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #4
	add	r3, r2, r3
	ldr	r3, [r3, #4]
	cmp	r3, #0
	ble	.L17
	bl	rand
	mov	r1, r0
	ldr	r3, .L21+12
	smull	r2, r3, r1, r3
	asr	r2, r3, #5
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r2, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #2
	sub	r2, r1, r3
	cmp	r2, #75
	bgt	.L17
	ldr	r3, .L21+16
	ldr	r2, [r3, #4]
	ldr	r1, .L21+8
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #4
	add	r3, r1, r3
	ldr	r3, [r3, #4]
	add	r3, r2, r3
	ldr	r2, .L21+16
	str	r3, [r2, #4]
	ldr	r2, .L21+8
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #4
	add	r3, r2, r3
	mov	r2, #0
	str	r2, [r3, #4]
	ldr	r2, .L21+20
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #4
	add	r3, r2, r3
	ldr	r2, [r3, #4]
	ldr	r1, .L21+24
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #4
	add	r3, r1, r3
	str	r2, [r3, #4]
	ldr	r1, [fp, #-8]
	ldr	r0, .L21+32
	bl	printf
.L17:
	ldr	r2, .L21+8
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #4
	add	r3, r2, r3
	ldr	r3, [r3, #8]
	cmp	r3, #0
	ble	.L18
	bl	rand
	mov	r1, r0
	ldr	r3, .L21+12
	smull	r2, r3, r1, r3
	asr	r2, r3, #5
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r2, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #2
	sub	r2, r1, r3
	cmp	r2, #60
	bgt	.L18
	ldr	r3, .L21+16
	ldr	r2, [r3, #8]
	ldr	r1, .L21+8
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #4
	add	r3, r1, r3
	ldr	r3, [r3, #8]
	add	r3, r2, r3
	ldr	r2, .L21+16
	str	r3, [r2, #8]
	ldr	r2, .L21+8
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #4
	add	r3, r2, r3
	mov	r2, #0
	str	r2, [r3, #8]
	ldr	r2, .L21+20
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #4
	add	r3, r2, r3
	ldr	r2, [r3, #8]
	ldr	r1, .L21+24
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #4
	add	r3, r1, r3
	str	r2, [r3, #8]
	ldr	r1, [fp, #-8]
	ldr	r0, .L21+36
	bl	printf
.L18:
	ldr	r2, .L21+8
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #4
	add	r3, r2, r3
	ldr	r3, [r3, #12]
	cmp	r3, #0
	ble	.L15
	bl	rand
	mov	r1, r0
	ldr	r3, .L21+12
	smull	r2, r3, r1, r3
	asr	r2, r3, #5
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #2
	add	r3, r3, r2
	lsl	r2, r3, #2
	add	r3, r3, r2
	lsl	r3, r3, #2
	sub	r2, r1, r3
	cmp	r2, #66
	bgt	.L15
	ldr	r3, .L21+16
	ldr	r2, [r3, #12]
	ldr	r1, .L21+8
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #4
	add	r3, r1, r3
	ldr	r3, [r3, #12]
	add	r3, r2, r3
	ldr	r2, .L21+16
	str	r3, [r2, #12]
	ldr	r2, .L21+8
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #4
	add	r3, r2, r3
	mov	r2, #0
	str	r2, [r3, #12]
	ldr	r2, .L21+20
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #4
	add	r3, r2, r3
	ldr	r2, [r3, #12]
	ldr	r1, .L21+24
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #4
	add	r3, r1, r3
	str	r2, [r3, #12]
	ldr	r1, [fp, #-8]
	ldr	r0, .L21+40
	bl	printf
.L15:
	ldr	r2, .L21+8
	ldr	r3, [fp, #-8]
	ldr	r3, [r2, r3, lsl #4]
	cmp	r3, #0
	bgt	.L19
	ldr	r2, .L21+8
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #4
	add	r3, r2, r3
	ldr	r3, [r3, #4]
	cmp	r3, #0
	bgt	.L19
	ldr	r2, .L21+8
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #4
	add	r3, r2, r3
	ldr	r3, [r3, #8]
	cmp	r3, #0
	bgt	.L19
	ldr	r2, .L21+8
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #4
	add	r3, r2, r3
	ldr	r3, [r3, #12]
	cmp	r3, #0
	bgt	.L19
	ldr	r0, .L21
	bl	sem_post
	ldr	r1, [fp, #-8]
	ldr	r0, .L21+44
	bl	printf
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L22:
	.align	2
.L21:
	.word	mutex3
	.word	.LC1
	.word	allocation
	.word	1374389535
	.word	available
	.word	max
	.word	need
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.size	collectResources, .-collectResources
	.section	.rodata
	.align	2
.LC7:
	.ascii	"Execution of process %d is starting\012\000"
	.text
	.align	2
	.global	processCode
	.syntax unified
	.arm
	.fpu softvfp
	.type	processCode, %function
processCode:
	@ 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]
	lsl	r3, r3, #4
	ldr	r2, .L25
	add	r3, r3, r2
	mov	r0, r3
	bl	sem_wait
	nop
.L24:
	ldr	r0, [fp, #-8]
	bl	sufficientResources
	mov	r3, r0
	eor	r3, r3, #1
	and	r3, r3, #255
	cmp	r3, #0
	bne	.L24
	ldr	r1, [fp, #-8]
	ldr	r0, .L25+4
	bl	printf
	ldr	r0, [fp, #-8]
	bl	runProcess
	ldr	r0, [fp, #-8]
	bl	collectResources
	ldr	r3, [fp, #-8]
	lsl	r3, r3, #4
	ldr	r2, .L25
	add	r3, r3, r2
	mov	r0, r3
	bl	sem_post
	mov	r0, #0
	bl	pthread_exit
.L26:
	.align	2
.L25:
	.word	mutex_array
	.word	.LC7
	.size	processCode, .-processCode
	.section	.rodata
	.align	2
.LC8:
	.ascii	"%d\000"
	.align	2
.LC9:
	.ascii	"%d %d %d %d\000"
	.align	2
.LC10:
	.ascii	"Error in creating thread %d\012\000"
	.align	2
.LC11:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 120
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #128
	str	r0, [fp, #-120]
	str	r1, [fp, #-124]
	ldr	r3, .L43
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r2, #1
	mov	r1, #0
	ldr	r0, .L43+4
	bl	sem_init
	mov	r2, #1
	mov	r1, #0
	ldr	r0, .L43+8
	bl	sem_init
	mov	r2, #1
	mov	r1, #0
	ldr	r0, .L43+12
	bl	sem_init
	ldr	r0, .L43+16
	bl	time
	mov	r3, r0
	mov	r0, r3
	bl	srand
	ldr	r1, .L43+20
	ldr	r0, .L43+24
	bl	__isoc99_scanf
	sub	r0, fp, #108
	sub	r2, fp, #112
	sub	r1, fp, #116
	sub	r3, fp, #104
	str	r3, [sp]
	mov	r3, r0
	ldr	r0, .L43+28
	bl	__isoc99_scanf
	ldr	r3, [fp, #-116]
	ldr	r2, .L43+32
	str	r3, [r2]
	ldr	r3, [fp, #-112]
	ldr	r2, .L43+32
	str	r3, [r2, #4]
	ldr	r3, [fp, #-108]
	ldr	r2, .L43+32
	str	r3, [r2, #8]
	ldr	r3, [fp, #-104]
	ldr	r2, .L43+32
	str	r3, [r2, #12]
	mov	r3, #0
	str	r3, [fp, #-100]
	b	.L28
.L31:
	mov	r3, #0
	str	r3, [fp, #-96]
	b	.L29
.L30:
	ldr	r1, .L43+36
	ldr	r3, [fp, #-100]
	lsl	r2, r3, #2
	ldr	r3, [fp, #-96]
	add	r3, r2, r3
	ldr	r2, [r1, r3, lsl #2]
	ldr	r0, .L43+40
	ldr	r3, [fp, #-100]
	lsl	r1, r3, #2
	ldr	r3, [fp, #-96]
	add	r3, r1, r3
	ldr	r3, [r0, r3, lsl #2]
	sub	r2, r2, r3
	ldr	r0, .L43+44
	ldr	r3, [fp, #-100]
	lsl	r1, r3, #2
	ldr	r3, [fp, #-96]
	add	r3, r1, r3
	str	r2, [r0, r3, lsl #2]
	ldr	r3, [fp, #-96]
	add	r3, r3, #1
	str	r3, [fp, #-96]
.L29:
	ldr	r3, [fp, #-96]
	cmp	r3, #3
	ble	.L30
	ldr	r3, [fp, #-100]
	add	r3, r3, #1
	str	r3, [fp, #-100]
.L28:
	ldr	r3, [fp, #-100]
	cmp	r3, #7
	ble	.L31
	mov	r3, #0
	str	r3, [fp, #-92]
	b	.L32
.L33:
	ldr	r3, [fp, #-92]
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r2, [fp, #-92]
	str	r2, [r3, #-68]
	ldr	r3, [fp, #-92]
	lsl	r3, r3, #4
	ldr	r2, .L43+48
	add	r3, r3, r2
	mov	r2, #1
	mov	r1, #0
	mov	r0, r3
	bl	sem_init
	ldr	r3, [fp, #-92]
	add	r3, r3, #1
	str	r3, [fp, #-92]
.L32:
	ldr	r3, [fp, #-92]
	cmp	r3, #7
	ble	.L33
	mov	r3, #0
	str	r3, [fp, #-88]
	b	.L34
.L38:
	ldr	r2, [fp, #-88]
	ldr	r3, [fp, #-88]
	lsl	r3, r3, #2
	sub	r1, fp, #4
	add	r3, r1, r3
	str	r2, [r3, #-36]
	mov	r3, #0
	str	r3, [fp, #-84]
	b	.L35
.L37:
	sub	r2, fp, #40
	ldr	r3, [fp, #-88]
	lsl	r3, r3, #2
	add	r0, r2, r3
	sub	r2, fp, #72
	ldr	r3, [fp, #-88]
	lsl	r3, r3, #2
	add	r3, r2, r3
	ldr	r2, .L43+52
	mov	r1, #0
	bl	pthread_create
	str	r0, [fp, #-76]
	ldr	r3, [fp, #-76]
	cmp	r3, #0
	beq	.L36
	ldr	r1, [fp, #-88]
	ldr	r0, .L43+56
	bl	printf
.L36:
	ldr	r3, [fp, #-84]
	add	r3, r3, #1
	str	r3, [fp, #-84]
.L35:
	ldr	r3, .L43+20
	ldr	r3, [r3]
	ldr	r2, [fp, #-84]
	cmp	r2, r3
	blt	.L37
	ldr	r3, [fp, #-88]
	add	r3, r3, #1
	str	r3, [fp, #-88]
.L34:
	ldr	r3, [fp, #-88]
	cmp	r3, #7
	ble	.L38
	mov	r3, #0
	str	r3, [fp, #-80]
	b	.L39
.L40:
	ldr	r3, [fp, #-80]
	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, #-80]
	add	r3, r3, #1
	str	r3, [fp, #-80]
.L39:
	ldr	r3, [fp, #-80]
	cmp	r3, #7
	ble	.L40
	mov	r3, #0
	ldr	r2, .L43
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L42
	bl	__stack_chk_fail
.L42:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L44:
	.align	2
.L43:
	.word	.LC11
	.word	mutex1
	.word	mutex2
	.word	mutex3
	.word	t
	.word	k
	.word	.LC8
	.word	.LC9
	.word	available
	.word	max
	.word	allocation
	.word	need
	.word	mutex_array
	.word	processCode
	.word	.LC10
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
