
_ls:     file format elf32-i386

Disassembly of section .text:

00000000 <fmtname>:
#include "fs.h"

char*
fmtname(char *path)
{
   0:	55                   	push   %ebp
   1:	89 e5                	mov    %esp,%ebp
   3:	56                   	push   %esi
   4:	53                   	push   %ebx
   5:	83 ec 10             	sub    $0x10,%esp
   8:	8b 5d 08             	mov    0x8(%ebp),%ebx
  static char buf[DIRSIZ+1];
  char *p;
  
  // Find first character after last slash.
  for(p=path+strlen(path); p >= path && *p != '/'; p--)
   b:	89 1c 24             	mov    %ebx,(%esp)
   e:	e8 7d 03 00 00       	call   390 <strlen>
  13:	8d 04 03             	lea    (%ebx,%eax,1),%eax
  16:	39 c3                	cmp    %eax,%ebx
  18:	76 0b                	jbe    25 <fmtname+0x25>
  1a:	eb 0e                	jmp    2a <fmtname+0x2a>
  1c:	8d 74 26 00          	lea    0x0(%esi),%esi
  20:	48                   	dec    %eax
  21:	39 c3                	cmp    %eax,%ebx
  23:	77 05                	ja     2a <fmtname+0x2a>
  25:	80 38 2f             	cmpb   $0x2f,(%eax)
  28:	75 f6                	jne    20 <fmtname+0x20>
    ;
  p++;
  2a:	8d 70 01             	lea    0x1(%eax),%esi
  
  // Return blank-padded name.
  if(strlen(p) >= DIRSIZ)
  2d:	89 34 24             	mov    %esi,(%esp)
  30:	e8 5b 03 00 00       	call   390 <strlen>
  35:	83 f8 0d             	cmp    $0xd,%eax
  38:	77 54                	ja     8e <fmtname+0x8e>
    return p;
  memmove(buf, p, strlen(p));
  3a:	89 34 24             	mov    %esi,(%esp)
  3d:	e8 4e 03 00 00       	call   390 <strlen>
  42:	89 74 24 04          	mov    %esi,0x4(%esp)
  46:	c7 04 24 0c 0a 00 00 	movl   $0xa0c,(%esp)
  4d:	89 44 24 08          	mov    %eax,0x8(%esp)
  51:	e8 fa 03 00 00       	call   450 <memmove>
  memset(buf+strlen(p), ' ', DIRSIZ-strlen(p));
  56:	89 34 24             	mov    %esi,(%esp)
  59:	e8 32 03 00 00       	call   390 <strlen>
  5e:	89 34 24             	mov    %esi,(%esp)
  61:	be 0c 0a 00 00       	mov    $0xa0c,%esi
  66:	89 c3                	mov    %eax,%ebx
  68:	e8 23 03 00 00       	call   390 <strlen>
  6d:	ba 0e 00 00 00       	mov    $0xe,%edx
  72:	29 da                	sub    %ebx,%edx
  74:	89 54 24 08          	mov    %edx,0x8(%esp)
  78:	ba 20 00 00 00       	mov    $0x20,%edx
  7d:	89 54 24 04          	mov    %edx,0x4(%esp)
  81:	05 0c 0a 00 00       	add    $0xa0c,%eax
  86:	89 04 24             	mov    %eax,(%esp)
  89:	e8 22 03 00 00       	call   3b0 <memset>
  return buf;
}
  8e:	83 c4 10             	add    $0x10,%esp
  91:	89 f0                	mov    %esi,%eax
  93:	5b                   	pop    %ebx
  94:	5e                   	pop    %esi
  95:	5d                   	pop    %ebp
  96:	c3                   	ret    
  97:	89 f6                	mov    %esi,%esi
  99:	8d bc 27 00 00 00 00 	lea    0x0(%edi),%edi

000000a0 <ls>:

void
ls(char *path)
{
  a0:	55                   	push   %ebp
  a1:	89 e5                	mov    %esp,%ebp
  a3:	81 ec 58 02 00 00    	sub    $0x258,%esp
  a9:	89 7d fc             	mov    %edi,0xfffffffc(%ebp)
  ac:	8b 7d 08             	mov    0x8(%ebp),%edi
  af:	89 75 f8             	mov    %esi,0xfffffff8(%ebp)
  char buf[512], *p;
  int fd;
  struct dirent de;
  struct stat st;
  
  if((fd = open(path, 0)) < 0){
  b2:	31 f6                	xor    %esi,%esi
  b4:	89 5d f4             	mov    %ebx,0xfffffff4(%ebp)
  b7:	89 74 24 04          	mov    %esi,0x4(%esp)
  bb:	89 3c 24             	mov    %edi,(%esp)
  be:	e8 d9 04 00 00       	call   59c <open>
  c3:	85 c0                	test   %eax,%eax
  c5:	89 85 cc fd ff ff    	mov    %eax,0xfffffdcc(%ebp)
  cb:	78 4b                	js     118 <ls+0x78>
    printf(2, "ls: cannot open %s\n", path);
    return;
  }
  
  if(fstat(fd, &st) < 0){
  cd:	8b 95 cc fd ff ff    	mov    0xfffffdcc(%ebp),%edx
  d3:	8d 45 d4             	lea    0xffffffd4(%ebp),%eax
  d6:	89 44 24 04          	mov    %eax,0x4(%esp)
  da:	89 14 24             	mov    %edx,(%esp)
  dd:	e8 d2 04 00 00       	call   5b4 <fstat>
  e2:	85 c0                	test   %eax,%eax
  e4:	0f 88 a2 01 00 00    	js     28c <ls+0x1ec>
    printf(2, "ls: cannot stat %s\n", path);
    close(fd);
    return;
  }
  
  switch(st.type){
  ea:	8b 45 dc             	mov    0xffffffdc(%ebp),%eax
  ed:	66 83 f8 01          	cmp    $0x1,%ax
  f1:	74 40                	je     133 <ls+0x93>
  f3:	66 83 f8 02          	cmp    $0x2,%ax
  f7:	0f 84 38 01 00 00    	je     235 <ls+0x195>
  case T_FILE:
    printf(1, "%s %d %d %d\n", fmtname(path), st.type, st.ino, st.size);
    break;
  
  case T_DIR:
    if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){
      printf(1, "ls: path too long\n");
      break;
    }
    strcpy(buf, path);
    p = buf+strlen(buf);
    *p++ = '/';
    while(read(fd, &de, sizeof(de)) == sizeof(de)){
      if(de.inum == 0)
        continue;
      memmove(p, de.name, DIRSIZ);
      p[DIRSIZ] = 0;
      if(stat(buf, &st) < 0){
        printf(1, "ls: cannot stat %s\n", buf);
        continue;
      }
      printf(1, "%s %d %d %d\n", fmtname(buf), st.type, st.ino, st.size);
    }
    break;
  }
  close(fd);
  fd:	8b 85 cc fd ff ff    	mov    0xfffffdcc(%ebp),%eax
 103:	89 04 24             	mov    %eax,(%esp)
 106:	e8 79 04 00 00       	call   584 <close>
}
 10b:	8b 5d f4             	mov    0xfffffff4(%ebp),%ebx
 10e:	8b 75 f8             	mov    0xfffffff8(%ebp),%esi
 111:	8b 7d fc             	mov    0xfffffffc(%ebp),%edi
 114:	89 ec                	mov    %ebp,%esp
 116:	5d                   	pop    %ebp
 117:	c3                   	ret    
 118:	bb aa 09 00 00       	mov    $0x9aa,%ebx
 11d:	89 7c 24 08          	mov    %edi,0x8(%esp)
 121:	89 5c 24 04          	mov    %ebx,0x4(%esp)
 125:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
 12c:	e8 8f 05 00 00       	call   6c0 <printf>
 131:	eb d8                	jmp    10b <ls+0x6b>
 133:	89 3c 24             	mov    %edi,(%esp)
 136:	e8 55 02 00 00       	call   390 <strlen>
 13b:	83 c0 10             	add    $0x10,%eax
 13e:	3d 00 02 00 00       	cmp    $0x200,%eax
 143:	0f 87 29 01 00 00    	ja     272 <ls+0x1d2>
 149:	8d 95 d4 fd ff ff    	lea    0xfffffdd4(%ebp),%edx
 14f:	89 14 24             	mov    %edx,(%esp)
 152:	89 7c 24 04          	mov    %edi,0x4(%esp)
 156:	e8 e5 01 00 00       	call   340 <strcpy>
 15b:	8d 85 d4 fd ff ff    	lea    0xfffffdd4(%ebp),%eax
 161:	89 04 24             	mov    %eax,(%esp)
 164:	e8 27 02 00 00       	call   390 <strlen>
 169:	8d 95 d4 fd ff ff    	lea    0xfffffdd4(%ebp),%edx
 16f:	8d 04 02             	lea    (%edx,%eax,1),%eax
 172:	c6 00 2f             	movb   $0x2f,(%eax)
 175:	40                   	inc    %eax
 176:	89 85 d0 fd ff ff    	mov    %eax,0xfffffdd0(%ebp)
 17c:	8d 74 26 00          	lea    0x0(%esi),%esi
 180:	8b 95 cc fd ff ff    	mov    0xfffffdcc(%ebp),%edx
 186:	b9 10 00 00 00       	mov    $0x10,%ecx
 18b:	8d 45 e4             	lea    0xffffffe4(%ebp),%eax
 18e:	89 4c 24 08          	mov    %ecx,0x8(%esp)
 192:	89 44 24 04          	mov    %eax,0x4(%esp)
 196:	89 14 24             	mov    %edx,(%esp)
 199:	e8 d6 03 00 00       	call   574 <read>
 19e:	83 f8 10             	cmp    $0x10,%eax
 1a1:	0f 85 56 ff ff ff    	jne    fd <ls+0x5d>
 1a7:	66 83 7d e4 00       	cmpw   $0x0,0xffffffe4(%ebp)
 1ac:	74 d2                	je     180 <ls+0xe0>
 1ae:	8d 45 e6             	lea    0xffffffe6(%ebp),%eax
 1b1:	bf 0e 00 00 00       	mov    $0xe,%edi
 1b6:	89 44 24 04          	mov    %eax,0x4(%esp)
 1ba:	8b 85 d0 fd ff ff    	mov    0xfffffdd0(%ebp),%eax
 1c0:	89 7c 24 08          	mov    %edi,0x8(%esp)
 1c4:	89 04 24             	mov    %eax,(%esp)
 1c7:	e8 84 02 00 00       	call   450 <memmove>
 1cc:	8b 95 d0 fd ff ff    	mov    0xfffffdd0(%ebp),%edx
 1d2:	8d 45 d4             	lea    0xffffffd4(%ebp),%eax
 1d5:	c6 42 0e 00          	movb   $0x0,0xe(%edx)
 1d9:	8d 95 d4 fd ff ff    	lea    0xfffffdd4(%ebp),%edx
 1df:	89 44 24 04          	mov    %eax,0x4(%esp)
 1e3:	89 14 24             	mov    %edx,(%esp)
 1e6:	e8 a5 02 00 00       	call   490 <stat>
 1eb:	85 c0                	test   %eax,%eax
 1ed:	0f 88 c5 00 00 00    	js     2b8 <ls+0x218>
 1f3:	8d 95 d4 fd ff ff    	lea    0xfffffdd4(%ebp),%edx
 1f9:	8b 5d e0             	mov    0xffffffe0(%ebp),%ebx
 1fc:	8b 75 d8             	mov    0xffffffd8(%ebp),%esi
 1ff:	0f bf 7d dc          	movswl 0xffffffdc(%ebp),%edi
 203:	89 14 24             	mov    %edx,(%esp)
 206:	e8 f5 fd ff ff       	call   0 <fmtname>
 20b:	89 5c 24 14          	mov    %ebx,0x14(%esp)
 20f:	bb d2 09 00 00       	mov    $0x9d2,%ebx
 214:	89 74 24 10          	mov    %esi,0x10(%esp)
 218:	89 7c 24 0c          	mov    %edi,0xc(%esp)
 21c:	89 5c 24 04          	mov    %ebx,0x4(%esp)
 220:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 227:	89 44 24 08          	mov    %eax,0x8(%esp)
 22b:	e8 90 04 00 00       	call   6c0 <printf>
 230:	e9 4b ff ff ff       	jmp    180 <ls+0xe0>
 235:	8b 5d e0             	mov    0xffffffe0(%ebp),%ebx
 238:	8b 75 d8             	mov    0xffffffd8(%ebp),%esi
 23b:	89 3c 24             	mov    %edi,(%esp)
 23e:	e8 bd fd ff ff       	call   0 <fmtname>
 243:	ba 02 00 00 00       	mov    $0x2,%edx
 248:	89 5c 24 14          	mov    %ebx,0x14(%esp)
 24c:	89 74 24 10          	mov    %esi,0x10(%esp)
 250:	89 54 24 0c          	mov    %edx,0xc(%esp)
 254:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 25b:	89 44 24 08          	mov    %eax,0x8(%esp)
 25f:	b8 d2 09 00 00       	mov    $0x9d2,%eax
 264:	89 44 24 04          	mov    %eax,0x4(%esp)
 268:	e8 53 04 00 00       	call   6c0 <printf>
 26d:	e9 8b fe ff ff       	jmp    fd <ls+0x5d>
 272:	b8 df 09 00 00       	mov    $0x9df,%eax
 277:	89 44 24 04          	mov    %eax,0x4(%esp)
 27b:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 282:	e8 39 04 00 00       	call   6c0 <printf>
 287:	e9 71 fe ff ff       	jmp    fd <ls+0x5d>
 28c:	b9 be 09 00 00       	mov    $0x9be,%ecx
 291:	89 7c 24 08          	mov    %edi,0x8(%esp)
 295:	89 4c 24 04          	mov    %ecx,0x4(%esp)
 299:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
 2a0:	e8 1b 04 00 00       	call   6c0 <printf>
 2a5:	8b 85 cc fd ff ff    	mov    0xfffffdcc(%ebp),%eax
 2ab:	89 04 24             	mov    %eax,(%esp)
 2ae:	e8 d1 02 00 00       	call   584 <close>
 2b3:	e9 53 fe ff ff       	jmp    10b <ls+0x6b>
 2b8:	8d 85 d4 fd ff ff    	lea    0xfffffdd4(%ebp),%eax
 2be:	be be 09 00 00       	mov    $0x9be,%esi
 2c3:	89 44 24 08          	mov    %eax,0x8(%esp)
 2c7:	89 74 24 04          	mov    %esi,0x4(%esp)
 2cb:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 2d2:	e8 e9 03 00 00       	call   6c0 <printf>
 2d7:	e9 a4 fe ff ff       	jmp    180 <ls+0xe0>
 2dc:	8d 74 26 00          	lea    0x0(%esi),%esi

