
_mkdir:     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 28             	sub    $0x28,%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 < 2){
  1e:	83 fb 01             	cmp    $0x1,%ebx
  21:	8b 41 04             	mov    0x4(%ecx),%eax
  24:	7f 1a                	jg     40 <main+0x40>
    printf(2, "Usage: mkdir files...\n");
  26:	ba ea 06 00 00       	mov    $0x6ea,%edx
  2b:	89 54 24 04          	mov    %edx,0x4(%esp)
  2f:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
  36:	e8 c5 03 00 00       	call   400 <printf>
    exit();
  3b:	e8 5c 02 00 00       	call   29c <exit>
  40:	8d 70 04             	lea    0x4(%eax),%esi
  43:	bf 01 00 00 00       	mov    $0x1,%edi
  48:	eb 08                	jmp    52 <main+0x52>
  }

  for(i = 1; i < argc; i++){
  4a:	47                   	inc    %edi
  4b:	83 c6 04             	add    $0x4,%esi
  4e:	39 fb                	cmp    %edi,%ebx
  50:	74 29                	je     7b <main+0x7b>
    if(mkdir(argv[i]) < 0){
  52:	8b 06                	mov    (%esi),%eax
  54:	89 04 24             	mov    %eax,(%esp)
  57:	e8 a8 02 00 00       	call   304 <mkdir>
  5c:	85 c0                	test   %eax,%eax
  5e:	79 ea                	jns    4a <main+0x4a>
      printf(2, "mkdir: %s failed to create\n", argv[i]);
  60:	8b 06                	mov    (%esi),%eax
  62:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
  69:	89 44 24 08          	mov    %eax,0x8(%esp)
  6d:	b8 01 07 00 00       	mov    $0x701,%eax
  72:	89 44 24 04          	mov    %eax,0x4(%esp)
  76:	e8 85 03 00 00       	call   400 <printf>
      break;
    }
  }

  exit();
  7b:	e8 1c 02 00 00       	call   29c <exit>

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

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

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

000000a0 <strcmp>:

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

000000d0 <strlen>:

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

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

000000f0 <memset>:

void*
memset(void *dst, int c, uint n)
{
  f0:	55                   	push   %ebp
  f1:	89 e5                	mov    %esp,%ebp
  f3:	8b 45 10             	mov    0x10(%ebp),%eax
  f6:	53                   	push   %ebx
  f7:	8b 5d 08             	mov    0x8(%ebp),%ebx
  char *d;
  
  d = dst;
  while(n-- > 0)
  fa:	85 c0                	test   %eax,%eax
  fc:	74 1a                	je     118 <memset+0x28>
  fe:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
 102:	31 d2                	xor    %edx,%edx
 104:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 10a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi
    *d++ = c;
 110:	88 0c 1a             	mov    %cl,(%edx,%ebx,1)
 113:	42                   	inc    %edx
 114:	39 d0                	cmp    %edx,%eax
 116:	75 f8                	jne    110 <memset+0x20>
  return dst;
}
 118:	89 d8                	mov    %ebx,%eax
 11a:	5b                   	pop    %ebx
 11b:	5d                   	pop    %ebp
 11c:	c3                   	ret    
 11d:	8d 76 00             	lea    0x0(%esi),%esi

00000120 <strchr>:

char*
strchr(const char *s, char c)
{
 120:	55                   	push   %ebp
 121:	89 e5                	mov    %esp,%ebp
 123:	8b 45 08             	mov    0x8(%ebp),%eax
 126:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
  for(; *s; s++)
 12a:	0f b6 10             	movzbl (%eax),%edx
 12d:	84 d2                	test   %dl,%dl
 12f:	74 19                	je     14a <strchr+0x2a>
    if(*s == c)
 131:	38 d1                	cmp    %dl,%cl
 133:	75 0d                	jne    142 <strchr+0x22>
 135:	eb 15                	jmp    14c <strchr+0x2c>
 137:	38 ca                	cmp    %cl,%dl
 139:	8d b4 26 00 00 00 00 	lea    0x0(%esi),%esi
 140:	74 0a                	je     14c <strchr+0x2c>
 142:	40                   	inc    %eax
 143:	0f b6 10             	movzbl (%eax),%edx
 146:	84 d2                	test   %dl,%dl
 148:	75 ed                	jne    137 <strchr+0x17>
 14a:	31 c0                	xor    %eax,%eax
      return (char*) s;
  return 0;
}
 14c:	5d                   	pop    %ebp
 14d:	c3                   	ret    
 14e:	89 f6                	mov    %esi,%esi

