diff --git a/bin/meu_malloc.o b/bin/meu_malloc.o
index ac9277b16f9a3439a70edb80832106d1c093bc78..4624a10edc2614cd913e8515fb2c9c669ba68f99 100644
Binary files a/bin/meu_malloc.o and b/bin/meu_malloc.o differ
diff --git a/includes/meu_malloc.h b/includes/meu_malloc.h
index 71a9f90a89d574d7e30f4fe26a94b7fbe6fa439d..53a46152f3911e34605fb407a7e8b65b5b067688 100644
--- a/includes/meu_malloc.h
+++ b/includes/meu_malloc.h
@@ -9,10 +9,10 @@ void aloca_espaco(int tam_alloc);
 
 void* alocaMem(int tam_alloc);
 
-//void arruma_heap();
+void arruma_heap();
 
-//void liberaMem(void* bloco);
+void liberaMem(void* bloco);
 
 void print_mapa();
 
-#endif
+#endif
\ No newline at end of file
diff --git a/lib/libmeu_malloc.a b/lib/libmeu_malloc.a
index 3416b0109e8268ca82e7e377514ba356f9416e97..c0a3011798857345f00bccd609e9428b9a54909f 100644
Binary files a/lib/libmeu_malloc.a and b/lib/libmeu_malloc.a differ
diff --git a/pseudoc.c b/pseudoc.c
index 25d5a2cff5c043c4e724bda2888ea28c401078f8..e7fee05a5d9e86b0a4058af8a51efd06350c697c 100644
--- a/pseudoc.c
+++ b/pseudoc.c
@@ -70,12 +70,10 @@ void* alocaMem(int tam_alloc)
 			}
 			else
 			{
-				if (endr == teto_heap)
-				{				
-					aloca_espaco(tam_alloc);
-					(endr) = 0;
-					8(endr) = tam_alloc;	
-				}			
+				endr = teto_heap;
+				aloca_espaco(tam_alloc);
+				(endr) = 0;
+				8(endr) = tam_alloc;			
 			}			
 			break;		
 		}		
@@ -86,23 +84,15 @@ void* alocaMem(int tam_alloc)
 	return (endr + 16);
 }
 