000002e0 <main>:

int
main(int argc, char *argv[])
{
 2e0:	8d 4c 24 04          	lea    0x4(%esp),%ecx
 2e4:	83 e4 f0             	and    $0xfffffff0,%esp
 2e7:	ff 71 fc             	pushl  0xfffffffc(%ecx)
 2ea:	55                   	push   %ebp
 2eb:	89 e5                	mov    %esp,%ebp
 2ed:	83 ec 18             	sub    $0x18,%esp
 2f0:	89 5d f4             	mov    %ebx,0xfffffff4(%ebp)
 2f3:	8b 19                	mov    (%ecx),%ebx
 2f5:	89 4d f0             	mov    %ecx,0xfffffff0(%ebp)
 2f8:	89 75 f8             	mov    %esi,0xfffffff8(%ebp)
 2fb:	89 7d fc             	mov    %edi,0xfffffffc(%ebp)
  int i;

  if(argc < 2){
 2fe:	83 fb 01             	cmp    $0x1,%ebx
 301:	8b 71 04             	mov    0x4(%ecx),%esi
 304:	7f 11                	jg     317 <main+0x37>
    ls(".");
 306:	c7 04 24 f2 09 00 00 	movl   $0x9f2,(%esp)
 30d:	e8 8e fd ff ff       	call   a0 <ls>
    exit();
 312:	e8 45 02 00 00       	call   55c <exit>
 317:	bf 01 00 00 00       	mov    $0x1,%edi
  }
  for(i=1; i<argc; i++)
    ls(argv[i]);
 31c:	8b 04 be             	mov    (%esi,%edi,4),%eax
 31f:	47                   	inc    %edi
 320:	89 04 24             	mov    %eax,(%esp)
 323:	e8 78 fd ff ff       	call   a0 <ls>
 328:	39 fb                	cmp    %edi,%ebx
 32a:	75 f0                	jne    31c <main+0x3c>
  exit();
 32c:	e8 2b 02 00 00       	call   55c <exit>
 331:	90                   	nop    
 332:	90                   	nop    
 333:	90                   	nop    
 334:	90                   	nop    
 335:	90                   	nop    
 336:	90                   	nop    
 337:	90                   	nop    
 338:	90                   	nop    
 339:	90                   	nop    
 33a:	90                   	nop    
 33b:	90                   	nop    
 33c:	90                   	nop    
 33d:	90                   	nop    
 33e:	90                   	nop    
 33f:	90                   	nop    

00000340 <strcpy>:
#include "user.h"

char*
strcpy(char *s, char *t)
{
 340:	55                   	push   %ebp
 341:	89 e5                	mov    %esp,%ebp
 343:	53                   	push   %ebx
 344:	8b 5d 08             	mov    0x8(%ebp),%ebx
 347:	8b 4d 0c             	mov    0xc(%ebp),%ecx
 34a:	89 da                	mov    %ebx,%edx
 34c:	8d 74 26 00          	lea    0x0(%esi),%esi
  char *os;

  os = s;
  while((*s++ = *t++) != 0)
 350:	0f b6 01             	movzbl (%ecx),%eax
 353:	41                   	inc    %ecx
 354:	88 02                	mov    %al,(%edx)
 356:	42                   	inc    %edx
 357:	84 c0                	test   %al,%al
 359:	75 f5                	jne    350 <strcpy+0x10>
    ;
  return os;
}
 35b:	89 d8                	mov    %ebx,%eax
 35d:	5b                   	pop    %ebx
 35e:	5d                   	pop    %ebp
 35f:	c3                   	ret    

00000360 <strcmp>:

int
strcmp(const char *p, const char *q)
{
 360:	55                   	push   %ebp
 361:	89 e5                	mov    %esp,%ebp
 363:	8b 55 08             	mov    0x8(%ebp),%edx
 366:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  while(*p && *p == *q)
 369:	0f b6 02             	movzbl (%edx),%eax
 36c:	84 c0                	test   %al,%al
 36e:	75 0c                	jne    37c <strcmp+0x1c>
 370:	eb 10                	jmp    382 <strcmp+0x22>
 372:	0f b6 42 01          	movzbl 0x1(%edx),%eax
    p++, q++;
 376:	41                   	inc    %ecx
 377:	84 c0                	test   %al,%al
 379:	74 07                	je     382 <strcmp+0x22>
 37b:	42                   	inc    %edx
 37c:	3a 01                	cmp    (%ecx),%al
 37e:	89 f6                	mov    %esi,%esi
 380:	74 f0                	je     372 <strcmp+0x12>
 382:	0f b6 11             	movzbl (%ecx),%edx
 385:	0f b6 c0             	movzbl %al,%eax
  return (uchar)*p - (uchar)*q;
}
 388:	5d                   	pop    %ebp
 389:	29 d0                	sub    %edx,%eax
 38b:	c3                   	ret    
 38c:	8d 74 26 00          	lea    0x0(%esi),%esi

00000390 <strlen>:

uint
strlen(char *s)
{
 390:	55                   	push   %ebp
  int n;

  for(n = 0; s[n]; n++)
 391:	31 c0                	xor    %eax,%eax
 393:	89 e5                	mov    %esp,%ebp
 395:	8b 55 08             	mov    0x8(%ebp),%edx
 398:	80 3a 00             	cmpb   $0x0,(%edx)
 39b:	74 0a                	je     3a7 <strlen+0x17>
 39d:	8d 76 00             	lea    0x0(%esi),%esi
 3a0:	40                   	inc    %eax
 3a1:	80 3c 10 00          	cmpb   $0x0,(%eax,%edx,1)
 3a5:	75 f9                	jne    3a0 <strlen+0x10>
    ;
  return n;
}
 3a7:	5d                   	pop    %ebp
 3a8:	c3                   	ret    
 3a9:	8d b4 26 00 00 00 00 	lea    0x0(%esi),%esi

000003b0 <memset>:

void*
memset(void *dst, int c, uint n)
{
 3b0:	55                   	push   %ebp
 3b1:	89 e5                	mov    %esp,%ebp
 3b3:	8b 45 10             	mov    0x10(%ebp),%eax
 3b6:	53                   	push   %ebx
 3b7:	8b 5d 08             	mov    0x8(%ebp),%ebx
  char *d;
  
  d = dst;
  while(n-- > 0)
 3ba:	85 c0                	test   %eax,%eax
 3bc:	74 1a                	je     3d8 <memset+0x28>
 3be:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
 3c2:	31 d2                	xor    %edx,%edx
 3c4:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 3ca:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi
    *d++ = c;
 3d0:	88 0c 1a             	mov    %cl,(%edx,%ebx,1)
 3d3:	42                   	inc    %edx
 3d4:	39 d0                	cmp    %edx,%eax
 3d6:	75 f8                	jne    3d0 <memset+0x20>
  return dst;
}
 3d8:	89 d8                	mov    %ebx,%eax
 3da:	5b                   	pop    %ebx
 3db:	5d                   	pop    %ebp
 3dc:	c3                   	ret    
 3dd:	8d 76 00             	lea    0x0(%esi),%esi

000003e0 <strchr>:

char*
strchr(const char *s, char c)
{
 3e0:	55                   	push   %ebp
 3e1:	89 e5                	mov    %esp,%ebp
 3e3:	8b 45 08             	mov    0x8(%ebp),%eax
 3e6:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
  for(; *s; s++)
 3ea:	0f b6 10             	movzbl (%eax),%edx
 3ed:	84 d2                	test   %dl,%dl
 3ef:	74 19                	je     40a <strchr+0x2a>
    if(*s == c)
 3f1:	38 d1                	cmp    %dl,%cl
 3f3:	75 0d                	jne    402 <strchr+0x22>
 3f5:	eb 15                	jmp    40c <strchr+0x2c>
 3f7:	38 ca                	cmp    %cl,%dl
 3f9:	8d b4 26 00 00 00 00 	lea    0x0(%esi),%esi
 400:	74 0a                	je     40c <strchr+0x2c>
 402:	40                   	inc    %eax
 403:	0f b6 10             	movzbl (%eax),%edx
 406:	84 d2                	test   %dl,%dl
 408:	75 ed                	jne    3f7 <strchr+0x17>
 40a:	31 c0                	xor    %eax,%eax
      return (char*) s;
  return 0;
}
 40c:	5d                   	pop    %ebp
 40d:	c3                   	ret    
 40e:	89 f6                	mov    %esi,%esi

00000410 <atoi>:

char*
gets(char *buf, int max)
{
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
    cc = read(0, &c, 1);
    if(cc < 1)
      break;
    buf[i++] = c;
    if(c == '\n' || c == '\r')
      break;
  }
  buf[i] = '\0';
  return buf;
}

