	.file	"877443.c"
	.intel_syntax noprefix
	.text
	.globl	sm
	.bss
	.align 32
	.type	sm, @object
	.size	sm, 32
sm:
	.zero	32
	.globl	mtx
	.align 32
	.type	mtx, @object
	.size	mtx, 40
mtx:
	.zero	40
	.globl	sm2
	.align 32
	.type	sm2, @object
	.size	sm2, 32
sm2:
	.zero	32
	.globl	mtx2
	.align 32
	.type	mtx2, @object
	.size	mtx2, 40
mtx2:
	.zero	40
	.globl	S
	.align 4
	.type	S, @object
	.size	S, 4
S:
	.zero	4
	.globl	S2
	.align 4
	.type	S2, @object
	.size	S2, 4
S2:
	.zero	4
	.globl	k
	.align 4
	.type	k, @object
	.size	k, 4
k:
	.zero	4
	.globl	dc
	.data
	.align 4
	.type	dc, @object
	.size	dc, 4
dc:
	.long	-1
	.globl	dct
	.align 4
	.type	dct, @object
	.size	dct, 4
dct:
	.long	-1
	.globl	rd
	.bss
	.align 4
	.type	rd, @object
	.size	rd, 4
rd:
	.zero	4
	.globl	check
	.align 4
	.type	check, @object
	.size	check, 4
check:
	.zero	4
	.globl	ora
	.data
	.align 4
	.type	ora, @object
	.size	ora, 4
ora:
	.long	8
	.globl	doc
	.bss
	.align 32
	.type	doc, @object
	.size	doc, 80
doc:
	.zero	80
	.globl	ts
	.align 16
	.type	ts, @object
	.size	ts, 16
ts:
	.zero	16
	.globl	tval
	.align 16
	.type	tval, @object
	.size	tval, 16
tval:
	.zero	16
	.text
	.globl	init_doctor
	.type	init_doctor, @function
init_doctor:
.LFB6:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	DWORD PTR -4[rbp], 0
	jmp	.L2
.L3:
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	lea	rax, doc[rip]
	mov	DWORD PTR [rdx+rax], 0
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	lea	rax, doc[rip+4]
	mov	DWORD PTR [rdx+rax], -1
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	lea	rax, doc[rip+8]
	mov	QWORD PTR [rdx+rax], 0
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	lea	rax, doc[rip+16]
	mov	QWORD PTR [rdx+rax], 0
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	lea	rax, doc[rip+24]
	mov	QWORD PTR [rdx+rax], 0
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	lea	rax, doc[rip+32]
	mov	QWORD PTR [rdx+rax], 0
	add	DWORD PTR -4[rbp], 1
.L2:
	cmp	DWORD PTR -4[rbp], 1
	jle	.L3
	nop
	nop
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	init_doctor, .-init_doctor
	.globl	get_doc
	.type	get_doc, @function
get_doc:
.LFB7:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	DWORD PTR -20[rbp], edi
	mov	QWORD PTR -32[rbp], rsi
	mov	DWORD PTR -4[rbp], 0
	jmp	.L5
.L8:
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	lea	rax, doc[rip]
	mov	eax, DWORD PTR [rdx+rax]
	test	eax, eax
	jne	.L6
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	lea	rax, doc[rip]
	mov	DWORD PTR [rdx+rax], 1
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rcx, rax
	lea	rdx, doc[rip+4]
	mov	eax, DWORD PTR -20[rbp]
	mov	DWORD PTR [rcx+rdx], eax
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rcx, rax
	lea	rdx, doc[rip+8]
	mov	rax, QWORD PTR -32[rbp]
	mov	QWORD PTR [rcx+rdx], rax
	mov	eax, DWORD PTR -4[rbp]
	jmp	.L7
.L6:
	add	DWORD PTR -4[rbp], 1
.L5:
	cmp	DWORD PTR -4[rbp], 1
	jle	.L8
	mov	eax, -1
.L7:
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	get_doc, .-get_doc
	.globl	my_doc
	.type	my_doc, @function
my_doc:
.LFB8:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	mov	QWORD PTR -24[rbp], rdi
	mov	DWORD PTR -4[rbp], 0
	jmp	.L10
.L13:
	mov	eax, DWORD PTR -4[rbp]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	lea	rax, doc[rip+8]
	mov	rax, QWORD PTR [rdx+rax]
	cmp	QWORD PTR -24[rbp], rax
	jne	.L11
	mov	eax, DWORD PTR -4[rbp]
	jmp	.L12
.L11:
	add	DWORD PTR -4[rbp], 1
.L10:
	cmp	DWORD PTR -4[rbp], 1
	jle	.L13
	mov	eax, -1
.L12:
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	my_doc, .-my_doc
	.section	.rodata
	.align 8
.LC0:
	.string	"-Pacientul %d si-a inceput consultatia la ora %ld cu doctorul %d \n"
	.align 8
.LC1:
	.string	"~!!~ Consultatia pacientului %d dureaza %ld ore si depaseste programul doctorului %d. Acesta pleaca acasa suparat >:( \n"
.LC2:
	.string	"Eroare - POST\n"
	.align 8