-
-
-		cmpq $LIVRE, %rbx
-		jne fim_if_aloca_mem
-	
-
-
 void arruma_heap()
 {
-	if (piso_heap == 1)
-		return;
+	void *endr_ant, endr; 
 
 	endr_ant = piso_heap;
 	endr = piso_heap + 8(endr_ant) + 16;
 	while (endr < teto_heap)
 	{
-		if ((endr == 1) && (endr_ant == 1))
+		if ((endr == 1) && ((endr_ant) == 1))
 			8(endr_ant) += 8(endr) + 16;
 		else
 			endr_ant = endr;
diff --git a/src/meu_malloc.s b/src/meu_malloc.s
index e59e0c88dde394b5fc87e1233de3389cc1f0f52b..629b69149150d6c5f9b8e55c5e38c77d90063365 100644
--- a/src/meu_malloc.s
+++ b/src/meu_malloc.s
@@ -8,8 +8,9 @@
 	str5: .string "INICIANDO O ALOCADOR\n"
 	pula_Linha: .string "\n"
 
-	flag: .string "%d\n"		#############APAGARRRRRRRR########## 
-	oi: .string "oi\n"		#############APAGARRRRRRRR########## 
+	flag: .string "%d"
+	flaag: .string "%d, %d \n"		#############APAGARRRRRRRR########## 
+	oi: .string "oi\n"			#############APAGARRRRRRRR########## 
 
 .section .bss
 	.equ ALOCADOR, 1040
@@ -75,7 +76,13 @@ finalizaAlocador:
 aloca_espaco:
 	pushq %rbp
 	movq %rsp, %rbp
-		#traducao nao feita
+	
+		movq %rdi, %rax
+		addq $16, %rax
+		addq %rax, teto_heap
+		movq teto_heap, %rdi
+		movq $12, %rax
+		syscall
 
 	popq %rbp
 	ret
@@ -86,11 +93,6 @@ alocaMem:
 	subq $8, %rsp		#aloca espaco para endr	
 	
 	movq %rdi, %r12		#r12 = ponteiro alocado
-	
-	#movq $flag, %rdi
-	#movq %r12, %rsi
-	#call printf	
-	
 	movq piso_heap, %rbx
 	cmpq $0, %rbx
 	jne fim_if_aloca_mem	
@@ -108,22 +110,22 @@ alocaMem:
 			jl else_if_aloca_mem2
 				addq $16, %r12		#8(endr) -= tam_alloc + 16
 				subq %r12, 8(%rbx)				
-				
-				addq $16, 8(%rbx)	#endr += 8(endr) + 16
-				addq 8(%rbx), %rbx
-			
+				movq 8(%rbx), %r13
+				subq $16, %r12				
+				addq $16, %r13	#endr += 8(endr) + 16
+				addq %r13, %rbx	
 				movq $OCUPADO, (%rbx)
-				movq %r12, 8(%rbx)
-				
+				movq %r12, 8(%rbx)				
 			jmp fim_if_aloca_mem2
 			else_if_aloca_mem2:					
-				cmpq teto_heap, %rbx
-				jne fim_if_aloca_mem2
-					pushq %r12					
-					call aloca_espaco
-					movq $OCUPADO,(%rbx)
-					movq %r12, 8(%rbx)										
-				jmp fim_if_aloca_mem2
+				movq teto_heap,%rbx
+				movq %r12, %r15
+				pushq %r12
+				call aloca_espaco
+				popq %r12
+				movq $OCUPADO,(%rbx)
+				movq %r15, 8(%rbx)										
+			jmp fim_if_aloca_mem2
 			fim_if_aloca_mem2:
 			jmp fim_while_aloca_mem	
 		
@@ -144,14 +146,59 @@ alocaMem:
 arruma_heap:
 	pushq %rbp
 	movq %rsp, %rbp
-		#traducao nao feita	
+	subq $16, %rsp	
+
+	movq piso_heap, %r10
+	movq %r10, -8(%rbp)	#endr_ant = piso_heap
+	movq -8(%rbp), %rax
+	
+	movq piso_heap, %rbx
+	addq $16, %rbx
+	addq 8(%rax), %rbx
+	movq %rbx, -16(%rbp)		#endr = piso_heap + tam_piso + 16
+
+	while_arruma_heap:
+	cmpq teto_heap, %rbx
+	jge fim_while_arruma_heap
+		cmpq $1, (%rbx)
+		jne else_if_arruma_heap
+		cmpq $1, (%rax)
+		jne else_if_arruma_heap
+			movq 8(%rbx), %r10
+
+			addq %r10, 8(%rax)
+			addq $16, 8(%rax)
+
+		jmp fim_if_arruma_heap
+		else_if_arruma_heap:
+			movq %rbx, %rax
+		jmp fim_if_arruma_heap
+	fim_if_arruma_heap:
+	
+	movq 8(%rbx), %r13
+	addq $16, %r13
+	addq %r13, %rbx
+
+	jmp while_arruma_heap
+	fim_while_arruma_heap: 
+
+	#movq $flaag, %rdi
+	#movq (%rax), %rsi
+	#movq (%rbx), %rdx
+	#call printf
+
+	addq $16, %rsp
 	popq %rbp
 	ret
 #---------------------------------------------------------------------#
 liberaMem:
 	pushq %rbp
 	movq %rsp, %rbp
-		#traducao nao feita
+
+	movq %rdi, %rbx
+	movq $LIVRE, -16(%rbx)
+	call arruma_heap	
+
 	popq %rbp
 	ret
 #---------------------------------------------------------------------#
@@ -184,9 +231,10 @@ print_mapa:
 			addq $1, %r12
 			jmp for_cabecalho
 		fim_for_cabecalho:
-			#movq flag,%rdi		
-			#movq 8(%rbx),%rsi
-			#call printf		
+			
+			movq $flag,%rdi		
+			movq 8(%rbx),%rsi
+			call printf		
 		
 		cmpq $LIVRE, (%rbx)
 		jne else_if_while
@@ -216,8 +264,10 @@ print_mapa:
 			jmp fim_if_while
 		
 		fim_if_while:
-		addq $16, 8(%rbx)
-		addq 8(%rbx), %rbx
+		movq 8(%rbx), %r13
+		addq $16, %r13
+		addq %r13, %rbx
+
 		jmp while_loop
 	
 	fim_while_loop:
diff --git a/src/teste.c b/src/teste.c
index 8d5cbb7387a25f14949bfddcb62ca0426d96862f..7ca01d9abf05a9d3fd608c1bcaddf9ecbf1ec3ef 100644
--- a/src/teste.c
+++ b/src/teste.c
@@ -1,13 +1,46 @@
 #include <meu_malloc.h>
+#include <stdio.h>
 
 int main()
 {
-	void* x;
+	void *w, *x, *y, *z;
 	
 	iniciaAlocador();
-	x = alocaMem(1024);
 	print_mapa();
-	finalizaAlocador();
+	printf("\n");
+	w = alocaMem(100);
+	print_mapa();
+	printf("\n");
+	x = alocaMem(200);
+	print_mapa();
+	printf("\n");
+	y = alocaMem(300);
+	print_mapa();
+	printf("\n");	
+	z = alocaMem(400);
+	print_mapa();
+	printf("\n");
 	
+	liberaMem(x);
+	print_mapa();
+	
+	x = alocaMem(50);
+	print_mapa();
+	printf("\n");
+	
+	printf("\n");
+	liberaMem(y);
+	print_mapa();
+	printf("\n");
+	liberaMem(w);
+	print_mapa();
+	printf("\n");
+	liberaMem(x);
+	print_mapa();
+	printf("\n");
+	liberaMem(z);
+	print_mapa();
+	printf("\n");
+
 	return (0);
 }
diff --git a/teste b/teste
new file mode 100755
index 0000000000000000000000000000000000000000..a62e04207aa5ce53ce47c638b817124e16b7bbc3
Binary files /dev/null and b/teste differ