int
stat(char *n, struct stat *st)
{
  int fd;
  int r;

  fd = open(n, O_RDONLY);
  if(fd < 0)
    return -1;
  r = fstat(fd, st);
  close(fd);
  return r;
}

int
atoi(const char *s)
{
 410:	55                   	push   %ebp
 411:	89 e5                	mov    %esp,%ebp
 413:	8b 4d 08             	mov    0x8(%ebp),%ecx
 416:	53                   	push   %ebx
  int n;

  n = 0;
  while('0' <= *s && *s <= '9')
 417:	31 db                	xor    %ebx,%ebx
 419:	0f b6 11             	movzbl (%ecx),%edx
 41c:	88 d0                	mov    %dl,%al
 41e:	2c 30                	sub    $0x30,%al
 420:	3c 09                	cmp    $0x9,%al
 422:	77 23                	ja     447 <atoi+0x37>
 424:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 42a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi
    n = n*10 + *s++ - '0';
 430:	8d 04 9b             	lea    (%ebx,%ebx,4),%eax
 433:	0f be d2             	movsbl %dl,%edx
 436:	8d 5c 42 d0          	lea    0xffffffd0(%edx,%eax,2),%ebx
 43a:	0f b6 51 01          	movzbl 0x1(%ecx),%edx
 43e:	41                   	inc    %ecx
 43f:	88 d0                	mov    %dl,%al
 441:	2c 30                	sub    $0x30,%al
 443:	3c 09                	cmp    $0x9,%al
 445:	76 e9                	jbe    430 <atoi+0x20>
  return n;
}
 447:	89 d8                	mov    %ebx,%eax
 449:	5b                   	pop    %ebx
 44a:	5d                   	pop    %ebp
 44b:	c3                   	ret    
 44c:	8d 74 26 00          	lea    0x0(%esi),%esi

00000450 <memmove>:

void*
memmove(void *vdst, void *vsrc, int n)
{
 450:	55                   	push   %ebp
 451:	89 e5                	mov    %esp,%ebp
 453:	8b 4d 10             	mov    0x10(%ebp),%ecx
 456:	56                   	push   %esi
 457:	8b 75 08             	mov    0x8(%ebp),%esi
 45a:	53                   	push   %ebx
 45b:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
 45e:	85 c9                	test   %ecx,%ecx
 460:	7e 1a                	jle    47c <memmove+0x2c>
 462:	31 d2                	xor    %edx,%edx
 464:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 46a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi
    *dst++ = *src++;
 470:	0f b6 04 1a          	movzbl (%edx,%ebx,1),%eax
 474:	88 04 32             	mov    %al,(%edx,%esi,1)
 477:	42                   	inc    %edx
 478:	39 ca                	cmp    %ecx,%edx
 47a:	75 f4                	jne    470 <memmove+0x20>
  return vdst;
}
 47c:	5b                   	pop    %ebx
 47d:	89 f0                	mov    %esi,%eax
 47f:	5e                   	pop    %esi
 480:	5d                   	pop    %ebp
 481:	c3                   	ret    
 482:	8d b4 26 00 00 00 00 	lea    0x0(%esi),%esi
 489:	8d bc 27 00 00 00 00 	lea    0x0(%edi),%edi

00000490 <stat>:
 490:	55                   	push   %ebp
 491:	31 c0                	xor    %eax,%eax
 493:	89 e5                	mov    %esp,%ebp
 495:	83 ec 18             	sub    $0x18,%esp
 498:	89 44 24 04          	mov    %eax,0x4(%esp)
 49c:	8b 45 08             	mov    0x8(%ebp),%eax
 49f:	89 5d f8             	mov    %ebx,0xfffffff8(%ebp)
 4a2:	89 75 fc             	mov    %esi,0xfffffffc(%ebp)
 4a5:	be ff ff ff ff       	mov    $0xffffffff,%esi
 4aa:	89 04 24             	mov    %eax,(%esp)
 4ad:	e8 ea 00 00 00       	call   59c <open>
 4b2:	85 c0                	test   %eax,%eax
 4b4:	89 c3                	mov    %eax,%ebx
 4b6:	78 19                	js     4d1 <stat+0x41>
 4b8:	8b 45 0c             	mov    0xc(%ebp),%eax
 4bb:	89 1c 24             	mov    %ebx,(%esp)
 4be:	89 44 24 04          	mov    %eax,0x4(%esp)
 4c2:	e8 ed 00 00 00       	call   5b4 <fstat>
 4c7:	89 1c 24             	mov    %ebx,(%esp)
 4ca:	89 c6                	mov    %eax,%esi
 4cc:	e8 b3 00 00 00       	call   584 <close>
 4d1:	89 f0                	mov    %esi,%eax
 4d3:	8b 5d f8             	mov    0xfffffff8(%ebp),%ebx
 4d6:	8b 75 fc             	mov    0xfffffffc(%ebp),%esi
 4d9:	89 ec                	mov    %ebp,%esp
 4db:	5d                   	pop    %ebp
 4dc:	c3                   	ret    
 4dd:	8d 76 00             	lea    0x0(%esi),%esi

