
_kill:     file format elf32-i386

Disassembly of section .text:

00000000 <main>:
#include "user.h"

int
main(int argc, char **argv)
{
   0:	8d 4c 24 04          	lea    0x4(%esp),%ecx
   4:	83 e4 f0             	and    $0xfffffff0,%esp
   7:	ff 71 fc             	pushl  0xfffffffc(%ecx)
   a:	55                   	push   %ebp
   b:	89 e5                	mov    %esp,%ebp
   d:	83 ec 18             	sub    $0x18,%esp
  10:	89 5d f4             	mov    %ebx,0xfffffff4(%ebp)
  13:	8b 19                	mov    (%ecx),%ebx
  15:	89 4d f0             	mov    %ecx,0xfffffff0(%ebp)
  18:	89 75 f8             	mov    %esi,0xfffffff8(%ebp)
  1b:	89 7d fc             	mov    %edi,0xfffffffc(%ebp)
  int i;
	
  if(argc < 1){
  1e:	85 db                	test   %ebx,%ebx
  20:	8b 71 04             	mov    0x4(%ecx),%esi
  23:	7f 1a                	jg     3f <main+0x3f>
    printf(2, "usage: kill pid...\n");
  25:	b8 da 06 00 00       	mov    $0x6da,%eax
  2a:	89 44 24 04          	mov    %eax,0x4(%esp)
  2e:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
  35:	e8 b6 03 00 00       	call   3f0 <printf>
    exit();
  3a:	e8 4d 02 00 00       	call   28c <exit>
  }
  for(i=1; i<argc; i++)
  3f:	83 fb 01             	cmp    $0x1,%ebx
  42:	bf 01 00 00 00       	mov    $0x1,%edi
  47:	7e 18                	jle    61 <main+0x61>
    kill(atoi(argv[i]));
  49:	8b 04 be             	mov    (%esi,%edi,4),%eax
  4c:	47                   	inc    %edi
  4d:	89 04 24             	mov    %eax,(%esp)
  50:	e8 eb 00 00 00       	call   140 <atoi>
  55:	89 04 24             	mov    %eax,(%esp)
  58:	e8 5f 02 00 00       	call   2bc <kill>
  5d:	39 fb                	cmp    %edi,%ebx
  5f:	75 e8                	jne    49 <main+0x49>
  exit();
  61:	e8 26 02 00 00       	call   28c <exit>
  66:	90                   	nop    
  67:	90                   	nop    
  68:	90                   	nop    
  69:	90                   	nop    
  6a:	90                   	nop    
  6b:	90                   	nop    
  6c:	90                   	nop    
  6d:	90                   	nop    
  6e:	90                   	nop    
  6f:	90                   	nop    

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

char*
strcpy(char *s, char *t)
{
  70:	55                   	push   %ebp
  71:	89 e5                	mov    %esp,%ebp
  73:	53                   	push   %ebx
  74:	8b 5d 08             	mov    0x8(%ebp),%ebx
  77:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  7a:	89 da                	mov    %ebx,%edx
  7c:	8d 74 26 00          	lea    0x0(%esi),%esi
  char *os;

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

00000090 <strcmp>:

int
strcmp(const char *p, const char *q)
{
  90:	55                   	push   %ebp
  91:	89 e5                	mov    %esp,%ebp
  93:	8b 55 08             	mov    0x8(%ebp),%edx
  96:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  while(*p && *p == *q)
  99:	0f b6 02             	movzbl (%edx),%eax
  9c:	84 c0                	test   %al,%al
  9e:	75 0c                	jne    ac <strcmp+0x1c>
  a0:	eb 10                	jmp    b2 <strcmp+0x22>
  a2:	0f b6 42 01          	movzbl 0x1(%edx),%eax
    p++, q++;
  a6:	41                   	inc    %ecx
  a7:	84 c0                	test   %al,%al
  a9:	74 07                	je     b2 <strcmp+0x22>
  ab:	42                   	inc    %edx
  ac:	3a 01                	cmp    (%ecx),%al
  ae:	89 f6                	mov    %esi,%esi
  b0:	74 f0                	je     a2 <strcmp+0x12>
  b2:	0f b6 11             	movzbl (%ecx),%edx
  b5:	0f b6 c0             	movzbl %al,%eax
  return (uchar)*p - (uchar)*q;
}
  b8:	5d                   	pop    %ebp
  b9:	29 d0                	sub    %edx,%eax
  bb:	c3                   	ret    
  bc:	8d 74 26 00          	lea    0x0(%esi),%esi

000000c0 <strlen>:

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

  for(n = 0; s[n]; n++)
  c1:	31 c0                	xor    %eax,%eax
  c3:	89 e5                	mov    %esp,%ebp
  c5:	8b 55 08             	mov    0x8(%ebp),%edx
  c8:	80 3a 00             	cmpb   $0x0,(%edx)
  cb:	74 0a                	je     d7 <strlen+0x17>
  cd:	8d 76 00             	lea    0x0(%esi),%esi
  d0:	40                   	inc    %eax
  d1:	80 3c 10 00          	cmpb   $0x0,(%eax,%edx,1)
  d5:	75 f9                	jne    d0 <strlen+0x10>
    ;
  return n;
}
  d7:	5d                   	pop    %ebp
  d8:	c3                   	ret    
  d9:	8d b4 26 00 00 00 00 	lea    0x0(%esi),%esi

000000e0 <memset>:

void*
memset(void *dst, int c, uint n)
{
  e0:	55                   	push   %ebp
  e1:	89 e5                	mov    %esp,%ebp
  e3:	8b 45 10             	mov    0x10(%ebp),%eax
  e6:	53                   	push   %ebx
  e7:	8b 5d 08             	mov    0x8(%ebp),%ebx
  char *d;
  
  d = dst;
  while(n-- > 0)
  ea:	85 c0                	test   %eax,%eax
  ec:	74 1a                	je     108 <memset+0x28>
  ee:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
  f2:	31 d2                	xor    %edx,%edx
  f4:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  fa:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi
    *d++ = c;
 100:	88 0c 1a             	mov    %cl,(%edx,%ebx,1)
 103:	42                   	inc    %edx
 104:	39 d0                	cmp    %edx,%eax
 106:	75 f8                	jne    100 <memset+0x20>
  return dst;
}
 108:	89 d8                	mov    %ebx,%eax
 10a:	5b                   	pop    %ebx
 10b:	5d                   	pop    %ebp
 10c:	c3                   	ret    
 10d:	8d 76 00             	lea    0x0(%esi),%esi

00000110 <strchr>:

char*
strchr(const char *s, char c)
{
 110:	55                   	push   %ebp
 111:	89 e5                	mov    %esp,%ebp
 113:	8b 45 08             	mov    0x8(%ebp),%eax
 116:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
  for(; *s; s++)
 11a:	0f b6 10             	movzbl (%eax),%edx
 11d:	84 d2                	test   %dl,%dl
 11f:	74 19                	je     13a <strchr+0x2a>
    if(*s == c)
 121:	38 d1                	cmp    %dl,%cl
 123:	75 0d                	jne    132 <strchr+0x22>
 125:	eb 15                	jmp    13c <strchr+0x2c>
 127:	38 ca                	cmp    %cl,%dl
 129:	8d b4 26 00 00 00 00 	lea    0x0(%esi),%esi
 130:	74 0a                	je     13c <strchr+0x2c>
 132:	40                   	inc    %eax
 133:	0f b6 10             	movzbl (%eax),%edx
 136:	84 d2                	test   %dl,%dl
 138:	75 ed                	jne    127 <strchr+0x17>
 13a:	31 c0                	xor    %eax,%eax
      return (char*) s;
  return 0;
}
 13c:	5d                   	pop    %ebp
 13d:	c3                   	ret    
 13e:	89 f6                	mov    %esi,%esi

00000140 <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)
{
 140:	55                   	push   %ebp
 141:	89 e5                	mov    %esp,%ebp
 143:	8b 4d 08             	mov    0x8(%ebp),%ecx
 146:	53                   	push   %ebx
  int n;

  n = 0;
  while('0' <= *s && *s <= '9')
 147:	31 db                	xor    %ebx,%ebx
 149:	0f b6 11             	movzbl (%ecx),%edx
 14c:	88 d0                	mov    %dl,%al
 14e:	2c 30                	sub    $0x30,%al
 150:	3c 09                	cmp    $0x9,%al
 152:	77 23                	ja     177 <atoi+0x37>
 154:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 15a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi
    n = n*10 + *s++ - '0';
 160:	8d 04 9b             	lea    (%ebx,%ebx,4),%eax
 163:	0f be d2             	movsbl %dl,%edx
 166:	8d 5c 42 d0          	lea    0xffffffd0(%edx,%eax,2),%ebx
 16a:	0f b6 51 01          	movzbl 0x1(%ecx),%edx
 16e:	41                   	inc    %ecx
 16f:	88 d0                	mov    %dl,%al
 171:	2c 30                	sub    $0x30,%al
 173:	3c 09                	cmp    $0x9,%al
 175:	76 e9                	jbe    160 <atoi+0x20>
  return n;
}
 177:	89 d8                	mov    %ebx,%eax
 179:	5b                   	pop    %ebx
 17a:	5d                   	pop    %ebp
 17b:	c3                   	ret    
 17c:	8d 74 26 00          	lea    0x0(%esi),%esi