00000150 <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)
{
 150:	55                   	push   %ebp
 151:	89 e5                	mov    %esp,%ebp
 153:	8b 4d 08             	mov    0x8(%ebp),%ecx
 156:	53                   	push   %ebx
  int n;

  n = 0;
  while('0' <= *s && *s <= '9')
 157:	31 db                	xor    %ebx,%ebx
 159:	0f b6 11             	movzbl (%ecx),%edx
 15c:	88 d0                	mov    %dl,%al
 15e:	2c 30                	sub    $0x30,%al
 160:	3c 09                	cmp    $0x9,%al
 162:	77 23                	ja     187 <atoi+0x37>
 164:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 16a:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi
    n = n*10 + *s++ - '0';
 170:	8d 04 9b             	lea    (%ebx,%ebx,4),%eax
 173:	0f be d2             	movsbl %dl,%edx
 176:	8d 5c 42 d0          	lea    0xffffffd0(%edx,%eax,2),%ebx
 17a:	0f b6 51 01          	movzbl 0x1(%ecx),%edx
 17e:	41                   	inc    %ecx
 17f:	88 d0                	mov    %dl,%al
 181:	2c 30                	sub    $0x30,%al
 183:	3c 09                	cmp    $0x9,%al
 185:	76 e9                	jbe    170 <atoi+0x20>
  return n;
}
 187:	89 d8                	mov    %ebx,%eax
 189:	5b                   	pop    %ebx
 18a:	5d                   	pop    %ebp
 18b:	c3                   	ret    
 18c:	8d 74 26 00          	lea    0x0(%esi),%esi

00000190 <memmove>:

void*
memmove(void *vdst, void *vsrc, int n)
{
 190:	55                   	push   %ebp
 191:	89 e5                	mov    %esp,%ebp
 193:	8b 4d 10             	mov    0x10(%ebp),%ecx
 196:	56                   	push   %esi
 197:	8b 75 08             	mov    0x8(%ebp),%esi
 19a:	53                   	push   %ebx
 19b:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  char *dst, *src;
  
  dst = vdst;
  src = vsrc;
  while(n-- > 0)
 19e:	85 c9                	test   %ecx,%ecx
 1a0:	7e 1a                	jle    1bc <memmove+0x2c>
 1a2:	31 d2                	xor    %edx,%edx
 1a4:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 1aa:	8d bf 00 00 00 00    	lea    0x0(%edi),%edi
    *dst++ = *src++;
 1b0:	0f b6 04 1a          	movzbl (%edx,%ebx,1),%eax
 1b4:	88 04 32             	mov    %al,(%edx,%esi,1)
 1b7:	42                   	inc    %edx
 1b8:	39 ca                	cmp    %ecx,%edx
 1ba:	75 f4                	jne    1b0 <memmove+0x20>
  return vdst;
}
 1bc:	5b                   	pop    %ebx
 1bd:	89 f0                	mov    %esi,%eax
 1bf:	5e                   	pop    %esi
 1c0:	5d                   	pop    %ebp
 1c1:	c3                   	ret    
 1c2:	8d b4 26 00 00 00 00 	lea    0x0(%esi),%esi
 1c9:	8d bc 27 00 00 00 00 	lea    0x0(%edi),%edi

000001d0 <stat>:
 1d0:	55                   	push   %ebp
 1d1:	31 c0                	xor    %eax,%eax
 1d3:	89 e5                	mov    %esp,%ebp
 1d5:	83 ec 18             	sub    $0x18,%esp
 1d8:	89 44 24 04          	mov    %eax,0x4(%esp)
 1dc:	8b 45 08             	mov    0x8(%ebp),%eax
 1df:	89 5d f8             	mov    %ebx,0xfffffff8(%ebp)
 1e2:	89 75 fc             	mov    %esi,0xfffffffc(%ebp)
 1e5:	be ff ff ff ff       	mov    $0xffffffff,%esi
 1ea:	89 04 24             	mov    %eax,(%esp)
 1ed:	e8 ea 00 00 00       	call   2dc <open>
 1f2:	85 c0                	test   %eax,%eax
 1f4:	89 c3                	mov    %eax,%ebx
 1f6:	78 19                	js     211 <stat+0x41>
 1f8:	8b 45 0c             	mov    0xc(%ebp),%eax
 1fb:	89 1c 24             	mov    %ebx,(%esp)
 1fe:	89 44 24 04          	mov    %eax,0x4(%esp)
 202:	e8 ed 00 00 00       	call   2f4 <fstat>
 207:	89 1c 24             	mov    %ebx,(%esp)
 20a:	89 c6                	mov    %eax,%esi
 20c:	e8 b3 00 00 00       	call   2c4 <close>
 211:	89 f0                	mov    %esi,%eax
 213:	8b 5d f8             	mov    0xfffffff8(%ebp),%ebx
 216:	8b 75 fc             	mov    0xfffffffc(%ebp),%esi
 219:	89 ec                	mov    %ebp,%esp
 21b:	5d                   	pop    %ebp
 21c:	c3                   	ret    
 21d:	8d 76 00             	lea    0x0(%esi),%esi