000004e0 <gets>:
 4e0:	55                   	push   %ebp
 4e1:	89 e5                	mov    %esp,%ebp
 4e3:	57                   	push   %edi
 4e4:	56                   	push   %esi
 4e5:	31 f6                	xor    %esi,%esi
 4e7:	53                   	push   %ebx
 4e8:	83 ec 1c             	sub    $0x1c,%esp
 4eb:	8d 5e 01             	lea    0x1(%esi),%ebx
 4ee:	8b 7d 08             	mov    0x8(%ebp),%edi
 4f1:	3b 5d 0c             	cmp    0xc(%ebp),%ebx
 4f4:	7d 3e                	jge    534 <gets+0x54>
 4f6:	ba 01 00 00 00       	mov    $0x1,%edx
 4fb:	8d 45 f3             	lea    0xfffffff3(%ebp),%eax
 4fe:	89 54 24 08          	mov    %edx,0x8(%esp)
 502:	89 44 24 04          	mov    %eax,0x4(%esp)
 506:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
 50d:	e8 62 00 00 00       	call   574 <read>
 512:	85 c0                	test   %eax,%eax
 514:	7e 1e                	jle    534 <gets+0x54>
 516:	0f b6 45 f3          	movzbl 0xfffffff3(%ebp),%eax
 51a:	88 44 3b ff          	mov    %al,0xffffffff(%ebx,%edi,1)
 51e:	0f b6 45 f3          	movzbl 0xfffffff3(%ebp),%eax
 522:	3c 0a                	cmp    $0xa,%al
 524:	74 1c                	je     542 <gets+0x62>
 526:	3c 0d                	cmp    $0xd,%al
 528:	74 18                	je     542 <gets+0x62>
 52a:	89 de                	mov    %ebx,%esi
 52c:	8d 5e 01             	lea    0x1(%esi),%ebx
 52f:	3b 5d 0c             	cmp    0xc(%ebp),%ebx
 532:	7c c2                	jl     4f6 <gets+0x16>
 534:	c6 04 3e 00          	movb   $0x0,(%esi,%edi,1)
 538:	83 c4 1c             	add    $0x1c,%esp
 53b:	89 f8                	mov    %edi,%eax
 53d:	5b                   	pop    %ebx
 53e:	5e                   	pop    %esi
 53f:	5f                   	pop    %edi
 540:	5d                   	pop    %ebp
 541:	c3                   	ret    
 542:	89 de                	mov    %ebx,%esi
 544:	89 f8                	mov    %edi,%eax
 546:	c6 04 3e 00          	movb   $0x0,(%esi,%edi,1)
 54a:	83 c4 1c             	add    $0x1c,%esp
 54d:	5b                   	pop    %ebx
 54e:	5e                   	pop    %esi
 54f:	5f                   	pop    %edi
 550:	5d                   	pop    %ebp
 551:	c3                   	ret    
 552:	90                   	nop    
 553:	90                   	nop    

00000554 <fork>:
 554:	b8 01 00 00 00       	mov    $0x1,%eax
 559:	cd 30                	int    $0x30
 55b:	c3                   	ret    

0000055c <exit>:
 55c:	b8 02 00 00 00       	mov    $0x2,%eax
 561:	cd 30                	int    $0x30
 563:	c3                   	ret    

00000564 <wait>:
 564:	b8 03 00 00 00       	mov    $0x3,%eax
 569:	cd 30                	int    $0x30
 56b:	c3                   	ret    

0000056c <pipe>:
 56c:	b8 04 00 00 00       	mov    $0x4,%eax
 571:	cd 30                	int    $0x30
 573:	c3                   	ret    

00000574 <read>:
 574:	b8 06 00 00 00       	mov    $0x6,%eax
 579:	cd 30                	int    $0x30
 57b:	c3                   	ret    

0000057c <write>:
 57c:	b8 05 00 00 00       	mov    $0x5,%eax
 581:	cd 30                	int    $0x30
 583:	c3                   	ret    

00000584 <close>:
 584:	b8 07 00 00 00       	mov    $0x7,%eax
 589:	cd 30                	int    $0x30
 58b:	c3                   	ret    

0000058c <kill>:
 58c:	b8 08 00 00 00       	mov    $0x8,%eax
 591:	cd 30                	int    $0x30
 593:	c3                   	ret    

00000594 <exec>:
 594:	b8 09 00 00 00       	mov    $0x9,%eax
 599:	cd 30                	int    $0x30
 59b:	c3                   	ret    

0000059c <open>:
 59c:	b8 0a 00 00 00       	mov    $0xa,%eax
 5a1:	cd 30                	int    $0x30
 5a3:	c3                   	ret    

000005a4 <mknod>:
 5a4:	b8 0b 00 00 00       	mov    $0xb,%eax
 5a9:	cd 30                	int    $0x30
 5ab:	c3                   	ret    

000005ac <unlink>:
 5ac:	b8 0c 00 00 00       	mov    $0xc,%eax
 5b1:	cd 30                	int    $0x30
 5b3:	c3                   	ret    

000005b4 <fstat>:
 5b4:	b8 0d 00 00 00       	mov    $0xd,%eax
 5b9:	cd 30                	int    $0x30
 5bb:	c3                   	ret    

000005bc <link>:
 5bc:	b8 0e 00 00 00       	mov    $0xe,%eax
 5c1:	cd 30                	int    $0x30
 5c3:	c3                   	ret    

000005c4 <mkdir>:
 5c4:	b8 0f 00 00 00       	mov    $0xf,%eax
 5c9:	cd 30                	int    $0x30
 5cb:	c3                   	ret    

000005cc <chdir>:
 5cc:	b8 10 00 00 00       	mov    $0x10,%eax
 5d1:	cd 30                	int    $0x30
 5d3:	c3                   	ret    

000005d4 <dup>:
 5d4:	b8 11 00 00 00       	mov    $0x11,%eax
 5d9:	cd 30                	int    $0x30
 5db:	c3                   	ret    

000005dc <getpid>:
 5dc:	b8 12 00 00 00       	mov    $0x12,%eax
 5e1:	cd 30                	int    $0x30
 5e3:	c3                   	ret    

000005e4 <sbrk>:
 5e4:	b8 13 00 00 00       	mov    $0x13,%eax
 5e9:	cd 30                	int    $0x30
 5eb:	c3                   	ret    

000005ec <sleep>:
 5ec:	b8 14 00 00 00       	mov    $0x14,%eax
 5f1:	cd 30                	int    $0x30
 5f3:	c3                   	ret    
 5f4:	90                   	nop    
 5f5:	90                   	nop    
 5f6:	90                   	nop    
 5f7:	90                   	nop    
 5f8:	90                   	nop    
 5f9:	90                   	nop    
 5fa:	90                   	nop    
 5fb:	90                   	nop    
 5fc:	90                   	nop    
 5fd:	90                   	nop    
 5fe:	90                   	nop    
 5ff:	90                   	nop    

00000600 <putc>:
#include "user.h"

static void
putc(int fd, char c)
{
 600:	55                   	push   %ebp
 601:	89 e5                	mov    %esp,%ebp
 603:	83 ec 18             	sub    $0x18,%esp
 606:	88 55 fc             	mov    %dl,0xfffffffc(%ebp)
  write(fd, &c, 1);
 609:	ba 01 00 00 00       	mov    $0x1,%edx
 60e:	89 54 24 08          	mov    %edx,0x8(%esp)
 612:	8d 55 fc             	lea    0xfffffffc(%ebp),%edx
 615:	89 54 24 04          	mov    %edx,0x4(%esp)
 619:	89 04 24             	mov    %eax,(%esp)
 61c:	e8 5b ff ff ff       	call   57c <write>
}
 621:	c9                   	leave  
 622:	c3                   	ret    
 623:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 629:	8d bc 27 00 00 00 00 	lea    0x0(%edi),%edi

00000630 <printint>:

static void
printint(int fd, int xx, int base, int sgn)
{
 630:	55                   	push   %ebp
 631:	89 e5                	mov    %esp,%ebp
 633:	57                   	push   %edi
 634:	56                   	push   %esi
 635:	89 ce                	mov    %ecx,%esi
 637:	53                   	push   %ebx
 638:	83 ec 1c             	sub    $0x1c,%esp
  static char digits[] = "0123456789ABCDEF";
  char buf[16];
  int i, neg;
  uint x;

  neg = 0;
  if(sgn && xx < 0){
 63b:	8b 5d 08             	mov    0x8(%ebp),%ebx
 63e:	89 45 dc             	mov    %eax,0xffffffdc(%ebp)
 641:	85 db                	test   %ebx,%ebx
 643:	74 04                	je     649 <printint+0x19>
 645:	85 d2                	test   %edx,%edx
 647:	78 62                	js     6ab <printint+0x7b>
    neg = 1;
    x = -xx;
  } else {
    x = xx;
 649:	89 d0                	mov    %edx,%eax
 64b:	c7 45 e0 00 00 00 00 	movl   $0x0,0xffffffe0(%ebp)
 652:	31 db                	xor    %ebx,%ebx
 654:	8d 7d e4             	lea    0xffffffe4(%ebp),%edi
 657:	89 f6                	mov    %esi,%esi
 659:	8d bc 27 00 00 00 00 	lea    0x0(%edi),%edi
  }

  i = 0;
  do{
    buf[i++] = digits[x % base];
 660:	31 d2                	xor    %edx,%edx
 662:	f7 f6                	div    %esi
 664:	89 c1                	mov    %eax,%ecx
 666:	0f b6 82 fb 09 00 00 	movzbl 0x9fb(%edx),%eax
 66d:	88 04 3b             	mov    %al,(%ebx,%edi,1)
 670:	43                   	inc    %ebx
  }while((x /= base) != 0);
 671:	85 c9                	test   %ecx,%ecx
 673:	89 c8                	mov    %ecx,%eax
 675:	75 e9                	jne    660 <printint+0x30>
  if(neg)
 677:	8b 4d e0             	mov    0xffffffe0(%ebp),%ecx
 67a:	85 c9                	test   %ecx,%ecx
 67c:	74 06                	je     684 <printint+0x54>
    buf[i++] = '-';
 67e:	c6 44 1d e4 2d       	movb   $0x2d,0xffffffe4(%ebp,%ebx,1)
 683:	43                   	inc    %ebx

  while(--i >= 0)
 684:	4b                   	dec    %ebx
 685:	78 1c                	js     6a3 <printint+0x73>
 687:	89 f6                	mov    %esi,%esi
 689:	8d bc 27 00 00 00 00 	lea    0x0(%edi),%edi
    putc(fd, buf[i]);
 690:	0f be 54 1d e4       	movsbl 0xffffffe4(%ebp,%ebx,1),%edx
 695:	4b                   	dec    %ebx
 696:	8b 45 dc             	mov    0xffffffdc(%ebp),%eax
 699:	e8 62 ff ff ff       	call   600 <putc>
 69e:	83 fb ff             	cmp    $0xffffffff,%ebx
 6a1:	75 ed                	jne    690 <printint+0x60>
}
 6a3:	83 c4 1c             	add    $0x1c,%esp
 6a6:	5b                   	pop    %ebx
 6a7:	5e                   	pop    %esi
 6a8:	5f                   	pop    %edi
 6a9:	5d                   	pop    %ebp
 6aa:	c3                   	ret    
 6ab:	89 d0                	mov    %edx,%eax
 6ad:	f7 d8                	neg    %eax
 6af:	c7 45 e0 01 00 00 00 	movl   $0x1,0xffffffe0(%ebp)
 6b6:	eb 9a                	jmp    652 <printint+0x22>
 6b8:	90                   	nop    
 6b9:	8d b4 26 00 00 00 00 	lea    0x0(%esi),%esi

000006c0 <printf>:

// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
 6c0:	55                   	push   %ebp
 6c1:	89 e5                	mov    %esp,%ebp
 6c3:	57                   	push   %edi
 6c4:	56                   	push   %esi
 6c5:	53                   	push   %ebx
 6c6:	83 ec 0c             	sub    $0xc,%esp
  char *s;
  int c, i, state;
  uint *ap;

  state = 0;
  ap = (uint*)(void*)&fmt + 1;
  for(i = 0; fmt[i]; i++){
 6c9:	8b 55 0c             	mov    0xc(%ebp),%edx
 6cc:	0f b6 02             	movzbl (%edx),%eax
 6cf:	84 c0                	test   %al,%al
 6d1:	0f 84 99 00 00 00    	je     770 <printf+0xb0>
 6d7:	8d 4d 10             	lea    0x10(%ebp),%ecx
 6da:	31 ff                	xor    %edi,%edi
 6dc:	31 f6                	xor    %esi,%esi
 6de:	89 4d f0             	mov    %ecx,0xfffffff0(%ebp)
 6e1:	eb 26                	jmp    709 <printf+0x49>
    c = fmt[i] & 0xff;
    if(state == 0){
      if(c == '%'){
 6e3:	83 fb 25             	cmp    $0x25,%ebx
 6e6:	0f 85 8c 00 00 00    	jne    778 <printf+0xb8>
 6ec:	be 25 00 00 00       	mov    $0x25,%esi
 6f1:	eb 0d                	jmp    700 <printf+0x40>
 6f3:	90                   	nop    
 6f4:	90                   	nop    
 6f5:	90                   	nop    
 6f6:	90                   	nop    
 6f7:	90                   	nop    
 6f8:	90                   	nop    
 6f9:	90                   	nop    
 6fa:	90                   	nop    
 6fb:	90                   	nop    
 6fc:	90                   	nop    
 6fd:	90                   	nop    
 6fe:	90                   	nop    
 6ff:	90                   	nop    
 700:	47                   	inc    %edi
 701:	0f b6 04 3a          	movzbl (%edx,%edi,1),%eax
 705:	84 c0                	test   %al,%al
 707:	74 67                	je     770 <printf+0xb0>
 709:	85 f6                	test   %esi,%esi
 70b:	0f b6 d8             	movzbl %al,%ebx
 70e:	74 d3                	je     6e3 <printf+0x23>
        state = '%';
      } else {
        putc(fd, c);
      }
    } else if(state == '%'){
 710:	83 fe 25             	cmp    $0x25,%esi
 713:	75 eb                	jne    700 <printf+0x40>
      if(c == 'd'){
 715:	83 fb 64             	cmp    $0x64,%ebx
 718:	0f 84 e0 00 00 00    	je     7fe <printf+0x13e>
        printint(fd, *ap, 10, 1);
        ap++;
      } else if(c == 'x' || c == 'p'){
 71e:	83 fb 78             	cmp    $0x78,%ebx
 721:	74 68                	je     78b <printf+0xcb>
 723:	83 fb 70             	cmp    $0x70,%ebx
 726:	74 63                	je     78b <printf+0xcb>
        printint(fd, *ap, 16, 0);
        ap++;
      } else if(c == 's'){
 728:	83 fb 73             	cmp    $0x73,%ebx
 72b:	90                   	nop    
 72c:	8d 74 26 00          	lea    0x0(%esi),%esi
 730:	0f 84 7c 00 00 00    	je     7b2 <printf+0xf2>
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
        while(*s != 0){
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
 736:	83 fb 63             	cmp    $0x63,%ebx
 739:	0f 84 e4 00 00 00    	je     823 <printf+0x163>
        putc(fd, *ap);
        ap++;
      } else if(c == '%'){
 73f:	83 fb 25             	cmp    $0x25,%ebx
 742:	0f 84 c4 00 00 00    	je     80c <printf+0x14c>
        putc(fd, c);
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
 748:	8b 45 08             	mov    0x8(%ebp),%eax
 74b:	ba 25 00 00 00       	mov    $0x25,%edx
 750:	47                   	inc    %edi
        putc(fd, c);
 751:	31 f6                	xor    %esi,%esi
 753:	e8 a8 fe ff ff       	call   600 <putc>
 758:	8b 45 08             	mov    0x8(%ebp),%eax
 75b:	0f be d3             	movsbl %bl,%edx
 75e:	e8 9d fe ff ff       	call   600 <putc>
 763:	8b 55 0c             	mov    0xc(%ebp),%edx
 766:	0f b6 04 3a          	movzbl (%edx,%edi,1),%eax
 76a:	84 c0                	test   %al,%al
 76c:	75 9b                	jne    709 <printf+0x49>
 76e:	89 f6                	mov    %esi,%esi
      }
      state = 0;
    }
  }
}
 770:	83 c4 0c             	add    $0xc,%esp
 773:	5b                   	pop    %ebx
 774:	5e                   	pop    %esi
 775:	5f                   	pop    %edi
 776:	5d                   	pop    %ebp
 777:	c3                   	ret    
 778:	8b 45 08             	mov    0x8(%ebp),%eax
 77b:	0f be d3             	movsbl %bl,%edx
 77e:	e8 7d fe ff ff       	call   600 <putc>
 783:	8b 55 0c             	mov    0xc(%ebp),%edx
 786:	e9 75 ff ff ff       	jmp    700 <printf+0x40>
 78b:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
 792:	b9 10 00 00 00       	mov    $0x10,%ecx
 797:	8b 45 f0             	mov    0xfffffff0(%ebp),%eax
 79a:	31 f6                	xor    %esi,%esi
 79c:	8b 10                	mov    (%eax),%edx
 79e:	8b 45 08             	mov    0x8(%ebp),%eax
 7a1:	e8 8a fe ff ff       	call   630 <printint>
 7a6:	8b 55 0c             	mov    0xc(%ebp),%edx
 7a9:	83 45 f0 04          	addl   $0x4,0xfffffff0(%ebp)
 7ad:	e9 4e ff ff ff       	jmp    700 <printf+0x40>
 7b2:	8b 4d f0             	mov    0xfffffff0(%ebp),%ecx
 7b5:	8b 01                	mov    (%ecx),%eax
 7b7:	83 c1 04             	add    $0x4,%ecx
 7ba:	89 4d f0             	mov    %ecx,0xfffffff0(%ebp)
 7bd:	b9 f4 09 00 00       	mov    $0x9f4,%ecx
 7c2:	85 c0                	test   %eax,%eax
 7c4:	74 02                	je     7c8 <printf+0x108>
 7c6:	89 c1                	mov    %eax,%ecx
 7c8:	0f b6 01             	movzbl (%ecx),%eax
 7cb:	84 c0                	test   %al,%al
 7cd:	74 28                	je     7f7 <printf+0x137>
 7cf:	89 cb                	mov    %ecx,%ebx
 7d1:	eb 0d                	jmp    7e0 <printf+0x120>
 7d3:	90                   	nop    
 7d4:	90                   	nop    
 7d5:	90                   	nop    
 7d6:	90                   	nop    
 7d7:	90                   	nop    
 7d8:	90                   	nop    
 7d9:	90                   	nop    
 7da:	90                   	nop    
 7db:	90                   	nop    
 7dc:	90                   	nop    
 7dd:	90                   	nop    
 7de:	90                   	nop    
 7df:	90                   	nop    
 7e0:	0f be d0             	movsbl %al,%edx
 7e3:	8b 45 08             	mov    0x8(%ebp),%eax
 7e6:	e8 15 fe ff ff       	call   600 <putc>
 7eb:	0f b6 43 01          	movzbl 0x1(%ebx),%eax
 7ef:	43                   	inc    %ebx
 7f0:	84 c0                	test   %al,%al
 7f2:	75 ec                	jne    7e0 <printf+0x120>
 7f4:	8b 55 0c             	mov    0xc(%ebp),%edx
 7f7:	31 f6                	xor    %esi,%esi
 7f9:	e9 02 ff ff ff       	jmp    700 <printf+0x40>
 7fe:	b9 0a 00 00 00       	mov    $0xa,%ecx
 803:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 80a:	eb 8b                	jmp    797 <printf+0xd7>
 80c:	8b 45 08             	mov    0x8(%ebp),%eax
 80f:	ba 25 00 00 00       	mov    $0x25,%edx
 814:	31 f6                	xor    %esi,%esi
 816:	e8 e5 fd ff ff       	call   600 <putc>
 81b:	8b 55 0c             	mov    0xc(%ebp),%edx
 81e:	e9 dd fe ff ff       	jmp    700 <printf+0x40>
 823:	8b 45 f0             	mov    0xfffffff0(%ebp),%eax
 826:	31 f6                	xor    %esi,%esi
 828:	0f be 10             	movsbl (%eax),%edx
 82b:	8b 45 08             	mov    0x8(%ebp),%eax
 82e:	e8 cd fd ff ff       	call   600 <putc>
 833:	8b 55 0c             	mov    0xc(%ebp),%edx
 836:	83 45 f0 04          	addl   $0x4,0xfffffff0(%ebp)
 83a:	e9 c1 fe ff ff       	jmp    700 <printf+0x40>
 83f:	90                   	nop    

00000840 <free>:
static Header *freep;

void
free(void *ap)
{
 840:	55                   	push   %ebp
  Header *bp, *p;

  bp = (Header*) ap - 1;
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
 841:	8b 0d 24 0a 00 00    	mov    0xa24,%ecx
 847:	89 e5                	mov    %esp,%ebp
 849:	56                   	push   %esi
 84a:	53                   	push   %ebx
 84b:	8b 5d 08             	mov    0x8(%ebp),%ebx
 84e:	83 eb 08             	sub    $0x8,%ebx
 851:	eb 0d                	jmp    860 <free+0x20>
 853:	90                   	nop    
 854:	90                   	nop    
 855:	90                   	nop    
 856:	90                   	nop    
 857:	90                   	nop    
 858:	90                   	nop    
 859:	90                   	nop    
 85a:	90                   	nop    
 85b:	90                   	nop    
 85c:	90                   	nop    
 85d:	90                   	nop    
 85e:	90                   	nop    
 85f:	90                   	nop    
 860:	39 d9                	cmp    %ebx,%ecx
 862:	73 04                	jae    868 <free+0x28>
 864:	3b 19                	cmp    (%ecx),%ebx
 866:	72 12                	jb     87a <free+0x3a>
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
 868:	8b 11                	mov    (%ecx),%edx
 86a:	39 d1                	cmp    %edx,%ecx
 86c:	72 08                	jb     876 <free+0x36>
 86e:	39 d9                	cmp    %ebx,%ecx
 870:	72 0a                	jb     87c <free+0x3c>
 872:	39 d3                	cmp    %edx,%ebx
 874:	72 06                	jb     87c <free+0x3c>
 876:	89 d1                	mov    %edx,%ecx
 878:	eb e6                	jmp    860 <free+0x20>
 87a:	8b 11                	mov    (%ecx),%edx
      break;
  if(bp + bp->s.size == p->s.ptr){
 87c:	8b 73 04             	mov    0x4(%ebx),%esi
 87f:	8d 04 f3             	lea    (%ebx,%esi,8),%eax
 882:	39 d0                	cmp    %edx,%eax
 884:	74 2e                	je     8b4 <free+0x74>
    bp->s.size += p->s.ptr->s.size;
    bp->s.ptr = p->s.ptr->s.ptr;
  } else
    bp->s.ptr = p->s.ptr;
 886:	89 13                	mov    %edx,(%ebx)
  if(p + p->s.size == bp){
 888:	8b 51 04             	mov    0x4(%ecx),%edx
 88b:	8d 04 d1             	lea    (%ecx,%edx,8),%eax
 88e:	39 c3                	cmp    %eax,%ebx
 890:	74 0c                	je     89e <free+0x5e>
    p->s.size += bp->s.size;
    p->s.ptr = bp->s.ptr;
  } else
    p->s.ptr = bp;
 892:	89 19                	mov    %ebx,(%ecx)
  freep = p;
}
 894:	5b                   	pop    %ebx
 895:	89 0d 24 0a 00 00    	mov    %ecx,0xa24
 89b:	5e                   	pop    %esi
 89c:	5d                   	pop    %ebp
 89d:	c3                   	ret    
 89e:	8b 43 04             	mov    0x4(%ebx),%eax
 8a1:	01 c2                	add    %eax,%edx
 8a3:	8b 03                	mov    (%ebx),%eax
 8a5:	89 51 04             	mov    %edx,0x4(%ecx)
 8a8:	89 01                	mov    %eax,(%ecx)
 8aa:	5b                   	pop    %ebx
 8ab:	89 0d 24 0a 00 00    	mov    %ecx,0xa24
 8b1:	5e                   	pop    %esi
 8b2:	5d                   	pop    %ebp
 8b3:	c3                   	ret    
 8b4:	8b 42 04             	mov    0x4(%edx),%eax
 8b7:	01 c6                	add    %eax,%esi
 8b9:	8b 02                	mov    (%edx),%eax
 8bb:	89 73 04             	mov    %esi,0x4(%ebx)
 8be:	89 03                	mov    %eax,(%ebx)
 8c0:	eb c6                	jmp    888 <free+0x48>
 8c2:	8d b4 26 00 00 00 00 	lea    0x0(%esi),%esi
 8c9:	8d bc 27 00 00 00 00 	lea    0x0(%edi),%edi

