	.file	"93327.c"
	.intel_syntax noprefix
	.text
	.globl	begin
	.bss
	.align 4
	.type	begin, @object
	.size	begin, 4
begin:
	.zero	4
	.globl	end
	.align 4
	.type	end, @object
	.size	end, 4
end:
	.zero	4
	.globl	size
	.align 4
	.type	size, @object
	.size	size, 4
size:
	.zero	4
	.globl	fila
	.align 16
	.type	fila, @object
	.size	fila, 16
fila:
	.zero	16
	.globl	travaFila
	.align 32
	.type	travaFila, @object
	.size	travaFila, 40
travaFila:
	.zero	40
	.text
	.globl	vazio
	.type	vazio, @function
vazio:
.LFB6:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	eax, DWORD PTR size[rip]
	test	eax, eax
	sete	al
	movzx	eax, al
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	vazio, .-vazio
	.section	.rodata
	.align 8
.LC0:
	.string	"O cliente %d acorda o barbeiro e senta em sua cadeira.\n"
	.align 8
.LC1:
	.string	"O cliente %d senta em uma das cadeiras vagas da sala de espera.\n"
	.align 8
.LC2:
	.string	"Todas as cadeiras estavam ocupadas, o cliente %d foi embora.\n"
	.text
	.globl	enqueue
	.type	enqueue, @function
enqueue:
.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
	mov	eax, DWORD PTR size[rip]
	cmp	eax, 3
	jg	.L4
	mov	eax, 0
	call	vazio
	test	eax, eax
	je	.L5
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L6
.L5:
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
.L6:
	mov	eax, DWORD PTR end[rip]
	cdqe
	lea	rcx, 0[0+rax*4]
	lea	rdx, fila[rip]
	mov	eax, DWORD PTR -4[rbp]
	mov	DWORD PTR [rcx+rdx], eax
	mov	eax, DWORD PTR end[rip]
	add	eax, 1
	cdq
	shr	edx, 30
	add	eax, edx
	and	eax, 3
	sub	eax, edx
	mov	DWORD PTR end[rip], eax
	mov	eax, DWORD PTR size[rip]
	add	eax, 1
	mov	DWORD PTR size[rip], eax
	jmp	.L8
.L4:
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
.L8:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	enqueue, .-enqueue
	.section	.rodata
	.align 8
.LC3:
	.string	"O barbeiro termina de cortar o cabelo do cliente %d, que vai embora.\n"
	.align 8
.LC4:
	.string	"N\303\243o h\303\241 clientes para serem atendidos, o barbeiro vai dormir."
	.align 8
.LC5:
	.string	"O cliente %d senta na cadeira do barbeiro.\n"
	.text
	.globl	denqueue
	.type	denqueue, @function
denqueue:
.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	eax, 0
	call	vazio
	test	eax, eax
	jne	.L10
	mov	edi, 0
	call	time@PLT
	mov	edi, eax
	call	srand@PLT
	call	rand@PLT
	cdq
	shr	edx, 30
	add	eax, edx
	and	eax, 3
	sub	eax, edx
	add	eax, 1
	mov	edi, eax
	mov	eax, 0
	call	sleep@PLT
	mov	eax, DWORD PTR begin[rip]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, fila[rip]
	mov	eax, DWORD PTR [rdx+rax]
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR begin[rip]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, fila[rip]
	mov	eax, DWORD PTR [rdx+rax]
	mov	DWORD PTR -4[rbp], eax
	mov	eax, DWORD PTR begin[rip]
	add	eax, 1
	cdq
	shr	edx, 30
	add	eax, edx
	and	eax, 3
	sub	eax, edx
	mov	DWORD PTR begin[rip], eax
	mov	eax, DWORD PTR size[rip]
	sub	eax, 1
	mov	DWORD PTR size[rip], eax
	mov	eax, 0
	call	vazio
	test	eax, eax
	je	.L11
	lea	rdi, .LC4[rip]
	call	puts@PLT
	jmp	.L12
.L11:
	mov	eax, DWORD PTR begin[rip]
	cdqe
	lea	rdx, 0[0+rax*4]
	lea	rax, fila[rip]
	mov	eax, DWORD PTR [rdx+rax]
	mov	esi, eax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
.L12:
	mov	eax, DWORD PTR -4[rbp]
	jmp	.L13
.L10:
	mov	eax, -1
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	denqueue, .-denqueue
	.globl	cliente
	.type	cliente, @function