00000220 <gets>:
 220:	55                   	push   %ebp
 221:	89 e5                	mov    %esp,%ebp
 223:	57                   	push   %edi
 224:	56                   	push   %esi
 225:	31 f6                	xor    %esi,%esi
 227:	53                   	push   %ebx
 228:	83 ec 1c             	sub    $0x1c,%esp
 22b:	8d 5e 01             	lea    0x1(%esi),%ebx
 22e:	8b 7d 08             	mov    0x8(%ebp),%edi
 231:	3b 5d 0c             	cmp    0xc(%ebp),%ebx
 234:	7d 3e                	jge    274 <gets+0x54>
 236:	ba 01 00 00 00       	mov    $0x1,%edx
 23b:	8d 45 f3             	lea    0xfffffff3(%ebp),%eax
 23e:	89 54 24 08          	mov    %edx,0x8(%esp)
 242:	89 44 24 04          	mov    %eax,0x4(%esp)
 246:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
 24d:	e8 62 00 00 00       	call   2b4 <read>
 252:	85 c0                	test   %eax,%eax
 254:	7e 1e                	jle    274 <gets+0x54>
 256:	0f b6 45 f3          	movzbl 0xfffffff3(%ebp),%eax
 25a:	88 44 3b ff          	mov    %al,0xffffffff(%ebx,%edi,1)
 25e:	0f b6 45 f3          	movzbl 0xfffffff3(%ebp),%eax
 262:	3c 0a                	cmp    $0xa,%al
 264:	74 1c                	je     282 <gets+0x62>
 266:	3c 0d                	cmp    $0xd,%al
 268:	74 18                	je     282 <gets+0x62>
 26a:	89 de                	mov    %ebx,%esi
 26c:	8d 5e 01             	lea    0x1(%esi),%ebx
 26f:	3b 5d 0c             	cmp    0xc(%ebp),%ebx
 272:	7c c2                	jl     236 <gets+0x16>
 274:	c6 04 3e 00          	movb   $0x0,(%esi,%edi,1)
 278:	83 c4 1c             	add    $0x1c,%esp
 27b:	89 f8                	mov    %edi,%eax
 27d:	5b                   	pop    %ebx
 27e:	5e                   	pop    %esi
 27f:	5f                   	pop    %edi
 280:	5d                   	pop    %ebp
 281:	c3                   	ret    
 282:	89 de                	mov    %ebx,%esi
 284:	89 f8                	mov    %edi,%eax
 286:	c6 04 3e 00          	movb   $0x0,(%esi,%edi,1)
 28a:	83 c4 1c             	add    $0x1c,%esp
 28d:	5b                   	pop    %ebx
 28e:	5e                   	pop    %esi
 28f:	5f                   	pop    %edi
 290:	5d                   	pop    %ebp
 291:	c3                   	ret    
 292:	90                   	nop    
 293:	90                   	nop    

00000294 <fork>:
 294:	b8 01 00 00 00       	mov    $0x1,%eax
 299:	cd 30                	int    $0x30
 29b:	c3                   	ret    

0000029c <exit>:
 29c:	b8 02 00 00 00       	mov    $0x2,%eax
 2a1:	cd 30                	int    $0x30
 2a3:	c3                   	ret    

000002a4 <wait>:
 2a4:	b8 03 00 00 00       	mov    $0x3,%eax
 2a9:	cd 30                	int    $0x30
 2ab:	c3                   	ret    

000002ac <pipe>:
 2ac:	b8 04 00 00 00       	mov    $0x4,%eax
 2b1:	cd 30                	int    $0x30
 2b3:	c3                   	ret    

000002b4 <read>:
 2b4:	b8 06 00 00 00       	mov    $0x6,%eax
 2b9:	cd 30                	int    $0x30
 2bb:	c3                   	ret    

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

000002c4 <close>:
 2c4:	b8 07 00 00 00       	mov    $0x7,%eax
 2c9:	cd 30                	int    $0x30
 2cb:	c3                   	ret    

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

000002d4 <exec>:
 2d4:	b8 09 00 00 00       	mov    $0x9,%eax
 2d9:	cd 30                	int    $0x30
 2db:	c3                   	ret    

000002dc <open>:
 2dc:	b8 0a 00 00 00       	mov    $0xa,%eax
 2e1:	cd 30                	int    $0x30
 2e3:	c3                   	ret    

000002e4 <mknod>:
 2e4:	b8 0b 00 00 00       	mov    $0xb,%eax
 2e9:	cd 30                	int    $0x30
 2eb:	c3                   	ret    

