	.file	"660815.c"
	.intel_syntax noprefix
	.text
	.globl	CADEIRAS
	.section	.rodata
	.align 4
	.type	CADEIRAS, @object
	.size	CADEIRAS, 4
CADEIRAS:
	.long	5
	.globl	qtdClientesAguardando
	.bss
	.align 4
	.type	qtdClientesAguardando, @object
	.size	qtdClientesAguardando, 4
qtdClientesAguardando:
	.zero	4
	.globl	clientes
	.align 32
	.type	clientes, @object
	.size	clientes, 32
clientes:
	.zero	32
	.globl	barbeiro
	.align 32
	.type	barbeiro, @object
	.size	barbeiro, 32
barbeiro:
	.zero	32
	.globl	mutex
	.align 32
	.type	mutex, @object
	.size	mutex, 32
mutex:
	.zero	32
	.section	.rodata
.LC0:
	.string	"\033[1;1H\033[2J"
	.align 8
.LC1:
	.string	"+---------------------------------------------------------------+"
	.align 8
.LC2:
	.string	"|        PONTIFICIA UNIVERSIDADE CATOLICA DE GOIAS              |"
	.align 8
.LC3:
	.string	"| Aluno: Silas dos S. Silva          Matricula: 2011.1.033.0188 |"
	.align 8
.LC4:
	.string	"|              O PROBLEMA DO BARBEIRO DORMINHOCO                |"
	.align 8
.LC5:
	.string	"| Quantidade de Cadeiras dispon\303\255veis: %d                         |\n"
	.align 8
.LC6:
	.string	"| Taxa de chegada de clientes: Distribui\303\247\303\243o normal de 1.0 a 3.0 |"
	.align 8
.LC7:
	.string	"| Tempo de atendimento do barbeiro: 1 cliente a cada 3 segundos |\n"
	.text
	.globl	cabecalho
	.type	cabecalho, @function
