
_maze:     file format elf32-i386


Disassembly of section .text:

00000000 <main>:

    int range = end - start + 1;
    return (rngnumber() + seed) % (range) + start;
}

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             	push   -0x4(%ecx)
   a:	55                   	push   %ebp
   b:	89 e5                	mov    %esp,%ebp
   d:	57                   	push   %edi
   e:	56                   	push   %esi
   f:	53                   	push   %ebx
  10:	51                   	push   %ecx
  11:	83 ec 08             	sub    $0x8,%esp
  14:	8b 39                	mov    (%ecx),%edi
  16:	8b 71 04             	mov    0x4(%ecx),%esi
    int lines = 1000;    
    int seed = getpid();
  19:	e8 5d 04 00 00       	call   47b <getpid>
        
    for (int i = 1; i < argc; i++) {
  1e:	83 ff 01             	cmp    $0x1,%edi
  21:	7e 6f                	jle    92 <main+0x92>
  23:	bb 01 00 00 00       	mov    $0x1,%ebx
  28:	eb 3b                	jmp    65 <main+0x65>
  2a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
        if (strcmp(argv[i],  "-l") == 0) 
        {
            lines = atoi(argv[i + 1]);            
        }
        else if (strcmp(argv[i], "-s") == 0) 
  30:	83 ec 08             	sub    $0x8,%esp
  33:	68 db 08 00 00       	push   $0x8db
  38:	ff 34 9e             	push   (%esi,%ebx,4)
  3b:	e8 d0 01 00 00       	call   210 <strcmp>
  40:	83 c4 10             	add    $0x10,%esp
  43:	85 c0                	test   %eax,%eax
  45:	74 35                	je     7c <main+0x7c>
        {
            seed = atoi(argv[i + 1]);
        }
        else if (strcmp(argv[i],  "-help") == 0)
  47:	83 ec 08             	sub    $0x8,%esp
  4a:	68 de 08 00 00       	push   $0x8de
  4f:	ff 34 9e             	push   (%esi,%ebx,4)
  52:	e8 b9 01 00 00       	call   210 <strcmp>
  57:	83 c4 10             	add    $0x10,%esp
  5a:	85 c0                	test   %eax,%eax
  5c:	74 69                	je     c7 <main+0xc7>
    for (int i = 1; i < argc; i++) {
  5e:	83 c3 01             	add    $0x1,%ebx
  61:	39 df                	cmp    %ebx,%edi
  63:	74 2d                	je     92 <main+0x92>
        if (strcmp(argv[i],  "-l") == 0) 
  65:	83 ec 08             	sub    $0x8,%esp
  68:	68 d8 08 00 00       	push   $0x8d8
  6d:	ff 34 9e             	push   (%esi,%ebx,4)
  70:	e8 9b 01 00 00       	call   210 <strcmp>
  75:	83 c4 10             	add    $0x10,%esp
  78:	85 c0                	test   %eax,%eax
  7a:	75 b4                	jne    30 <main+0x30>
            seed = atoi(argv[i + 1]);
  7c:	83 ec 0c             	sub    $0xc,%esp
  7f:	ff 74 9e 04          	push   0x4(%esi,%ebx,4)
    for (int i = 1; i < argc; i++) {
  83:	83 c3 01             	add    $0x1,%ebx
            seed = atoi(argv[i + 1]);
  86:	e8 35 03 00 00       	call   3c0 <atoi>
  8b:	83 c4 10             	add    $0x10,%esp
    for (int i = 1; i < argc; i++) {
  8e:	39 df                	cmp    %ebx,%edi
  90:	75 d3                	jne    65 <main+0x65>
            exit();
            return 0;
        }
    }
    
    cls();
  92:	e8 5c 04 00 00       	call   4f3 <cls>
    
    printf(1, "Start Maze (DISABLED)\n");
  97:	83 ec 08             	sub    $0x8,%esp
  9a:	68 ee 08 00 00       	push   $0x8ee
  9f:	6a 01                	push   $0x1
  a1:	e8 0a 05 00 00       	call   5b0 <printf>
    printf(1, "This does not work on the azure servers, but it would generate a random x lines of characters to look like a maze, similar to the old c64 basic program.\n");
  a6:	58                   	pop    %eax
  a7:	5a                   	pop    %edx
  a8:	68 ac 09 00 00       	push   $0x9ac
  ad:	6a 01                	push   $0x1
  af:	e8 fc 04 00 00       	call   5b0 <printf>
    printf(1, "I could have used the slashes but they look aweful in this font so use the count app instead.\n\n");
  b4:	59                   	pop    %ecx
  b5:	5b                   	pop    %ebx
  b6:	68 48 0a 00 00       	push   $0xa48
  bb:	6a 01                	push   $0x1
  bd:	e8 ee 04 00 00       	call   5b0 <printf>
    exit();
  c2:	e8 6c 03 00 00       	call   433 <exit>
            printf(1, "Generates X lines of random maze.\n");
  c7:	56                   	push   %esi
  c8:	56                   	push   %esi
  c9:	68 08 09 00 00       	push   $0x908
  ce:	6a 01                	push   $0x1
  d0:	e8 db 04 00 00       	call   5b0 <printf>
            printf(1, "Options:\n");
  d5:	5f                   	pop    %edi
  d6:	58                   	pop    %eax
  d7:	68 e4 08 00 00       	push   $0x8e4
  dc:	6a 01                	push   $0x1
  de:	e8 cd 04 00 00       	call   5b0 <printf>
            printf(1, "-l [Number] : Sets number of lines to generate for the maze.\n");
  e3:	58                   	pop    %eax
  e4:	5a                   	pop    %edx
  e5:	68 2c 09 00 00       	push   $0x92c
  ea:	6a 01                	push   $0x1
  ec:	e8 bf 04 00 00       	call   5b0 <printf>
            printf(1, "-s [Number] : Sets the current seed for the random function.\n");
  f1:	59                   	pop    %ecx
  f2:	5b                   	pop    %ebx
  f3:	68 6c 09 00 00       	push   $0x96c
  f8:	6a 01                	push   $0x1
  fa:	e8 b1 04 00 00       	call   5b0 <printf>
            exit();
  ff:	e8 2f 03 00 00       	call   433 <exit>
 104:	66 90                	xchg   %ax,%ax
 106:	66 90                	xchg   %ax,%ax
 108:	66 90                	xchg   %ax,%ax
 10a:	66 90                	xchg   %ax,%ax
 10c:	66 90                	xchg   %ax,%ax
 10e:	66 90                	xchg   %ax,%ax

00000110 <rngnumber>:
  b  = ((z1 << 6) ^ z1) >> 13;
 110:	8b 0d 1c 0e 00 00    	mov    0xe1c,%ecx
  b  = ((z2 << 2) ^ z2) >> 27; 
 116:	a1 18 0e 00 00       	mov    0xe18,%eax
{
 11b:	55                   	push   %ebp
  b  = ((z1 << 6) ^ z1) >> 13;
 11c:	89 ca                	mov    %ecx,%edx
 11e:	c1 e2 06             	shl    $0x6,%edx
{
 121:	89 e5                	mov    %esp,%ebp
 123:	56                   	push   %esi
  b  = ((z4 << 3) ^ z4) >> 12;
 124:	8b 35 10 0e 00 00    	mov    0xe10,%esi
  b  = ((z1 << 6) ^ z1) >> 13;
 12a:	31 ca                	xor    %ecx,%edx
  z1 = ((z1 & 4294967294U) << 18) ^ b;
 12c:	c1 e1 12             	shl    $0x12,%ecx
{
 12f:	53                   	push   %ebx
  z1 = ((z1 & 4294967294U) << 18) ^ b;
 130:	81 e1 00 00 f8 ff    	and    $0xfff80000,%ecx
  b  = ((z1 << 6) ^ z1) >> 13;
 136:	c1 ea 0d             	shr    $0xd,%edx
  z1 = ((z1 & 4294967294U) << 18) ^ b;
 139:	31 ca                	xor    %ecx,%edx
  b  = ((z2 << 2) ^ z2) >> 27; 
 13b:	8d 0c 85 00 00 00 00 	lea    0x0(,%eax,4),%ecx
 142:	31 c8                	xor    %ecx,%eax
  z2 = ((z2 & 4294967288U) << 2) ^ b;
 144:	83 e1 e0             	and    $0xffffffe0,%ecx
  z1 = ((z1 & 4294967294U) << 18) ^ b;
 147:	89 15 1c 0e 00 00    	mov    %edx,0xe1c
  b  = ((z2 << 2) ^ z2) >> 27; 
 14d:	c1 e8 1b             	shr    $0x1b,%eax
  z2 = ((z2 & 4294967288U) << 2) ^ b;
 150:	31 c8                	xor    %ecx,%eax
  b  = ((z3 << 13) ^ z3) >> 21;
 152:	8b 0d 14 0e 00 00    	mov    0xe14,%ecx
  z2 = ((z2 & 4294967288U) << 2) ^ b;
 158:	a3 18 0e 00 00       	mov    %eax,0xe18
  return (z1 ^ z2 ^ z3 ^ z4) / 2;
 15d:	31 d0                	xor    %edx,%eax
  b  = ((z3 << 13) ^ z3) >> 21;
 15f:	89 cb                	mov    %ecx,%ebx
 161:	c1 e3 0d             	shl    $0xd,%ebx
 164:	31 cb                	xor    %ecx,%ebx
  z3 = ((z3 & 4294967280U) << 7) ^ b;
 166:	c1 e1 07             	shl    $0x7,%ecx
 169:	81 e1 00 f8 ff ff    	and    $0xfffff800,%ecx
  b  = ((z3 << 13) ^ z3) >> 21;
 16f:	c1 eb 15             	shr    $0x15,%ebx
  z3 = ((z3 & 4294967280U) << 7) ^ b;
 172:	31 cb                	xor    %ecx,%ebx
  b  = ((z4 << 3) ^ z4) >> 12;
 174:	8d 0c f5 00 00 00 00 	lea    0x0(,%esi,8),%ecx
 17b:	31 f1                	xor    %esi,%ecx
  z4 = ((z4 & 4294967168U) << 13) ^ b;
 17d:	c1 e6 0d             	shl    $0xd,%esi
  return (z1 ^ z2 ^ z3 ^ z4) / 2;
 180:	31 d8                	xor    %ebx,%eax
  z3 = ((z3 & 4294967280U) << 7) ^ b;
 182:	89 1d 14 0e 00 00    	mov    %ebx,0xe14
  z4 = ((z4 & 4294967168U) << 13) ^ b;
 188:	81 e6 00 00 f0 ff    	and    $0xfff00000,%esi
  b  = ((z4 << 3) ^ z4) >> 12;
 18e:	c1 e9 0c             	shr    $0xc,%ecx
}
 191:	5b                   	pop    %ebx
  z4 = ((z4 & 4294967168U) << 13) ^ b;
 192:	31 f1                	xor    %esi,%ecx
}
 194:	5e                   	pop    %esi
 195:	5d                   	pop    %ebp
  return (z1 ^ z2 ^ z3 ^ z4) / 2;
 196:	31 c8                	xor    %ecx,%eax
  z4 = ((z4 & 4294967168U) << 13) ^ b;
 198:	89 0d 10 0e 00 00    	mov    %ecx,0xe10
  return (z1 ^ z2 ^ z3 ^ z4) / 2;
 19e:	d1 e8                	shr    %eax
}
 1a0:	c3                   	ret    
 1a1:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 1a8:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 1af:	90                   	nop

000001b0 <rngrange>:
{
 1b0:	55                   	push   %ebp
 1b1:	89 e5                	mov    %esp,%ebp
 1b3:	56                   	push   %esi
 1b4:	8b 75 08             	mov    0x8(%ebp),%esi
 1b7:	53                   	push   %ebx
 1b8:	8b 5d 0c             	mov    0xc(%ebp),%ebx
    if (end < start)
 1bb:	39 f3                	cmp    %esi,%ebx
 1bd:	7d 06                	jge    1c5 <rngrange+0x15>
 1bf:	89 f0                	mov    %esi,%eax
 1c1:	89 de                	mov    %ebx,%esi
 1c3:	89 c3                	mov    %eax,%ebx
    return (rngnumber() + seed) % (range) + start;
 1c5:	e8 46 ff ff ff       	call   110 <rngnumber>
    int range = end - start + 1;
 1ca:	29 f3                	sub    %esi,%ebx
    return (rngnumber() + seed) % (range) + start;
 1cc:	03 45 10             	add    0x10(%ebp),%eax
 1cf:	31 d2                	xor    %edx,%edx
    int range = end - start + 1;
 1d1:	83 c3 01             	add    $0x1,%ebx
    return (rngnumber() + seed) % (range) + start;
 1d4:	f7 f3                	div    %ebx
}
 1d6:	5b                   	pop    %ebx
    return (rngnumber() + seed) % (range) + start;
 1d7:	8d 04 32             	lea    (%edx,%esi,1),%eax
}
 1da:	5e                   	pop    %esi
 1db:	5d                   	pop    %ebp
 1dc:	c3                   	ret    
 1dd:	66 90                	xchg   %ax,%ax
 1df:	90                   	nop

000001e0 <strcpy>:
#include "stat.h"
#include "fcntl.h"
#include "user.h"
#include "x86.h"

char*strcpy(char *s, const char *t) {
 1e0:	55                   	push   %ebp
    char *os;

    os = s;
    while ((*s++ = *t++) != 0) {
 1e1:	31 c0                	xor    %eax,%eax
char*strcpy(char *s, const char *t) {
 1e3:	89 e5                	mov    %esp,%ebp
 1e5:	53                   	push   %ebx
 1e6:	8b 4d 08             	mov    0x8(%ebp),%ecx
 1e9:	8b 5d 0c             	mov    0xc(%ebp),%ebx
 1ec:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    while ((*s++ = *t++) != 0) {
 1f0:	0f b6 14 03          	movzbl (%ebx,%eax,1),%edx
 1f4:	88 14 01             	mov    %dl,(%ecx,%eax,1)
 1f7:	83 c0 01             	add    $0x1,%eax
 1fa:	84 d2                	test   %dl,%dl
 1fc:	75 f2                	jne    1f0 <strcpy+0x10>
        ;
    }
    return os;
}
 1fe:	8b 5d fc             	mov    -0x4(%ebp),%ebx
 201:	89 c8                	mov    %ecx,%eax
 203:	c9                   	leave  
 204:	c3                   	ret    
 205:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 20c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi

00000210 <strcmp>:

int strcmp(const char *p, const char *q) {
 210:	55                   	push   %ebp
 211:	89 e5                	mov    %esp,%ebp
 213:	53                   	push   %ebx
 214:	8b 55 08             	mov    0x8(%ebp),%edx
 217:	8b 4d 0c             	mov    0xc(%ebp),%ecx
    while (*p && *p == *q) {
 21a:	0f b6 02             	movzbl (%edx),%eax
 21d:	84 c0                	test   %al,%al
 21f:	75 17                	jne    238 <strcmp+0x28>
 221:	eb 3a                	jmp    25d <strcmp+0x4d>
 223:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
 227:	90                   	nop
 228:	0f b6 42 01          	movzbl 0x1(%edx),%eax
        p++, q++;
 22c:	83 c2 01             	add    $0x1,%edx
 22f:	8d 59 01             	lea    0x1(%ecx),%ebx
    while (*p && *p == *q) {
 232:	84 c0                	test   %al,%al
 234:	74 1a                	je     250 <strcmp+0x40>
        p++, q++;
 236:	89 d9                	mov    %ebx,%ecx
    while (*p && *p == *q) {
 238:	0f b6 19             	movzbl (%ecx),%ebx
 23b:	38 c3                	cmp    %al,%bl
 23d:	74 e9                	je     228 <strcmp+0x18>
    }
    return (uchar) * p - (uchar) * q;
 23f:	29 d8                	sub    %ebx,%eax
}
 241:	8b 5d fc             	mov    -0x4(%ebp),%ebx
 244:	c9                   	leave  
 245:	c3                   	ret    
 246:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 24d:	8d 76 00             	lea    0x0(%esi),%esi
    return (uchar) * p - (uchar) * q;
 250:	0f b6 59 01          	movzbl 0x1(%ecx),%ebx
 254:	31 c0                	xor    %eax,%eax
 256:	29 d8                	sub    %ebx,%eax
}
 258:	8b 5d fc             	mov    -0x4(%ebp),%ebx
 25b:	c9                   	leave  
 25c:	c3                   	ret    
    return (uchar) * p - (uchar) * q;
 25d:	0f b6 19             	movzbl (%ecx),%ebx
 260:	31 c0                	xor    %eax,%eax
 262:	eb db                	jmp    23f <strcmp+0x2f>
 264:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 26b:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
 26f:	90                   	nop

00000270 <strlen>:

uint strlen(const char *s)      {
 270:	55                   	push   %ebp
 271:	89 e5                	mov    %esp,%ebp
 273:	8b 55 08             	mov    0x8(%ebp),%edx
    int n;

    for (n = 0; s[n]; n++) {
 276:	80 3a 00             	cmpb   $0x0,(%edx)
 279:	74 15                	je     290 <strlen+0x20>
 27b:	31 c0                	xor    %eax,%eax
 27d:	8d 76 00             	lea    0x0(%esi),%esi
 280:	83 c0 01             	add    $0x1,%eax
 283:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
 287:	89 c1                	mov    %eax,%ecx
 289:	75 f5                	jne    280 <strlen+0x10>
        ;
    }
    return n;
}
 28b:	89 c8                	mov    %ecx,%eax
 28d:	5d                   	pop    %ebp
 28e:	c3                   	ret    
 28f:	90                   	nop
    for (n = 0; s[n]; n++) {
 290:	31 c9                	xor    %ecx,%ecx
}
 292:	5d                   	pop    %ebp
 293:	89 c8                	mov    %ecx,%eax
 295:	c3                   	ret    
 296:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 29d:	8d 76 00             	lea    0x0(%esi),%esi

000002a0 <memset>:

void* memset(void *dst, int c, uint n) {
 2a0:	55                   	push   %ebp
 2a1:	89 e5                	mov    %esp,%ebp
 2a3:	57                   	push   %edi
 2a4:	8b 55 08             	mov    0x8(%ebp),%edx
                  "d" (port), "0" (addr), "1" (cnt) :
                  "cc");
}

static inline void stosb(void *addr, int data, int cnt)  {
    asm volatile ("cld; rep stosb" :
 2a7:	8b 4d 10             	mov    0x10(%ebp),%ecx
 2aa:	8b 45 0c             	mov    0xc(%ebp),%eax
 2ad:	89 d7                	mov    %edx,%edi
 2af:	fc                   	cld    
 2b0:	f3 aa                	rep stos %al,%es:(%edi)
    stosb(dst, c, n);
    return dst;
}
 2b2:	8b 7d fc             	mov    -0x4(%ebp),%edi
 2b5:	89 d0                	mov    %edx,%eax
 2b7:	c9                   	leave  
 2b8:	c3                   	ret    
 2b9:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi

000002c0 <strchr>:

char* strchr(const char *s, char c) {
 2c0:	55                   	push   %ebp
 2c1:	89 e5                	mov    %esp,%ebp
 2c3:	8b 45 08             	mov    0x8(%ebp),%eax
 2c6:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
    for (; *s; s++) {
 2ca:	0f b6 10             	movzbl (%eax),%edx
 2cd:	84 d2                	test   %dl,%dl
 2cf:	75 12                	jne    2e3 <strchr+0x23>
 2d1:	eb 1d                	jmp    2f0 <strchr+0x30>
 2d3:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
 2d7:	90                   	nop
 2d8:	0f b6 50 01          	movzbl 0x1(%eax),%edx
 2dc:	83 c0 01             	add    $0x1,%eax
 2df:	84 d2                	test   %dl,%dl
 2e1:	74 0d                	je     2f0 <strchr+0x30>
        if (*s == c) {
 2e3:	38 d1                	cmp    %dl,%cl
 2e5:	75 f1                	jne    2d8 <strchr+0x18>
            return (char*)s;
        }
    }
    return 0;
}
 2e7:	5d                   	pop    %ebp
 2e8:	c3                   	ret    
 2e9:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
    return 0;
 2f0:	31 c0                	xor    %eax,%eax
}
 2f2:	5d                   	pop    %ebp
 2f3:	c3                   	ret    
 2f4:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 2fb:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
 2ff:	90                   	nop

00000300 <gets>:

char* gets(char *buf, int max) {
 300:	55                   	push   %ebp
 301:	89 e5                	mov    %esp,%ebp
 303:	57                   	push   %edi
 304:	56                   	push   %esi
    int i, cc;
    char c;

    for (i = 0; i + 1 < max;) {
        cc = read(0, &c, 1);
 305:	8d 7d e7             	lea    -0x19(%ebp),%edi
char* gets(char *buf, int max) {
 308:	53                   	push   %ebx
    for (i = 0; i + 1 < max;) {
 309:	31 db                	xor    %ebx,%ebx
char* gets(char *buf, int max) {
 30b:	83 ec 1c             	sub    $0x1c,%esp
    for (i = 0; i + 1 < max;) {
 30e:	eb 27                	jmp    337 <gets+0x37>
        cc = read(0, &c, 1);
 310:	83 ec 04             	sub    $0x4,%esp
 313:	6a 01                	push   $0x1
 315:	57                   	push   %edi
 316:	6a 00                	push   $0x0
 318:	e8 2e 01 00 00       	call   44b <read>
        if (cc < 1) {
 31d:	83 c4 10             	add    $0x10,%esp
 320:	85 c0                	test   %eax,%eax
 322:	7e 1d                	jle    341 <gets+0x41>
            break;
        }
        buf[i++] = c;
 324:	0f b6 45 e7          	movzbl -0x19(%ebp),%eax
 328:	8b 55 08             	mov    0x8(%ebp),%edx
 32b:	88 44 1a ff          	mov    %al,-0x1(%edx,%ebx,1)
        if (c == '\n' || c == '\r') {
 32f:	3c 0a                	cmp    $0xa,%al
 331:	74 1d                	je     350 <gets+0x50>
 333:	3c 0d                	cmp    $0xd,%al
 335:	74 19                	je     350 <gets+0x50>
    for (i = 0; i + 1 < max;) {
 337:	89 de                	mov    %ebx,%esi
 339:	83 c3 01             	add    $0x1,%ebx
 33c:	3b 5d 0c             	cmp    0xc(%ebp),%ebx
 33f:	7c cf                	jl     310 <gets+0x10>
            break;
        }
    }
    buf[i] = '\0';
 341:	8b 45 08             	mov    0x8(%ebp),%eax
 344:	c6 04 30 00          	movb   $0x0,(%eax,%esi,1)
    return buf;
}
 348:	8d 65 f4             	lea    -0xc(%ebp),%esp
 34b:	5b                   	pop    %ebx
 34c:	5e                   	pop    %esi
 34d:	5f                   	pop    %edi
 34e:	5d                   	pop    %ebp
 34f:	c3                   	ret    
    buf[i] = '\0';
 350:	8b 45 08             	mov    0x8(%ebp),%eax
 353:	89 de                	mov    %ebx,%esi
 355:	c6 04 30 00          	movb   $0x0,(%eax,%esi,1)
}
 359:	8d 65 f4             	lea    -0xc(%ebp),%esp
 35c:	5b                   	pop    %ebx
 35d:	5e                   	pop    %esi
 35e:	5f                   	pop    %edi
 35f:	5d                   	pop    %ebp
 360:	c3                   	ret    
 361:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 368:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 36f:	90                   	nop

00000370 <stat>:

int stat(const char *n, struct stat *st) {
 370:	55                   	push   %ebp
 371:	89 e5                	mov    %esp,%ebp
 373:	56                   	push   %esi
 374:	53                   	push   %ebx
    int fd;
    int r;

    fd = open(n, O_RDONLY);
 375:	83 ec 08             	sub    $0x8,%esp
 378:	6a 00                	push   $0x0
 37a:	ff 75 08             	push   0x8(%ebp)
 37d:	e8 19 01 00 00       	call   49b <open>
    if (fd < 0) {
 382:	83 c4 10             	add    $0x10,%esp
 385:	85 c0                	test   %eax,%eax
 387:	78 27                	js     3b0 <stat+0x40>
        return -1;
    }
    r = fstat(fd, st);
 389:	83 ec 08             	sub    $0x8,%esp
 38c:	ff 75 0c             	push   0xc(%ebp)
 38f:	89 c3                	mov    %eax,%ebx
 391:	50                   	push   %eax
 392:	e8 cc 00 00 00       	call   463 <fstat>
    close(fd);
 397:	89 1c 24             	mov    %ebx,(%esp)
    r = fstat(fd, st);
 39a:	89 c6                	mov    %eax,%esi
    close(fd);
 39c:	e8 2a 01 00 00       	call   4cb <close>
    return r;
 3a1:	83 c4 10             	add    $0x10,%esp
}
 3a4:	8d 65 f8             	lea    -0x8(%ebp),%esp
 3a7:	89 f0                	mov    %esi,%eax
 3a9:	5b                   	pop    %ebx
 3aa:	5e                   	pop    %esi
 3ab:	5d                   	pop    %ebp
 3ac:	c3                   	ret    
 3ad:	8d 76 00             	lea    0x0(%esi),%esi
        return -1;
 3b0:	be ff ff ff ff       	mov    $0xffffffff,%esi
 3b5:	eb ed                	jmp    3a4 <stat+0x34>
 3b7:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 3be:	66 90                	xchg   %ax,%ax

000003c0 <atoi>:

int atoi(const char *s) {
 3c0:	55                   	push   %ebp
 3c1:	89 e5                	mov    %esp,%ebp
 3c3:	53                   	push   %ebx
 3c4:	8b 55 08             	mov    0x8(%ebp),%edx
    int n;

    n = 0;
    while ('0' <= *s && *s <= '9') {
 3c7:	0f be 02             	movsbl (%edx),%eax
 3ca:	8d 48 d0             	lea    -0x30(%eax),%ecx
 3cd:	80 f9 09             	cmp    $0x9,%cl
    n = 0;
 3d0:	b9 00 00 00 00       	mov    $0x0,%ecx
    while ('0' <= *s && *s <= '9') {
 3d5:	77 1e                	ja     3f5 <atoi+0x35>
 3d7:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 3de:	66 90                	xchg   %ax,%ax
        n = n * 10 + *s++ - '0';
 3e0:	83 c2 01             	add    $0x1,%edx
 3e3:	8d 0c 89             	lea    (%ecx,%ecx,4),%ecx
 3e6:	8d 4c 48 d0          	lea    -0x30(%eax,%ecx,2),%ecx
    while ('0' <= *s && *s <= '9') {
 3ea:	0f be 02             	movsbl (%edx),%eax
 3ed:	8d 58 d0             	lea    -0x30(%eax),%ebx
 3f0:	80 fb 09             	cmp    $0x9,%bl
 3f3:	76 eb                	jbe    3e0 <atoi+0x20>
    }
    return n;
}
 3f5:	8b 5d fc             	mov    -0x4(%ebp),%ebx
 3f8:	89 c8                	mov    %ecx,%eax
 3fa:	c9                   	leave  
 3fb:	c3                   	ret    
 3fc:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi

00000400 <memmove>:

void* memmove(void *vdst, const void *vsrc, int n) {
 400:	55                   	push   %ebp
 401:	89 e5                	mov    %esp,%ebp
 403:	57                   	push   %edi
 404:	8b 45 10             	mov    0x10(%ebp),%eax
 407:	8b 55 08             	mov    0x8(%ebp),%edx
 40a:	56                   	push   %esi
 40b:	8b 75 0c             	mov    0xc(%ebp),%esi
    char *dst;
    const char *src;

    dst = vdst;
    src = vsrc;
    while (n-- > 0) {
 40e:	85 c0                	test   %eax,%eax
 410:	7e 13                	jle    425 <memmove+0x25>
 412:	01 d0                	add    %edx,%eax
    dst = vdst;
 414:	89 d7                	mov    %edx,%edi
 416:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 41d:	8d 76 00             	lea    0x0(%esi),%esi
        *dst++ = *src++;
 420:	a4                   	movsb  %ds:(%esi),%es:(%edi)
    while (n-- > 0) {
 421:	39 f8                	cmp    %edi,%eax
 423:	75 fb                	jne    420 <memmove+0x20>
    }
    return vdst;
}
 425:	5e                   	pop    %esi
 426:	89 d0                	mov    %edx,%eax
 428:	5f                   	pop    %edi
 429:	5d                   	pop    %ebp
 42a:	c3                   	ret    

0000042b <fork>:
name: \
	movl	$SYS_ ## name, %eax; \
	int	$T_SYSCALL; \
	ret

SYSCALL(fork)
 42b:	b8 01 00 00 00       	mov    $0x1,%eax
 430:	cd 40                	int    $0x40
 432:	c3                   	ret    

00000433 <exit>:
SYSCALL(exit)
 433:	b8 02 00 00 00       	mov    $0x2,%eax
 438:	cd 40                	int    $0x40
 43a:	c3                   	ret    

0000043b <wait>:
SYSCALL(wait)
 43b:	b8 03 00 00 00       	mov    $0x3,%eax
 440:	cd 40                	int    $0x40
 442:	c3                   	ret    

00000443 <pipe>:
SYSCALL(pipe)
 443:	b8 04 00 00 00       	mov    $0x4,%eax
 448:	cd 40                	int    $0x40
 44a:	c3                   	ret    

0000044b <read>:
SYSCALL(read)
 44b:	b8 05 00 00 00       	mov    $0x5,%eax
 450:	cd 40                	int    $0x40
 452:	c3                   	ret    

00000453 <kill>:
SYSCALL(kill)
 453:	b8 06 00 00 00       	mov    $0x6,%eax
 458:	cd 40                	int    $0x40
 45a:	c3                   	ret    

0000045b <exec>:
SYSCALL(exec)
 45b:	b8 07 00 00 00       	mov    $0x7,%eax
 460:	cd 40                	int    $0x40
 462:	c3                   	ret    

00000463 <fstat>:
SYSCALL(fstat)
 463:	b8 08 00 00 00       	mov    $0x8,%eax
 468:	cd 40                	int    $0x40
 46a:	c3                   	ret    

0000046b <chdir>:
SYSCALL(chdir)
 46b:	b8 09 00 00 00       	mov    $0x9,%eax
 470:	cd 40                	int    $0x40
 472:	c3                   	ret    

00000473 <dup>:
SYSCALL(dup)
 473:	b8 0a 00 00 00       	mov    $0xa,%eax
 478:	cd 40                	int    $0x40
 47a:	c3                   	ret    

0000047b <getpid>:
SYSCALL(getpid)
 47b:	b8 0b 00 00 00       	mov    $0xb,%eax
 480:	cd 40                	int    $0x40
 482:	c3                   	ret    

00000483 <sbrk>:
SYSCALL(sbrk)
 483:	b8 0c 00 00 00       	mov    $0xc,%eax
 488:	cd 40                	int    $0x40
 48a:	c3                   	ret    

0000048b <sleep>:
SYSCALL(sleep)
 48b:	b8 0d 00 00 00       	mov    $0xd,%eax
 490:	cd 40                	int    $0x40
 492:	c3                   	ret    

00000493 <uptime>:
SYSCALL(uptime)
 493:	b8 0e 00 00 00       	mov    $0xe,%eax
 498:	cd 40                	int    $0x40
 49a:	c3                   	ret    

0000049b <open>:
SYSCALL(open)
 49b:	b8 0f 00 00 00       	mov    $0xf,%eax
 4a0:	cd 40                	int    $0x40
 4a2:	c3                   	ret    

000004a3 <write>:
SYSCALL(write)
 4a3:	b8 10 00 00 00       	mov    $0x10,%eax
 4a8:	cd 40                	int    $0x40
 4aa:	c3                   	ret    

000004ab <mknod>:
SYSCALL(mknod)
 4ab:	b8 11 00 00 00       	mov    $0x11,%eax
 4b0:	cd 40                	int    $0x40
 4b2:	c3                   	ret    

000004b3 <unlink>:
SYSCALL(unlink)
 4b3:	b8 12 00 00 00       	mov    $0x12,%eax
 4b8:	cd 40                	int    $0x40
 4ba:	c3                   	ret    

000004bb <link>:
SYSCALL(link)
 4bb:	b8 13 00 00 00       	mov    $0x13,%eax
 4c0:	cd 40                	int    $0x40
 4c2:	c3                   	ret    

000004c3 <mkdir>:
SYSCALL(mkdir)
 4c3:	b8 14 00 00 00       	mov    $0x14,%eax
 4c8:	cd 40                	int    $0x40
 4ca:	c3                   	ret    

000004cb <close>:
SYSCALL(close)
 4cb:	b8 15 00 00 00       	mov    $0x15,%eax
 4d0:	cd 40                	int    $0x40
 4d2:	c3                   	ret    

000004d3 <getch>:
SYSCALL(getch)
 4d3:	b8 16 00 00 00       	mov    $0x16,%eax
 4d8:	cd 40                	int    $0x40
 4da:	c3                   	ret    

000004db <greeting>:
SYSCALL(greeting)
 4db:	b8 17 00 00 00       	mov    $0x17,%eax
 4e0:	cd 40                	int    $0x40
 4e2:	c3                   	ret    

000004e3 <shutdown>:
SYSCALL(shutdown)
 4e3:	b8 18 00 00 00       	mov    $0x18,%eax
 4e8:	cd 40                	int    $0x40
 4ea:	c3                   	ret    

000004eb <screen>:
SYSCALL(screen)
 4eb:	b8 19 00 00 00       	mov    $0x19,%eax
 4f0:	cd 40                	int    $0x40
 4f2:	c3                   	ret    

000004f3 <cls>:
SYSCALL(cls)
 4f3:	b8 1a 00 00 00       	mov    $0x1a,%eax
 4f8:	cd 40                	int    $0x40
 4fa:	c3                   	ret    
 4fb:	66 90                	xchg   %ax,%ax
 4fd:	66 90                	xchg   %ax,%ax
 4ff:	90                   	nop

00000500 <printint>:

static void putc(int fd, char c) {
    write(fd, &c, 1);
}

static void printint(int fd, int xx, int base, int sgn) {
 500:	55                   	push   %ebp
 501:	89 e5                	mov    %esp,%ebp
 503:	57                   	push   %edi
 504:	56                   	push   %esi
 505:	53                   	push   %ebx
 506:	83 ec 3c             	sub    $0x3c,%esp
 509:	89 4d c4             	mov    %ecx,-0x3c(%ebp)
    uint x;

    neg = 0;
    if (sgn && xx < 0) {
        neg = 1;
        x = -xx;
 50c:	89 d1                	mov    %edx,%ecx
static void printint(int fd, int xx, int base, int sgn) {
 50e:	89 45 b8             	mov    %eax,-0x48(%ebp)
    if (sgn && xx < 0) {
 511:	85 d2                	test   %edx,%edx
 513:	0f 89 7f 00 00 00    	jns    598 <printint+0x98>
 519:	f6 45 08 01          	testb  $0x1,0x8(%ebp)
 51d:	74 79                	je     598 <printint+0x98>
        neg = 1;
 51f:	c7 45 bc 01 00 00 00 	movl   $0x1,-0x44(%ebp)
        x = -xx;
 526:	f7 d9                	neg    %ecx
    }
    else {
        x = xx;
    }

    i = 0;
 528:	31 db                	xor    %ebx,%ebx
 52a:	8d 75 d7             	lea    -0x29(%ebp),%esi
 52d:	8d 76 00             	lea    0x0(%esi),%esi
    do {
        buf[i++] = digits[x % base];
 530:	89 c8                	mov    %ecx,%eax
 532:	31 d2                	xor    %edx,%edx
 534:	89 cf                	mov    %ecx,%edi
 536:	f7 75 c4             	divl   -0x3c(%ebp)
 539:	0f b6 92 08 0b 00 00 	movzbl 0xb08(%edx),%edx
 540:	89 45 c0             	mov    %eax,-0x40(%ebp)
 543:	89 d8                	mov    %ebx,%eax
 545:	8d 5b 01             	lea    0x1(%ebx),%ebx
    }
    while ((x /= base) != 0);
 548:	8b 4d c0             	mov    -0x40(%ebp),%ecx
        buf[i++] = digits[x % base];
 54b:	88 14 1e             	mov    %dl,(%esi,%ebx,1)
    while ((x /= base) != 0);
 54e:	39 7d c4             	cmp    %edi,-0x3c(%ebp)
 551:	76 dd                	jbe    530 <printint+0x30>
    if (neg) {
 553:	8b 4d bc             	mov    -0x44(%ebp),%ecx
 556:	85 c9                	test   %ecx,%ecx
 558:	74 0c                	je     566 <printint+0x66>
        buf[i++] = '-';
 55a:	c6 44 1d d8 2d       	movb   $0x2d,-0x28(%ebp,%ebx,1)
        buf[i++] = digits[x % base];
 55f:	89 d8                	mov    %ebx,%eax
        buf[i++] = '-';
 561:	ba 2d 00 00 00       	mov    $0x2d,%edx
    }

    while (--i >= 0) {
 566:	8b 7d b8             	mov    -0x48(%ebp),%edi
 569:	8d 5c 05 d7          	lea    -0x29(%ebp,%eax,1),%ebx
 56d:	eb 07                	jmp    576 <printint+0x76>
 56f:	90                   	nop
        putc(fd, buf[i]);
 570:	0f b6 13             	movzbl (%ebx),%edx
 573:	83 eb 01             	sub    $0x1,%ebx
    write(fd, &c, 1);
 576:	83 ec 04             	sub    $0x4,%esp
 579:	88 55 d7             	mov    %dl,-0x29(%ebp)
 57c:	6a 01                	push   $0x1
 57e:	56                   	push   %esi
 57f:	57                   	push   %edi
 580:	e8 1e ff ff ff       	call   4a3 <write>
    while (--i >= 0) {
 585:	83 c4 10             	add    $0x10,%esp
 588:	39 de                	cmp    %ebx,%esi
 58a:	75 e4                	jne    570 <printint+0x70>
    }
}
 58c:	8d 65 f4             	lea    -0xc(%ebp),%esp
 58f:	5b                   	pop    %ebx
 590:	5e                   	pop    %esi
 591:	5f                   	pop    %edi
 592:	5d                   	pop    %ebp
 593:	c3                   	ret    
 594:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
    neg = 0;
 598:	c7 45 bc 00 00 00 00 	movl   $0x0,-0x44(%ebp)
 59f:	eb 87                	jmp    528 <printint+0x28>
 5a1:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 5a8:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 5af:	90                   	nop

000005b0 <printf>:

// Print to the given fd. Only understands %d, %x, %p, %s.
void printf(int fd, const char *fmt, ...) {
 5b0:	55                   	push   %ebp
 5b1:	89 e5                	mov    %esp,%ebp
 5b3:	57                   	push   %edi
 5b4:	56                   	push   %esi
 5b5:	53                   	push   %ebx
 5b6:	83 ec 2c             	sub    $0x2c,%esp
    int c, i, state;
    uint *ap;

    state = 0;
    ap = (uint*)(void*)&fmt + 1;
    for (i = 0; fmt[i]; i++) {
 5b9:	8b 5d 0c             	mov    0xc(%ebp),%ebx
void printf(int fd, const char *fmt, ...) {
 5bc:	8b 75 08             	mov    0x8(%ebp),%esi
    for (i = 0; fmt[i]; i++) {
 5bf:	0f b6 13             	movzbl (%ebx),%edx
 5c2:	84 d2                	test   %dl,%dl
 5c4:	74 6a                	je     630 <printf+0x80>
    ap = (uint*)(void*)&fmt + 1;
 5c6:	8d 45 10             	lea    0x10(%ebp),%eax
 5c9:	83 c3 01             	add    $0x1,%ebx
    write(fd, &c, 1);
 5cc:	8d 7d e7             	lea    -0x19(%ebp),%edi
    state = 0;
 5cf:	31 c9                	xor    %ecx,%ecx
    ap = (uint*)(void*)&fmt + 1;
 5d1:	89 45 d0             	mov    %eax,-0x30(%ebp)
 5d4:	eb 36                	jmp    60c <printf+0x5c>
 5d6:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 5dd:	8d 76 00             	lea    0x0(%esi),%esi
 5e0:	89 4d d4             	mov    %ecx,-0x2c(%ebp)
        c = fmt[i] & 0xff;
        if (state == 0) {
            if (c == '%') {
                state = '%';
 5e3:	b9 25 00 00 00       	mov    $0x25,%ecx
            if (c == '%') {
 5e8:	83 f8 25             	cmp    $0x25,%eax
 5eb:	74 15                	je     602 <printf+0x52>
    write(fd, &c, 1);
 5ed:	83 ec 04             	sub    $0x4,%esp
 5f0:	88 55 e7             	mov    %dl,-0x19(%ebp)
 5f3:	6a 01                	push   $0x1
 5f5:	57                   	push   %edi
 5f6:	56                   	push   %esi
 5f7:	e8 a7 fe ff ff       	call   4a3 <write>
 5fc:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
            }
            else {
                putc(fd, c);
 5ff:	83 c4 10             	add    $0x10,%esp
    for (i = 0; fmt[i]; i++) {
 602:	0f b6 13             	movzbl (%ebx),%edx
 605:	83 c3 01             	add    $0x1,%ebx
 608:	84 d2                	test   %dl,%dl
 60a:	74 24                	je     630 <printf+0x80>
        c = fmt[i] & 0xff;
 60c:	0f b6 c2             	movzbl %dl,%eax
        if (state == 0) {
 60f:	85 c9                	test   %ecx,%ecx
 611:	74 cd                	je     5e0 <printf+0x30>
            }
        }
        else if (state == '%') {
 613:	83 f9 25             	cmp    $0x25,%ecx
 616:	75 ea                	jne    602 <printf+0x52>
            if (c == 'd') {
 618:	83 f8 25             	cmp    $0x25,%eax
 61b:	0f 84 07 01 00 00    	je     728 <printf+0x178>
 621:	83 e8 63             	sub    $0x63,%eax
 624:	83 f8 15             	cmp    $0x15,%eax
 627:	77 17                	ja     640 <printf+0x90>
 629:	ff 24 85 b0 0a 00 00 	jmp    *0xab0(,%eax,4)
                putc(fd, c);
            }
            state = 0;
        }
    }
}
 630:	8d 65 f4             	lea    -0xc(%ebp),%esp
 633:	5b                   	pop    %ebx
 634:	5e                   	pop    %esi
 635:	5f                   	pop    %edi
 636:	5d                   	pop    %ebp
 637:	c3                   	ret    
 638:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 63f:	90                   	nop
    write(fd, &c, 1);
 640:	83 ec 04             	sub    $0x4,%esp
 643:	88 55 d4             	mov    %dl,-0x2c(%ebp)
 646:	6a 01                	push   $0x1
 648:	57                   	push   %edi
 649:	56                   	push   %esi
 64a:	c6 45 e7 25          	movb   $0x25,-0x19(%ebp)
 64e:	e8 50 fe ff ff       	call   4a3 <write>
                putc(fd, c);
 653:	0f b6 55 d4          	movzbl -0x2c(%ebp),%edx
    write(fd, &c, 1);
 657:	83 c4 0c             	add    $0xc,%esp
 65a:	88 55 e7             	mov    %dl,-0x19(%ebp)
 65d:	6a 01                	push   $0x1
 65f:	57                   	push   %edi
 660:	56                   	push   %esi
 661:	e8 3d fe ff ff       	call   4a3 <write>
                putc(fd, c);
 666:	83 c4 10             	add    $0x10,%esp
            state = 0;
 669:	31 c9                	xor    %ecx,%ecx
 66b:	eb 95                	jmp    602 <printf+0x52>
 66d:	8d 76 00             	lea    0x0(%esi),%esi
                printint(fd, *ap, 16, 0);
 670:	83 ec 0c             	sub    $0xc,%esp
 673:	b9 10 00 00 00       	mov    $0x10,%ecx
 678:	6a 00                	push   $0x0
 67a:	8b 45 d0             	mov    -0x30(%ebp),%eax
 67d:	8b 10                	mov    (%eax),%edx
 67f:	89 f0                	mov    %esi,%eax
 681:	e8 7a fe ff ff       	call   500 <printint>
                ap++;
 686:	83 45 d0 04          	addl   $0x4,-0x30(%ebp)
 68a:	83 c4 10             	add    $0x10,%esp
            state = 0;
 68d:	31 c9                	xor    %ecx,%ecx
 68f:	e9 6e ff ff ff       	jmp    602 <printf+0x52>
 694:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
                s = (char*)*ap;
 698:	8b 45 d0             	mov    -0x30(%ebp),%eax
 69b:	8b 10                	mov    (%eax),%edx
                ap++;
 69d:	83 c0 04             	add    $0x4,%eax
 6a0:	89 45 d0             	mov    %eax,-0x30(%ebp)
                if (s == 0) {
 6a3:	85 d2                	test   %edx,%edx
 6a5:	0f 84 8d 00 00 00    	je     738 <printf+0x188>
                while (*s != 0) {
 6ab:	0f b6 02             	movzbl (%edx),%eax
            state = 0;
 6ae:	31 c9                	xor    %ecx,%ecx
                while (*s != 0) {
 6b0:	84 c0                	test   %al,%al
 6b2:	0f 84 4a ff ff ff    	je     602 <printf+0x52>
 6b8:	89 5d d4             	mov    %ebx,-0x2c(%ebp)
 6bb:	89 d3                	mov    %edx,%ebx
 6bd:	8d 76 00             	lea    0x0(%esi),%esi
    write(fd, &c, 1);
 6c0:	83 ec 04             	sub    $0x4,%esp
                    s++;
 6c3:	83 c3 01             	add    $0x1,%ebx
 6c6:	88 45 e7             	mov    %al,-0x19(%ebp)
    write(fd, &c, 1);
 6c9:	6a 01                	push   $0x1
 6cb:	57                   	push   %edi
 6cc:	56                   	push   %esi
 6cd:	e8 d1 fd ff ff       	call   4a3 <write>
                while (*s != 0) {
 6d2:	0f b6 03             	movzbl (%ebx),%eax
 6d5:	83 c4 10             	add    $0x10,%esp
 6d8:	84 c0                	test   %al,%al
 6da:	75 e4                	jne    6c0 <printf+0x110>
            state = 0;
 6dc:	8b 5d d4             	mov    -0x2c(%ebp),%ebx
 6df:	31 c9                	xor    %ecx,%ecx
 6e1:	e9 1c ff ff ff       	jmp    602 <printf+0x52>
 6e6:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 6ed:	8d 76 00             	lea    0x0(%esi),%esi
                printint(fd, *ap, 10, 1);
 6f0:	83 ec 0c             	sub    $0xc,%esp
 6f3:	b9 0a 00 00 00       	mov    $0xa,%ecx
 6f8:	6a 01                	push   $0x1
 6fa:	e9 7b ff ff ff       	jmp    67a <printf+0xca>
 6ff:	90                   	nop
                putc(fd, *ap);
 700:	8b 45 d0             	mov    -0x30(%ebp),%eax
    write(fd, &c, 1);
 703:	83 ec 04             	sub    $0x4,%esp
                putc(fd, *ap);
 706:	8b 00                	mov    (%eax),%eax
    write(fd, &c, 1);
 708:	6a 01                	push   $0x1
 70a:	57                   	push   %edi
 70b:	56                   	push   %esi
                putc(fd, *ap);
 70c:	88 45 e7             	mov    %al,-0x19(%ebp)
    write(fd, &c, 1);
 70f:	e8 8f fd ff ff       	call   4a3 <write>
                ap++;
 714:	83 45 d0 04          	addl   $0x4,-0x30(%ebp)
 718:	83 c4 10             	add    $0x10,%esp
            state = 0;
 71b:	31 c9                	xor    %ecx,%ecx
 71d:	e9 e0 fe ff ff       	jmp    602 <printf+0x52>
 722:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
                putc(fd, c);
 728:	88 55 e7             	mov    %dl,-0x19(%ebp)
    write(fd, &c, 1);
 72b:	83 ec 04             	sub    $0x4,%esp
 72e:	e9 2a ff ff ff       	jmp    65d <printf+0xad>
 733:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
 737:	90                   	nop
                    s = "(null)";
 738:	ba a8 0a 00 00       	mov    $0xaa8,%edx
                while (*s != 0) {
 73d:	89 5d d4             	mov    %ebx,-0x2c(%ebp)
 740:	b8 28 00 00 00       	mov    $0x28,%eax
 745:	89 d3                	mov    %edx,%ebx
 747:	e9 74 ff ff ff       	jmp    6c0 <printf+0x110>
 74c:	66 90                	xchg   %ax,%ax
 74e:	66 90                	xchg   %ax,%ax

00000750 <free>:
typedef union header Header;

static Header base;
static Header *freep;

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

    bp = (Header*)ap - 1;
    for (p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) {
 751:	a1 20 0e 00 00       	mov    0xe20,%eax
void free(void *ap) {
 756:	89 e5                	mov    %esp,%ebp
 758:	57                   	push   %edi
 759:	56                   	push   %esi
 75a:	53                   	push   %ebx
 75b:	8b 5d 08             	mov    0x8(%ebp),%ebx
    bp = (Header*)ap - 1;
 75e:	8d 4b f8             	lea    -0x8(%ebx),%ecx
    for (p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) {
 761:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
 768:	89 c2                	mov    %eax,%edx
 76a:	8b 00                	mov    (%eax),%eax
 76c:	39 ca                	cmp    %ecx,%edx
 76e:	73 30                	jae    7a0 <free+0x50>
 770:	39 c1                	cmp    %eax,%ecx
 772:	72 04                	jb     778 <free+0x28>
        if (p >= p->s.ptr && (bp > p || bp < p->s.ptr)) {
 774:	39 c2                	cmp    %eax,%edx
 776:	72 f0                	jb     768 <free+0x18>
            break;
        }
    }
    if (bp + bp->s.size == p->s.ptr) {
 778:	8b 73 fc             	mov    -0x4(%ebx),%esi
 77b:	8d 3c f1             	lea    (%ecx,%esi,8),%edi
 77e:	39 f8                	cmp    %edi,%eax
 780:	74 30                	je     7b2 <free+0x62>
        bp->s.size += p->s.ptr->s.size;
        bp->s.ptr = p->s.ptr->s.ptr;
 782:	89 43 f8             	mov    %eax,-0x8(%ebx)
    }
    else {
        bp->s.ptr = p->s.ptr;
    }
    if (p + p->s.size == bp) {
 785:	8b 42 04             	mov    0x4(%edx),%eax
 788:	8d 34 c2             	lea    (%edx,%eax,8),%esi
 78b:	39 f1                	cmp    %esi,%ecx
 78d:	74 3a                	je     7c9 <free+0x79>
        p->s.size += bp->s.size;
        p->s.ptr = bp->s.ptr;
 78f:	89 0a                	mov    %ecx,(%edx)
    }
    else {
        p->s.ptr = bp;
    }
    freep = p;
}
 791:	5b                   	pop    %ebx
    freep = p;
 792:	89 15 20 0e 00 00    	mov    %edx,0xe20
}
 798:	5e                   	pop    %esi
 799:	5f                   	pop    %edi
 79a:	5d                   	pop    %ebp
 79b:	c3                   	ret    
 79c:	8d 74 26 00          	lea    0x0(%esi,%eiz,1),%esi
        if (p >= p->s.ptr && (bp > p || bp < p->s.ptr)) {
 7a0:	39 c2                	cmp    %eax,%edx
 7a2:	72 c4                	jb     768 <free+0x18>
 7a4:	39 c1                	cmp    %eax,%ecx
 7a6:	73 c0                	jae    768 <free+0x18>
    if (bp + bp->s.size == p->s.ptr) {
 7a8:	8b 73 fc             	mov    -0x4(%ebx),%esi
 7ab:	8d 3c f1             	lea    (%ecx,%esi,8),%edi
 7ae:	39 f8                	cmp    %edi,%eax
 7b0:	75 d0                	jne    782 <free+0x32>
        bp->s.size += p->s.ptr->s.size;
 7b2:	03 70 04             	add    0x4(%eax),%esi
 7b5:	89 73 fc             	mov    %esi,-0x4(%ebx)
        bp->s.ptr = p->s.ptr->s.ptr;
 7b8:	8b 02                	mov    (%edx),%eax
 7ba:	8b 00                	mov    (%eax),%eax
 7bc:	89 43 f8             	mov    %eax,-0x8(%ebx)
    if (p + p->s.size == bp) {
 7bf:	8b 42 04             	mov    0x4(%edx),%eax
 7c2:	8d 34 c2             	lea    (%edx,%eax,8),%esi
 7c5:	39 f1                	cmp    %esi,%ecx
 7c7:	75 c6                	jne    78f <free+0x3f>
        p->s.size += bp->s.size;
 7c9:	03 43 fc             	add    -0x4(%ebx),%eax
    freep = p;
 7cc:	89 15 20 0e 00 00    	mov    %edx,0xe20
        p->s.size += bp->s.size;
 7d2:	89 42 04             	mov    %eax,0x4(%edx)
        p->s.ptr = bp->s.ptr;
 7d5:	8b 4b f8             	mov    -0x8(%ebx),%ecx
 7d8:	89 0a                	mov    %ecx,(%edx)
}
 7da:	5b                   	pop    %ebx
 7db:	5e                   	pop    %esi
 7dc:	5f                   	pop    %edi
 7dd:	5d                   	pop    %ebp
 7de:	c3                   	ret    
 7df:	90                   	nop

000007e0 <malloc>:
    hp->s.size = nu;
    free((void*)(hp + 1));
    return freep;
}

void* malloc(uint nbytes) {
 7e0:	55                   	push   %ebp
 7e1:	89 e5                	mov    %esp,%ebp
 7e3:	57                   	push   %edi
 7e4:	56                   	push   %esi
 7e5:	53                   	push   %ebx
 7e6:	83 ec 1c             	sub    $0x1c,%esp
    Header *p, *prevp;
    uint nunits;

    nunits = (nbytes + sizeof(Header) - 1) / sizeof(Header) + 1;
 7e9:	8b 45 08             	mov    0x8(%ebp),%eax
    if ((prevp = freep) == 0) {
 7ec:	8b 3d 20 0e 00 00    	mov    0xe20,%edi
    nunits = (nbytes + sizeof(Header) - 1) / sizeof(Header) + 1;
 7f2:	8d 70 07             	lea    0x7(%eax),%esi
 7f5:	c1 ee 03             	shr    $0x3,%esi
 7f8:	83 c6 01             	add    $0x1,%esi
    if ((prevp = freep) == 0) {
 7fb:	85 ff                	test   %edi,%edi
 7fd:	0f 84 9d 00 00 00    	je     8a0 <malloc+0xc0>
        base.s.ptr = freep = prevp = &base;
        base.s.size = 0;
    }
    for (p = prevp->s.ptr;; prevp = p, p = p->s.ptr) {
 803:	8b 17                	mov    (%edi),%edx
        if (p->s.size >= nunits) {
 805:	8b 4a 04             	mov    0x4(%edx),%ecx
 808:	39 f1                	cmp    %esi,%ecx
 80a:	73 6a                	jae    876 <malloc+0x96>
 80c:	bb 00 10 00 00       	mov    $0x1000,%ebx
 811:	39 de                	cmp    %ebx,%esi
 813:	0f 43 de             	cmovae %esi,%ebx
    p = sbrk(nu * sizeof(Header));
 816:	8d 04 dd 00 00 00 00 	lea    0x0(,%ebx,8),%eax
 81d:	89 45 e4             	mov    %eax,-0x1c(%ebp)
 820:	eb 17                	jmp    839 <malloc+0x59>
 822:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
    for (p = prevp->s.ptr;; prevp = p, p = p->s.ptr) {
 828:	8b 02                	mov    (%edx),%eax
        if (p->s.size >= nunits) {
 82a:	8b 48 04             	mov    0x4(%eax),%ecx
 82d:	39 f1                	cmp    %esi,%ecx
 82f:	73 4f                	jae    880 <malloc+0xa0>
                p->s.size = nunits;
            }
            freep = prevp;
            return (void*)(p + 1);
        }
        if (p == freep) {
 831:	8b 3d 20 0e 00 00    	mov    0xe20,%edi
 837:	89 c2                	mov    %eax,%edx
 839:	39 d7                	cmp    %edx,%edi
 83b:	75 eb                	jne    828 <malloc+0x48>
    p = sbrk(nu * sizeof(Header));
 83d:	83 ec 0c             	sub    $0xc,%esp
 840:	ff 75 e4             	push   -0x1c(%ebp)
 843:	e8 3b fc ff ff       	call   483 <sbrk>
    if (p == (char*)-1) {
 848:	83 c4 10             	add    $0x10,%esp
 84b:	83 f8 ff             	cmp    $0xffffffff,%eax
 84e:	74 1c                	je     86c <malloc+0x8c>
    hp->s.size = nu;
 850:	89 58 04             	mov    %ebx,0x4(%eax)
    free((void*)(hp + 1));
 853:	83 ec 0c             	sub    $0xc,%esp
 856:	83 c0 08             	add    $0x8,%eax
 859:	50                   	push   %eax
 85a:	e8 f1 fe ff ff       	call   750 <free>
    return freep;
 85f:	8b 15 20 0e 00 00    	mov    0xe20,%edx
            if ((p = morecore(nunits)) == 0) {
 865:	83 c4 10             	add    $0x10,%esp
 868:	85 d2                	test   %edx,%edx
 86a:	75 bc                	jne    828 <malloc+0x48>
                return 0;
            }
        }
    }
}
 86c:	8d 65 f4             	lea    -0xc(%ebp),%esp
                return 0;
 86f:	31 c0                	xor    %eax,%eax
}
 871:	5b                   	pop    %ebx
 872:	5e                   	pop    %esi
 873:	5f                   	pop    %edi
 874:	5d                   	pop    %ebp
 875:	c3                   	ret    
        if (p->s.size >= nunits) {
 876:	89 d0                	mov    %edx,%eax
 878:	89 fa                	mov    %edi,%edx
 87a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
            if (p->s.size == nunits) {
 880:	39 ce                	cmp    %ecx,%esi
 882:	74 4c                	je     8d0 <malloc+0xf0>
                p->s.size -= nunits;
 884:	29 f1                	sub    %esi,%ecx
 886:	89 48 04             	mov    %ecx,0x4(%eax)
                p += p->s.size;
 889:	8d 04 c8             	lea    (%eax,%ecx,8),%eax
                p->s.size = nunits;
 88c:	89 70 04             	mov    %esi,0x4(%eax)
            freep = prevp;
 88f:	89 15 20 0e 00 00    	mov    %edx,0xe20
}
 895:	8d 65 f4             	lea    -0xc(%ebp),%esp
            return (void*)(p + 1);
 898:	83 c0 08             	add    $0x8,%eax
}
 89b:	5b                   	pop    %ebx
 89c:	5e                   	pop    %esi
 89d:	5f                   	pop    %edi
 89e:	5d                   	pop    %ebp
 89f:	c3                   	ret    
        base.s.ptr = freep = prevp = &base;
 8a0:	c7 05 20 0e 00 00 24 	movl   $0xe24,0xe20
 8a7:	0e 00 00 
        base.s.size = 0;
 8aa:	bf 24 0e 00 00       	mov    $0xe24,%edi
        base.s.ptr = freep = prevp = &base;
 8af:	c7 05 24 0e 00 00 24 	movl   $0xe24,0xe24
 8b6:	0e 00 00 
    for (p = prevp->s.ptr;; prevp = p, p = p->s.ptr) {
 8b9:	89 fa                	mov    %edi,%edx
        base.s.size = 0;
 8bb:	c7 05 28 0e 00 00 00 	movl   $0x0,0xe28
 8c2:	00 00 00 
        if (p->s.size >= nunits) {
 8c5:	e9 42 ff ff ff       	jmp    80c <malloc+0x2c>
 8ca:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
                prevp->s.ptr = p->s.ptr;
 8d0:	8b 08                	mov    (%eax),%ecx
 8d2:	89 0a                	mov    %ecx,(%edx)
 8d4:	eb b9                	jmp    88f <malloc+0xaf>