00000180 <memmove>:

void*
memmove(void *vdst, void *vsrc, int n)
{
 180:	55                   	push   %ebp
 181:	89 e5                	mov    %esp,%ebp
 183:	8b 4d 10             	mov    0x10(%ebp),%ecx
 186:	56                   	push   %esi
 187:	8b 75 08             	mov    0x8(%ebp),%esi
 18a:	53                   	push   %ebx
 18b:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
 18e:	85 c9                	test   %ecx,%ecx
 190:	7e 1a                	jle    1ac <memmove+0x2c>
 192:	31 d2                	xor    %edx,%edx
 194:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 19a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi
    *dst++ = *src++;
 1a0:	0f b6 04 1a          	movzbl (%edx,%ebx,1),%eax
 1a4:	88 04 32             	mov    %al,(%edx,%esi,1)
 1a7:	42                   	inc    %edx
 1a8:	39 ca                	cmp    %ecx,%edx
 1aa:	75 f4                	jne    1a0 <memmove+0x20>
  return vdst;
}
 1ac:	5b                   	pop    %ebx
 1ad:	89 f0                	mov    %esi,%eax
 1af:	5e                   	pop    %esi
 1b0:	5d                   	pop    %ebp
 1b1:	c3                   	ret    
 1b2:	8d b4 26 00 00 00 00 	lea    0x0(%esi),%esi
 1b9:	8d bc 27 00 00 00 00 	lea    0x0(%edi),%edi