cabecalho:
.LFB6:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, .LC1[rip]
	call	puts@PLT
	lea	rdi, .LC2[rip]
	call	puts@PLT
	lea	rdi, .LC3[rip]
	call	puts@PLT
	lea	rdi, .LC4[rip]
	call	puts@PLT
	lea	rdi, .LC1[rip]
	call	puts@PLT
	mov	eax, 5
	mov	esi, eax
	lea	rdi, .LC5[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, .LC6[rip]
	call	puts@PLT
	lea	rdi, .LC7[rip]
	call	puts@PLT
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	cabecalho, .-cabecalho
	.globl	main
	.type	main, @function
main:
.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	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	eax, 0
	call	cabecalho
	mov	edx, 0
	mov	esi, 1
	lea	rdi, clientes[rip]
	call	sem_init@PLT
	mov	edx, 0
	mov	esi, 1
	lea	rdi, barbeiro[rip]
	call	sem_init@PLT
	mov	edx, 1
	mov	esi, 1
	lea	rdi, mutex[rip]
	call	sem_init@PLT
	mov	edi, 0
	call	time@PLT
	mov	edi, eax
	call	srand@PLT
	lea	rax, -24[rbp]
	mov	ecx, 0
	lea	rdx, pthBarbeiro[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	mov	DWORD PTR -28[rbp], 0
.L3:
	add	DWORD PTR -28[rbp], 1
	mov	eax, DWORD PTR -28[rbp]
	mov	DWORD PTR -32[rbp], eax
	lea	rdx, -32[rbp]
	lea	rax, -16[rbp]
	mov	rcx, rdx
	lea	rdx, pthCliente[rip]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_create@PLT
	mov	eax, 0
	call	distNormalAleatoria
	cvttsd2si	rax, xmm0
	mov	edi, eax
	call	sleep@PLT
	jmp	.L3
	.cfi_endproc
.LFE7:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC8:
	.string	"\nCliente novo. Agora temos %d clientes em cadeiras.\n"
	.align 8
.LC9:
	.string	"Cliente numero %d est\303\241 sendo atendido pelo barbeiro.\n"
	.align 8
.LC10:
	.string	"\nCliente numero %d foi embora, fila muito grande.\n"
	.text
	.globl	pthCliente
	.type	pthCliente, @function
pthCliente:
.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	QWORD PTR -8[rbp], rdi
	lea	rdi, mutex[rip]
	call	sem_wait@PLT
	mov	eax, DWORD PTR qtdClientesAguardando[rip]
	mov	edx, 5
	cmp	eax, edx
	jge	.L6
	movzx	eax, BYTE PTR clientes[rip]
	movsx	eax, al
	add	eax, 1
	mov	esi, eax
	lea	rdi, .LC8[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR qtdClientesAguardando[rip]
	add	eax, 1
	mov	DWORD PTR qtdClientesAguardando[rip], eax
	lea	rdi, clientes[rip]
	call	sem_post@PLT
	lea	rdi, mutex[rip]
	call	sem_post@PLT
	lea	rdi, barbeiro[rip]
	call	sem_wait@PLT
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	mov	esi, eax
	lea	rdi, .LC9[rip]
	mov	eax, 0
	call	printf@PLT
	jmp	.L7
.L6:
	lea	rdi, mutex[rip]
	call	sem_post@PLT
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	mov	esi, eax
	lea	rdi, .LC10[rip]
	mov	eax, 0
	call	printf@PLT
.L7:
	mov	edi, 0
	call	pthread_exit@PLT
	.cfi_endproc
.LFE8:
	.size	pthCliente, .-pthCliente
	.section	.rodata
	.align 8
.LC11:
	.string	"Barbeiro atendendo o cliente. Sobraram %d clientes aguardando em cadeiras.\n"
	.text
	.globl	pthBarbeiro
	.type	pthBarbeiro, @function
pthBarbeiro:
.LFB9:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
.L9:
	lea	rdi, clientes[rip]
	call	sem_wait@PLT
	lea	rdi, mutex[rip]
	call	sem_wait@PLT
	mov	eax, DWORD PTR qtdClientesAguardando[rip]
	sub	eax, 1
	mov	DWORD PTR qtdClientesAguardando[rip], eax
	lea	rdi, barbeiro[rip]
	call	sem_post@PLT
	lea	rdi, mutex[rip]
	call	sem_post@PLT
	mov	eax, DWORD PTR qtdClientesAguardando[rip]
	mov	esi, eax
	lea	rdi, .LC11[rip]
	mov	eax, 0
	call	printf@PLT
	mov	edi, 3
	call	sleep@PLT
	jmp	.L9
	.cfi_endproc
.LFE9:
	.size	pthBarbeiro, .-pthBarbeiro
	.globl	distNormalAleatoria
	.type	distNormalAleatoria, @function
distNormalAleatoria:
.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, 32
.L11:
	call	rand@PLT
	pxor	xmm1, xmm1
	cvtsi2sd	xmm1, eax
	movsd	xmm0, QWORD PTR .LC12[rip]
	addsd	xmm0, xmm1
	movsd	xmm1, QWORD PTR .LC13[rip]
	divsd	xmm0, xmm1
	movq	rax, xmm0
	movq	xmm0, rax
	call	log@PLT
	movsd	xmm1, QWORD PTR .LC14[rip]
	mulsd	xmm0, xmm1
	movq	rax, xmm0
	movq	xmm0, rax
	call	sqrt@PLT
	movsd	xmm1, QWORD PTR .LC15[rip]
	mulsd	xmm0, xmm1
	movsd	QWORD PTR -24[rbp], xmm0
	call	rand@PLT
	pxor	xmm1, xmm1
	cvtsi2sd	xmm1, eax
	movsd	xmm0, QWORD PTR .LC12[rip]
	addsd	xmm1, xmm0
	movsd	xmm0, QWORD PTR .LC16[rip]
	mulsd	xmm0, xmm1
	movsd	xmm1, QWORD PTR .LC13[rip]
	movapd	xmm2, xmm0
	divsd	xmm2, xmm1
	movq	rax, xmm2
	movq	xmm0, rax
	call	cos@PLT
	movsd	xmm1, QWORD PTR -24[rbp]
	mulsd	xmm1, xmm0
	movsd	xmm0, QWORD PTR .LC12[rip]
	addsd	xmm0, xmm1
	movsd	QWORD PTR -8[rbp], xmm0
	movsd	xmm0, QWORD PTR .LC12[rip]
	comisd	xmm0, QWORD PTR -8[rbp]
	jnb	.L11
	movsd	xmm0, QWORD PTR -8[rbp]
	comisd	xmm0, QWORD PTR .LC17[rip]
	jnb	.L11
	movsd	xmm0, QWORD PTR -8[rbp]
	movq	rax, xmm0
	movq	xmm0, rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	distNormalAleatoria, .-distNormalAleatoria
	.section	.rodata
	.align 8
.LC12:
	.long	0
	.long	1072693248
	.align 8
.LC13:
	.long	0
	.long	1105199104
	.align 8
.LC14:
	.long	0
	.long	-1073741824
	.align 8
.LC15:
	.long	0
	.long	1073217536
	.align 8
.LC16:
	.long	1413754136
	.long	1075388923
	.align 8
.LC17:
	.long	0
	.long	1074266112
	.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	"660815.c"
	.text
	.global	CADEIRAS
	.section	.rodata
	.align	2
	.type	CADEIRAS, %object
	.size	CADEIRAS, 4
CADEIRAS:
	.word	5
	.global	qtdClientesAguardando
	.bss
	.align	2
	.type	qtdClientesAguardando, %object
	.size	qtdClientesAguardando, 4
qtdClientesAguardando:
	.space	4
	.comm	clientes,16,4
	.comm	barbeiro,16,4
	.comm	mutex,16,4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"\033[1;1H\033[2J\000"
	.align	2
.LC1:
	.ascii	"+--------------------------------------------------"
	.ascii	"-------------+\000"
	.align	2
.LC2:
	.ascii	"|        PONTIFICIA UNIVERSIDADE CATOLICA DE GOIAS "
	.ascii	"             |\000"
	.align	2
.LC3:
	.ascii	"| Aluno: Silas dos S. Silva          Matricula: 201"
	.ascii	"1.1.033.0188 |\000"
	.align	2
.LC4:
	.ascii	"|              O PROBLEMA DO BARBEIRO DORMINHOCO   "
	.ascii	"             |\000"
	.align	2
.LC5:
	.ascii	"| Quantidade de Cadeiras dispon\303\255veis: %d    "
	.ascii	"                     |\012\000"
	.align	2
.LC6:
	.ascii	"| Taxa de chegada de clientes: Distribui\303\247\303"
	.ascii	"\243o normal de 1.0 a 3.0 |\000"
	.align	2
.LC7:
	.ascii	"| Tempo de atendimento do barbeiro: 1 cliente a cad"
	.ascii	"a 3 segundos |\012\000"
	.text
	.align	2
	.global	cabecalho
	.syntax unified
	.arm
	.fpu softvfp
	.type	cabecalho, %function
cabecalho:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	ldr	r0, .L2
	bl	printf
	ldr	r0, .L2+4
	bl	puts
	ldr	r0, .L2+8
	bl	puts
	ldr	r0, .L2+12
	bl	puts
	ldr	r0, .L2+16
	bl	puts
	ldr	r0, .L2+4
	bl	puts
	mov	r3, #5
	mov	r1, r3
	ldr	r0, .L2+20
	bl	printf
	ldr	r0, .L2+24
	bl	puts
	ldr	r0, .L2+28
	bl	puts
	nop
	pop	{fp, pc}
.L3:
	.align	2
.L2:
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	.LC3
	.word	.LC4
	.word	.LC5
	.word	.LC6
	.word	.LC7
	.size	cabecalho, .-cabecalho
	.global	__aeabi_d2uiz
	.section	.rodata
	.align	2
.LC8:
	.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	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #24
	ldr	r3, .L7
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	bl	cabecalho
	mov	r2, #0
	mov	r1, #1
	ldr	r0, .L7+4
	bl	sem_init
	mov	r2, #0
	mov	r1, #1
	ldr	r0, .L7+8
	bl	sem_init
	mov	r2, #1
	mov	r1, #1
	ldr	r0, .L7+12
	bl	sem_init
	mov	r0, #0
	bl	time
	mov	r3, r0
	mov	r0, r3
	bl	srand
	sub	r0, fp, #24
	mov	r3, #0
	ldr	r2, .L7+16
	mov	r1, #0
	bl	pthread_create
	mov	r3, #0
	str	r3, [fp, #-12]
.L5:
	ldr	r3, [fp, #-12]
	add	r3, r3, #1
	str	r3, [fp, #-12]
	ldr	r3, [fp, #-12]
	str	r3, [fp, #-16]
	sub	r3, fp, #16
	sub	r0, fp, #20
	ldr	r2, .L7+20
	mov	r1, #0
	bl	pthread_create
	bl	distNormalAleatoria
	mov	r2, r0
	mov	r3, r1
	mov	r0, r2
	mov	r1, r3
	bl	__aeabi_d2uiz
	mov	r3, r0
	mov	r0, r3
	bl	sleep
	b	.L5
.L8:
	.align	2
.L7:
	.word	.LC8
	.word	clientes
	.word	barbeiro
	.word	mutex
	.word	pthBarbeiro
	.word	pthCliente
	.size	main, .-main
	.section	.rodata
	.align	2
.LC9:
	.ascii	"\012Cliente novo. Agora temos %d clientes em cadeir"
	.ascii	"as.\012\000"
	.align	2
.LC10:
	.ascii	"Cliente numero %d est\303\241 sendo atendido pelo b"
	.ascii	"arbeiro.\012\000"
	.align	2
.LC11:
	.ascii	"\012Cliente numero %d foi embora, fila muito grande"
	.ascii	".\012\000"
	.text
	.align	2
	.global	pthCliente
	.syntax unified
	.arm
	.fpu softvfp
	.type	pthCliente, %function
pthCliente:
	@ 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	r3, .L12+4
	ldr	r3, [r3]
	mov	r2, #5
	cmp	r3, r2
	bge	.L10
	ldr	r3, .L12+8
	ldrb	r3, [r3]	@ zero_extendqisi2
	add	r3, r3, #1
	mov	r1, r3
	ldr	r0, .L12+12
	bl	printf
	ldr	r3, .L12+4
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L12+4
	str	r3, [r2]
	ldr	r0, .L12+8
	bl	sem_post
	ldr	r0, .L12
	bl	sem_post
	ldr	r0, .L12+16
	bl	sem_wait
	ldr	r3, [fp, #-8]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L12+20
	bl	printf
	b	.L11
.L10:
	ldr	r0, .L12
	bl	sem_post
	ldr	r3, [fp, #-8]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L12+24
	bl	printf
.L11:
	mov	r0, #0
	bl	pthread_exit
.L13:
	.align	2
.L12:
	.word	mutex
	.word	qtdClientesAguardando
	.word	clientes
	.word	.LC9
	.word	barbeiro
	.word	.LC10
	.word	.LC11
	.size	pthCliente, .-pthCliente
	.section	.rodata
	.align	2
.LC12:
	.ascii	"Barbeiro atendendo o cliente. Sobraram %d clientes "
	.ascii	"aguardando em cadeiras.\012\000"
	.text
	.align	2
	.global	pthBarbeiro
	.syntax unified
	.arm
	.fpu softvfp
	.type	pthBarbeiro, %function
pthBarbeiro:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
.L15:
	ldr	r0, .L16
	bl	sem_wait
	ldr	r0, .L16+4
	bl	sem_wait
	ldr	r3, .L16+8
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L16+8
	str	r3, [r2]
	ldr	r0, .L16+12
	bl	sem_post
	ldr	r0, .L16+4
	bl	sem_post
	ldr	r3, .L16+8
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L16+16
	bl	printf
	mov	r0, #3
	bl	sleep
	b	.L15
.L17:
	.align	2
.L16:
	.word	clientes
	.word	mutex
	.word	qtdClientesAguardando
	.word	barbeiro
	.word	.LC12
	.size	pthBarbeiro, .-pthBarbeiro
	.global	__aeabi_i2d
	.global	__aeabi_dadd
	.global	__aeabi_ddiv
	.global	__aeabi_dmul
	.global	__aeabi_dcmple
	.global	__aeabi_dcmpge
	.align	2
	.global	distNormalAleatoria
	.syntax unified
	.arm
	.fpu softvfp
	.type	distNormalAleatoria, %function
distNormalAleatoria:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, fp, lr}
	add	fp, sp, #12
	sub	sp, sp, #8
.L19:
	bl	rand
	mov	r3, r0
	mov	r0, r3
	bl	__aeabi_i2d
	mov	r2, #0
	ldr	r3, .L21
	bl	__aeabi_dadd
	mov	r2, r0
	mov	r3, r1
	mov	r0, r2
	mov	r1, r3
	mov	r2, #0
	ldr	r3, .L21+4
	bl	__aeabi_ddiv
	mov	r2, r0
	mov	r3, r1
	mov	r0, r2
	mov	r1, r3
	bl	log
	mov	r2, #0
	mov	r3, #-1073741824
	bl	__aeabi_dmul
	mov	r2, r0
	mov	r3, r1
	mov	r0, r2
	mov	r1, r3
	bl	sqrt
	mov	r2, #0
	ldr	r3, .L21+8
	bl	__aeabi_dmul
	mov	r2, r0
	mov	r3, r1
	mov	r4, r2
	mov	r5, r3
	bl	rand
	mov	r3, r0
	mov	r0, r3
	bl	__aeabi_i2d
	mov	r2, #0
	ldr	r3, .L21
	bl	__aeabi_dadd
	mov	r2, r0
	mov	r3, r1
	mov	r0, r2
	mov	r1, r3
	ldr	r2, .L21+12
	ldr	r3, .L21+16
	bl	__aeabi_dmul
	mov	r2, r0
	mov	r3, r1
	mov	r0, r2
	mov	r1, r3
	mov	r2, #0
	ldr	r3, .L21+4
	bl	__aeabi_ddiv
	mov	r2, r0
	mov	r3, r1
	mov	r0, r2
	mov	r1, r3
	bl	cos
	mov	r2, r0
	mov	r3, r1
	mov	r0, r4
	mov	r1, r5
	bl	__aeabi_dmul
	mov	r2, r0
	mov	r3, r1
	mov	r0, r2
	mov	r1, r3
	mov	r2, #0
	ldr	r3, .L21
	bl	__aeabi_dadd
	mov	r2, r0
	mov	r3, r1
	str	r2, [fp, #-20]
	str	r3, [fp, #-16]
	mov	r2, #0
	ldr	r3, .L21
	sub	r1, fp, #20
	ldmia	r1, {r0-r1}
	bl	__aeabi_dcmple
	mov	r3, r0
	cmp	r3, #0
	bne	.L19
	mov	r2, #0
	ldr	r3, .L21+20
	sub	r1, fp, #20
	ldmia	r1, {r0-r1}
	bl	__aeabi_dcmpge
	mov	r3, r0
	cmp	r3, #0
	bne	.L19
	sub	r3, fp, #20
	ldmia	r3, {r2-r3}
	mov	r0, r2
	mov	r1, r3
	sub	sp, fp, #12
	@ sp needed
	pop	{r4, r5, fp, pc}
.L22:
	.align	2
.L21:
	.word	1072693248
	.word	1105199104
	.word	1073217536
	.word	1413754136
	.word	1075388923
	.word	1074266112
	.size	distNormalAleatoria, .-distNormalAleatoria
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
