
_grep:     file format elf32-i386

Disassembly of section .text:

00000000 <matchstar>:
}

// matchstar: search for c*re at beginning of text
int matchstar(int c, char *re, char *text)
{
   0:	55                   	push   %ebp
   1:	89 e5                	mov    %esp,%ebp
   3:	57                   	push   %edi
   4:	56                   	push   %esi
   5:	53                   	push   %ebx
   6:	83 ec 0c             	sub    $0xc,%esp
   9:	8b 75 08             	mov    0x8(%ebp),%esi
   c:	8b 7d 0c             	mov    0xc(%ebp),%edi
   f:	8b 5d 10             	mov    0x10(%ebp),%ebx
  12:	8d b4 26 00 00 00 00 	lea    0x0(%esi),%esi
  19:	8d bc 27 00 00 00 00 	lea    0x0(%edi),%edi
  do{  // a * matches zero or more instances
    if(matchhere(re, text))
  20:	89 5c 24 04          	mov    %ebx,0x4(%esp)
  24:	89 3c 24             	mov    %edi,(%esp)
  27:	e8 34 00 00 00       	call   60 <matchhere>
  2c:	85 c0                	test   %eax,%eax
  2e:	75 1e                	jne    4e <matchstar+0x4e>
      return 1;
  }while(*text!='\0' && (*text++==c || c=='.'));
  30:	0f b6 03             	movzbl (%ebx),%eax
  33:	84 c0                	test   %al,%al
  35:	74 0d                	je     44 <matchstar+0x44>
  37:	0f be c0             	movsbl %al,%eax
  3a:	43                   	inc    %ebx
  3b:	39 f0                	cmp    %esi,%eax
  3d:	74 e1                	je     20 <matchstar+0x20>
  3f:	83 fe 2e             	cmp    $0x2e,%esi
  42:	74 dc                	je     20 <matchstar+0x20>
  return 0;
}
  44:	83 c4 0c             	add    $0xc,%esp
  47:	31 c0                	xor    %eax,%eax
  49:	5b                   	pop    %ebx
  4a:	5e                   	pop    %esi
  4b:	5f                   	pop    %edi
  4c:	5d                   	pop    %ebp
  4d:	c3                   	ret    
  4e:	83 c4 0c             	add    $0xc,%esp
  51:	b8 01 00 00 00       	mov    $0x1,%eax
  56:	5b                   	pop    %ebx
  57:	5e                   	pop    %esi
  58:	5f                   	pop    %edi
  59:	5d                   	pop    %ebp
  5a:	c3                   	ret    
  5b:	90                   	nop    
  5c:	8d 74 26 00          	lea    0x0(%esi),%esi

00000060 <matchhere>:
  60:	55                   	push   %ebp
  61:	89 e5                	mov    %esp,%ebp
  63:	56                   	push   %esi
  64:	53                   	push   %ebx
  65:	83 ec 10             	sub    $0x10,%esp
  68:	8b 45 08             	mov    0x8(%ebp),%eax
  6b:	8b 75 0c             	mov    0xc(%ebp),%esi
  6e:	0f b6 08             	movzbl (%eax),%ecx
  71:	84 c9                	test   %cl,%cl
  73:	74 53                	je     c8 <matchhere+0x68>
  75:	0f b6 50 01          	movzbl 0x1(%eax),%edx
  79:	8d 58 01             	lea    0x1(%eax),%ebx
  7c:	80 fa 2a             	cmp    $0x2a,%dl
  7f:	75 2b                	jne    ac <matchhere+0x4c>
  81:	eb 51                	jmp    d4 <matchhere+0x74>
  83:	0f b6 16             	movzbl (%esi),%edx
  86:	84 d2                	test   %dl,%dl
  88:	74 35                	je     bf <matchhere+0x5f>
  8a:	80 f9 2e             	cmp    $0x2e,%cl
  8d:	8d 76 00             	lea    0x0(%esi),%esi
  90:	74 04                	je     96 <matchhere+0x36>
  92:	38 ca                	cmp    %cl,%dl
  94:	75 29                	jne    bf <matchhere+0x5f>
  96:	0f b6 0b             	movzbl (%ebx),%ecx
  99:	84 c9                	test   %cl,%cl
  9b:	74 2b                	je     c8 <matchhere+0x68>
  9d:	0f b6 53 01          	movzbl 0x1(%ebx),%edx
  a1:	46                   	inc    %esi
  a2:	8d 43 01             	lea    0x1(%ebx),%eax
  a5:	80 fa 2a             	cmp    $0x2a,%dl
  a8:	74 2c                	je     d6 <matchhere+0x76>
  aa:	89 c3                	mov    %eax,%ebx
  ac:	80 f9 24             	cmp    $0x24,%cl
  af:	75 d2                	jne    83 <matchhere+0x23>
  b1:	84 d2                	test   %dl,%dl
  b3:	75 ce                	jne    83 <matchhere+0x23>
  b5:	31 c0                	xor    %eax,%eax
  b7:	80 3e 00             	cmpb   $0x0,(%esi)
  ba:	0f 94 c0             	sete   %al
  bd:	eb 02                	jmp    c1 <matchhere+0x61>
  bf:	31 c0                	xor    %eax,%eax
  c1:	83 c4 10             	add    $0x10,%esp
  c4:	5b                   	pop    %ebx
  c5:	5e                   	pop    %esi
  c6:	5d                   	pop    %ebp
  c7:	c3                   	ret    
  c8:	83 c4 10             	add    $0x10,%esp
  cb:	b8 01 00 00 00       	mov    $0x1,%eax
  d0:	5b                   	pop    %ebx
  d1:	5e                   	pop    %esi
  d2:	5d                   	pop    %ebp
  d3:	c3                   	ret    
  d4:	89 c3                	mov    %eax,%ebx
  d6:	8d 43 02             	lea    0x2(%ebx),%eax
  d9:	89 44 24 04          	mov    %eax,0x4(%esp)
  dd:	0f be c1             	movsbl %cl,%eax
  e0:	89 74 24 08          	mov    %esi,0x8(%esp)
  e4:	89 04 24             	mov    %eax,(%esp)
  e7:	e8 14 ff ff ff       	call   0 <matchstar>
  ec:	83 c4 10             	add    $0x10,%esp
  ef:	5b                   	pop    %ebx
  f0:	5e                   	pop    %esi
  f1:	5d                   	pop    %ebp
  f2:	c3                   	ret    
  f3:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  f9:	8d bc 27 00 00 00 00 	lea    0x0(%edi),%edi