000001c0 <stat>:
 1c0:	55                   	push   %ebp
 1c1:	31 c0                	xor    %eax,%eax
 1c3:	89 e5                	mov    %esp,%ebp
 1c5:	83 ec 18             	sub    $0x18,%esp
 1c8:	89 44 24 04          	mov    %eax,0x4(%esp)
 1cc:	8b 45 08             	mov    0x8(%ebp),%eax
 1cf:	89 5d f8             	mov    %ebx,0xfffffff8(%ebp)
 1d2:	89 75 fc             	mov    %esi,0xfffffffc(%ebp)
 1d5:	be ff ff ff ff       	mov    $0xffffffff,%esi
 1da:	89 04 24             	mov    %eax,(%esp)
 1dd:	e8 ea 00 00 00       	call   2cc <open>
 1e2:	85 c0                	test   %eax,%eax
 1e4:	89 c3                	mov    %eax,%ebx
 1e6:	78 19                	js     201 <stat+0x41>
 1e8:	8b 45 0c             	mov    0xc(%ebp),%eax
 1eb:	89 1c 24             	mov    %ebx,(%esp)
 1ee:	89 44 24 04          	mov    %eax,0x4(%esp)
 1f2:	e8 ed 00 00 00       	call   2e4 <fstat>
 1f7:	89 1c 24             	mov    %ebx,(%esp)
 1fa:	89 c6                	mov    %eax,%esi
 1fc:	e8 b3 00 00 00       	call   2b4 <close>
 201:	89 f0                	mov    %esi,%eax
 203:	8b 5d f8             	mov    0xfffffff8(%ebp),%ebx
 206:	8b 75 fc             	mov    0xfffffffc(%ebp),%esi
 209:	89 ec                	mov    %ebp,%esp
 20b:	5d                   	pop    %ebp
 20c:	c3                   	ret    
 20d:	8d 76 00             	lea    0x0(%esi),%esi

00000210 <gets>:
 210:	55                   	push   %ebp
 211:	89 e5                	mov    %esp,%ebp
 213:	57                   	push   %edi
 214:	56                   	push   %esi
 215:	31 f6                	xor    %esi,%esi
 217:	53                   	push   %ebx
 218:	83 ec 1c             	sub    $0x1c,%esp
 21b:	8d 5e 01             	lea    0x1(%esi),%ebx
 21e:	8b 7d 08             	mov    0x8(%ebp),%edi
 221:	3b 5d 0c             	cmp    0xc(%ebp),%ebx
 224:	7d 3e                	jge    264 <gets+0x54>
 226:	ba 01 00 00 00       	mov    $0x1,%edx
 22b:	8d 45 f3             	lea    0xfffffff3(%ebp),%eax
 22e:	89 54 24 08          	mov    %edx,0x8(%esp)
 232:	89 44 24 04          	mov    %eax,0x4(%esp)
 236:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
 23d:	e8 62 00 00 00       	call   2a4 <read>
 242:	85 c0                	test   %eax,%eax
 244:	7e 1e                	jle    264 <gets+0x54>
 246:	0f b6 45 f3          	movzbl 0xfffffff3(%ebp),%eax
 24a:	88 44 3b ff          	mov    %al,0xffffffff(%ebx,%edi,1)
 24e:	0f b6 45 f3          	movzbl 0xfffffff3(%ebp),%eax
 252:	3c 0a                	cmp    $0xa,%al
 254:	74 1c                	je     272 <gets+0x62>
 256:	3c 0d                	cmp    $0xd,%al
 258:	74 18                	je     272 <gets+0x62>
 25a:	89 de                	mov    %ebx,%esi
 25c:	8d 5e 01             	lea    0x1(%esi),%ebx
 25f:	3b 5d 0c             	cmp    0xc(%ebp),%ebx
 262:	7c c2                	jl     226 <gets+0x16>
 264:	c6 04 3e 00          	movb   $0x0,(%esi,%edi,1)
 268:	83 c4 1c             	add    $0x1c,%esp
 26b:	89 f8                	mov    %edi,%eax
 26d:	5b                   	pop    %ebx
 26e:	5e                   	pop    %esi
 26f:	5f                   	pop    %edi
 270:	5d                   	pop    %ebp
 271:	c3                   	ret    
 272:	89 de                	mov    %ebx,%esi
 274:	89 f8                	mov    %edi,%eax
 276:	c6 04 3e 00          	movb   $0x0,(%esi,%edi,1)
 27a:	83 c4 1c             	add    $0x1c,%esp
 27d:	5b                   	pop    %ebx
 27e:	5e                   	pop    %esi
 27f:	5f                   	pop    %edi
 280:	5d                   	pop    %ebp
 281:	c3                   	ret    
 282:	90                   	nop    
 283:	90                   	nop    

00000284 <fork>:
 284:	b8 01 00 00 00       	mov    $0x1,%eax
 289:	cd 30                	int    $0x30
 28b:	c3                   	ret    

0000028c <exit>:
 28c:	b8 02 00 00 00       	mov    $0x2,%eax
 291:	cd 30                	int    $0x30
 293:	c3                   	ret    

