	.file	"112639196.c"
	.intel_syntax noprefix
	.text
	.globl	mutex_esquerda
	.bss
	.align 32
	.type	mutex_esquerda, @object
	.size	mutex_esquerda, 40
mutex_esquerda:
	.zero	40
	.globl	mutex_direita
	.align 32
	.type	mutex_direita, @object
	.size	mutex_direita, 40
mutex_direita:
	.zero	40
	.globl	mutex
	.align 32
	.type	mutex, @object
	.size	mutex, 40
mutex:
	.zero	40
	.globl	vez
	.align 32
	.type	vez, @object
	.size	vez, 40
vez:
	.zero	40
	.globl	esquerda
	.align 4
	.type	esquerda, @object
	.size	esquerda, 4
esquerda:
	.zero	4
	.globl	direita
	.align 4
	.type	direita, @object
	.size	direita, 4
direita:
	.zero	4
	.section	.rodata
	.align 8
.LC0:
	.string	"Monkey %d crossing from left to right \n"
	.align 8
.LC1:
	.string	"Monkey %d has finished crossing ; num: %d\n"
	.text
	.globl	macaco_esquerda
	.type	macaco_esquerda, @function
macaco_esquerda:
.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	QWORD PTR -24[rbp], rdi
	mov	rax, QWORD PTR -24[rbp]
	mov	eax, DWORD PTR [rax]
	mov	DWORD PTR -4[rbp], eax
.L4:
	lea	rdi, vez[rip]
	call	pthread_mutex_lock@PLT
	lea	rdi, mutex_esquerda[rip]
	call	pthread_mutex_lock@PLT
	mov	eax, DWORD PTR esquerda[rip]
	add	eax, 1
	mov	DWORD PTR esquerda[rip], eax
	mov	eax, DWORD PTR esquerda[rip]
	cmp	eax, 1
	jne	.L2
	lea	rdi, mutex[rip]
	call	pthread_mutex_lock@PLT