000002ec <unlink>:
 2ec:	b8 0c 00 00 00       	mov    $0xc,%eax
 2f1:	cd 30                	int    $0x30
 2f3:	c3                   	ret    

000002f4 <fstat>:
 2f4:	b8 0d 00 00 00       	mov    $0xd,%eax
 2f9:	cd 30                	int    $0x30
 2fb:	c3                   	ret    

000002fc <link>:
 2fc:	b8 0e 00 00 00       	mov    $0xe,%eax
 301:	cd 30                	int    $0x30
 303:	c3                   	ret    

00000304 <mkdir>:
 304:	b8 0f 00 00 00       	mov    $0xf,%eax
 309:	cd 30                	int    $0x30
 30b:	c3                   	ret    

0000030c <chdir>:
 30c:	b8 10 00 00 00       	mov    $0x10,%eax
 311:	cd 30                	int    $0x30
 313:	c3                   	ret    

00000314 <dup>:
 314:	b8 11 00 00 00       	mov    $0x11,%eax
 319:	cd 30                	int    $0x30
 31b:	c3                   	ret    

0000031c <getpid>:
 31c:	b8 12 00 00 00       	mov    $0x12,%eax
 321:	cd 30                	int    $0x30
 323:	c3                   	ret    

00000324 <sbrk>:
 324:	b8 13 00 00 00       	mov    $0x13,%eax
 329:	cd 30                	int    $0x30
 32b:	c3                   	ret    

0000032c <sleep>:
 32c:	b8 14 00 00 00       	mov    $0x14,%eax
 331:	cd 30                	int    $0x30
 333:	c3                   	ret    
 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 <putc>:
#include "user.h"

static void
putc(int fd, char c)
{
 340:	55                   	push   %ebp
 341:	89 e5                	mov    %esp,%ebp
 343:	83 ec 18             	sub    $0x18,%esp
 346:	88 55 fc             	mov    %dl,0xfffffffc(%ebp)
  write(fd, &c, 1);
 349:	ba 01 00 00 00       	mov    $0x1,%edx
 34e:	89 54 24 08          	mov    %edx,0x8(%esp)
 352:	8d 55 fc             	lea    0xfffffffc(%ebp),%edx
 355:	89 54 24 04          	mov    %edx,0x4(%esp)
 359:	89 04 24             	mov    %eax,(%esp)
 35c:	e8 5b ff ff ff       	call   2bc <write>
}
 361:	c9                   	leave  
 362:	c3                   	ret    
 363:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
 369:	8d bc 27 00 00 00 00 	lea    0x0(%edi),%edi

00000370 <printint>:

static void
printint(int fd, int xx, int base, int sgn)
{
 370:	55                   	push   %ebp
 371:	89 e5                	mov    %esp,%ebp
 373:	57                   	push   %edi
 374:	56                   	push   %esi
 375:	89 ce                	mov    %ecx,%esi
 377:	53                   	push   %ebx
 378:	83 ec 1c             	sub    $0x1c,%esp
  static char digits[] = "0123456789ABCDEF";
  char buf[16];
  int i, neg;
  uint x;

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

  i = 0;
  do{
    buf[i++] = digits[x % base];
 3a0:	31 d2                	xor    %edx,%edx
 3a2:	f7 f6                	div    %esi
 3a4:	89 c1                	mov    %eax,%ecx
 3a6:	0f b6 82 24 07 00 00 	movzbl 0x724(%edx),%eax
 3ad:	88 04 3b             	mov    %al,(%ebx,%edi,1)
 3b0:	43                   	inc    %ebx
  }while((x /= base) != 0);
 3b1:	85 c9                	test   %ecx,%ecx
 3b3:	89 c8                	mov    %ecx,%eax
 3b5:	75 e9                	jne    3a0 <printint+0x30>
  if(neg)
 3b7:	8b 4d e0             	mov    0xffffffe0(%ebp),%ecx
 3ba:	85 c9                	test   %ecx,%ecx
 3bc:	74 06                	je     3c4 <printint+0x54>
    buf[i++] = '-';
 3be:	c6 44 1d e4 2d       	movb   $0x2d,0xffffffe4(%ebp,%ebx,1)
 3c3:	43                   	inc    %ebx

  while(--i >= 0)
 3c4:	4b                   	dec    %ebx
 3c5:	78 1c                	js     3e3 <printint+0x73>
 3c7:	89 f6                	mov    %esi,%esi
 3c9:	8d bc 27 00 00 00 00 	lea    0x0(%edi),%edi
    putc(fd, buf[i]);
 3d0:	0f be 54 1d e4       	movsbl 0xffffffe4(%ebp,%ebx,1),%edx
 3d5:	4b                   	dec    %ebx
 3d6:	8b 45 dc             	mov    0xffffffdc(%ebp),%eax
 3d9:	e8 62 ff ff ff       	call   340 <putc>
 3de:	83 fb ff             	cmp    $0xffffffff,%ebx
 3e1:	75 ed                	jne    3d0 <printint+0x60>
}
 3e3:	83 c4 1c             	add    $0x1c,%esp
 3e6:	5b                   	pop    %ebx
 3e7:	5e                   	pop    %esi
 3e8:	5f                   	pop    %edi
 3e9:	5d                   	pop    %ebp
 3ea:	c3                   	ret    
 3eb:	89 d0                	mov    %edx,%eax
 3ed:	f7 d8                	neg    %eax
 3ef:	c7 45 e0 01 00 00 00 	movl   $0x1,0xffffffe0(%ebp)
 3f6:	eb 9a                	jmp    392 <printint+0x22>
 3f8:	90                   	nop    
 3f9:	8d b4 26 00 00 00 00 	lea    0x0(%esi),%esi