00000294 <wait>:
 294:	b8 03 00 00 00       	mov    $0x3,%eax
 299:	cd 30                	int    $0x30
 29b:	c3                   	ret    

0000029c <pipe>:
 29c:	b8 04 00 00 00       	mov    $0x4,%eax
 2a1:	cd 30                	int    $0x30
 2a3:	c3                   	ret    

000002a4 <read>:
 2a4:	b8 06 00 00 00       	mov    $0x6,%eax
 2a9:	cd 30                	int    $0x30
 2ab:	c3                   	ret    

000002ac <write>:
 2ac:	b8 05 00 00 00       	mov    $0x5,%eax
 2b1:	cd 30                	int    $0x30
 2b3:	c3                   	ret    

000002b4 <close>:
 2b4:	b8 07 00 00 00       	mov    $0x7,%eax
 2b9:	cd 30                	int    $0x30
 2bb:	c3                   	ret    

000002bc <kill>:
 2bc:	b8 08 00 00 00       	mov    $0x8,%eax
 2c1:	cd 30                	int    $0x30
 2c3:	c3                   	ret    

000002c4 <exec>:
 2c4:	b8 09 00 00 00       	mov    $0x9,%eax
 2c9:	cd 30                	int    $0x30
 2cb:	c3                   	ret    

000002cc <open>:
 2cc:	b8 0a 00 00 00       	mov    $0xa,%eax
 2d1:	cd 30                	int    $0x30
 2d3:	c3                   	ret    

000002d4 <mknod>:
 2d4:	b8 0b 00 00 00       	mov    $0xb,%eax
 2d9:	cd 30                	int    $0x30
 2db:	c3                   	ret    

000002dc <unlink>:
 2dc:	b8 0c 00 00 00       	mov    $0xc,%eax
 2e1:	cd 30                	int    $0x30
 2e3:	c3                   	ret    

000002e4 <fstat>:
 2e4:	b8 0d 00 00 00       	mov    $0xd,%eax
 2e9:	cd 30                	int    $0x30
 2eb:	c3                   	ret    

000002ec <link>:
 2ec:	b8 0e 00 00 00       	mov    $0xe,%eax
 2f1:	cd 30                	int    $0x30
 2f3:	c3                   	ret    

000002f4 <mkdir>:
 2f4:	b8 0f 00 00 00       	mov    $0xf,%eax
 2f9:	cd 30                	int    $0x30
 2fb:	c3                   	ret    

000002fc <chdir>:
 2fc:	b8 10 00 00 00       	mov    $0x10,%eax
 301:	cd 30                	int    $0x30
 303:	c3                   	ret    

00000304 <dup>:
 304:	b8 11 00 00 00       	mov    $0x11,%eax
 309:	cd 30                	int    $0x30
 30b:	c3                   	ret    

0000030c <getpid>:
 30c:	b8 12 00 00 00       	mov    $0x12,%eax
 311:	cd 30                	int    $0x30
 313:	c3                   	ret    

00000314 <sbrk>:
 314:	b8 13 00 00 00       	mov    $0x13,%eax
 319:	cd 30                	int    $0x30
 31b:	c3                   	ret    

0000031c <sleep>:
 31c:	b8 14 00 00 00       	mov    $0x14,%eax
 321:	cd 30                	int    $0x30
 323:	c3                   	ret    
 324:	90                   	nop    
 325:	90                   	nop    
 326:	90                   	nop    
 327:	90                   	nop    
 328:	90                   	nop    
 329:	90                   	nop    
 32a:	90                   	nop    
 32b:	90                   	nop    
 32c:	90                   	nop    
 32d:	90                   	nop    
 32e:	90                   	nop    
 32f:	90                   	nop    

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

static void
putc(int fd, char c)
{
 330:	55                   	push   %ebp
 331:	89 e5                	mov    %esp,%ebp
 333:	83 ec 18             	sub    $0x18,%esp
 336:	88 55 fc             	mov    %dl,0xfffffffc(%ebp)
  write(fd, &c, 1);
 339:	ba 01 00 00 00       	mov    $0x1,%edx
 33e:	89 54 24 08          	mov    %edx,0x8(%esp)
 342:	8d 55 fc             	lea    0xfffffffc(%ebp),%edx
 345:	89 54 24 04          	mov    %edx,0x4(%esp)
 349:	89 04 24             	mov    %eax,(%esp)
 34c:	e8 5b ff ff ff       	call   2ac <write>
}
 351:	c9                   	leave  
 352:	c3                   	ret    
 353:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 359:	8d bc 27 00 00 00 00 	lea    0x0(%edi),%edi

00000360 <printint>:

static void
printint(int fd, int xx, int base, int sgn)
{
 360:	55                   	push   %ebp
 361:	89 e5                	mov    %esp,%ebp
 363:	57                   	push   %edi
 364:	56                   	push   %esi
 365:	89 ce                	mov    %ecx,%esi
 367:	53                   	push   %ebx
 368:	83 ec 1c             	sub    $0x1c,%esp
  static char digits[] = "0123456789ABCDEF";
  char buf[16];
  int i, neg;
  uint x;

  neg = 0;
  if(sgn && xx < 0){
 36b:	8b 5d 08             	mov    0x8(%ebp),%ebx
 36e:	89 45 dc             	mov    %eax,0xffffffdc(%ebp)
 371:	85 db                	test   %ebx,%ebx
 373:	74 04                	je     379 <printint+0x19>
 375:	85 d2                	test   %edx,%edx
 377:	78 62                	js     3db <printint+0x7b>
    neg = 1;
    x = -xx;
  } else {
    x = xx;
 379:	89 d0                	mov    %edx,%eax
 37b:	c7 45 e0 00 00 00 00 	movl   $0x0,0xffffffe0(%ebp)
 382:	31 db                	xor    %ebx,%ebx
 384:	8d 7d e4             	lea    0xffffffe4(%ebp),%edi
 387:	89 f6                	mov    %esi,%esi
 389:	8d bc 27 00 00 00 00 	lea    0x0(%edi),%edi
  }

  i = 0;
  do{
    buf[i++] = digits[x % base];
 390:	31 d2                	xor    %edx,%edx
 392:	f7 f6                	div    %esi
 394:	89 c1                	mov    %eax,%ecx
 396:	0f b6 82 f5 06 00 00 	movzbl 0x6f5(%edx),%eax
 39d:	88 04 3b             	mov    %al,(%ebx,%edi,1)
 3a0:	43                   	inc    %ebx
  }while((x /= base) != 0);
 3a1:	85 c9                	test   %ecx,%ecx
 3a3:	89 c8                	mov    %ecx,%eax
 3a5:	75 e9                	jne    390 <printint+0x30>
  if(neg)
 3a7:	8b 4d e0             	mov    0xffffffe0(%ebp),%ecx
 3aa:	85 c9                	test   %ecx,%ecx
 3ac:	74 06                	je     3b4 <printint+0x54>
    buf[i++] = '-';
 3ae:	c6 44 1d e4 2d       	movb   $0x2d,0xffffffe4(%ebp,%ebx,1)
 3b3:	43                   	inc    %ebx

  while(--i >= 0)
 3b4:	4b                   	dec    %ebx
 3b5:	78 1c                	js     3d3 <printint+0x73>
 3b7:	89 f6                	mov    %esi,%esi
 3b9:	8d bc 27 00 00 00 00 	lea    0x0(%edi),%edi
    putc(fd, buf[i]);
 3c0:	0f be 54 1d e4       	movsbl 0xffffffe4(%ebp,%ebx,1),%edx
 3c5:	4b                   	dec    %ebx
 3c6:	8b 45 dc             	mov    0xffffffdc(%ebp),%eax
 3c9:	e8 62 ff ff ff       	call   330 <putc>
 3ce:	83 fb ff             	cmp    $0xffffffff,%ebx
 3d1:	75 ed                	jne    3c0 <printint+0x60>
}
 3d3:	83 c4 1c             	add    $0x1c,%esp
 3d6:	5b                   	pop    %ebx
 3d7:	5e                   	pop    %esi
 3d8:	5f                   	pop    %edi
 3d9:	5d                   	pop    %ebp
 3da:	c3                   	ret    
 3db:	89 d0                	mov    %edx,%eax
 3dd:	f7 d8                	neg    %eax
 3df:	c7 45 e0 01 00 00 00 	movl   $0x1,0xffffffe0(%ebp)
 3e6:	eb 9a                	jmp    382 <printint+0x22>
 3e8:	90                   	nop    
 3e9:	8d b4 26 00 00 00 00 	lea    0x0(%esi),%esi

000003f0 <printf>:

// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
 3f0:	55                   	push   %ebp
 3f1:	89 e5                	mov    %esp,%ebp
 3f3:	57                   	push   %edi
 3f4:	56                   	push   %esi
 3f5:	53                   	push   %ebx
 3f6:	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++){
 3f9:	8b 55 0c             	mov    0xc(%ebp),%edx
 3fc:	0f b6 02             	movzbl (%edx),%eax
 3ff:	84 c0                	test   %al,%al
 401:	0f 84 99 00 00 00    	je     4a0 <printf+0xb0>
 407:	8d 4d 10             	lea    0x10(%ebp),%ecx
 40a:	31 ff                	xor    %edi,%edi
 40c:	31 f6                	xor    %esi,%esi
 40e:	89 4d f0             	mov    %ecx,0xfffffff0(%ebp)
 411:	eb 26                	jmp    439 <printf+0x49>
    c = fmt[i] & 0xff;
    if(state == 0){
      if(c == '%'){
 413:	83 fb 25             	cmp    $0x25,%ebx
 416:	0f 85 8c 00 00 00    	jne    4a8 <printf+0xb8>
 41c:	be 25 00 00 00       	mov    $0x25,%esi
 421:	eb 0d                	jmp    430 <printf+0x40>
 423:	90                   	nop    
 424:	90                   	nop    
 425:	90                   	nop    
 426:	90                   	nop    
 427:	90                   	nop    
 428:	90                   	nop    
 429:	90                   	nop    
 42a:	90                   	nop    
 42b:	90                   	nop    
 42c:	90                   	nop    
 42d:	90                   	nop    
 42e:	90                   	nop    
 42f:	90                   	nop    
 430:	47                   	inc    %edi
 431:	0f b6 04 3a          	movzbl (%edx,%edi,1),%eax
 435:	84 c0                	test   %al,%al
 437:	74 67                	je     4a0 <printf+0xb0>
 439:	85 f6                	test   %esi,%esi
 43b:	0f b6 d8             	movzbl %al,%ebx
 43e:	74 d3                	je     413 <printf+0x23>
        state = '%';
      } else {
        putc(fd, c);
      }
    } else if(state == '%'){
 440:	83 fe 25             	cmp    $0x25,%esi
 443:	75 eb                	jne    430 <printf+0x40>
      if(c == 'd'){
 445:	83 fb 64             	cmp    $0x64,%ebx
 448:	0f 84 e0 00 00 00    	je     52e <printf+0x13e>
        printint(fd, *ap, 10, 1);
        ap++;
      } else if(c == 'x' || c == 'p'){
 44e:	83 fb 78             	cmp    $0x78,%ebx
 451:	74 68                	je     4bb <printf+0xcb>
 453:	83 fb 70             	cmp    $0x70,%ebx
 456:	74 63                	je     4bb <printf+0xcb>
        printint(fd, *ap, 16, 0);
        ap++;
      } else if(c == 's'){
 458:	83 fb 73             	cmp    $0x73,%ebx
 45b:	90                   	nop    
 45c:	8d 74 26 00          	lea    0x0(%esi),%esi
 460:	0f 84 7c 00 00 00    	je     4e2 <printf+0xf2>
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
        while(*s != 0){
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
 466:	83 fb 63             	cmp    $0x63,%ebx
 469:	0f 84 e4 00 00 00    	je     553 <printf+0x163>
        putc(fd, *ap);
        ap++;
      } else if(c == '%'){
 46f:	83 fb 25             	cmp    $0x25,%ebx
 472:	0f 84 c4 00 00 00    	je     53c <printf+0x14c>
        putc(fd, c);
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
 478:	8b 45 08             	mov    0x8(%ebp),%eax
 47b:	ba 25 00 00 00       	mov    $0x25,%edx
 480:	47                   	inc    %edi
        putc(fd, c);
 481:	31 f6                	xor    %esi,%esi
 483:	e8 a8 fe ff ff       	call   330 <putc>
 488:	8b 45 08             	mov    0x8(%ebp),%eax
 48b:	0f be d3             	movsbl %bl,%edx
 48e:	e8 9d fe ff ff       	call   330 <putc>
 493:	8b 55 0c             	mov    0xc(%ebp),%edx
 496:	0f b6 04 3a          	movzbl (%edx,%edi,1),%eax
 49a:	84 c0                	test   %al,%al
 49c:	75 9b                	jne    439 <printf+0x49>
 49e:	89 f6                	mov    %esi,%esi
      }
      state = 0;
    }
  }
}
 4a0:	83 c4 0c             	add    $0xc,%esp
 4a3:	5b                   	pop    %ebx
 4a4:	5e                   	pop    %esi
 4a5:	5f                   	pop    %edi
 4a6:	5d                   	pop    %ebp
 4a7:	c3                   	ret    
 4a8:	8b 45 08             	mov    0x8(%ebp),%eax
 4ab:	0f be d3             	movsbl %bl,%edx
 4ae:	e8 7d fe ff ff       	call   330 <putc>
 4b3:	8b 55 0c             	mov    0xc(%ebp),%edx
 4b6:	e9 75 ff ff ff       	jmp    430 <printf+0x40>
 4bb:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
 4c2:	b9 10 00 00 00       	mov    $0x10,%ecx
 4c7:	8b 45 f0             	mov    0xfffffff0(%ebp),%eax
 4ca:	31 f6                	xor    %esi,%esi
 4cc:	8b 10                	mov    (%eax),%edx
 4ce:	8b 45 08             	mov    0x8(%ebp),%eax
 4d1:	e8 8a fe ff ff       	call   360 <printint>
 4d6:	8b 55 0c             	mov    0xc(%ebp),%edx
 4d9:	83 45 f0 04          	addl   $0x4,0xfffffff0(%ebp)
 4dd:	e9 4e ff ff ff       	jmp    430 <printf+0x40>
 4e2:	8b 4d f0             	mov    0xfffffff0(%ebp),%ecx
 4e5:	8b 01                	mov    (%ecx),%eax
 4e7:	83 c1 04             	add    $0x4,%ecx
 4ea:	89 4d f0             	mov    %ecx,0xfffffff0(%ebp)
 4ed:	b9 ee 06 00 00       	mov    $0x6ee,%ecx
 4f2:	85 c0                	test   %eax,%eax
 4f4:	74 02                	je     4f8 <printf+0x108>
 4f6:	89 c1                	mov    %eax,%ecx
 4f8:	0f b6 01             	movzbl (%ecx),%eax
 4fb:	84 c0                	test   %al,%al
 4fd:	74 28                	je     527 <printf+0x137>
 4ff:	89 cb                	mov    %ecx,%ebx
 501:	eb 0d                	jmp    510 <printf+0x120>
 503:	90                   	nop    
 504:	90                   	nop    
 505:	90                   	nop    
 506:	90                   	nop    
 507:	90                   	nop    
 508:	90                   	nop    
 509:	90                   	nop    
 50a:	90                   	nop    
 50b:	90                   	nop    
 50c:	90                   	nop    
 50d:	90                   	nop    
 50e:	90                   	nop    
 50f:	90                   	nop    
 510:	0f be d0             	movsbl %al,%edx
 513:	8b 45 08             	mov    0x8(%ebp),%eax
 516:	e8 15 fe ff ff       	call   330 <putc>
 51b:	0f b6 43 01          	movzbl 0x1(%ebx),%eax
 51f:	43                   	inc    %ebx
 520:	84 c0                	test   %al,%al
 522:	75 ec                	jne    510 <printf+0x120>
 524:	8b 55 0c             	mov    0xc(%ebp),%edx
 527:	31 f6                	xor    %esi,%esi
 529:	e9 02 ff ff ff       	jmp    430 <printf+0x40>
 52e:	b9 0a 00 00 00       	mov    $0xa,%ecx
 533:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 53a:	eb 8b                	jmp    4c7 <printf+0xd7>
 53c:	8b 45 08             	mov    0x8(%ebp),%eax
 53f:	ba 25 00 00 00       	mov    $0x25,%edx
 544:	31 f6                	xor    %esi,%esi
 546:	e8 e5 fd ff ff       	call   330 <putc>
 54b:	8b 55 0c             	mov    0xc(%ebp),%edx
 54e:	e9 dd fe ff ff       	jmp    430 <printf+0x40>
 553:	8b 45 f0             	mov    0xfffffff0(%ebp),%eax
 556:	31 f6                	xor    %esi,%esi
 558:	0f be 10             	movsbl (%eax),%edx
 55b:	8b 45 08             	mov    0x8(%ebp),%eax
 55e:	e8 cd fd ff ff       	call   330 <putc>
 563:	8b 55 0c             	mov    0xc(%ebp),%edx
 566:	83 45 f0 04          	addl   $0x4,0xfffffff0(%ebp)
 56a:	e9 c1 fe ff ff       	jmp    430 <printf+0x40>
 56f:	90                   	nop    