000008d0 <malloc>:

static Header*
morecore(uint nu)
{
  char *p;
  Header *hp;

  if(nu < PAGE)
    nu = PAGE;
  p = sbrk(nu * sizeof(Header));
  if(p == (char*) -1)
    return 0;
  hp = (Header*)p;
  hp->s.size = nu;
  free((void*)(hp + 1));
  return freep;
}

void*
malloc(uint nbytes)
{
 8d0:	55                   	push   %ebp
 8d1:	89 e5                	mov    %esp,%ebp
 8d3:	57                   	push   %edi
 8d4:	56                   	push   %esi
 8d5:	53                   	push   %ebx
 8d6:	83 ec 0c             	sub    $0xc,%esp
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
 8d9:	8b 45 08             	mov    0x8(%ebp),%eax
  if((prevp = freep) == 0){
 8dc:	8b 15 24 0a 00 00    	mov    0xa24,%edx
 8e2:	83 c0 07             	add    $0x7,%eax
 8e5:	c1 e8 03             	shr    $0x3,%eax
 8e8:	85 d2                	test   %edx,%edx
 8ea:	8d 58 01             	lea    0x1(%eax),%ebx
 8ed:	0f 84 92 00 00 00    	je     985 <malloc+0xb5>
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
 8f3:	8b 0a                	mov    (%edx),%ecx
    if(p->s.size >= nunits){
 8f5:	8b 41 04             	mov    0x4(%ecx),%eax
 8f8:	39 c3                	cmp    %eax,%ebx
 8fa:	76 63                	jbe    95f <malloc+0x8f>
      if(p->s.size == nunits)
        prevp->s.ptr = p->s.ptr;
      else {
        p->s.size -= nunits;
        p += p->s.size;
        p->s.size = nunits;
      }
      freep = prevp;
      return (void*) (p + 1);
 8fc:	8d 3c dd 00 00 00 00 	lea    0x0(,%ebx,8),%edi
 903:	eb 09                	jmp    90e <malloc+0x3e>
 905:	8b 0a                	mov    (%edx),%ecx
 907:	8b 41 04             	mov    0x4(%ecx),%eax
 90a:	39 c3                	cmp    %eax,%ebx
 90c:	76 51                	jbe    95f <malloc+0x8f>
    }
    if(p == freep)
 90e:	39 0d 24 0a 00 00    	cmp    %ecx,0xa24
 914:	89 ca                	mov    %ecx,%edx
 916:	75 ed                	jne    905 <malloc+0x35>
 918:	81 fb ff 0f 00 00    	cmp    $0xfff,%ebx
 91e:	77 39                	ja     959 <malloc+0x89>
 920:	be 00 10 00 00       	mov    $0x1000,%esi
 925:	b8 00 80 00 00       	mov    $0x8000,%eax
 92a:	89 04 24             	mov    %eax,(%esp)
 92d:	e8 b2 fc ff ff       	call   5e4 <sbrk>
 932:	83 f8 ff             	cmp    $0xffffffff,%eax
 935:	74 18                	je     94f <malloc+0x7f>
 937:	89 70 04             	mov    %esi,0x4(%eax)
 93a:	83 c0 08             	add    $0x8,%eax
 93d:	89 04 24             	mov    %eax,(%esp)
 940:	e8 fb fe ff ff       	call   840 <free>
 945:	8b 15 24 0a 00 00    	mov    0xa24,%edx
      if((p = morecore(nunits)) == 0)
 94b:	85 d2                	test   %edx,%edx
 94d:	75 b6                	jne    905 <malloc+0x35>
        return 0;
  }
}
 94f:	83 c4 0c             	add    $0xc,%esp
 952:	31 c0                	xor    %eax,%eax
 954:	5b                   	pop    %ebx
 955:	5e                   	pop    %esi
 956:	5f                   	pop    %edi
 957:	5d                   	pop    %ebp
 958:	c3                   	ret    
 959:	89 de                	mov    %ebx,%esi
 95b:	89 f8                	mov    %edi,%eax
 95d:	eb cb                	jmp    92a <malloc+0x5a>
 95f:	39 c3                	cmp    %eax,%ebx
 961:	74 1c                	je     97f <malloc+0xaf>
 963:	29 d8                	sub    %ebx,%eax
 965:	89 41 04             	mov    %eax,0x4(%ecx)
 968:	8d 0c c1             	lea    (%ecx,%eax,8),%ecx
 96b:	89 59 04             	mov    %ebx,0x4(%ecx)
 96e:	89 15 24 0a 00 00    	mov    %edx,0xa24
 974:	83 c4 0c             	add    $0xc,%esp
 977:	5b                   	pop    %ebx
 978:	8d 41 08             	lea    0x8(%ecx),%eax
 97b:	5e                   	pop    %esi
 97c:	5f                   	pop    %edi
 97d:	5d                   	pop    %ebp
 97e:	c3                   	ret    
 97f:	8b 01                	mov    (%ecx),%eax
 981:	89 02                	mov    %eax,(%edx)
 983:	eb e9                	jmp    96e <malloc+0x9e>
 985:	b8 1c 0a 00 00       	mov    $0xa1c,%eax
 98a:	ba 1c 0a 00 00       	mov    $0xa1c,%edx
 98f:	a3 24 0a 00 00       	mov    %eax,0xa24
 994:	b8 1c 0a 00 00       	mov    $0xa1c,%eax
 999:	a3 1c 0a 00 00       	mov    %eax,0xa1c
 99e:	31 c0                	xor    %eax,%eax
 9a0:	a3 20 0a 00 00       	mov    %eax,0xa20
 9a5:	e9 49 ff ff ff       	jmp    8f3 <malloc+0x23>