00000400 <printf>:

// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
 400:	55                   	push   %ebp
 401:	89 e5                	mov    %esp,%ebp
 403:	57                   	push   %edi
 404:	56                   	push   %esi
 405:	53                   	push   %ebx
 406:	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++){
 409:	8b 55 0c             	mov    0xc(%ebp),%edx
 40c:	0f b6 02             	movzbl (%edx),%eax
 40f:	84 c0                	test   %al,%al
 411:	0f 84 99 00 00 00    	je     4b0 <printf+0xb0>
 417:	8d 4d 10             	lea    0x10(%ebp),%ecx
 41a:	31 ff                	xor    %edi,%edi
 41c:	31 f6                	xor    %esi,%esi
 41e:	89 4d f0             	mov    %ecx,0xfffffff0(%ebp)
 421:	eb 26                	jmp    449 <printf+0x49>
    c = fmt[i] & 0xff;
    if(state == 0){
      if(c == '%'){
 423:	83 fb 25             	cmp    $0x25,%ebx
 426:	0f 85 8c 00 00 00    	jne    4b8 <printf+0xb8>
 42c:	be 25 00 00 00       	mov    $0x25,%esi
 431:	eb 0d                	jmp    440 <printf+0x40>
 433:	90                   	nop    
 434:	90                   	nop    
 435:	90                   	nop    
 436:	90                   	nop    
 437:	90                   	nop    
 438:	90                   	nop    
 439:	90                   	nop    
 43a:	90                   	nop    
 43b:	90                   	nop    
 43c:	90                   	nop    
 43d:	90                   	nop    
 43e:	90                   	nop    
 43f:	90                   	nop    
 440:	47                   	inc    %edi
 441:	0f b6 04 3a          	movzbl (%edx,%edi,1),%eax
 445:	84 c0                	test   %al,%al
 447:	74 67                	je     4b0 <printf+0xb0>
 449:	85 f6                	test   %esi,%esi
 44b:	0f b6 d8             	movzbl %al,%ebx
 44e:	74 d3                	je     423 <printf+0x23>
        state = '%';
      } else {
        putc(fd, c);
      }
    } else if(state == '%'){
 450:	83 fe 25             	cmp    $0x25,%esi
 453:	75 eb                	jne    440 <printf+0x40>
      if(c == 'd'){
 455:	83 fb 64             	cmp    $0x64,%ebx
 458:	0f 84 e0 00 00 00    	je     53e <printf+0x13e>
        printint(fd, *ap, 10, 1);
        ap++;
      } else if(c == 'x' || c == 'p'){
 45e:	83 fb 78             	cmp    $0x78,%ebx
 461:	74 68                	je     4cb <printf+0xcb>
 463:	83 fb 70             	cmp    $0x70,%ebx
 466:	74 63                	je     4cb <printf+0xcb>
        printint(fd, *ap, 16, 0);
        ap++;
      } else if(c == 's'){
 468:	83 fb 73             	cmp    $0x73,%ebx
 46b:	90                   	nop    
 46c:	8d 74 26 00          	lea    0x0(%esi),%esi
 470:	0f 84 7c 00 00 00    	je     4f2 <printf+0xf2>
        s = (char*)*ap;
        ap++;
        if(s == 0)
          s = "(null)";
        while(*s != 0){
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
 476:	83 fb 63             	cmp    $0x63,%ebx
 479:	0f 84 e4 00 00 00    	je     563 <printf+0x163>
        putc(fd, *ap);
        ap++;
      } else if(c == '%'){
 47f:	83 fb 25             	cmp    $0x25,%ebx
 482:	0f 84 c4 00 00 00    	je     54c <printf+0x14c>
        putc(fd, c);
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
 488:	8b 45 08             	mov    0x8(%ebp),%eax
 48b:	ba 25 00 00 00       	mov    $0x25,%edx
 490:	47                   	inc    %edi
        putc(fd, c);
 491:	31 f6                	xor    %esi,%esi
 493:	e8 a8 fe ff ff       	call   340 <putc>
 498:	8b 45 08             	mov    0x8(%ebp),%eax
 49b:	0f be d3             	movsbl %bl,%edx
 49e:	e8 9d fe ff ff       	call   340 <putc>
 4a3:	8b 55 0c             	mov    0xc(%ebp),%edx
 4a6:	0f b6 04 3a          	movzbl (%edx,%edi,1),%eax
 4aa:	84 c0                	test   %al,%al
 4ac:	75 9b                	jne    449 <printf+0x49>
 4ae:	89 f6                	mov    %esi,%esi
      }
      state = 0;
    }
  }
}
 4b0:	83 c4 0c             	add    $0xc,%esp
 4b3:	5b                   	pop    %ebx
 4b4:	5e                   	pop    %esi
 4b5:	5f                   	pop    %edi
 4b6:	5d                   	pop    %ebp
 4b7:	c3                   	ret    
 4b8:	8b 45 08             	mov    0x8(%ebp),%eax
 4bb:	0f be d3             	movsbl %bl,%edx
 4be:	e8 7d fe ff ff       	call   340 <putc>
 4c3:	8b 55 0c             	mov    0xc(%ebp),%edx
 4c6:	e9 75 ff ff ff       	jmp    440 <printf+0x40>
 4cb:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
 4d2:	b9 10 00 00 00       	mov    $0x10,%ecx
 4d7:	8b 45 f0             	mov    0xfffffff0(%ebp),%eax
 4da:	31 f6                	xor    %esi,%esi
 4dc:	8b 10                	mov    (%eax),%edx
 4de:	8b 45 08             	mov    0x8(%ebp),%eax
 4e1:	e8 8a fe ff ff       	call   370 <printint>
 4e6:	8b 55 0c             	mov    0xc(%ebp),%edx
 4e9:	83 45 f0 04          	addl   $0x4,0xfffffff0(%ebp)
 4ed:	e9 4e ff ff ff       	jmp    440 <printf+0x40>
 4f2:	8b 4d f0             	mov    0xfffffff0(%ebp),%ecx
 4f5:	8b 01                	mov    (%ecx),%eax
 4f7:	83 c1 04             	add    $0x4,%ecx
 4fa:	89 4d f0             	mov    %ecx,0xfffffff0(%ebp)
 4fd:	b9 1d 07 00 00       	mov    $0x71d,%ecx
 502:	85 c0                	test   %eax,%eax
 504:	74 02                	je     508 <printf+0x108>
 506:	89 c1                	mov    %eax,%ecx
 508:	0f b6 01             	movzbl (%ecx),%eax
 50b:	84 c0                	test   %al,%al
 50d:	74 28                	je     537 <printf+0x137>
 50f:	89 cb                	mov    %ecx,%ebx
 511:	eb 0d                	jmp    520 <printf+0x120>
 513:	90                   	nop    
 514:	90                   	nop    
 515:	90                   	nop    
 516:	90                   	nop    
 517:	90                   	nop    
 518:	90                   	nop    
 519:	90                   	nop    
 51a:	90                   	nop    
 51b:	90                   	nop    
 51c:	90                   	nop    
 51d:	90                   	nop    
 51e:	90                   	nop    
 51f:	90                   	nop    
 520:	0f be d0             	movsbl %al,%edx
 523:	8b 45 08             	mov    0x8(%ebp),%eax
 526:	e8 15 fe ff ff       	call   340 <putc>
 52b:	0f b6 43 01          	movzbl 0x1(%ebx),%eax
 52f:	43                   	inc    %ebx
 530:	84 c0                	test   %al,%al
 532:	75 ec                	jne    520 <printf+0x120>
 534:	8b 55 0c             	mov    0xc(%ebp),%edx
 537:	31 f6                	xor    %esi,%esi
 539:	e9 02 ff ff ff       	jmp    440 <printf+0x40>
 53e:	b9 0a 00 00 00       	mov    $0xa,%ecx
 543:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
 54a:	eb 8b                	jmp    4d7 <printf+0xd7>
 54c:	8b 45 08             	mov    0x8(%ebp),%eax
 54f:	ba 25 00 00 00       	mov    $0x25,%edx
 554:	31 f6                	xor    %esi,%esi
 556:	e8 e5 fd ff ff       	call   340 <putc>
 55b:	8b 55 0c             	mov    0xc(%ebp),%edx
 55e:	e9 dd fe ff ff       	jmp    440 <printf+0x40>
 563:	8b 45 f0             	mov    0xfffffff0(%ebp),%eax
 566:	31 f6                	xor    %esi,%esi
 568:	0f be 10             	movsbl (%eax),%edx
 56b:	8b 45 08             	mov    0x8(%ebp),%eax
 56e:	e8 cd fd ff ff       	call   340 <putc>
 573:	8b 55 0c             	mov    0xc(%ebp),%edx
 576:	83 45 f0 04          	addl   $0x4,0xfffffff0(%ebp)
 57a:	e9 c1 fe ff ff       	jmp    440 <printf+0x40>
 57f:	90                   	nop    