00000570 <free>:
static Header *freep;

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

  bp = (Header*) ap - 1;
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
 571:	8b 0d 10 07 00 00    	mov    0x710,%ecx
 577:	89 e5                	mov    %esp,%ebp
 579:	56                   	push   %esi
 57a:	53                   	push   %ebx
 57b:	8b 5d 08             	mov    0x8(%ebp),%ebx
 57e:	83 eb 08             	sub    $0x8,%ebx
 581:	eb 0d                	jmp    590 <free+0x20>
 583:	90                   	nop    
 584:	90                   	nop    
 585:	90                   	nop    
 586:	90                   	nop    
 587:	90                   	nop    
 588:	90                   	nop    
 589:	90                   	nop    
 58a:	90                   	nop    
 58b:	90                   	nop    
 58c:	90                   	nop    
 58d:	90                   	nop    
 58e:	90                   	nop    
 58f:	90                   	nop    
 590:	39 d9                	cmp    %ebx,%ecx
 592:	73 04                	jae    598 <free+0x28>
 594:	3b 19                	cmp    (%ecx),%ebx
 596:	72 12                	jb     5aa <free+0x3a>
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
 598:	8b 11                	mov    (%ecx),%edx
 59a:	39 d1                	cmp    %edx,%ecx
 59c:	72 08                	jb     5a6 <free+0x36>
 59e:	39 d9                	cmp    %ebx,%ecx
 5a0:	72 0a                	jb     5ac <free+0x3c>
 5a2:	39 d3                	cmp    %edx,%ebx
 5a4:	72 06                	jb     5ac <free+0x3c>
 5a6:	89 d1                	mov    %edx,%ecx
 5a8:	eb e6                	jmp    590 <free+0x20>
 5aa:	8b 11                	mov    (%ecx),%edx
      break;
  if(bp + bp->s.size == p->s.ptr){
 5ac:	8b 73 04             	mov    0x4(%ebx),%esi
 5af:	8d 04 f3             	lea    (%ebx,%esi,8),%eax
 5b2:	39 d0                	cmp    %edx,%eax
 5b4:	74 2e                	je     5e4 <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;
 5b6:	89 13                	mov    %edx,(%ebx)
  if(p + p->s.size == bp){
 5b8:	8b 51 04             	mov    0x4(%ecx),%edx
 5bb:	8d 04 d1             	lea    (%ecx,%edx,8),%eax
 5be:	39 c3                	cmp    %eax,%ebx
 5c0:	74 0c                	je     5ce <free+0x5e>
    p->s.size += bp->s.size;
    p->s.ptr = bp->s.ptr;
  } else
    p->s.ptr = bp;
 5c2:	89 19                	mov    %ebx,(%ecx)
  freep = p;
}
 5c4:	5b                   	pop    %ebx
 5c5:	89 0d 10 07 00 00    	mov    %ecx,0x710
 5cb:	5e                   	pop    %esi
 5cc:	5d                   	pop    %ebp
 5cd:	c3                   	ret    
 5ce:	8b 43 04             	mov    0x4(%ebx),%eax
 5d1:	01 c2                	add    %eax,%edx
 5d3:	8b 03                	mov    (%ebx),%eax
 5d5:	89 51 04             	mov    %edx,0x4(%ecx)
 5d8:	89 01                	mov    %eax,(%ecx)
 5da:	5b                   	pop    %ebx
 5db:	89 0d 10 07 00 00    	mov    %ecx,0x710
 5e1:	5e                   	pop    %esi
 5e2:	5d                   	pop    %ebp
 5e3:	c3                   	ret    
 5e4:	8b 42 04             	mov    0x4(%edx),%eax
 5e7:	01 c6                	add    %eax,%esi
 5e9:	8b 02                	mov    (%edx),%eax
 5eb:	89 73 04             	mov    %esi,0x4(%ebx)
 5ee:	89 03                	mov    %eax,(%ebx)
 5f0:	eb c6                	jmp    5b8 <free+0x48>
 5f2:	8d b4 26 00 00 00 00 	lea    0x0(%esi),%esi
 5f9:	8d bc 27 00 00 00 00 	lea    0x0(%edi),%edi