cliente:
.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	rax, QWORD PTR [rax]
	mov	QWORD PTR -8[rbp], rax
	lea	rdi, travaFila[rip]
	call	pthread_mutex_trylock@PLT
	mov	rax, QWORD PTR -8[rbp]
	mov	edi, eax
	call	enqueue
	lea	rdi, travaFila[rip]
	call	pthread_mutex_unlock@PLT
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	cliente, .-cliente
	.globl	barbeiro
	.type	barbeiro, @function
barbeiro:
.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, 16
	mov	QWORD PTR -8[rbp], rdi
.L16:
	lea	rdi, travaFila[rip]
	call	pthread_mutex_trylock@PLT
	mov	eax, 0
	call	denqueue
	lea	rdi, travaFila[rip]
	call	pthread_mutex_unlock@PLT
	jmp	.L16
	.cfi_endproc
.LFE10:
	.size	barbeiro, .-barbeiro
	.globl	main
	.type	main, @function
main:
.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, 32
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	esi, 0
	lea	rdi, travaFila[rip]
	call	pthread_mutex_init@PLT
	lea	rax, -24[rbp]
	mov	ecx, 0
	lea	rdx, barbeiro[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	mov	edi, 0
	call	time@PLT
	mov	edi, eax
	call	srand@PLT
	mov	DWORD PTR -28[rbp], 0
.L18:
	call	rand@PLT
	cdq
	shr	edx, 30
	add	eax, edx
	and	eax, 3
	sub	eax, edx
	add	eax, 1
	mov	edi, eax
	mov	eax, 0
	call	sleep@PLT
	lea	rdx, -28[rbp]
	lea	rax, -16[rbp]
	mov	rcx, rdx
	lea	rdx, cliente[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	mov	eax, DWORD PTR -28[rbp]
	add	eax, 1
	mov	DWORD PTR -28[rbp], eax
	jmp	.L18
	.cfi_endproc
.LFE11:
	.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	"93327.c"
	.text
	.global	begin
	.bss
	.align	2
	.type	begin, %object
	.size	begin, 4
begin:
	.space	4
	.global	end
	.align	2
	.type	end, %object
	.size	end, 4
end:
	.space	4
	.global	size
	.align	2
	.type	size, %object
	.size	size, 4
size:
	.space	4
	.comm	fila,16,4
	.comm	travaFila,24,4
	.text
	.align	2
	.global	vazio
	.syntax unified
	.arm
	.fpu softvfp
	.type	vazio, %function
vazio:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	ldr	r3, .L3
	ldr	r3, [r3]
	cmp	r3, #0
	moveq	r3, #1
	movne	r3, #0
	and	r3, r3, #255
	mov	r0, r3
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
.L4:
	.align	2
.L3:
	.word	size
	.size	vazio, .-vazio
	.section	.rodata
	.align	2
.LC0:
	.ascii	"O cliente %d acorda o barbeiro e senta em sua cadei"
	.ascii	"ra.\012\000"
	.align	2
.LC1:
	.ascii	"O cliente %d senta em uma das cadeiras vagas da sal"
	.ascii	"a de espera.\012\000"
	.align	2
.LC2:
	.ascii	"Todas as cadeiras estavam ocupadas, o cliente %d fo"
	.ascii	"i embora.\012\000"
	.text
	.align	2
	.global	enqueue
	.syntax unified
	.arm
	.fpu softvfp
	.type	enqueue, %function
enqueue:
	@ 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, .L11
	ldr	r3, [r3]
	cmp	r3, #3
	bgt	.L6
	bl	vazio
	mov	r3, r0
	cmp	r3, #0
	beq	.L7
	ldr	r1, [fp, #-8]
	ldr	r0, .L11+4
	bl	printf
	b	.L8
.L7:
	ldr	r1, [fp, #-8]
	ldr	r0, .L11+8
	bl	printf
.L8:
	ldr	r3, .L11+12
	ldr	r3, [r3]
	ldr	r1, .L11+16
	ldr	r2, [fp, #-8]
	str	r2, [r1, r3, lsl #2]
	ldr	r3, .L11+12
	ldr	r3, [r3]
	add	r3, r3, #1
	rsbs	r2, r3, #0
	and	r3, r3, #3
	and	r2, r2, #3
	rsbpl	r3, r2, #0
	ldr	r2, .L11+12
	str	r3, [r2]
	ldr	r3, .L11
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L11
	str	r3, [r2]
	b	.L10
.L6:
	ldr	r1, [fp, #-8]
	ldr	r0, .L11+20
	bl	printf
.L10:
	nop
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L12:
	.align	2
.L11:
	.word	size
	.word	.LC0
	.word	.LC1
	.word	end
	.word	fila
	.word	.LC2
	.size	enqueue, .-enqueue
	.section	.rodata
	.align	2
.LC3:
	.ascii	"O barbeiro termina de cortar o cabelo do cliente %d"
	.ascii	", que vai embora.\012\000"
	.align	2
.LC4:
	.ascii	"N\303\243o h\303\241 clientes para serem atendidos,"
	.ascii	" o barbeiro vai dormir.\000"
	.align	2
.LC5:
	.ascii	"O cliente %d senta na cadeira do barbeiro.\012\000"
	.text
	.align	2
	.global	denqueue
	.syntax unified
	.arm
	.fpu softvfp
	.type	denqueue, %function
denqueue:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #8
	bl	vazio
	mov	r3, r0
	cmp	r3, #0
	bne	.L14
	mov	r0, #0
	bl	time
	mov	r3, r0
	mov	r0, r3
	bl	srand
	bl	rand
	mov	r3, r0
	rsbs	r2, r3, #0
	and	r3, r3, #3
	and	r2, r2, #3
	rsbpl	r3, r2, #0
	add	r3, r3, #1
	mov	r0, r3
	bl	sleep
	ldr	r3, .L18
	ldr	r3, [r3]
	ldr	r2, .L18+4
	ldr	r3, [r2, r3, lsl #2]
	mov	r1, r3
	ldr	r0, .L18+8
	bl	printf
	ldr	r3, .L18
	ldr	r3, [r3]
	ldr	r2, .L18+4
	ldr	r3, [r2, r3, lsl #2]
	str	r3, [fp, #-8]
	ldr	r3, .L18
	ldr	r3, [r3]
	add	r3, r3, #1
	rsbs	r2, r3, #0
	and	r3, r3, #3
	and	r2, r2, #3
	rsbpl	r3, r2, #0
	ldr	r2, .L18
	str	r3, [r2]
	ldr	r3, .L18+12
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L18+12
	str	r3, [r2]
	bl	vazio
	mov	r3, r0
	cmp	r3, #0
	beq	.L15
	ldr	r0, .L18+16
	bl	puts
	b	.L16
.L15:
	ldr	r3, .L18
	ldr	r3, [r3]
	ldr	r2, .L18+4
	ldr	r3, [r2, r3, lsl #2]
	mov	r1, r3
	ldr	r0, .L18+20
	bl	printf
.L16:
	ldr	r3, [fp, #-8]
	b	.L17
.L14:
	mvn	r3, #0
.L17:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L19:
	.align	2
.L18:
	.word	begin
	.word	fila
	.word	.LC3
	.word	size
	.word	.LC4
	.word	.LC5
	.size	denqueue, .-denqueue
	.align	2
	.global	cliente
	.syntax unified
	.arm
	.fpu softvfp
	.type	cliente, %function
cliente:
	@ 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	r0, .L21
	bl	pthread_mutex_trylock
	ldr	r3, [fp, #-8]
	mov	r0, r3
	bl	enqueue
	ldr	r0, .L21
	bl	pthread_mutex_unlock
	nop
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L22:
	.align	2
.L21:
	.word	travaFila
	.size	cliente, .-cliente
	.align	2
	.global	barbeiro
	.syntax unified
	.arm
	.fpu softvfp
	.type	barbeiro, %function
barbeiro:
	@ 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]
.L24:
	ldr	r0, .L25
	bl	pthread_mutex_trylock
	bl	denqueue
	ldr	r0, .L25
	bl	pthread_mutex_unlock
	b	.L24
.L26:
	.align	2
.L25:
	.word	travaFila
	.size	barbeiro, .-barbeiro
	.section	.rodata
	.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
	ldr	r3, .L30
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r1, #0
	ldr	r0, .L30+4
	bl	pthread_mutex_init
	sub	r0, fp, #16
	mov	r3, #0
	ldr	r2, .L30+8
	mov	r1, #0
	bl	pthread_create
	mov	r0, #0
	bl	time
	mov	r3, r0
	mov	r0, r3
	bl	srand
	mov	r3, #0
	str	r3, [fp, #-20]
.L28:
	bl	rand
	mov	r3, r0
	rsbs	r2, r3, #0
	and	r3, r3, #3
	and	r2, r2, #3
	rsbpl	r3, r2, #0
	add	r3, r3, #1
	mov	r0, r3
	bl	sleep
	sub	r3, fp, #20
	sub	r0, fp, #12
	ldr	r2, .L30+12
	mov	r1, #0
	bl	pthread_create
	ldr	r3, [fp, #-20]
	add	r3, r3, #1
	str	r3, [fp, #-20]
	b	.L28
.L31:
	.align	2
.L30:
	.word	.LC6
	.word	travaFila
	.word	barbeiro
	.word	cliente
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