.L2:
	lea	rdi, mutex_esquerda[rip]
	call	pthread_mutex_unlock@PLT
	lea	rdi, vez[rip]
	call	pthread_mutex_unlock@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC0[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, mutex_esquerda[rip]
	call	pthread_mutex_lock@PLT
	mov	eax, DWORD PTR esquerda[rip]
	sub	eax, 1
	mov	DWORD PTR esquerda[rip], eax
	mov	edx, DWORD PTR esquerda[rip]
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR esquerda[rip]
	test	eax, eax
	jne	.L3
	lea	rdi, mutex[rip]
	call	pthread_mutex_unlock@PLT
.L3:
	lea	rdi, mutex_esquerda[rip]
	call	pthread_mutex_unlock@PLT
	jmp	.L4
	.cfi_endproc
.LFE6:
	.size	macaco_esquerda, .-macaco_esquerda
	.section	.rodata
	.align 8
.LC2:
	.string	"Monkey %d crossing from right to left \n"
	.text
	.globl	macaco_direita
	.type	macaco_direita, @function
macaco_direita:
.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
.L8:
	lea	rdi, vez[rip]
	call	pthread_mutex_lock@PLT
	lea	rdi, mutex_direita[rip]
	call	pthread_mutex_lock@PLT
	mov	eax, DWORD PTR direita[rip]
	add	eax, 1
	mov	DWORD PTR direita[rip], eax
	mov	eax, DWORD PTR direita[rip]
	cmp	eax, 1
	jne	.L6
	lea	rdi, mutex[rip]
	call	pthread_mutex_lock@PLT
.L6:
	lea	rdi, mutex_direita[rip]
	call	pthread_mutex_unlock@PLT
	lea	rdi, vez[rip]
	call	pthread_mutex_unlock@PLT
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC2[rip]
	mov	eax, 0
	call	printf@PLT
	lea	rdi, mutex_direita[rip]
	call	pthread_mutex_lock@PLT
	mov	eax, DWORD PTR direita[rip]
	sub	eax, 1
	mov	DWORD PTR direita[rip], eax
	mov	edx, DWORD PTR direita[rip]
	mov	eax, DWORD PTR -4[rbp]
	mov	esi, eax
	lea	rdi, .LC1[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, DWORD PTR direita[rip]
	test	eax, eax
	jne	.L7
	lea	rdi, mutex[rip]
	call	pthread_mutex_unlock@PLT
.L7:
	lea	rdi, mutex_direita[rip]
	call	pthread_mutex_unlock@PLT
	jmp	.L8
	.cfi_endproc
.LFE7:
	.size	macaco_direita, .-macaco_direita
	.section	.rodata
.LC3:
	.string	"N\303\243o pode criar a thread %d\n"
.LC4:
	.string	"Could not join thread %d\n"
.LC5:
	.string	"TERMINOU!"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	add	rsp, -128
	mov	DWORD PTR -116[rbp], edi
	mov	QWORD PTR -128[rbp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -8[rbp], rax
	xor	eax, eax
	mov	esi, 0
	lea	rdi, mutex_esquerda[rip]
	call	pthread_mutex_init@PLT
	mov	esi, 0
	lea	rdi, mutex_direita[rip]
	call	pthread_mutex_init@PLT
	mov	esi, 0
	lea	rdi, mutex[rip]
	call	pthread_mutex_init@PLT
	mov	esi, 0
	lea	rdi, vez[rip]
	call	pthread_mutex_init@PLT
	mov	DWORD PTR -108[rbp], 0
	mov	DWORD PTR -108[rbp], 0
	jmp	.L10
.L14:
	mov	edi, 4
	call	malloc@PLT
	mov	QWORD PTR -104[rbp], rax
	mov	rax, QWORD PTR -104[rbp]
	mov	edx, DWORD PTR -108[rbp]
	mov	DWORD PTR [rax], edx
	mov	eax, DWORD PTR -108[rbp]
	and	eax, 1
	test	eax, eax
	jne	.L11
	lea	rdx, -96[rbp]
	mov	eax, DWORD PTR -108[rbp]
	cdqe
	sal	rax, 3
	lea	rdi, [rdx+rax]
	mov	rax, QWORD PTR -104[rbp]
	mov	rcx, rax
	lea	rdx, macaco_direita[rip]
	mov	esi, 0
	call	pthread_create@PLT
	test	eax, eax
	je	.L12
	mov	eax, DWORD PTR -108[rbp]
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, -1
	jmp	.L18
.L11:
	lea	rdx, -96[rbp]
	mov	eax, DWORD PTR -108[rbp]
	cdqe
	sal	rax, 3
	lea	rdi, [rdx+rax]
	mov	rax, QWORD PTR -104[rbp]
	mov	rcx, rax
	lea	rdx, macaco_esquerda[rip]
	mov	esi, 0
	call	pthread_create@PLT
	test	eax, eax
	je	.L12
	mov	eax, DWORD PTR -108[rbp]
	mov	esi, eax
	lea	rdi, .LC3[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, -1
	jmp	.L18
.L12:
	add	QWORD PTR -104[rbp], 4
	add	DWORD PTR -108[rbp], 1
.L10:
	cmp	DWORD PTR -108[rbp], 9
	jle	.L14
	mov	DWORD PTR -108[rbp], 0
	jmp	.L15
.L17:
	mov	eax, DWORD PTR -108[rbp]
	cdqe
	mov	rax, QWORD PTR -96[rbp+rax*8]
	mov	esi, 0
	mov	rdi, rax
	call	pthread_join@PLT
	test	eax, eax
	je	.L16
	mov	eax, DWORD PTR -108[rbp]
	mov	esi, eax
	lea	rdi, .LC4[rip]
	mov	eax, 0
	call	printf@PLT
	mov	eax, -1
	jmp	.L18
.L16:
	add	DWORD PTR -108[rbp], 1
.L15:
	cmp	DWORD PTR -108[rbp], 9
	jle	.L17
	lea	rdi, .LC5[rip]
	call	puts@PLT
	mov	eax, 0
.L18:
	mov	rcx, QWORD PTR -8[rbp]
	sub	rcx, QWORD PTR fs:40
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.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	"112639196.c"
	.text
	.comm	mutex_esquerda,24,4
	.comm	mutex_direita,24,4
	.comm	mutex,24,4
	.comm	vez,24,4
	.global	esquerda
	.bss
	.align	2
	.type	esquerda, %object
	.size	esquerda, 4
esquerda:
	.space	4
	.global	direita
	.align	2
	.type	direita, %object
	.size	direita, 4
direita:
	.space	4
	.section	.rodata
	.align	2
.LC0:
	.ascii	"Monkey %d crossing from left to right \012\000"
	.align	2
.LC1:
	.ascii	"Monkey %d has finished crossing ; num: %d\012\000"
	.text
	.align	2
	.global	macaco_esquerda
	.syntax unified
	.arm
	.fpu softvfp
	.type	macaco_esquerda, %function
macaco_esquerda:
	@ 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]
.L4:
	ldr	r0, .L5
	bl	pthread_mutex_lock
	ldr	r0, .L5+4
	bl	pthread_mutex_lock
	ldr	r3, .L5+8
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L5+8
	str	r3, [r2]
	ldr	r3, .L5+8
	ldr	r3, [r3]
	cmp	r3, #1
	bne	.L2
	ldr	r0, .L5+12
	bl	pthread_mutex_lock
.L2:
	ldr	r0, .L5+4
	bl	pthread_mutex_unlock
	ldr	r0, .L5
	bl	pthread_mutex_unlock
	ldr	r1, [fp, #-8]
	ldr	r0, .L5+16
	bl	printf
	ldr	r0, .L5+4
	bl	pthread_mutex_lock
	ldr	r3, .L5+8
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L5+8
	str	r3, [r2]
	ldr	r3, .L5+8
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, [fp, #-8]
	ldr	r0, .L5+20
	bl	printf
	ldr	r3, .L5+8
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L3
	ldr	r0, .L5+12
	bl	pthread_mutex_unlock
.L3:
	ldr	r0, .L5+4
	bl	pthread_mutex_unlock
	b	.L4
.L6:
	.align	2
.L5:
	.word	vez
	.word	mutex_esquerda
	.word	esquerda
	.word	mutex
	.word	.LC0
	.word	.LC1
	.size	macaco_esquerda, .-macaco_esquerda
	.section	.rodata
	.align	2
.LC2:
	.ascii	"Monkey %d crossing from right to left \012\000"
	.text
	.align	2
	.global	macaco_direita
	.syntax unified
	.arm
	.fpu softvfp
	.type	macaco_direita, %function
macaco_direita:
	@ 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]
.L10:
	ldr	r0, .L11
	bl	pthread_mutex_lock
	ldr	r0, .L11+4
	bl	pthread_mutex_lock
	ldr	r3, .L11+8
	ldr	r3, [r3]
	add	r3, r3, #1
	ldr	r2, .L11+8
	str	r3, [r2]
	ldr	r3, .L11+8
	ldr	r3, [r3]
	cmp	r3, #1
	bne	.L8
	ldr	r0, .L11+12
	bl	pthread_mutex_lock
.L8:
	ldr	r0, .L11+4
	bl	pthread_mutex_unlock
	ldr	r0, .L11
	bl	pthread_mutex_unlock
	ldr	r1, [fp, #-8]
	ldr	r0, .L11+16
	bl	printf
	ldr	r0, .L11+4
	bl	pthread_mutex_lock
	ldr	r3, .L11+8
	ldr	r3, [r3]
	sub	r3, r3, #1
	ldr	r2, .L11+8
	str	r3, [r2]
	ldr	r3, .L11+8
	ldr	r3, [r3]
	mov	r2, r3
	ldr	r1, [fp, #-8]
	ldr	r0, .L11+20
	bl	printf
	ldr	r3, .L11+8
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L9
	ldr	r0, .L11+12
	bl	pthread_mutex_unlock
.L9:
	ldr	r0, .L11+4
	bl	pthread_mutex_unlock
	b	.L10
.L12:
	.align	2
.L11:
	.word	vez
	.word	mutex_direita
	.word	direita
	.word	mutex
	.word	.LC2
	.word	.LC1
	.size	macaco_direita, .-macaco_direita
	.section	.rodata
	.align	2
.LC3:
	.ascii	"N\303\243o pode criar a thread %d\012\000"
	.align	2
.LC4:
	.ascii	"Could not join thread %d\012\000"
	.align	2
.LC5:
	.ascii	"TERMINOU!\000"
	.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 = 64
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{fp, lr}
	add	fp, sp, #4
	sub	sp, sp, #64
	str	r0, [fp, #-64]
	str	r1, [fp, #-68]
	ldr	r3, .L24
	ldr	r3, [r3]
	str	r3, [fp, #-8]
	mov	r3,#0
	mov	r1, #0
	ldr	r0, .L24+4
	bl	pthread_mutex_init
	mov	r1, #0
	ldr	r0, .L24+8
	bl	pthread_mutex_init
	mov	r1, #0
	ldr	r0, .L24+12
	bl	pthread_mutex_init
	mov	r1, #0
	ldr	r0, .L24+16
	bl	pthread_mutex_init
	mov	r3, #0
	str	r3, [fp, #-56]
	mov	r3, #0
	str	r3, [fp, #-56]
	b	.L14
.L18:
	mov	r0, #4
	bl	malloc
	mov	r3, r0
	str	r3, [fp, #-52]
	ldr	r3, [fp, #-52]
	ldr	r2, [fp, #-56]
	str	r2, [r3]
	ldr	r3, [fp, #-56]
	and	r3, r3, #1
	cmp	r3, #0
	bne	.L15
	sub	r2, fp, #48
	ldr	r3, [fp, #-56]
	lsl	r3, r3, #2
	add	r0, r2, r3
	ldr	r3, [fp, #-52]
	ldr	r2, .L24+20
	mov	r1, #0
	bl	pthread_create
	mov	r3, r0
	cmp	r3, #0
	beq	.L16
	ldr	r1, [fp, #-56]
	ldr	r0, .L24+24
	bl	printf
	mvn	r3, #0
	b	.L22
.L15:
	sub	r2, fp, #48
	ldr	r3, [fp, #-56]
	lsl	r3, r3, #2
	add	r0, r2, r3
	ldr	r3, [fp, #-52]
	ldr	r2, .L24+28
	mov	r1, #0
	bl	pthread_create
	mov	r3, r0
	cmp	r3, #0
	beq	.L16
	ldr	r1, [fp, #-56]
	ldr	r0, .L24+24
	bl	printf
	mvn	r3, #0
	b	.L22
.L16:
	ldr	r3, [fp, #-52]
	add	r3, r3, #4
	str	r3, [fp, #-52]
	ldr	r3, [fp, #-56]
	add	r3, r3, #1
	str	r3, [fp, #-56]
.L14:
	ldr	r3, [fp, #-56]
	cmp	r3, #9
	ble	.L18
	mov	r3, #0
	str	r3, [fp, #-56]
	b	.L19
.L21:
	ldr	r3, [fp, #-56]
	lsl	r3, r3, #2
	sub	r2, fp, #4
	add	r3, r2, r3
	ldr	r3, [r3, #-44]
	mov	r1, #0
	mov	r0, r3
	bl	pthread_join
	mov	r3, r0
	cmp	r3, #0
	beq	.L20
	ldr	r1, [fp, #-56]
	ldr	r0, .L24+32
	bl	printf
	mvn	r3, #0
	b	.L22
.L20:
	ldr	r3, [fp, #-56]
	add	r3, r3, #1
	str	r3, [fp, #-56]
.L19:
	ldr	r3, [fp, #-56]
	cmp	r3, #9
	ble	.L21
	ldr	r0, .L24+36
	bl	puts
	mov	r3, #0
.L22:
	ldr	r2, .L24
	ldr	r1, [r2]
	ldr	r2, [fp, #-8]
	eors	r1, r2, r1
	mov	r2, #0
	beq	.L23
	bl	__stack_chk_fail
.L23:
	mov	r0, r3
	sub	sp, fp, #4
	@ sp needed
	pop	{fp, pc}
.L25:
	.align	2
.L24:
	.word	.LC6
	.word	mutex_esquerda
	.word	mutex_direita
	.word	mutex
	.word	vez
	.word	macaco_direita
	.word	.LC3
	.word	macaco_esquerda
	.word	.LC4
	.word	.LC5
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