00000100 <match>:
 100:	55                   	push   %ebp
 101:	89 e5                	mov    %esp,%ebp
 103:	56                   	push   %esi
 104:	53                   	push   %ebx
 105:	83 ec 10             	sub    $0x10,%esp
 108:	8b 75 08             	mov    0x8(%ebp),%esi
 10b:	8b 5d 0c             	mov    0xc(%ebp),%ebx
 10e:	80 3e 5e             	cmpb   $0x5e,(%esi)
 111:	75 03                	jne    116 <match+0x16>
 113:	eb 2b                	jmp    140 <match+0x40>
 115:	43                   	inc    %ebx
 116:	89 5c 24 04          	mov    %ebx,0x4(%esp)
 11a:	89 34 24             	mov    %esi,(%esp)
 11d:	e8 3e ff ff ff       	call   60 <matchhere>
 122:	85 c0                	test   %eax,%eax
 124:	75 0e                	jne    134 <match+0x34>
 126:	80 3b 00             	cmpb   $0x0,(%ebx)
 129:	75 ea                	jne    115 <match+0x15>
 12b:	83 c4 10             	add    $0x10,%esp
 12e:	31 c0                	xor    %eax,%eax
 130:	5b                   	pop    %ebx
 131:	5e                   	pop    %esi
 132:	5d                   	pop    %ebp
 133:	c3                   	ret    
 134:	83 c4 10             	add    $0x10,%esp
 137:	b8 01 00 00 00       	mov    $0x1,%eax
 13c:	5b                   	pop    %ebx
 13d:	5e                   	pop    %esi
 13e:	5d                   	pop    %ebp
 13f:	c3                   	ret    
 140:	8d 46 01             	lea    0x1(%esi),%eax
 143:	89 45 08             	mov    %eax,0x8(%ebp)
 146:	83 c4 10             	add    $0x10,%esp
 149:	5b                   	pop    %ebx
 14a:	5e                   	pop    %esi
 14b:	5d                   	pop    %ebp
 14c:	e9 0f ff ff ff       	jmp    60 <matchhere>
 151:	eb 0d                	jmp    160 <grep>
 153:	90                   	nop    
 154:	90                   	nop    
 155:	90                   	nop    
 156:	90                   	nop    
 157:	90                   	nop    
 158:	90                   	nop    
 159:	90                   	nop    
 15a:	90                   	nop    
 15b:	90                   	nop    
 15c:	90                   	nop    
 15d:	90                   	nop    
 15e:	90                   	nop    
 15f:	90                   	nop    

00000160 <grep>:
 160:	55                   	push   %ebp
 161:	89 e5                	mov    %esp,%ebp
 163:	57                   	push   %edi
 164:	56                   	push   %esi
 165:	53                   	push   %ebx
 166:	83 ec 1c             	sub    $0x1c,%esp
 169:	c7 45 f0 00 00 00 00 	movl   $0x0,0xfffffff0(%ebp)
 170:	8b 55 f0             	mov    0xfffffff0(%ebp),%edx
 173:	b8 00 04 00 00       	mov    $0x400,%eax
 178:	29 d0                	sub    %edx,%eax
 17a:	89 44 24 08          	mov    %eax,0x8(%esp)
 17e:	8b 45 f0             	mov    0xfffffff0(%ebp),%eax
 181:	05 00 0a 00 00       	add    $0xa00,%eax
 186:	89 44 24 04          	mov    %eax,0x4(%esp)
 18a:	8b 45 0c             	mov    0xc(%ebp),%eax
 18d:	89 04 24             	mov    %eax,(%esp)
 190:	e8 bf 03 00 00       	call   554 <read>
 195:	85 c0                	test   %eax,%eax
 197:	89 c7                	mov    %eax,%edi
 199:	0f 8e 9d 00 00 00    	jle    23c <grep+0xdc>
 19f:	be 00 0a 00 00       	mov    $0xa00,%esi
 1a4:	eb 03                	jmp    1a9 <grep+0x49>
 1a6:	8d 73 01             	lea    0x1(%ebx),%esi
 1a9:	bb 0a 00 00 00       	mov    $0xa,%ebx
 1ae:	89 5c 24 04          	mov    %ebx,0x4(%esp)
 1b2:	89 34 24             	mov    %esi,(%esp)
 1b5:	e8 06 02 00 00       	call   3c0 <strchr>
 1ba:	85 c0                	test   %eax,%eax
 1bc:	89 c3                	mov    %eax,%ebx
 1be:	74 34                	je     1f4 <grep+0x94>
 1c0:	c6 03 00             	movb   $0x0,(%ebx)
 1c3:	8b 45 08             	mov    0x8(%ebp),%eax
 1c6:	89 74 24 04          	mov    %esi,0x4(%esp)
 1ca:	89 04 24             	mov    %eax,(%esp)
 1cd:	e8 2e ff ff ff       	call   100 <match>
 1d2:	85 c0                	test   %eax,%eax
 1d4:	74 d0                	je     1a6 <grep+0x46>
 1d6:	89 d8                	mov    %ebx,%eax
 1d8:	29 f0                	sub    %esi,%eax
 1da:	c6 03 0a             	movb   $0xa,(%ebx)
 1dd:	40                   	inc    %eax
 1de:	89 44 24 08          	mov    %eax,0x8(%esp)
 1e2:	89 74 24 04          	mov    %esi,0x4(%esp)
 1e6:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 1ed:	e8 6a 03 00 00       	call   55c <write>
 1f2:	eb b2                	jmp    1a6 <grep+0x46>
 1f4:	81 fe 00 0a 00 00    	cmp    $0xa00,%esi
 1fa:	74 34                	je     230 <grep+0xd0>
 1fc:	01 7d f0             	add    %edi,0xfffffff0(%ebp)
 1ff:	8b 4d f0             	mov    0xfffffff0(%ebp),%ecx
 202:	85 c9                	test   %ecx,%ecx
 204:	0f 8e 66 ff ff ff    	jle    170 <grep+0x10>
 20a:	8b 45 f0             	mov    0xfffffff0(%ebp),%eax
 20d:	89 74 24 04          	mov    %esi,0x4(%esp)
 211:	c7 04 24 00 0a 00 00 	movl   $0xa00,(%esp)
 218:	29 f0                	sub    %esi,%eax
 21a:	05 00 0a 00 00       	add    $0xa00,%eax
 21f:	89 45 f0             	mov    %eax,0xfffffff0(%ebp)
 222:	89 44 24 08          	mov    %eax,0x8(%esp)
 226:	e8 05 02 00 00       	call   430 <memmove>
 22b:	e9 40 ff ff ff       	jmp    170 <grep+0x10>
 230:	c7 45 f0 00 00 00 00 	movl   $0x0,0xfffffff0(%ebp)
 237:	e9 34 ff ff ff       	jmp    170 <grep+0x10>
 23c:	83 c4 1c             	add    $0x1c,%esp
 23f:	5b                   	pop    %ebx
 240:	5e                   	pop    %esi
 241:	5f                   	pop    %edi
 242:	5d                   	pop    %ebp
 243:	c3                   	ret    
 244:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 24a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi

00000250 <main>:
 250:	8d 4c 24 04          	lea    0x4(%esp),%ecx
 254:	83 e4 f0             	and    $0xfffffff0,%esp
 257:	ff 71 fc             	pushl  0xfffffffc(%ecx)
 25a:	55                   	push   %ebp
 25b:	89 e5                	mov    %esp,%ebp
 25d:	57                   	push   %edi
 25e:	56                   	push   %esi
 25f:	53                   	push   %ebx
 260:	51                   	push   %ecx
 261:	83 ec 18             	sub    $0x18,%esp
 264:	8b 01                	mov    (%ecx),%eax
 266:	89 45 e8             	mov    %eax,0xffffffe8(%ebp)
 269:	8b 41 04             	mov    0x4(%ecx),%eax
 26c:	83 7d e8 01          	cmpl   $0x1,0xffffffe8(%ebp)
 270:	0f 8e 8b 00 00 00    	jle    301 <main+0xb1>
 276:	8b 50 04             	mov    0x4(%eax),%edx
 279:	83 7d e8 02          	cmpl   $0x2,0xffffffe8(%ebp)
 27d:	89 55 ec             	mov    %edx,0xffffffec(%ebp)
 280:	74 69                	je     2eb <main+0x9b>
 282:	7e 62                	jle    2e6 <main+0x96>
 284:	8d 70 08             	lea    0x8(%eax),%esi
 287:	bf 02 00 00 00       	mov    $0x2,%edi
 28c:	eb 22                	jmp    2b0 <main+0x60>
 28e:	89 f6                	mov    %esi,%esi
 290:	8b 55 ec             	mov    0xffffffec(%ebp),%edx
 293:	47                   	inc    %edi
 294:	83 c6 04             	add    $0x4,%esi
 297:	89 44 24 04          	mov    %eax,0x4(%esp)
 29b:	89 14 24             	mov    %edx,(%esp)
 29e:	e8 bd fe ff ff       	call   160 <grep>
 2a3:	89 1c 24             	mov    %ebx,(%esp)
 2a6:	e8 b9 02 00 00       	call   564 <close>
 2ab:	39 7d e8             	cmp    %edi,0xffffffe8(%ebp)
 2ae:	74 36                	je     2e6 <main+0x96>
 2b0:	31 c0                	xor    %eax,%eax
 2b2:	89 44 24 04          	mov    %eax,0x4(%esp)
 2b6:	8b 06                	mov    (%esi),%eax
 2b8:	89 04 24             	mov    %eax,(%esp)
 2bb:	e8 bc 02 00 00       	call   57c <open>
 2c0:	85 c0                	test   %eax,%eax
 2c2:	89 c3                	mov    %eax,%ebx
 2c4:	79 ca                	jns    290 <main+0x40>
 2c6:	8b 06                	mov    (%esi),%eax
 2c8:	be ac 09 00 00       	mov    $0x9ac,%esi
 2cd:	89 74 24 04          	mov    %esi,0x4(%esp)
 2d1:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 2d8:	89 44 24 08          	mov    %eax,0x8(%esp)
 2dc:	e8 bf 03 00 00       	call   6a0 <printf>
 2e1:	e8 56 02 00 00       	call   53c <exit>
 2e6:	e8 51 02 00 00       	call   53c <exit>
 2eb:	31 c0                	xor    %eax,%eax
 2ed:	89 44 24 04          	mov    %eax,0x4(%esp)
 2f1:	8b 45 ec             	mov    0xffffffec(%ebp),%eax
 2f4:	89 04 24             	mov    %eax,(%esp)
 2f7:	e8 64 fe ff ff       	call   160 <grep>
 2fc:	e8 3b 02 00 00       	call   53c <exit>
 301:	b8 8c 09 00 00       	mov    $0x98c,%eax
 306:	89 44 24 04          	mov    %eax,0x4(%esp)
 30a:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
 311:	e8 8a 03 00 00       	call   6a0 <printf>
 316:	e8 21 02 00 00       	call   53c <exit>
 31b:	90                   	nop    
 31c:	90                   	nop    
 31d:	90                   	nop    
 31e:	90                   	nop    
 31f:	90                   	nop    

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

char*
strcpy(char *s, char *t)
{
 320:	55                   	push   %ebp
 321:	89 e5                	mov    %esp,%ebp
 323:	53                   	push   %ebx
 324:	8b 5d 08             	mov    0x8(%ebp),%ebx
 327:	8b 4d 0c             	mov    0xc(%ebp),%ecx
 32a:	89 da                	mov    %ebx,%edx
 32c:	8d 74 26 00          	lea    0x0(%esi),%esi
  char *os;

  os = s;
  while((*s++ = *t++) != 0)
 330:	0f b6 01             	movzbl (%ecx),%eax
 333:	41                   	inc    %ecx
 334:	88 02                	mov    %al,(%edx)
 336:	42                   	inc    %edx
 337:	84 c0                	test   %al,%al
 339:	75 f5                	jne    330 <strcpy+0x10>
    ;
  return os;
}
 33b:	89 d8                	mov    %ebx,%eax
 33d:	5b                   	pop    %ebx
 33e:	5d                   	pop    %ebp
 33f:	c3                   	ret    

00000340 <strcmp>:

int
strcmp(const char *p, const char *q)
{
 340:	55                   	push   %ebp
 341:	89 e5                	mov    %esp,%ebp
 343:	8b 55 08             	mov    0x8(%ebp),%edx
 346:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  while(*p && *p == *q)
 349:	0f b6 02             	movzbl (%edx),%eax
 34c:	84 c0                	test   %al,%al
 34e:	75 0c                	jne    35c <strcmp+0x1c>
 350:	eb 10                	jmp    362 <strcmp+0x22>
 352:	0f b6 42 01          	movzbl 0x1(%edx),%eax
    p++, q++;
 356:	41                   	inc    %ecx
 357:	84 c0                	test   %al,%al
 359:	74 07                	je     362 <strcmp+0x22>
 35b:	42                   	inc    %edx
 35c:	3a 01                	cmp    (%ecx),%al
 35e:	89 f6                	mov    %esi,%esi
 360:	74 f0                	je     352 <strcmp+0x12>
 362:	0f b6 11             	movzbl (%ecx),%edx
 365:	0f b6 c0             	movzbl %al,%eax
  return (uchar)*p - (uchar)*q;
}
 368:	5d                   	pop    %ebp
 369:	29 d0                	sub    %edx,%eax
 36b:	c3                   	ret    
 36c:	8d 74 26 00          	lea    0x0(%esi),%esi

00000370 <strlen>:

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

  for(n = 0; s[n]; n++)
 371:	31 c0                	xor    %eax,%eax
 373:	89 e5                	mov    %esp,%ebp
 375:	8b 55 08             	mov    0x8(%ebp),%edx
 378:	80 3a 00             	cmpb   $0x0,(%edx)
 37b:	74 0a                	je     387 <strlen+0x17>
 37d:	8d 76 00             	lea    0x0(%esi),%esi
 380:	40                   	inc    %eax
 381:	80 3c 10 00          	cmpb   $0x0,(%eax,%edx,1)
 385:	75 f9                	jne    380 <strlen+0x10>
    ;
  return n;
}
 387:	5d                   	pop    %ebp
 388:	c3                   	ret    
 389:	8d b4 26 00 00 00 00 	lea    0x0(%esi),%esi

00000390 <memset>:

void*
memset(void *dst, int c, uint n)
{
 390:	55                   	push   %ebp
 391:	89 e5                	mov    %esp,%ebp
 393:	8b 45 10             	mov    0x10(%ebp),%eax
 396:	53                   	push   %ebx
 397:	8b 5d 08             	mov    0x8(%ebp),%ebx
  char *d;
  
  d = dst;
  while(n-- > 0)
 39a:	85 c0                	test   %eax,%eax
 39c:	74 1a                	je     3b8 <memset+0x28>
 39e:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
 3a2:	31 d2                	xor    %edx,%edx
 3a4:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 3aa:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi
    *d++ = c;
 3b0:	88 0c 1a             	mov    %cl,(%edx,%ebx,1)
 3b3:	42                   	inc    %edx
 3b4:	39 d0                	cmp    %edx,%eax
 3b6:	75 f8                	jne    3b0 <memset+0x20>
  return dst;
}
 3b8:	89 d8                	mov    %ebx,%eax
 3ba:	5b                   	pop    %ebx
 3bb:	5d                   	pop    %ebp
 3bc:	c3                   	ret    
 3bd:	8d 76 00             	lea    0x0(%esi),%esi