00000580 <free>:
static Header *freep;

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

  bp = (Header*) ap - 1;
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
 581:	8b 0d 40 07 00 00    	mov    0x740,%ecx
 587:	89 e5                	mov    %esp,%ebp
 589:	56                   	push   %esi
 58a:	53                   	push   %ebx
 58b:	8b 5d 08             	mov    0x8(%ebp),%ebx
 58e:	83 eb 08             	sub    $0x8,%ebx
 591:	eb 0d                	jmp    5a0 <free+0x20>
 593:	90                   	nop    
 594:	90                   	nop    
 595:	90                   	nop    
 596:	90                   	nop    
 597:	90                   	nop    
 598:	90                   	nop    
 599:	90                   	nop    
 59a:	90                   	nop    
 59b:	90                   	nop    
 59c:	90                   	nop    
 59d:	90                   	nop    
 59e:	90                   	nop    
 59f:	90                   	nop    
 5a0:	39 d9                	cmp    %ebx,%ecx
 5a2:	73 04                	jae    5a8 <free+0x28>
 5a4:	3b 19                	cmp    (%ecx),%ebx
 5a6:	72 12                	jb     5ba <free+0x3a>
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
 5a8:	8b 11                	mov    (%ecx),%edx
 5aa:	39 d1                	cmp    %edx,%ecx
 5ac:	72 08                	jb     5b6 <free+0x36>
 5ae:	39 d9                	cmp    %ebx,%ecx
 5b0:	72 0a                	jb     5bc <free+0x3c>
 5b2:	39 d3                	cmp    %edx,%ebx
 5b4:	72 06                	jb     5bc <free+0x3c>
 5b6:	89 d1                	mov    %edx,%ecx
 5b8:	eb e6                	jmp    5a0 <free+0x20>
 5ba:	8b 11                	mov    (%ecx),%edx
      break;
  if(bp + bp->s.size == p->s.ptr){
 5bc:	8b 73 04             	mov    0x4(%ebx),%esi
 5bf:	8d 04 f3             	lea    (%ebx,%esi,8),%eax
 5c2:	39 d0                	cmp    %edx,%eax
 5c4:	74 2e                	je     5f4 <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;
 5c6:	89 13                	mov    %edx,(%ebx)
  if(p + p->s.size == bp){
 5c8:	8b 51 04             	mov    0x4(%ecx),%edx
 5cb:	8d 04 d1             	lea    (%ecx,%edx,8),%eax
 5ce:	39 c3                	cmp    %eax,%ebx
 5d0:	74 0c                	je     5de <free+0x5e>
    p->s.size += bp->s.size;
    p->s.ptr = bp->s.ptr;
  } else
    p->s.ptr = bp;
 5d2:	89 19                	mov    %ebx,(%ecx)
  freep = p;
}
 5d4:	5b                   	pop    %ebx
 5d5:	89 0d 40 07 00 00    	mov    %ecx,0x740
 5db:	5e                   	pop    %esi
 5dc:	5d                   	pop    %ebp
 5dd:	c3                   	ret    
 5de:	8b 43 04             	mov    0x4(%ebx),%eax
 5e1:	01 c2                	add    %eax,%edx
 5e3:	8b 03                	mov    (%ebx),%eax
 5e5:	89 51 04             	mov    %edx,0x4(%ecx)
 5e8:	89 01                	mov    %eax,(%ecx)
 5ea:	5b                   	pop    %ebx
 5eb:	89 0d 40 07 00 00    	mov    %ecx,0x740
 5f1:	5e                   	pop    %esi
 5f2:	5d                   	pop    %ebp
 5f3:	c3                   	ret    
 5f4:	8b 42 04             	mov    0x4(%edx),%eax
 5f7:	01 c6                	add    %eax,%esi
 5f9:	8b 02                	mov    (%edx),%eax
 5fb:	89 73 04             	mov    %esi,0x4(%ebx)
 5fe:	89 03                	mov    %eax,(%ebx)
 600:	eb c6                	jmp    5c8 <free+0x48>
 602:	8d b4 26 00 00 00 00 	lea    0x0(%esi),%esi
 609:	8d bc 27 00 00 00 00 	lea    0x0(%edi),%edi