00000600 <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)
{
 600:	55                   	push   %ebp
 601:	89 e5                	mov    %esp,%ebp
 603:	57                   	push   %edi
 604:	56                   	push   %esi
 605:	53                   	push   %ebx
 606:	83 ec 0c             	sub    $0xc,%esp
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
 609:	8b 45 08             	mov    0x8(%ebp),%eax
  if((prevp = freep) == 0){
 60c:	8b 15 10 07 00 00    	mov    0x710,%edx
 612:	83 c0 07             	add    $0x7,%eax
 615:	c1 e8 03             	shr    $0x3,%eax
 618:	85 d2                	test   %edx,%edx
 61a:	8d 58 01             	lea    0x1(%eax),%ebx
 61d:	0f 84 92 00 00 00    	je     6b5 <malloc+0xb5>
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
 623:	8b 0a                	mov    (%edx),%ecx
    if(p->s.size >= nunits){
 625:	8b 41 04             	mov    0x4(%ecx),%eax
 628:	39 c3                	cmp    %eax,%ebx
 62a:	76 63                	jbe    68f <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);
 62c:	8d 3c dd 00 00 00 00 	lea    0x0(,%ebx,8),%edi
 633:	eb 09                	jmp    63e <malloc+0x3e>
 635:	8b 0a                	mov    (%edx),%ecx
 637:	8b 41 04             	mov    0x4(%ecx),%eax
 63a:	39 c3                	cmp    %eax,%ebx
 63c:	76 51                	jbe    68f <malloc+0x8f>
    }
    if(p == freep)
 63e:	39 0d 10 07 00 00    	cmp    %ecx,0x710
 644:	89 ca                	mov    %ecx,%edx
 646:	75 ed                	jne    635 <malloc+0x35>
 648:	81 fb ff 0f 00 00    	cmp    $0xfff,%ebx
 64e:	77 39                	ja     689 <malloc+0x89>
 650:	be 00 10 00 00       	mov    $0x1000,%esi
 655:	b8 00 80 00 00       	mov    $0x8000,%eax
 65a:	89 04 24             	mov    %eax,(%esp)
 65d:	e8 b2 fc ff ff       	call   314 <sbrk>
 662:	83 f8 ff             	cmp    $0xffffffff,%eax
 665:	74 18                	je     67f <malloc+0x7f>
 667:	89 70 04             	mov    %esi,0x4(%eax)
 66a:	83 c0 08             	add    $0x8,%eax
 66d:	89 04 24             	mov    %eax,(%esp)
 670:	e8 fb fe ff ff       	call   570 <free>
 675:	8b 15 10 07 00 00    	mov    0x710,%edx
      if((p = morecore(nunits)) == 0)
 67b:	85 d2                	test   %edx,%edx
 67d:	75 b6                	jne    635 <malloc+0x35>
        return 0;
  }
}
 67f:	83 c4 0c             	add    $0xc,%esp
 682:	31 c0                	xor    %eax,%eax
 684:	5b                   	pop    %ebx
 685:	5e                   	pop    %esi
 686:	5f                   	pop    %edi
 687:	5d                   	pop    %ebp
 688:	c3                   	ret    
 689:	89 de                	mov    %ebx,%esi
 68b:	89 f8                	mov    %edi,%eax
 68d:	eb cb                	jmp    65a <malloc+0x5a>
 68f:	39 c3                	cmp    %eax,%ebx
 691:	74 1c                	je     6af <malloc+0xaf>
 693:	29 d8                	sub    %ebx,%eax
 695:	89 41 04             	mov    %eax,0x4(%ecx)
 698:	8d 0c c1             	lea    (%ecx,%eax,8),%ecx
 69b:	89 59 04             	mov    %ebx,0x4(%ecx)
 69e:	89 15 10 07 00 00    	mov    %edx,0x710
 6a4:	83 c4 0c             	add    $0xc,%esp
 6a7:	5b                   	pop    %ebx
 6a8:	8d 41 08             	lea    0x8(%ecx),%eax
 6ab:	5e                   	pop    %esi
 6ac:	5f                   	pop    %edi
 6ad:	5d                   	pop    %ebp
 6ae:	c3                   	ret    
 6af:	8b 01                	mov    (%ecx),%eax
 6b1:	89 02                	mov    %eax,(%edx)
 6b3:	eb e9                	jmp    69e <malloc+0x9e>
 6b5:	b8 08 07 00 00       	mov    $0x708,%eax
 6ba:	ba 08 07 00 00       	mov    $0x708,%edx
 6bf:	a3 10 07 00 00       	mov    %eax,0x710
 6c4:	b8 08 07 00 00       	mov    $0x708,%eax
 6c9:	a3 08 07 00 00       	mov    %eax,0x708
 6ce:	31 c0                	xor    %eax,%eax
 6d0:	a3 0c 07 00 00       	mov    %eax,0x70c
 6d5:	e9 49 ff ff ff       	jmp    623 <malloc+0x23>