000003c0 <strchr>:

char*
strchr(const char *s, char c)
{
 3c0:	55                   	push   %ebp
 3c1:	89 e5                	mov    %esp,%ebp
 3c3:	8b 45 08             	mov    0x8(%ebp),%eax
 3c6:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
  for(; *s; s++)
 3ca:	0f b6 10             	movzbl (%eax),%edx
 3cd:	84 d2                	test   %dl,%dl
 3cf:	74 19                	je     3ea <strchr+0x2a>
    if(*s == c)
 3d1:	38 d1                	cmp    %dl,%cl
 3d3:	75 0d                	jne    3e2 <strchr+0x22>
 3d5:	eb 15                	jmp    3ec <strchr+0x2c>
 3d7:	38 ca                	cmp    %cl,%dl
 3d9:	8d b4 26 00 00 00 00 	lea    0x0(%esi),%esi
 3e0:	74 0a                	je     3ec <strchr+0x2c>
 3e2:	40                   	inc    %eax
 3e3:	0f b6 10             	movzbl (%eax),%edx
 3e6:	84 d2                	test   %dl,%dl
 3e8:	75 ed                	jne    3d7 <strchr+0x17>
 3ea:	31 c0                	xor    %eax,%eax
      return (char*) s;
  return 0;
}
 3ec:	5d                   	pop    %ebp
 3ed:	c3                   	ret    
 3ee:	89 f6                	mov    %esi,%esi

000003f0 <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)
{
 3f0:	55                   	push   %ebp
 3f1:	89 e5                	mov    %esp,%ebp
 3f3:	8b 4d 08             	mov    0x8(%ebp),%ecx
 3f6:	53                   	push   %ebx
  int n;

  n = 0;
  while('0' <= *s && *s <= '9')
 3f7:	31 db                	xor    %ebx,%ebx
 3f9:	0f b6 11             	movzbl (%ecx),%edx
 3fc:	88 d0                	mov    %dl,%al
 3fe:	2c 30                	sub    $0x30,%al
 400:	3c 09                	cmp    $0x9,%al
 402:	77 23                	ja     427 <atoi+0x37>
 404:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 40a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi
    n = n*10 + *s++ - '0';
 410:	8d 04 9b             	lea    (%ebx,%ebx,4),%eax
 413:	0f be d2             	movsbl %dl,%edx
 416:	8d 5c 42 d0          	lea    0xffffffd0(%edx,%eax,2),%ebx
 41a:	0f b6 51 01          	movzbl 0x1(%ecx),%edx
 41e:	41                   	inc    %ecx
 41f:	88 d0                	mov    %dl,%al
 421:	2c 30                	sub    $0x30,%al
 423:	3c 09                	cmp    $0x9,%al
 425:	76 e9                	jbe    410 <atoi+0x20>
  return n;
}
 427:	89 d8                	mov    %ebx,%eax
 429:	5b                   	pop    %ebx
 42a:	5d                   	pop    %ebp
 42b:	c3                   	ret    
 42c:	8d 74 26 00          	lea    0x0(%esi),%esi

00000430 <memmove>:

void*
memmove(void *vdst, void *vsrc, int n)
{
 430:	55                   	push   %ebp
 431:	89 e5                	mov    %esp,%ebp
 433:	8b 4d 10             	mov    0x10(%ebp),%ecx
 436:	56                   	push   %esi
 437:	8b 75 08             	mov    0x8(%ebp),%esi
 43a:	53                   	push   %ebx
 43b:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
 43e:	85 c9                	test   %ecx,%ecx
 440:	7e 1a                	jle    45c <memmove+0x2c>
 442:	31 d2                	xor    %edx,%edx
 444:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 44a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi
    *dst++ = *src++;
 450:	0f b6 04 1a          	movzbl (%edx,%ebx,1),%eax
 454:	88 04 32             	mov    %al,(%edx,%esi,1)
 457:	42                   	inc    %edx
 458:	39 ca                	cmp    %ecx,%edx
 45a:	75 f4                	jne    450 <memmove+0x20>
  return vdst;
}
 45c:	5b                   	pop    %ebx
 45d:	89 f0                	mov    %esi,%eax
 45f:	5e                   	pop    %esi
 460:	5d                   	pop    %ebp
 461:	c3                   	ret    
 462:	8d b4 26 00 00 00 00 	lea    0x0(%esi),%esi
 469:	8d bc 27 00 00 00 00 	lea    0x0(%edi),%edi

00000470 <stat>:
 470:	55                   	push   %ebp
 471:	31 c0                	xor    %eax,%eax
 473:	89 e5                	mov    %esp,%ebp
 475:	83 ec 18             	sub    $0x18,%esp
 478:	89 44 24 04          	mov    %eax,0x4(%esp)
 47c:	8b 45 08             	mov    0x8(%ebp),%eax
 47f:	89 5d f8             	mov    %ebx,0xfffffff8(%ebp)
 482:	89 75 fc             	mov    %esi,0xfffffffc(%ebp)
 485:	be ff ff ff ff       	mov    $0xffffffff,%esi
 48a:	89 04 24             	mov    %eax,(%esp)
 48d:	e8 ea 00 00 00       	call   57c <open>
 492:	85 c0                	test   %eax,%eax
 494:	89 c3                	mov    %eax,%ebx
 496:	78 19                	js     4b1 <stat+0x41>
 498:	8b 45 0c             	mov    0xc(%ebp),%eax
 49b:	89 1c 24             	mov    %ebx,(%esp)
 49e:	89 44 24 04          	mov    %eax,0x4(%esp)
 4a2:	e8 ed 00 00 00       	call   594 <fstat>
 4a7:	89 1c 24             	mov    %ebx,(%esp)
 4aa:	89 c6                	mov    %eax,%esi
 4ac:	e8 b3 00 00 00       	call   564 <close>
 4b1:	89 f0                	mov    %esi,%eax
 4b3:	8b 5d f8             	mov    0xfffffff8(%ebp),%ebx
 4b6:	8b 75 fc             	mov    0xfffffffc(%ebp),%esi
 4b9:	89 ec                	mov    %ebp,%esp
 4bb:	5d                   	pop    %ebp
 4bc:	c3                   	ret    
 4bd:	8d 76 00             	lea    0x0(%esi),%esi