00000610 <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)
{
 610:	55                   	push   %ebp
 611:	89 e5                	mov    %esp,%ebp
 613:	57                   	push   %edi
 614:	56                   	push   %esi
 615:	53                   	push   %ebx
 616:	83 ec 0c             	sub    $0xc,%esp
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
 619:	8b 45 08             	mov    0x8(%ebp),%eax
  if((prevp = freep) == 0){
 61c:	8b 15 40 07 00 00    	mov    0x740,%edx
 622:	83 c0 07             	add    $0x7,%eax
 625:	c1 e8 03             	shr    $0x3,%eax
 628:	85 d2                	test   %edx,%edx
 62a:	8d 58 01             	lea    0x1(%eax),%ebx
 62d:	0f 84 92 00 00 00    	je     6c5 <malloc+0xb5>
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
 633:	8b 0a                	mov    (%edx),%ecx
    if(p->s.size >= nunits){
 635:	8b 41 04             	mov    0x4(%ecx),%eax
 638:	39 c3                	cmp    %eax,%ebx
 63a:	76 63                	jbe    69f <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);
 63c:	8d 3c dd 00 00 00 00 	lea    0x0(,%ebx,8),%edi
 643:	eb 09                	jmp    64e <malloc+0x3e>
 645:	8b 0a                	mov    (%edx),%ecx
 647:	8b 41 04             	mov    0x4(%ecx),%eax
 64a:	39 c3                	cmp    %eax,%ebx
 64c:	76 51                	jbe    69f <malloc+0x8f>
    }
    if(p == freep)
 64e:	39 0d 40 07 00 00    	cmp    %ecx,0x740
 654:	89 ca                	mov    %ecx,%edx
 656:	75 ed                	jne    645 <malloc+0x35>
 658:	81 fb ff 0f 00 00    	cmp    $0xfff,%ebx
 65e:	77 39                	ja     699 <malloc+0x89>
 660:	be 00 10 00 00       	mov    $0x1000,%esi
 665:	b8 00 80 00 00       	mov    $0x8000,%eax
 66a:	89 04 24             	mov    %eax,(%esp)
 66d:	e8 b2 fc ff ff       	call   324 <sbrk>
 672:	83 f8 ff             	cmp    $0xffffffff,%eax
 675:	74 18                	je     68f <malloc+0x7f>
 677:	89 70 04             	mov    %esi,0x4(%eax)
 67a:	83 c0 08             	add    $0x8,%eax
 67d:	89 04 24             	mov    %eax,(%esp)
 680:	e8 fb fe ff ff       	call   580 <free>
 685:	8b 15 40 07 00 00    	mov    0x740,%edx
      if((p = morecore(nunits)) == 0)
 68b:	85 d2                	test   %edx,%edx
 68d:	75 b6                	jne    645 <malloc+0x35>
        return 0;
  }
}
 68f:	83 c4 0c             	add    $0xc,%esp
 692:	31 c0                	xor    %eax,%eax
 694:	5b                   	pop    %ebx
 695:	5e                   	pop    %esi
 696:	5f                   	pop    %edi
 697:	5d                   	pop    %ebp
 698:	c3                   	ret    
 699:	89 de                	mov    %ebx,%esi
 69b:	89 f8                	mov    %edi,%eax
 69d:	eb cb                	jmp    66a <malloc+0x5a>
 69f:	39 c3                	cmp    %eax,%ebx
 6a1:	74 1c                	je     6bf <malloc+0xaf>
 6a3:	29 d8                	sub    %ebx,%eax
 6a5:	89 41 04             	mov    %eax,0x4(%ecx)
 6a8:	8d 0c c1             	lea    (%ecx,%eax,8),%ecx
 6ab:	89 59 04             	mov    %ebx,0x4(%ecx)
 6ae:	89 15 40 07 00 00    	mov    %edx,0x740
 6b4:	83 c4 0c             	add    $0xc,%esp
 6b7:	5b                   	pop    %ebx
 6b8:	8d 41 08             	lea    0x8(%ecx),%eax
 6bb:	5e                   	pop    %esi
 6bc:	5f                   	pop    %edi
 6bd:	5d                   	pop    %ebp
 6be:	c3                   	ret    
 6bf:	8b 01                	mov    (%ecx),%eax
 6c1:	89 02                	mov    %eax,(%edx)
 6c3:	eb e9                	jmp    6ae <malloc+0x9e>
 6c5:	b8 38 07 00 00       	mov    $0x738,%eax
 6ca:	ba 38 07 00 00       	mov    $0x738,%edx
 6cf:	a3 40 07 00 00       	mov    %eax,0x740
 6d4:	b8 38 07 00 00       	mov    $0x738,%eax
 6d9:	a3 38 07 00 00       	mov    %eax,0x738
 6de:	31 c0                	xor    %eax,%eax
 6e0:	a3 3c 07 00 00       	mov    %eax,0x73c
 6e5:	e9 49 ff ff ff       	jmp    633 <malloc+0x23>