.LC3:
	.string	"-Pacientul %d a iesit de la doctor la ora %ld .El a stat %ld ore \n"
	.text
	.globl	cabinet_doctor
	.type	cabinet_doctor, @function
cabinet_doctor:
.LFB9:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	r12
	push	rbx
	.cfi_offset 12, -24
	.cfi_offset 3, -32
	lea	rdi, mtx2[rip]
	call	pthread_mutex_lock@PLT
	mov	eax, DWORD PTR k[rip]
	add	eax, 1
	mov	DWORD PTR k[rip], eax
	call	pthread_self@PLT
	mov	rdi, rax
	call	my_doc
	mov	DWORD PTR dc[rip], eax
	mov	eax, DWORD PTR dc[rip]
	cmp	eax, -1
	jne	.L15
	call	pthread_self@PLT
	mov	rdx, rax
	mov	eax, DWORD PTR k[rip]
	sub	eax, 1
	mov	rsi, rdx
	mov	edi, eax
	call	get_doc
	mov	DWORD PTR dc[rip], eax
.L15:
	mov	ecx, DWORD PTR dc[rip]
	mov	eax, DWORD PTR dc[rip]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	lea	rax, doc[rip+24]
	mov	rdx, QWORD PTR [rdx+rax]
	mov	eax, DWORD PTR dc[rip]
	movsx	rsi, eax
	mov	rax, rsi
	sal	rax, 2
	add	rax, rsi
	sal	rax, 3
	mov	rsi, rax
	lea	rax, doc[rip+4]
	mov	eax, DWORD PTR [rsi+rax]
	mov	esi, eax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	call	rand@PLT
	mov	edx, eax
	movsx	rax, edx
	imul	rax, rax, 715827883
	shr	rax, 32
	mov	esi, edx
	sar	esi, 31
	mov	ecx, eax
	sub	ecx, esi
	mov	eax, ecx
	add	eax, eax
	add	eax, ecx
	add	eax, eax
	mov	ecx, edx
	sub	ecx, eax
	lea	edx, 1[rcx]
	mov	eax, DWORD PTR dc[rip]
	movsx	rdx, edx
	movsx	rcx, eax
	mov	rax, rcx
	sal	rax, 2
	add	rax, rcx
	sal	rax, 3
	mov	rcx, rax
	lea	rax, doc[rip+16]
	mov	QWORD PTR [rcx+rax], rdx
	mov	eax, DWORD PTR dc[rip]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	lea	rax, doc[rip+24]
	mov	rcx, QWORD PTR [rdx+rax]
	mov	eax, DWORD PTR dc[rip]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	lea	rax, doc[rip+16]
	mov	rax, QWORD PTR [rdx+rax]
	add	rax, rcx
	cmp	rax, 24
	jle	.L16
	mov	ecx, DWORD PTR dc[rip]
	mov	eax, DWORD PTR dc[rip]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	lea	rax, doc[rip+16]
	mov	rdx, QWORD PTR [rdx+rax]
	mov	eax, DWORD PTR dc[rip]
	movsx	rsi, eax
	mov	rax, rsi
	sal	rax, 2
	add	rax, rsi
	sal	rax, 3
	mov	rsi, rax
	lea	rax, doc[rip+4]
	mov	eax, DWORD PTR [rsi+rax]
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, mtx2[rip]
	call	pthread_mutex_unlock@PLT
	lea	rdi, sm[rip]
	call	sem_post@PLT
	test	eax, eax
	je	.L17
	lea	rdi, .LC2[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	jmp	.L18
.L17:
	mov	eax, 0
	jmp	.L18
.L16:
	mov	eax, DWORD PTR dc[rip]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	lea	rax, doc[rip+24]
	mov	rcx, QWORD PTR [rdx+rax]
	mov	eax, DWORD PTR dc[rip]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	lea	rax, doc[rip+16]
	mov	rdx, QWORD PTR [rdx+rax]
	mov	eax, DWORD PTR dc[rip]
	add	rcx, rdx
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	lea	rax, doc[rip+32]
	mov	QWORD PTR [rdx+rax], rcx
	mov	eax, DWORD PTR dc[rip]
	mov	ecx, DWORD PTR dc[rip]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	lea	rax, doc[rip+32]
	mov	rdx, QWORD PTR [rdx+rax]
	movsx	rcx, ecx
	mov	rax, rcx
	sal	rax, 2
	add	rax, rcx
	sal	rax, 3
	mov	rcx, rax
	lea	rax, doc[rip+24]
	mov	QWORD PTR [rcx+rax], rdx
	mov	esi, 0
	lea	rdi, tval[rip]
	call	gettimeofday@PLT
	mov	rcx, QWORD PTR tval[rip]
	mov	eax, DWORD PTR dc[rip]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	lea	rax, doc[rip+16]
	mov	rax, QWORD PTR [rdx+rax]
	add	rax, rcx
	mov	QWORD PTR ts[rip], rax
	mov	QWORD PTR ts[rip+8], 0
	mov	eax, DWORD PTR k[rip]
	cmp	eax, 3
	jg	.L19
	lea	rdi, mtx2[rip]
	call	pthread_mutex_unlock@PLT
	jmp	.L20
.L21:
	nop
.L20:
	lea	rsi, ts[rip]
	lea	rdi, sm2[rip]
	call	sem_timedwait@PLT
	mov	DWORD PTR check[rip], eax
	mov	eax, DWORD PTR check[rip]
	cmp	eax, -1
	jne	.L19
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	cmp	eax, 4
	je	.L21
.L19:
	lea	rdi, mtx2[rip]
	call	pthread_mutex_unlock@PLT
	lea	rdi, sm[rip]
	call	sem_post@PLT
	test	eax, eax
	je	.L22
	lea	rdi, .LC2[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	jmp	.L18
.L22:
	call	pthread_self@PLT
	mov	rdi, rax
	call	my_doc
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	lea	rax, doc[rip]
	mov	DWORD PTR [rdx+rax], 0
	call	pthread_self@PLT
	mov	rdi, rax
	call	my_doc
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	lea	rax, doc[rip+16]
	mov	r12, QWORD PTR [rdx+rax]
	call	pthread_self@PLT
	mov	rdi, rax
	call	my_doc
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	lea	rax, doc[rip+32]
	mov	rbx, QWORD PTR [rdx+rax]
	call	pthread_self@PLT
	mov	rdi, rax
	call	my_doc
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	lea	rax, doc[rip+4]
	mov	eax, DWORD PTR [rdx+rax]
	mov	rcx, r12
	mov	rdx, rbx
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
.L18:
	pop	rbx
	pop	r12
	pop	rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	cabinet_doctor, .-cabinet_doctor
	.section	.rodata
	.align 8
.LC4:
	.string	"~!!~ Pacientul %d a ajuns la cabinet la o ora prea tarzie. El va reveni maine \n"
.LC5:
	.string	"Eroare - WAIT\n"
	.text
	.globl	receptie
	.type	receptie, @function
receptie:
.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
	mov	QWORD PTR -24[rbp], rdi
	mov	rax, QWORD PTR -24[rbp]
	mov	QWORD PTR -8[rbp], rax
	lea	rdi, mtx[rip]
	call	pthread_mutex_lock@PLT
	call	pthread_self@PLT
	mov	rdx, rax
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	mov	rsi, rdx
	mov	edi, eax
	call	get_doc
	mov	DWORD PTR dct[rip], eax
	mov	eax, DWORD PTR dct[rip]
	cmp	eax, -1
	je	.L24
	mov	eax, DWORD PTR dct[rip]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	lea	rax, doc[rip+24]
	mov	rax, QWORD PTR [rdx+rax]
	test	rax, rax
	je	.L25
	mov	eax, DWORD PTR dct[rip]
	movsx	rdx, eax
	mov	rax, rdx
	sal	rax, 2
	add	rax, rdx
	sal	rax, 3
	mov	rdx, rax
	lea	rax, doc[rip+24]
	mov	rdx, QWORD PTR [rdx+rax]
	mov	eax, DWORD PTR ora[rip]
	cdqe
	cmp	rdx, rax
	jge	.L26
.L25:
	mov	eax, DWORD PTR ora[rip]
	cmp	eax, 24
	jle	.L27
	mov	rax, QWORD PTR -8[rbp]
	mov	eax, DWORD PTR [rax]
	mov	esi, eax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, mtx[rip]
	call	pthread_mutex_unlock@PLT
	mov	eax, 0
	jmp	.L28
.L27:
	mov	edx, DWORD PTR ora[rip]
	mov	eax, DWORD PTR dct[rip]
	movsx	rdx, edx
	movsx	rcx, eax
	mov	rax, rcx
	sal	rax, 2
	add	rax, rcx
	sal	rax, 3
	mov	rcx, rax
	lea	rax, doc[rip+24]
	mov	QWORD PTR [rcx+rax], rdx
.L26:
	lea	rdi, mtx[rip]
	call	pthread_mutex_unlock@PLT
	mov	eax, 0
	call	cabinet_doctor
	jmp	.L29
.L24:
	lea	rdi, mtx[rip]
	call	pthread_mutex_unlock@PLT
	lea	rdi, sm[rip]
	call	sem_wait@PLT
	test	eax, eax
	je	.L30
	lea	rdi, .LC5[rip]
	call	perror@PLT
	mov	eax, 0
	jmp	.L28
.L30:
	mov	eax, 0
	call	cabinet_doctor
.L29:
	mov	rax, QWORD PTR -8[rbp]
	mov	rdi, rax
	call	free@PLT
	mov	eax, 0
.L28:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	receptie, .-receptie
	.section	.rodata
	.align 8
.LC6:
	.string	"->Numarul de pacienti programati astazi este = %d\n"
.LC7:
	.string	"Eroare - MUTEX"
.LC8:
	.string	"Eroare - SEMAFOR-INIT\n"
	.align 8
.LC9:
	.string	">>A aparut un pacient nou la ora %d, cu nr de ordine: %d\n"
.LC10:
	.string	"Eroare - T_CREATE\n"
.LC11:
	.string	"Eroare - T_JOIN\n"
	.text
	.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, 64
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	esi, 4
	lea	rdi, .LC6[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, 0
	call	init_doctor
	mov	esi, 0
	lea	rdi, mtx[rip]
	call	pthread_mutex_init@PLT
	test	eax, eax
	je	.L32
	lea	rdi, .LC7[rip]
	call	puts@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	jmp	.L44
.L32:
	mov	esi, 0
	lea	rdi, mtx2[rip]
	call	pthread_mutex_init@PLT
	test	eax, eax
	je	.L34
	lea	rdi, .LC7[rip]
	call	puts@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	jmp	.L44
.L34:
	mov	eax, DWORD PTR S[rip]
	mov	edx, eax
	mov	esi, 0
	lea	rdi, sm[rip]
	call	sem_init@PLT
	test	eax, eax
	je	.L35
	lea	rdi, .LC8[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	jmp	.L44
.L35:
	mov	eax, DWORD PTR S2[rip]
	mov	edx, eax
	mov	esi, 0
	lea	rdi, sm2[rip]
	call	sem_init@PLT
	test	eax, eax
	je	.L36
	lea	rdi, .LC8[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	jmp	.L44
.L36:
	mov	edi, 0
	call	time@PLT
	mov	edi, eax
	call	srand@PLT
	mov	DWORD PTR -64[rbp], 0
	jmp	.L37
.L40:
	mov	edi, 4
	call	malloc@PLT
	mov	QWORD PTR -56[rbp], rax
	mov	rax, QWORD PTR -56[rbp]
	mov	edx, DWORD PTR -64[rbp]
	mov	DWORD PTR [rax], edx
	mov	edx, DWORD PTR ora[rip]
	mov	eax, DWORD PTR rd[rip]
	add	eax, edx
	mov	DWORD PTR ora[rip], eax
	call	rand@PLT
	cdq
	shr	edx, 30
	add	eax, edx
	and	eax, 3
	sub	eax, edx
	add	eax, 1
	mov	DWORD PTR rd[rip], eax
	mov	eax, DWORD PTR ora[rip]
	mov	edx, DWORD PTR -64[rbp]
	mov	esi, eax
	lea	rdi, .LC9[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdx, -48[rbp]
	mov	eax, DWORD PTR -64[rbp]
	cdqe
	sal	rax, 3
	lea	rdi, [rdx+rax]
	mov	rax, QWORD PTR -56[rbp]
	mov	rcx, rax
	lea	rdx, receptie[rip]
	mov	esi, 0
	call	pthread_create@PLT
	test	eax, eax
	je	.L38
	lea	rdi, .LC10[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	jmp	.L44
.L38:
	cmp	DWORD PTR -64[rbp], 2
	jg	.L39
	mov	eax, DWORD PTR rd[rip]
	mov	edi, eax
	call	sleep@PLT
.L39:
	add	DWORD PTR -64[rbp], 1
.L37:
	cmp	DWORD PTR -64[rbp], 3
	jle	.L40
	mov	DWORD PTR -60[rbp], 0
	jmp	.L41
.L43:
	mov	eax, DWORD PTR -60[rbp]
	cdqe
	mov	rax, QWORD PTR -48[rbp+rax*8]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	test	eax, eax
	je	.L42
	lea	rdi, .LC11[rip]
	call	perror@PLT
	call	__errno_location@PLT
	mov	eax, DWORD PTR [rax]
	jmp	.L44
.L42:
	add	DWORD PTR -60[rbp], 1
.L41:
	cmp	DWORD PTR -60[rbp], 3
	jle	.L43
	lea	rdi, mtx[rip]
	call	pthread_mutex_destroy@PLT
	lea	rdi, sm[rip]
	call	sem_destroy@PLT
	lea	rdi, mtx2[rip]
	call	pthread_mutex_destroy@PLT
	lea	rdi, sm2[rip]
	call	sem_destroy@PLT
	mov	eax, 0
.L44:
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L45
	call	__stack_chk_fail@PLT
.L45:
	leave
	.cfi_def_cfa 7, 8
	ret
	.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	"877443.c"
	.text
	.comm	sm,16,4
	.comm	mtx,24,4
	.comm	sm2,16,4
	.comm	mtx2,24,4
	.global	S
	.bss
	.align	2
	.type	S, %object
	.size	S, 4
S:
	.space	4
	.global	S2
	.align	2
	.type	S2, %object
	.size	S2, 4
S2:
	.space	4
	.global	k
	.align	2
	.type	k, %object
	.size	k, 4
k:
	.space	4
	.global	dc
	.data
	.align	2
	.type	dc, %object
	.size	dc, 4
dc:
	.word	-1
	.global	dct
	.align	2
	.type	dct, %object
	.size	dct, 4
dct:
	.word	-1
	.global	rd
	.bss
	.align	2
	.type	rd, %object
	.size	rd, 4
rd:
	.space	4
	.comm	check,4,4
	.global	ora
	.data
	.align	2
	.type	ora, %object
	.size	ora, 4
ora:
	.word	8
	.comm	doc,48,4
	.comm	ts,8,4
	.comm	tval,8,4
	.text
	.align	2
	.global	init_doctor
	.syntax unified
	.arm
	.fpu softvfp
	.type	init_doctor, %function
init_doctor:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	sub	sp, sp, #12
	mov	r3, #0
	str	r3, [fp, #-8]
	b	.L2
.L3:
	ldr	r1, .L4
	ldr	r2, [fp, #-8]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r1, r3
	mov	r2, #0
	str	r2, [r3]
	ldr	r1, .L4
	ldr	r2, [fp, #-8]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r1, r3
	add	r3, r3, #4
	mvn	r2, #0
	str	r2, [r3]
	ldr	r1, .L4
	ldr	r2, [fp, #-8]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r1, r3
	add	r3, r3, #8
	mov	r2, #0
	str	r2, [r3]
	ldr	r1, .L4
	ldr	r2, [fp, #-8]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r1, r3
	add	r3, r3, #12
	mov	r2, #0
	str	r2, [r3]
	ldr	r1, .L4
	ldr	r2, [fp, #-8]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r1, r3
	add	r3, r3, #16
	mov	r2, #0
	str	r2, [r3]
	ldr	r1, .L4
	ldr	r2, [fp, #-8]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r1, r3
	add	r3, r3, #20
	mov	r2, #0
	str	r2, [r3]
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L2:
	ldr	r3, [fp, #-8]
	cmp	r3, #1
	ble	.L3
	nop
	nop
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
.L5:
	.align	2
.L4:
	.word	doc
	.size	init_doctor, .-init_doctor
	.align	2
	.global	get_doc
	.syntax unified
	.arm
	.fpu softvfp
	.type	get_doc, %function
get_doc:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	sub	sp, sp, #20
	str	r0, [fp, #-16]
	str	r1, [fp, #-20]
	mov	r3, #0
	str	r3, [fp, #-8]
	b	.L7
.L10:
	ldr	r1, .L11
	ldr	r2, [fp, #-8]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r1, r3
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L8
	ldr	r1, .L11
	ldr	r2, [fp, #-8]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r1, r3
	mov	r2, #1
	str	r2, [r3]
	ldr	r1, .L11
	ldr	r2, [fp, #-8]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r1, r3
	add	r3, r3, #4
	ldr	r2, [fp, #-16]
	str	r2, [r3]
	ldr	r1, .L11
	ldr	r2, [fp, #-8]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r1, r3
	add	r3, r3, #8
	ldr	r2, [fp, #-20]
	str	r2, [r3]
	ldr	r3, [fp, #-8]
	b	.L9
.L8:
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L7:
	ldr	r3, [fp, #-8]
	cmp	r3, #1
	ble	.L10
	mvn	r3, #0
.L9:
	mov	r0, r3
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
.L12:
	.align	2
.L11:
	.word	doc
	.size	get_doc, .-get_doc
	.align	2
	.global	my_doc
	.syntax unified
	.arm
	.fpu softvfp
	.type	my_doc, %function
my_doc:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	@ link register save eliminated.
	str	fp, [sp, #-4]!
	add	fp, sp, #0
	sub	sp, sp, #20
	str	r0, [fp, #-16]
	mov	r3, #0
	str	r3, [fp, #-8]
	b	.L14
.L17:
	ldr	r1, .L18
	ldr	r2, [fp, #-8]
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r1, r3
	add	r3, r3, #8
	ldr	r3, [r3]
	ldr	r2, [fp, #-16]
	cmp	r2, r3
	bne	.L15
	ldr	r3, [fp, #-8]
	b	.L16
.L15:
	ldr	r3, [fp, #-8]
	add	r3, r3, #1
	str	r3, [fp, #-8]
.L14:
	ldr	r3, [fp, #-8]
	cmp	r3, #1
	ble	.L17
	mvn	r3, #0
.L16:
	mov	r0, r3
	add	sp, fp, #0
	@ sp needed
	ldr	fp, [sp], #4
	bx	lr
.L19:
	.align	2
.L18:
	.word	doc
	.size	my_doc, .-my_doc
	.section	.rodata
	.align	2
.LC0:
	.ascii	"-Pacientul %d si-a inceput consultatia la ora %ld c"
	.ascii	"u doctorul %d \012\000"
	.align	2
.LC1:
	.ascii	"~!!~ Consultatia pacientului %d dureaza %ld ore si "
	.ascii	"depaseste programul doctorului %d. Acesta pleaca ac"
	.ascii	"asa suparat >:( \012\000"
	.align	2
.LC2:
	.ascii	"Eroare - POST\012\000"
	.align	2
.LC3:
	.ascii	"-Pacientul %d a iesit de la doctor la ora %ld .El a"
	.ascii	" stat %ld ore \012\000"
	.text
	.align	2
	.global	cabinet_doctor
	.syntax unified
	.arm
	.fpu softvfp
	.type	cabinet_doctor, %function
cabinet_doctor:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, fp, lr}
	add	fp, sp, #12
	ldr	r0, .L29
	bl	pthread_mutex_lock
	ldr	r3, .L29+4
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L29+4
	str	r3, [r2]
	bl	pthread_self
	mov	r3, r0
	mov	r0, r3
	bl	my_doc
	mov	r3, r0
	ldr	r2, .L29+8
	str	r3, [r2]
	ldr	r3, .L29+8
	ldr	r3, [r3]
	cmn	r3, #1
	bne	.L21
	ldr	r3, .L29+4
	ldr	r3, [r3]
	sub	r4, r3, #1
	bl	pthread_self
	mov	r3, r0
	mov	r1, r3
	mov	r0, r4
	bl	get_doc
	mov	r3, r0
	ldr	r2, .L29+8
	str	r3, [r2]
.L21:
	ldr	r3, .L29+8
	ldr	r2, [r3]
	ldr	r1, .L29+12
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r1, r3
	add	r3, r3, #4
	ldr	r1, [r3]
	ldr	r3, .L29+8
	ldr	r2, [r3]
	ldr	r0, .L29+12
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r0, r3
	add	r3, r3, #16
	ldr	r2, [r3]
	ldr	r3, .L29+8
	ldr	r3, [r3]
	ldr	r0, .L29+16
	bl	printf
	bl	rand
	mov	r1, r0
	ldr	r3, .L29+20
	smull	r0, r2, r3, r1
	asr	r3, r1, #31
	sub	r2, r2, r3
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #1
	sub	r2, r1, r3
	ldr	r3, .L29+8
	ldr	r1, [r3]
	add	r2, r2, #1
	ldr	r0, .L29+12
	mov	r3, r1
	lsl	r3, r3, #1
	add	r3, r3, r1
	lsl	r3, r3, #3
	add	r3, r0, r3
	add	r3, r3, #12
	str	r2, [r3]
	ldr	r3, .L29+8
	ldr	r2, [r3]
	ldr	r1, .L29+12
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r1, r3
	add	r3, r3, #16
	ldr	r1, [r3]
	ldr	r3, .L29+8
	ldr	r2, [r3]
	ldr	r0, .L29+12
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r0, r3
	add	r3, r3, #12
	ldr	r3, [r3]
	add	r3, r1, r3
	cmp	r3, #24
	ble	.L22
	ldr	r3, .L29+8
	ldr	r2, [r3]
	ldr	r1, .L29+12
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r1, r3
	add	r3, r3, #4
	ldr	r1, [r3]
	ldr	r3, .L29+8
	ldr	r2, [r3]
	ldr	r0, .L29+12
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r0, r3
	add	r3, r3, #12
	ldr	r2, [r3]
	ldr	r3, .L29+8
	ldr	r3, [r3]
	ldr	r0, .L29+24
	bl	printf
	ldr	r0, .L29
	bl	pthread_mutex_unlock
	ldr	r0, .L29+28
	bl	sem_post
	mov	r3, r0
	cmp	r3, #0
	beq	.L23
	ldr	r0, .L29+32
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	b	.L24
.L23:
	mov	r3, #0
	b	.L24
.L22:
	ldr	r3, .L29+8
	ldr	r2, [r3]
	ldr	r1, .L29+12
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r1, r3
	add	r3, r3, #16
	ldr	r1, [r3]
	ldr	r3, .L29+8
	ldr	r2, [r3]
	ldr	r0, .L29+12
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r0, r3
	add	r3, r3, #12
	ldr	r3, [r3]
	ldr	r2, .L29+8
	ldr	r2, [r2]
	add	r1, r1, r3
	ldr	r0, .L29+12
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r0, r3
	add	r3, r3, #20
	str	r1, [r3]
	ldr	r3, .L29+8
	ldr	r1, [r3]
	ldr	r3, .L29+8
	ldr	r2, [r3]
	ldr	r0, .L29+12
	mov	r3, r1
	lsl	r3, r3, #1
	add	r3, r3, r1
	lsl	r3, r3, #3
	add	r3, r0, r3
	add	r3, r3, #20
	ldr	r1, [r3]
	ldr	r0, .L29+12
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r0, r3
	add	r3, r3, #16
	str	r1, [r3]
	mov	r1, #0
	ldr	r0, .L29+36
	bl	gettimeofday
	ldr	r3, .L29+36
	ldr	r1, [r3]
	ldr	r3, .L29+8
	ldr	r2, [r3]
	ldr	r0, .L29+12
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r0, r3
	add	r3, r3, #12
	ldr	r3, [r3]
	add	r3, r1, r3
	ldr	r2, .L29+40
	str	r3, [r2]
	ldr	r3, .L29+40
	mov	r2, #0
	str	r2, [r3, #4]
	ldr	r3, .L29+4
	ldr	r3, [r3]
	cmp	r3, #3
	bgt	.L25
	ldr	r0, .L29
	bl	pthread_mutex_unlock
	b	.L26
.L27:
	nop
.L26:
	ldr	r1, .L29+40
	ldr	r0, .L29+44
	bl	sem_timedwait
	mov	r3, r0
	ldr	r2, .L29+48
	str	r3, [r2]
	ldr	r3, .L29+48
	ldr	r3, [r3]
	cmn	r3, #1
	bne	.L25
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	cmp	r3, #4
	beq	.L27
.L25:
	ldr	r0, .L29
	bl	pthread_mutex_unlock
	ldr	r0, .L29+28
	bl	sem_post
	mov	r3, r0
	cmp	r3, #0
	beq	.L28
	ldr	r0, .L29+32
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	b	.L24
.L28:
	bl	pthread_self
	mov	r3, r0
	mov	r0, r3
	bl	my_doc
	mov	r2, r0
	ldr	r1, .L29+12
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r1, r3
	mov	r2, #0
	str	r2, [r3]
	bl	pthread_self
	mov	r3, r0
	mov	r0, r3
	bl	my_doc
	mov	r2, r0
	ldr	r1, .L29+12
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r1, r3
	add	r3, r3, #4
	ldr	r4, [r3]
	bl	pthread_self
	mov	r3, r0
	mov	r0, r3
	bl	my_doc
	mov	r2, r0
	ldr	r1, .L29+12
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r1, r3
	add	r3, r3, #20
	ldr	r5, [r3]
	bl	pthread_self
	mov	r3, r0
	mov	r0, r3
	bl	my_doc
	mov	r2, r0
	ldr	r1, .L29+12
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r1, r3
	add	r3, r3, #12
	ldr	r3, [r3]
	mov	r2, r5
	mov	r1, r4
	ldr	r0, .L29+52
	bl	printf
	mov	r3, #0
.L24:
	mov	r0, r3
	pop	{r4, r5, fp, pc}
.L30:
	.align	2
.L29:
	.word	mtx2
	.word	k
	.word	dc
	.word	doc
	.word	.LC0
	.word	715827883
	.word	.LC1
	.word	sm
	.word	.LC2
	.word	tval
	.word	ts
	.word	sm2
	.word	check
	.word	.LC3
	.size	cabinet_doctor, .-cabinet_doctor
	.section	.rodata
	.align	2
.LC4:
	.ascii	"~!!~ Pacientul %d a ajuns la cabinet la o ora prea "
	.ascii	"tarzie. El va reveni maine \012\000"
	.align	2
.LC5:
	.ascii	"Eroare - WAIT\012\000"
	.text
	.align	2
	.global	receptie
	.syntax unified
	.arm
	.fpu softvfp
	.type	receptie, %function
receptie:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, fp, lr}
	add	fp, sp, #8
	sub	sp, sp, #20
	str	r0, [fp, #-24]
	ldr	r3, [fp, #-24]
	str	r3, [fp, #-16]
	ldr	r0, .L39
	bl	pthread_mutex_lock
	ldr	r3, [fp, #-16]
	ldr	r4, [r3]
	bl	pthread_self
	mov	r3, r0
	mov	r1, r3
	mov	r0, r4
	bl	get_doc
	mov	r3, r0
	ldr	r2, .L39+4
	str	r3, [r2]
	ldr	r3, .L39+4
	ldr	r3, [r3]
	cmn	r3, #1
	beq	.L32
	ldr	r3, .L39+4
	ldr	r2, [r3]
	ldr	r1, .L39+8
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r1, r3
	add	r3, r3, #16
	ldr	r3, [r3]
	cmp	r3, #0
	beq	.L33
	ldr	r3, .L39+4
	ldr	r2, [r3]
	ldr	r1, .L39+8
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r1, r3
	add	r3, r3, #16
	ldr	r2, [r3]
	ldr	r3, .L39+12
	ldr	r3, [r3]
	cmp	r2, r3
	bge	.L34
.L33:
	ldr	r3, .L39+12
	ldr	r3, [r3]
	cmp	r3, #24
	ble	.L35
	ldr	r3, [fp, #-16]
	ldr	r3, [r3]
	mov	r1, r3
	ldr	r0, .L39+16
	bl	printf
	ldr	r0, .L39
	bl	pthread_mutex_unlock
	mov	r3, #0
	b	.L36
.L35:
	ldr	r3, .L39+4
	ldr	r2, [r3]
	ldr	r3, .L39+12
	ldr	r1, [r3]
	ldr	r0, .L39+8
	mov	r3, r2
	lsl	r3, r3, #1
	add	r3, r3, r2
	lsl	r3, r3, #3
	add	r3, r0, r3
	add	r3, r3, #16
	str	r1, [r3]
.L34:
	ldr	r0, .L39
	bl	pthread_mutex_unlock
	bl	cabinet_doctor
	b	.L37
.L32:
	ldr	r0, .L39
	bl	pthread_mutex_unlock
	ldr	r0, .L39+20
	bl	sem_wait
	mov	r3, r0
	cmp	r3, #0
	beq	.L38
	ldr	r0, .L39+24
	bl	perror
	mov	r3, #0
	b	.L36
.L38:
	bl	cabinet_doctor
.L37:
	ldr	r0, [fp, #-16]
	bl	free
	mov	r3, #0
.L36:
	mov	r0, r3
	sub	sp, fp, #8
	@ sp needed
	pop	{r4, fp, pc}
.L40:
	.align	2
.L39:
	.word	mtx
	.word	dct
	.word	doc
	.word	ora
	.word	.LC4
	.word	sm
	.word	.LC5
	.size	receptie, .-receptie
	.section	.rodata
	.align	2
.LC6:
	.ascii	"->Numarul de pacienti programati astazi este = %d\012"
	.ascii	"\000"
	.align	2
.LC7:
	.ascii	"Eroare - MUTEX\000"
	.align	2
.LC8:
	.ascii	"Eroare - SEMAFOR-INIT\012\000"
	.align	2
.LC9:
	.ascii	">>A aparut un pacient nou la ora %d, cu nr de ordin"
	.ascii	"e: %d\012\000"
	.align	2
.LC10:
	.ascii	"Eroare - T_CREATE\012\000"
	.align	2
.LC11:
	.ascii	"Eroare - T_JOIN\012\000"
	.align	2
.LC12:
	.word	__stack_chk_guard
	.text
	.align	2
	.global	main
	.syntax unified
	.arm
	.fpu softvfp
	.type	main, %function
main:
	@ args = 0, pretend = 0, frame = 32
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #32
	ldr	r3, .L56
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r1, #4
	ldr	r0, .L56+4
	bl	printf
	bl	init_doctor
	mov	r1, #0
	ldr	r0, .L56+8
	bl	pthread_mutex_init
	mov	r3, r0
	cmp	r3, #0
	beq	.L42
	ldr	r0, .L56+12
	bl	puts
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	b	.L54
.L42:
	mov	r1, #0
	ldr	r0, .L56+16
	bl	pthread_mutex_init
	mov	r3, r0
	cmp	r3, #0
	beq	.L44
	ldr	r0, .L56+12
	bl	puts
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	b	.L54
.L44:
	ldr	r3, .L56+20
	ldr	r3, [r3]
	mov	r2, r3
	mov	r1, #0
	ldr	r0, .L56+24
	bl	sem_init
	mov	r3, r0
	cmp	r3, #0
	beq	.L45
	ldr	r0, .L56+28
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	b	.L54
.L45:
	ldr	r3, .L56+32
	ldr	r3, [r3]
	mov	r2, r3
	mov	r1, #0
	ldr	r0, .L56+36
	bl	sem_init
	mov	r3, r0
	cmp	r3, #0
	beq	.L46
	ldr	r0, .L56+28
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	b	.L54
.L46:
	mov	r0, #0
	bl	time
	mov	r3, r0
	mov	r0, r3
	bl	srand
	mov	r3, #0
	str	r3, [fp, #-36]
	b	.L47
.L50:
	mov	r0, #4
	bl	malloc
	mov	r3, r0
	str	r3, [fp, #-28]
	ldr	r3, [fp, #-28]
	ldr	r2, [fp, #-36]
	str	r2, [r3]
	ldr	r3, .L56+40
	ldr	r2, [r3]
	ldr	r3, .L56+44
	ldr	r3, [r3]
	add	r3, r2, r3
	ldr	r2, .L56+40
	str	r3, [r2]
	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
	ldr	r2, .L56+44
	str	r3, [r2]
	ldr	r3, .L56+40
	ldr	r3, [r3]
	ldr	r2, [fp, #-36]
	mov	r1, r3
	ldr	r0, .L56+48
	bl	printf
	sub	r2, fp, #24
	ldr	r3, [fp, #-36]
	lsl	r3, r3, #2
	add	r0, r2, r3
	ldr	r3, [fp, #-28]
	ldr	r2, .L56+52
	mov	r1, #0
	bl	pthread_create
	mov	r3, r0
	cmp	r3, #0
	beq	.L48
	ldr	r0, .L56+56
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	b	.L54
.L48:
	ldr	r3, [fp, #-36]
	cmp	r3, #2
	bgt	.L49
	ldr	r3, .L56+44
	ldr	r3, [r3]
	mov	r0, r3
	bl	sleep
.L49:
	ldr	r3, [fp, #-36]
	add	r3, r3, #1
	str	r3, [fp, #-36]
.L47:
	ldr	r3, [fp, #-36]
	cmp	r3, #3
	ble	.L50
	mov	r3, #0
	str	r3, [fp, #-32]
	b	.L51
.L53:
	ldr	r3, [fp, #-32]
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r3, [r3, #-20]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	mov	r3, r0
	cmp	r3, #0
	beq	.L52
	ldr	r0, .L56+60
	bl	perror
	bl	__errno_location
	mov	r3, r0
	ldr	r3, [r3]
	b	.L54
.L52:
	ldr	r3, [fp, #-32]
	add	r3, r3, #1
	str	r3, [fp, #-32]
.L51:
	ldr	r3, [fp, #-32]
	cmp	r3, #3
	ble	.L53
	ldr	r0, .L56+8
	bl	pthread_mutex_destroy
	ldr	r0, .L56+24
	bl	sem_destroy
	ldr	r0, .L56+16
	bl	pthread_mutex_destroy
	ldr	r0, .L56+36
	bl	sem_destroy
	mov	r3, #0
.L54:
	ldr	r2, .L56
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L55
	bl	__stack_chk_fail
.L55:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L57:
	.align	2
.L56:
	.word	.LC12
	.word	.LC6
	.word	mtx
	.word	.LC7
	.word	mtx2
	.word	S
	.word	sm
	.word	.LC8
	.word	S2
	.word	sm2
	.word	ora
	.word	rd
	.word	.LC9
	.word	receptie
	.word	.LC10
	.word	.LC11
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