000004c0 <gets>:
 4c0:	55                   	push   %ebp
 4c1:	89 e5                	mov    %esp,%ebp
 4c3:	57                   	push   %edi
 4c4:	56                   	push   %esi
 4c5:	31 f6                	xor    %esi,%esi
 4c7:	53                   	push   %ebx
 4c8:	83 ec 1c             	sub    $0x1c,%esp
 4cb:	8d 5e 01             	lea    0x1(%esi),%ebx
 4ce:	8b 7d 08             	mov    0x8(%ebp),%edi
 4d1:	3b 5d 0c             	cmp    0xc(%ebp),%ebx
 4d4:	7d 3e                	jge    514 <gets+0x54>
 4d6:	ba 01 00 00 00       	mov    $0x1,%edx
 4db:	8d 45 f3             	lea    0xfffffff3(%ebp),%eax
 4de:	89 54 24 08          	mov    %edx,0x8(%esp)
 4e2:	89 44 24 04          	mov    %eax,0x4(%esp)
 4e6:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
 4ed:	e8 62 00 00 00       	call   554 <read>
 4f2:	85 c0                	test   %eax,%eax
 4f4:	7e 1e                	jle    514 <gets+0x54>
 4f6:	0f b6 45 f3          	movzbl 0xfffffff3(%ebp),%eax
 4fa:	88 44 3b ff          	mov    %al,0xffffffff(%ebx,%edi,1)
 4fe:	0f b6 45 f3          	movzbl 0xfffffff3(%ebp),%eax
 502:	3c 0a                	cmp    $0xa,%al
 504:	74 1c                	je     522 <gets+0x62>
 506:	3c 0d                	cmp    $0xd,%al
 508:	74 18                	je     522 <gets+0x62>
 50a:	89 de                	mov    %ebx,%esi
 50c:	8d 5e 01             	lea    0x1(%esi),%ebx
 50f:	3b 5d 0c             	cmp    0xc(%ebp),%ebx
 512:	7c c2                	jl     4d6 <gets+0x16>
 514:	c6 04 3e 00          	movb   $0x0,(%esi,%edi,1)
 518:	83 c4 1c             	add    $0x1c,%esp
 51b:	89 f8                	mov    %edi,%eax
 51d:	5b                   	pop    %ebx
 51e:	5e                   	pop    %esi
 51f:	5f                   	pop    %edi
 520:	5d                   	pop    %ebp
 521:	c3                   	ret    
 522:	89 de                	mov    %ebx,%esi
 524:	89 f8                	mov    %edi,%eax
 526:	c6 04 3e 00          	movb   $0x0,(%esi,%edi,1)
 52a:	83 c4 1c             	add    $0x1c,%esp
 52d:	5b                   	pop    %ebx
 52e:	5e                   	pop    %esi
 52f:	5f                   	pop    %edi
 530:	5d                   	pop    %ebp
 531:	c3                   	ret    
 532:	90                   	nop    
 533:	90                   	nop    

00000534 <fork>:
 534:	b8 01 00 00 00       	mov    $0x1,%eax
 539:	cd 30                	int    $0x30
 53b:	c3                   	ret    

0000053c <exit>:
 53c:	b8 02 00 00 00       	mov    $0x2,%eax
 541:	cd 30                	int    $0x30
 543:	c3                   	ret    

00000544 <wait>:
 544:	b8 03 00 00 00       	mov    $0x3,%eax
 549:	cd 30                	int    $0x30
 54b:	c3                   	ret    

0000054c <pipe>:
 54c:	b8 04 00 00 00       	mov    $0x4,%eax
 551:	cd 30                	int    $0x30
 553:	c3                   	ret    

00000554 <read>:
 554:	b8 06 00 00 00       	mov    $0x6,%eax
 559:	cd 30                	int    $0x30
 55b:	c3                   	ret    

0000055c <write>:
 55c:	b8 05 00 00 00       	mov    $0x5,%eax
 561:	cd 30                	int    $0x30
 563:	c3                   	ret    

00000564 <close>:
 564:	b8 07 00 00 00       	mov    $0x7,%eax
 569:	cd 30                	int    $0x30
 56b:	c3                   	ret    

0000056c <kill>:
 56c:	b8 08 00 00 00       	mov    $0x8,%eax
 571:	cd 30                	int    $0x30
 573:	c3                   	ret    

00000574 <exec>:
 574:	b8 09 00 00 00       	mov    $0x9,%eax
 579:	cd 30                	int    $0x30
 57b:	c3                   	ret    

0000057c <open>:
 57c:	b8 0a 00 00 00       	mov    $0xa,%eax
 581:	cd 30                	int    $0x30
 583:	c3                   	ret    

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

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

00000594 <fstat>:
 594:	b8 0d 00 00 00       	mov    $0xd,%eax
 599:	cd 30                	int    $0x30
 59b:	c3                   	ret    

0000059c <link>:
 59c:	b8 0e 00 00 00       	mov    $0xe,%eax
 5a1:	cd 30                	int    $0x30
 5a3:	c3                   	ret    

000005a4 <mkdir>:
 5a4:	b8 0f 00 00 00       	mov    $0xf,%eax
 5a9:	cd 30                	int    $0x30
 5ab:	c3                   	ret    

000005ac <chdir>:
 5ac:	b8 10 00 00 00       	mov    $0x10,%eax
 5b1:	cd 30                	int    $0x30
 5b3:	c3                   	ret    

000005b4 <dup>:
 5b4:	b8 11 00 00 00       	mov    $0x11,%eax
 5b9:	cd 30                	int    $0x30
 5bb:	c3                   	ret    

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

000005c4 <sbrk>:
 5c4:	b8 13 00 00 00       	mov    $0x13,%eax
 5c9:	cd 30                	int    $0x30
 5cb:	c3                   	ret    

000005cc <sleep>:
 5cc:	b8 14 00 00 00       	mov    $0x14,%eax
 5d1:	cd 30                	int    $0x30
 5d3:	c3                   	ret    
 5d4:	90                   	nop    
 5d5:	90                   	nop    
 5d6:	90                   	nop    
 5d7:	90                   	nop    
 5d8:	90                   	nop    
 5d9:	90                   	nop    
 5da:	90                   	nop    
 5db:	90                   	nop    
 5dc:	90                   	nop    
 5dd:	90                   	nop    
 5de:	90                   	nop    
 5df:	90                   	nop    

000005e0 <putc>:
#include "user.h"

static void
putc(int fd, char c)
{
 5e0:	55                   	push   %ebp
 5e1:	89 e5                	mov    %esp,%ebp
 5e3:	83 ec 18             	sub    $0x18,%esp
 5e6:	88 55 fc             	mov    %dl,0xfffffffc(%ebp)
  write(fd, &c, 1);
 5e9:	ba 01 00 00 00       	mov    $0x1,%edx
 5ee:	89 54 24 08          	mov    %edx,0x8(%esp)
 5f2:	8d 55 fc             	lea    0xfffffffc(%ebp),%edx
 5f5:	89 54 24 04          	mov    %edx,0x4(%esp)
 5f9:	89 04 24             	mov    %eax,(%esp)
 5fc:	e8 5b ff ff ff       	call   55c <write>
}
 601:	c9                   	leave  
 602:	c3                   	ret    
 603:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 609:	8d bc 27 00 00 00 00 	lea    0x0(%edi),%edi

00000610 <printint>:

static void
printint(int fd, int xx, int base, int sgn)
{
 610:	55                   	push   %ebp
 611:	89 e5                	mov    %esp,%ebp
 613:	57                   	push   %edi
 614:	56                   	push   %esi
 615:	89 ce                	mov    %ecx,%esi
 617:	53                   	push   %ebx
 618:	83 ec 1c             	sub    $0x1c,%esp
  static char digits[] = "0123456789ABCDEF";
  char buf[16];
  int i, neg;
  uint x;

  neg = 0;
  if(sgn && xx < 0){
 61b:	8b 5d 08             	mov    0x8(%ebp),%ebx
 61e:	89 45 dc             	mov    %eax,0xffffffdc(%ebp)
 621:	85 db                	test   %ebx,%ebx
 623:	74 04                	je     629 <printint+0x19>
 625:	85 d2                	test   %edx,%edx
 627:	78 62                	js     68b <printint+0x7b>
    neg = 1;
    x = -xx;
  } else {
    x = xx;
 629:	89 d0                	mov    %edx,%eax
 62b:	c7 45 e0 00 00 00 00 	movl   $0x0,0xffffffe0(%ebp)
 632:	31 db                	xor    %ebx,%ebx
 634:	8d 7d e4             	lea    0xffffffe4(%ebp),%edi
 637:	89 f6                	mov    %esi,%esi
 639:	8d bc 27 00 00 00 00 	lea    0x0(%edi),%edi
  }

  i = 0;
  do{
    buf[i++] = digits[x % base];
 640:	31 d2                	xor    %edx,%edx
 642:	f7 f6                	div    %esi
 644:	89 c1                	mov    %eax,%ecx
 646:	0f b6 82 c9 09 00 00 	movzbl 0x9c9(%edx),%eax
 64d:	88 04 3b             	mov    %al,(%ebx,%edi,1)
 650:	43                   	inc    %ebx
  }while((x /= base) != 0);
 651:	85 c9                	test   %ecx,%ecx
 653:	89 c8                	mov    %ecx,%eax
 655:	75 e9                	jne    640 <printint+0x30>
  if(neg)
 657:	8b 4d e0             	mov    0xffffffe0(%ebp),%ecx
 65a:	85 c9                	test   %ecx,%ecx
 65c:	74 06                	je     664 <printint+0x54>
    buf[i++] = '-';
 65e:	c6 44 1d e4 2d       	movb   $0x2d,0xffffffe4(%ebp,%ebx,1)
 663:	43                   	inc    %ebx

  while(--i >= 0)
 664:	4b                   	dec    %ebx
 665:	78 1c                	js     683 <printint+0x73>
 667:	89 f6                	mov    %esi,%esi
 669:	8d bc 27 00 00 00 00 	lea    0x0(%edi),%edi
    putc(fd, buf[i]);
 670:	0f be 54 1d e4       	movsbl 0xffffffe4(%ebp,%ebx,1),%edx
 675:	4b                   	dec    %ebx
 676:	8b 45 dc             	mov    0xffffffdc(%ebp),%eax
 679:	e8 62 ff ff ff       	call   5e0 <putc>
 67e:	83 fb ff             	cmp    $0xffffffff,%ebx
 681:	75 ed                	jne    670 <printint+0x60>
}
 683:	83 c4 1c             	add    $0x1c,%esp
 686:	5b                   	pop    %ebx
 687:	5e                   	pop    %esi
 688:	5f                   	pop    %edi
 689:	5d                   	pop    %ebp
 68a:	c3                   	ret    
 68b:	89 d0                	mov    %edx,%eax
 68d:	f7 d8                	neg    %eax
 68f:	c7 45 e0 01 00 00 00 	movl   $0x1,0xffffffe0(%ebp)
 696:	eb 9a                	jmp    632 <printint+0x22>
 698:	90                   	nop    
 699:	8d b4 26 00 00 00 00 	lea    0x0(%esi),%esi

000006a0 <printf>:

// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
 6a0:	55                   	push   %ebp
 6a1:	89 e5                	mov    %esp,%ebp
 6a3:	57                   	push   %edi
 6a4:	56                   	push   %esi
 6a5:	53                   	push   %ebx
 6a6:	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++){
 6a9:	8b 55 0c             	mov    0xc(%ebp),%edx
 6ac:	0f b6 02             	movzbl (%edx),%eax
 6af:	84 c0                	test   %al,%al
 6b1:	0f 84 99 00 00 00    	je     750 <printf+0xb0>
 6b7:	8d 4d 10             	lea    0x10(%ebp),%ecx
 6ba:	31 ff                	xor    %edi,%edi
 6bc:	31 f6                	xor    %esi,%esi
 6be:	89 4d f0             	mov    %ecx,0xfffffff0(%ebp)
 6c1:	eb 26                	jmp    6e9 <printf+0x49>
    c = fmt[i] & 0xff;
    if(state == 0){
      if(c == '%'){
 6c3:	83 fb 25             	cmp    $0x25,%ebx
 6c6:	0f 85 8c 00 00 00    	jne    758 <printf+0xb8>
 6cc:	be 25 00 00 00       	mov    $0x25,%esi
 6d1:	eb 0d                	jmp    6e0 <printf+0x40>
 6d3:	90                   	nop    
 6d4:	90                   	nop    
 6d5:	90                   	nop    
 6d6:	90                   	nop    
 6d7:	90                   	nop    
 6d8:	90                   	nop    
 6d9:	90                   	nop    
 6da:	90                   	nop    
 6db:	90                   	nop    
 6dc:	90                   	nop    
 6dd:	90                   	nop    
 6de:	90                   	nop    
 6df:	90                   	nop    
 6e0:	47                   	inc    %edi
 6e1:	0f b6 04 3a          	movzbl (%edx,%edi,1),%eax
 6e5:	84 c0                	test   %al,%al
 6e7:	74 67                	je     750 <printf+0xb0>
 6e9:	85 f6                	test   %esi,%esi
 6eb:	0f b6 d8             	movzbl %al,%ebx
 6ee:	74 d3                	je     6c3 <printf+0x23>
        state = '%';
      } else {
        putc(fd, c);
      }
    } else if(state == '%'){
 6f0:	83 fe 25             	cmp    $0x25,%esi
 6f3:	75 eb                	jne    6e0 <printf+0x40>
      if(c == 'd'){
 6f5:	83 fb 64             	cmp    $0x64,%ebx
 6f8:	0f 84 e0 00 00 00    	je     7de <printf+0x13e>
        printint(fd, *ap, 10, 1);
        ap++;
      } else if(c == 'x' || c == 'p'){
 6fe:	83 fb 78             	cmp    $0x78,%ebx
 701:	74 68                	je     76b <printf+0xcb>
 703:	83 fb 70             	cmp    $0x70,%ebx
 706:	74 63                	je     76b <printf+0xcb>
        printint(fd, *ap, 16, 0);
        ap++;
      } else if(c == 's'){
 708:	83 fb 73             	cmp    $0x73,%ebx
 70b:	90                   	nop    
 70c:	8d 74 26 00          	lea    0x0(%esi),%esi
 710:	0f 84 7c 00 00 00    	je     792 <printf+0xf2>
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
        while(*s != 0){
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
 716:	83 fb 63             	cmp    $0x63,%ebx
 719:	0f 84 e4 00 00 00    	je     803 <printf+0x163>
        putc(fd, *ap);
        ap++;
      } else if(c == '%'){
 71f:	83 fb 25             	cmp    $0x25,%ebx
 722:	0f 84 c4 00 00 00    	je     7ec <printf+0x14c>
        putc(fd, c);
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
 728:	8b 45 08             	mov    0x8(%ebp),%eax
 72b:	ba 25 00 00 00       	mov    $0x25,%edx
 730:	47                   	inc    %edi
        putc(fd, c);
 731:	31 f6                	xor    %esi,%esi
 733:	e8 a8 fe ff ff       	call   5e0 <putc>
 738:	8b 45 08             	mov    0x8(%ebp),%eax
 73b:	0f be d3             	movsbl %bl,%edx
 73e:	e8 9d fe ff ff       	call   5e0 <putc>
 743:	8b 55 0c             	mov    0xc(%ebp),%edx
 746:	0f b6 04 3a          	movzbl (%edx,%edi,1),%eax
 74a:	84 c0                	test   %al,%al
 74c:	75 9b                	jne    6e9 <printf+0x49>
 74e:	89 f6                	mov    %esi,%esi
      }
      state = 0;
    }
  }
}
 750:	83 c4 0c             	add    $0xc,%esp
 753:	5b                   	pop    %ebx
 754:	5e                   	pop    %esi
 755:	5f                   	pop    %edi
 756:	5d                   	pop    %ebp
 757:	c3                   	ret    
 758:	8b 45 08             	mov    0x8(%ebp),%eax
 75b:	0f be d3             	movsbl %bl,%edx
 75e:	e8 7d fe ff ff       	call   5e0 <putc>
 763:	8b 55 0c             	mov    0xc(%ebp),%edx
 766:	e9 75 ff ff ff       	jmp    6e0 <printf+0x40>
 76b:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
 772:	b9 10 00 00 00       	mov    $0x10,%ecx
 777:	8b 45 f0             	mov    0xfffffff0(%ebp),%eax
 77a:	31 f6                	xor    %esi,%esi
 77c:	8b 10                	mov    (%eax),%edx
 77e:	8b 45 08             	mov    0x8(%ebp),%eax
 781:	e8 8a fe ff ff       	call   610 <printint>
 786:	8b 55 0c             	mov    0xc(%ebp),%edx
 789:	83 45 f0 04          	addl   $0x4,0xfffffff0(%ebp)
 78d:	e9 4e ff ff ff       	jmp    6e0 <printf+0x40>
 792:	8b 4d f0             	mov    0xfffffff0(%ebp),%ecx
 795:	8b 01                	mov    (%ecx),%eax
 797:	83 c1 04             	add    $0x4,%ecx
 79a:	89 4d f0             	mov    %ecx,0xfffffff0(%ebp)
 79d:	b9 c2 09 00 00       	mov    $0x9c2,%ecx
 7a2:	85 c0                	test   %eax,%eax
 7a4:	74 02                	je     7a8 <printf+0x108>
 7a6:	89 c1                	mov    %eax,%ecx
 7a8:	0f b6 01             	movzbl (%ecx),%eax
 7ab:	84 c0                	test   %al,%al
 7ad:	74 28                	je     7d7 <printf+0x137>
 7af:	89 cb                	mov    %ecx,%ebx
 7b1:	eb 0d                	jmp    7c0 <printf+0x120>
 7b3:	90                   	nop    
 7b4:	90                   	nop    
 7b5:	90                   	nop    
 7b6:	90                   	nop    
 7b7:	90                   	nop    
 7b8:	90                   	nop    
 7b9:	90                   	nop    
 7ba:	90                   	nop    
 7bb:	90                   	nop    
 7bc:	90                   	nop    
 7bd:	90                   	nop    
 7be:	90                   	nop    
 7bf:	90                   	nop    
 7c0:	0f be d0             	movsbl %al,%edx
 7c3:	8b 45 08             	mov    0x8(%ebp),%eax
 7c6:	e8 15 fe ff ff       	call   5e0 <putc>
 7cb:	0f b6 43 01          	movzbl 0x1(%ebx),%eax
 7cf:	43                   	inc    %ebx
 7d0:	84 c0                	test   %al,%al
 7d2:	75 ec                	jne    7c0 <printf+0x120>
 7d4:	8b 55 0c             	mov    0xc(%ebp),%edx
 7d7:	31 f6                	xor    %esi,%esi
 7d9:	e9 02 ff ff ff       	jmp    6e0 <printf+0x40>
 7de:	b9 0a 00 00 00       	mov    $0xa,%ecx
 7e3:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 7ea:	eb 8b                	jmp    777 <printf+0xd7>
 7ec:	8b 45 08             	mov    0x8(%ebp),%eax
 7ef:	ba 25 00 00 00       	mov    $0x25,%edx
 7f4:	31 f6                	xor    %esi,%esi
 7f6:	e8 e5 fd ff ff       	call   5e0 <putc>
 7fb:	8b 55 0c             	mov    0xc(%ebp),%edx
 7fe:	e9 dd fe ff ff       	jmp    6e0 <printf+0x40>
 803:	8b 45 f0             	mov    0xfffffff0(%ebp),%eax
 806:	31 f6                	xor    %esi,%esi
 808:	0f be 10             	movsbl (%eax),%edx
 80b:	8b 45 08             	mov    0x8(%ebp),%eax
 80e:	e8 cd fd ff ff       	call   5e0 <putc>
 813:	8b 55 0c             	mov    0xc(%ebp),%edx
 816:	83 45 f0 04          	addl   $0x4,0xfffffff0(%ebp)
 81a:	e9 c1 fe ff ff       	jmp    6e0 <printf+0x40>
 81f:	90                   	nop    

00000820 <free>:
static Header *freep;

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

  bp = (Header*) ap - 1;
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
 821:	8b 0d e8 09 00 00    	mov    0x9e8,%ecx
 827:	89 e5                	mov    %esp,%ebp
 829:	56                   	push   %esi
 82a:	53                   	push   %ebx
 82b:	8b 5d 08             	mov    0x8(%ebp),%ebx
 82e:	83 eb 08             	sub    $0x8,%ebx
 831:	eb 0d                	jmp    840 <free+0x20>
 833:	90                   	nop    
 834:	90                   	nop    
 835:	90                   	nop    
 836:	90                   	nop    
 837:	90                   	nop    
 838:	90                   	nop    
 839:	90                   	nop    
 83a:	90                   	nop    
 83b:	90                   	nop    
 83c:	90                   	nop    
 83d:	90                   	nop    
 83e:	90                   	nop    
 83f:	90                   	nop    
 840:	39 d9                	cmp    %ebx,%ecx
 842:	73 04                	jae    848 <free+0x28>
 844:	3b 19                	cmp    (%ecx),%ebx
 846:	72 12                	jb     85a <free+0x3a>
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
 848:	8b 11                	mov    (%ecx),%edx
 84a:	39 d1                	cmp    %edx,%ecx
 84c:	72 08                	jb     856 <free+0x36>
 84e:	39 d9                	cmp    %ebx,%ecx
 850:	72 0a                	jb     85c <free+0x3c>
 852:	39 d3                	cmp    %edx,%ebx
 854:	72 06                	jb     85c <free+0x3c>
 856:	89 d1                	mov    %edx,%ecx
 858:	eb e6                	jmp    840 <free+0x20>
 85a:	8b 11                	mov    (%ecx),%edx
      break;
  if(bp + bp->s.size == p->s.ptr){
 85c:	8b 73 04             	mov    0x4(%ebx),%esi
 85f:	8d 04 f3             	lea    (%ebx,%esi,8),%eax
 862:	39 d0                	cmp    %edx,%eax
 864:	74 2e                	je     894 <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;
 866:	89 13                	mov    %edx,(%ebx)
  if(p + p->s.size == bp){
 868:	8b 51 04             	mov    0x4(%ecx),%edx
 86b:	8d 04 d1             	lea    (%ecx,%edx,8),%eax
 86e:	39 c3                	cmp    %eax,%ebx
 870:	74 0c                	je     87e <free+0x5e>
    p->s.size += bp->s.size;
    p->s.ptr = bp->s.ptr;
  } else
    p->s.ptr = bp;
 872:	89 19                	mov    %ebx,(%ecx)
  freep = p;
}
 874:	5b                   	pop    %ebx
 875:	89 0d e8 09 00 00    	mov    %ecx,0x9e8
 87b:	5e                   	pop    %esi
 87c:	5d                   	pop    %ebp
 87d:	c3                   	ret    
 87e:	8b 43 04             	mov    0x4(%ebx),%eax
 881:	01 c2                	add    %eax,%edx
 883:	8b 03                	mov    (%ebx),%eax
 885:	89 51 04             	mov    %edx,0x4(%ecx)
 888:	89 01                	mov    %eax,(%ecx)
 88a:	5b                   	pop    %ebx
 88b:	89 0d e8 09 00 00    	mov    %ecx,0x9e8
 891:	5e                   	pop    %esi
 892:	5d                   	pop    %ebp
 893:	c3                   	ret    
 894:	8b 42 04             	mov    0x4(%edx),%eax
 897:	01 c6                	add    %eax,%esi
 899:	8b 02                	mov    (%edx),%eax
 89b:	89 73 04             	mov    %esi,0x4(%ebx)
 89e:	89 03                	mov    %eax,(%ebx)
 8a0:	eb c6                	jmp    868 <free+0x48>
 8a2:	8d b4 26 00 00 00 00 	lea    0x0(%esi),%esi
 8a9:	8d bc 27 00 00 00 00 	lea    0x0(%edi),%edi

000008b0 <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)
{
 8b0:	55                   	push   %ebp
 8b1:	89 e5                	mov    %esp,%ebp
 8b3:	57                   	push   %edi
 8b4:	56                   	push   %esi
 8b5:	53                   	push   %ebx
 8b6:	83 ec 0c             	sub    $0xc,%esp
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
 8b9:	8b 45 08             	mov    0x8(%ebp),%eax
  if((prevp = freep) == 0){
 8bc:	8b 15 e8 09 00 00    	mov    0x9e8,%edx
 8c2:	83 c0 07             	add    $0x7,%eax
 8c5:	c1 e8 03             	shr    $0x3,%eax
 8c8:	85 d2                	test   %edx,%edx
 8ca:	8d 58 01             	lea    0x1(%eax),%ebx
 8cd:	0f 84 92 00 00 00    	je     965 <malloc+0xb5>
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
 8d3:	8b 0a                	mov    (%edx),%ecx
    if(p->s.size >= nunits){
 8d5:	8b 41 04             	mov    0x4(%ecx),%eax
 8d8:	39 c3                	cmp    %eax,%ebx
 8da:	76 63                	jbe    93f <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);
 8dc:	8d 3c dd 00 00 00 00 	lea    0x0(,%ebx,8),%edi
 8e3:	eb 09                	jmp    8ee <malloc+0x3e>
 8e5:	8b 0a                	mov    (%edx),%ecx
 8e7:	8b 41 04             	mov    0x4(%ecx),%eax
 8ea:	39 c3                	cmp    %eax,%ebx
 8ec:	76 51                	jbe    93f <malloc+0x8f>
    }
    if(p == freep)
 8ee:	39 0d e8 09 00 00    	cmp    %ecx,0x9e8
 8f4:	89 ca                	mov    %ecx,%edx
 8f6:	75 ed                	jne    8e5 <malloc+0x35>
 8f8:	81 fb ff 0f 00 00    	cmp    $0xfff,%ebx
 8fe:	77 39                	ja     939 <malloc+0x89>
 900:	be 00 10 00 00       	mov    $0x1000,%esi
 905:	b8 00 80 00 00       	mov    $0x8000,%eax
 90a:	89 04 24             	mov    %eax,(%esp)
 90d:	e8 b2 fc ff ff       	call   5c4 <sbrk>
 912:	83 f8 ff             	cmp    $0xffffffff,%eax
 915:	74 18                	je     92f <malloc+0x7f>
 917:	89 70 04             	mov    %esi,0x4(%eax)
 91a:	83 c0 08             	add    $0x8,%eax
 91d:	89 04 24             	mov    %eax,(%esp)
 920:	e8 fb fe ff ff       	call   820 <free>
 925:	8b 15 e8 09 00 00    	mov    0x9e8,%edx
      if((p = morecore(nunits)) == 0)
 92b:	85 d2                	test   %edx,%edx
 92d:	75 b6                	jne    8e5 <malloc+0x35>
        return 0;
  }
}
 92f:	83 c4 0c             	add    $0xc,%esp
 932:	31 c0                	xor    %eax,%eax
 934:	5b                   	pop    %ebx
 935:	5e                   	pop    %esi
 936:	5f                   	pop    %edi
 937:	5d                   	pop    %ebp
 938:	c3                   	ret    
 939:	89 de                	mov    %ebx,%esi
 93b:	89 f8                	mov    %edi,%eax
 93d:	eb cb                	jmp    90a <malloc+0x5a>
 93f:	39 c3                	cmp    %eax,%ebx
 941:	74 1c                	je     95f <malloc+0xaf>
 943:	29 d8                	sub    %ebx,%eax
 945:	89 41 04             	mov    %eax,0x4(%ecx)
 948:	8d 0c c1             	lea    (%ecx,%eax,8),%ecx
 94b:	89 59 04             	mov    %ebx,0x4(%ecx)
 94e:	89 15 e8 09 00 00    	mov    %edx,0x9e8
 954:	83 c4 0c             	add    $0xc,%esp
 957:	5b                   	pop    %ebx
 958:	8d 41 08             	lea    0x8(%ecx),%eax
 95b:	5e                   	pop    %esi
 95c:	5f                   	pop    %edi
 95d:	5d                   	pop    %ebp
 95e:	c3                   	ret    
 95f:	8b 01                	mov    (%ecx),%eax
 961:	89 02                	mov    %eax,(%edx)
 963:	eb e9                	jmp    94e <malloc+0x9e>
 965:	b8 e0 09 00 00       	mov    $0x9e0,%eax
 96a:	ba e0 09 00 00       	mov    $0x9e0,%edx
 96f:	a3 e8 09 00 00       	mov    %eax,0x9e8
 974:	b8 e0 09 00 00       	mov    $0x9e0,%eax
 979:	a3 e0 09 00 00       	mov    %eax,0x9e0
 97e:	31 c0                	xor    %eax,%eax
 980:	a3 e4 09 00 00       	mov    %eax,0x9e4
 985:	e9 49 ff ff ff       	jmp    8d3 <malloc+0x23>
