// File: jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb_load.c
// Function: readhdr
static void readhdr(void)
{
	char *ptr;

	while (fgets(dbuf.mv_data, dbuf.mv_size, stdin) != NULL) {
		lineno++;
		if (!strncmp(dbuf.mv_data, "VERSION=", STRLENOF("VERSION="))) {
			version=atoi((char *)dbuf.mv_data+STRLENOF("VERSION="));
			if (version > 3) {
				fprintf(stderr, "%s: line %" Z "d: unsupported VERSION %d\n",
					prog, lineno, version);
				exit(EXIT_FAILURE);
			}
		} else if (!strncmp(dbuf.mv_data, "HEADER=END", STRLENOF("HEADER=END"))) {
			break;
		} else if (!strncmp(dbuf.mv_data, "format=", STRLENOF("format="))) {
			if (!strncmp((char *)dbuf.mv_data+STRLENOF("FORMAT="), "print", STRLENOF("print")))
				mode |= PRINT;
			else if (strncmp((char *)dbuf.mv_data+STRLENOF("FORMAT="), "bytevalue", STRLENOF("bytevalue"))) {
				fprintf(stderr, "%s: line %" Z "d: unsupported FORMAT %s\n",
					prog, lineno, (char *)dbuf.mv_data+STRLENOF("FORMAT="));
				exit(EXIT_FAILURE);
			}
		} else if (!strncmp(dbuf.mv_data, "database=", STRLENOF("database="))) {
			ptr = memchr(dbuf.mv_data, '\n', dbuf.mv_size);
			if (ptr) *ptr = '\0';
			if (subname) free(subname);
			subname = strdup((char *)dbuf.mv_data+STRLENOF("database="));
		} else if (!strncmp(dbuf.mv_data, "type=", STRLENOF("type="))) {
			if (strncmp((char *)dbuf.mv_data+STRLENOF("type="), "btree", STRLENOF("btree")))  {
				fprintf(stderr, "%s: line %" Z "d: unsupported type %s\n",
					prog, lineno, (char *)dbuf.mv_data+STRLENOF("type="));
				exit(EXIT_FAILURE);
			}
		} else if (!strncmp(dbuf.mv_data, "mapaddr=", STRLENOF("mapaddr="))) {
			int i;
			ptr = memchr(dbuf.mv_data, '\n', dbuf.mv_size);
			if (ptr) *ptr = '\0';
			i = sscanf((char *)dbuf.mv_data+STRLENOF("mapaddr="), "%p", &info.me_mapaddr);
			if (i != 1) {
				fprintf(stderr, "%s: line %" Z "d: invalid mapaddr %s\n",
					prog, lineno, (char *)dbuf.mv_data+STRLENOF("mapaddr="));
				exit(EXIT_FAILURE);
			}
		} else if (!strncmp(dbuf.mv_data, "mapsize=", STRLENOF("mapsize="))) {
			int i;
			ptr = memchr(dbuf.mv_data, '\n', dbuf.mv_size);
			if (ptr) *ptr = '\0';
			i = sscanf((char *)dbuf.mv_data+STRLENOF("mapsize="), "%" Z "u", &info.me_mapsize);
			if (i != 1) {
				fprintf(stderr, "%s: line %" Z "d: invalid mapsize %s\n",
					prog, lineno, (char *)dbuf.mv_data+STRLENOF("mapsize="));
				exit(EXIT_FAILURE);
			}
		} else if (!strncmp(dbuf.mv_data, "maxreaders=", STRLENOF("maxreaders="))) {
			int i;
			ptr = memchr(dbuf.mv_data, '\n', dbuf.mv_size);
			if (ptr) *ptr = '\0';
			i = sscanf((char *)dbuf.mv_data+STRLENOF("maxreaders="), "%u", &info.me_maxreaders);
			if (i != 1) {
				fprintf(stderr, "%s: line %" Z "d: invalid maxreaders %s\n",
					prog, lineno, (char *)dbuf.mv_data+STRLENOF("maxreaders="));
				exit(EXIT_FAILURE);
			}
		} else {
			int i;
			for (i=0; dbflags[i].bit; i++) {
				if (!strncmp(dbuf.mv_data, dbflags[i].name, dbflags[i].len) &&
					((char *)dbuf.mv_data)[dbflags[i].len] == '=') {
					flags |= dbflags[i].bit;
					break;
				}
			}
			if (!dbflags[i].bit) {
				ptr = memchr(dbuf.mv_data, '=', dbuf.mv_size);
				if (!ptr) {
					fprintf(stderr, "%s: line %" Z "d: unexpected format\n",
						prog, lineno);
					exit(EXIT_FAILURE);
				} else {
					*ptr = '\0';
					fprintf(stderr, "%s: line %" Z "d: unrecognized keyword ignored: %s\n",
						prog, lineno, (char *)dbuf.mv_data);
				}
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq 0x19641(%rip), %rdi     # 0x1c320
movq 0x19632(%rip), %rax     # 0x1c318
movl %eax, %esi
movq 0x192d1(%rip), %rax     # 0x1bfc0
movq (%rax), %rdx
callq 0x2200
cmpq $0x0, %rax
je 0x32ee
movq 0x19660(%rip), %rax     # 0x1c368
addq $0x1, %rax
movq %rax, 0x19655(%rip)     # 0x1c368
movq 0x19606(%rip), %rdi     # 0x1c320
leaq 0x154f9(%rip), %rsi     # 0x1821a
movl $0x8, %edx
callq 0x2070
cmpl $0x0, %eax
jne 0x2d8b
movq 0x195e9(%rip), %rdi     # 0x1c320
addq $0x8, %rdi
callq 0x2380
movl %eax, 0x1962a(%rip)     # 0x1c370
cmpl $0x3, 0x19623(%rip)     # 0x1c370
jle 0x2d86
movq 0x1929a(%rip), %rax     # 0x1bff0
movq (%rax), %rdi
movq 0x195a0(%rip), %rdx     # 0x1c300
movq 0x19601(%rip), %rcx     # 0x1c368
movl 0x19602(%rip), %r8d     # 0x1c370
leaq 0x154ae(%rip), %rsi     # 0x18223
movb $0x0, %al
callq 0x2240
movl $0x1, %edi
callq 0x23b0
jmp 0x32e9
movq 0x1958e(%rip), %rdi     # 0x1c320
leaq 0x154b0(%rip), %rsi     # 0x18249
movl $0xa, %edx
callq 0x2070
cmpl $0x0, %eax
jne 0x2dad
jmp 0x32ee
movq 0x1956c(%rip), %rdi     # 0x1c320
leaq 0x15499(%rip), %rsi     # 0x18254
movl $0x7, %edx
callq 0x2070
cmpl $0x0, %eax
jne 0x2e63
movq 0x1954b(%rip), %rdi     # 0x1c320
addq $0x7, %rdi
leaq 0x1547c(%rip), %rsi     # 0x1825c
movl $0x5, %edx
callq 0x2070
cmpl $0x0, %eax
jne 0x2e00
movl 0x1951b(%rip), %eax     # 0x1c310
orl $0x1, %eax
movl %eax, 0x19512(%rip)     # 0x1c310
jmp 0x2e5e
movq 0x19519(%rip), %rdi     # 0x1c320
addq $0x7, %rdi
leaq 0x15450(%rip), %rsi     # 0x18262
movl $0x9, %edx
callq 0x2070
cmpl $0x0, %eax
je 0x2e5c
movq 0x191c8(%rip), %rax     # 0x1bff0
movq (%rax), %rdi
movq 0x194ce(%rip), %rdx     # 0x1c300
movq 0x1952f(%rip), %rcx     # 0x1c368
movq 0x194e0(%rip), %r8      # 0x1c320
addq $0x7, %r8
leaq 0x15421(%rip), %rsi     # 0x1826c
movb $0x0, %al
callq 0x2240
movl $0x1, %edi
callq 0x23b0
jmp 0x2e5e
jmp 0x32e5
movq 0x194b6(%rip), %rdi     # 0x1c320
leaq 0x15420(%rip), %rsi     # 0x18291
movl $0x9, %edx
callq 0x2070
cmpl $0x0, %eax
jne 0x2edc
movq 0x19499(%rip), %rdi     # 0x1c320
movq 0x1948a(%rip), %rdx     # 0x1c318
movl $0xa, %esi
callq 0x21d0
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x2eaa
movq -0x8(%rbp), %rax
movb $0x0, (%rax)
cmpq $0x0, 0x19456(%rip)     # 0x1c308
je 0x2ec0
movq 0x1944d(%rip), %rdi     # 0x1c308
callq 0x2030
movq 0x19459(%rip), %rdi     # 0x1c320
addq $0x9, %rdi
callq 0x23f0
movq %rax, 0x19431(%rip)     # 0x1c308
jmp 0x32e3
movq 0x1943d(%rip), %rdi     # 0x1c320
leaq 0x153b1(%rip), %rsi     # 0x1829b
movl $0x5, %edx
callq 0x2070
cmpl $0x0, %eax
jne 0x2f5a
movq 0x19420(%rip), %rdi     # 0x1c320
addq $0x5, %rdi
leaq 0x15396(%rip), %rsi     # 0x182a1
movl $0x5, %edx
callq 0x2070
cmpl $0x0, %eax
je 0x2f55
movq 0x190cf(%rip), %rax     # 0x1bff0
movq (%rax), %rdi
movq 0x193d5(%rip), %rdx     # 0x1c300
movq 0x19436(%rip), %rcx     # 0x1c368
movq 0x193e7(%rip), %r8      # 0x1c320
addq $0x5, %r8
leaq 0x15363(%rip), %rsi     # 0x182a7
movb $0x0, %al
callq 0x2240
movl $0x1, %edi
callq 0x23b0
jmp 0x32e1
movq 0x193bf(%rip), %rdi     # 0x1c320
leaq 0x15362(%rip), %rsi     # 0x182ca
movl $0x8, %edx
callq 0x2070
cmpl $0x0, %eax
jne 0x300e
movq 0x1939e(%rip), %rdi     # 0x1c320
movq 0x1938f(%rip), %rdx     # 0x1c318
movl $0xa, %esi
callq 0x21d0
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x2fa5
movq -0x8(%rbp), %rax
movb $0x0, (%rax)
movq 0x19374(%rip), %rdi     # 0x1c320
addq $0x8, %rdi
leaq 0x1531c(%rip), %rsi     # 0x182d3
leaq 0x1936a(%rip), %rdx     # 0x1c328
movb $0x0, %al
callq 0x22a0
movl %eax, -0xc(%rbp)
cmpl $0x1, -0xc(%rbp)
je 0x3009
movq 0x1901b(%rip), %rax     # 0x1bff0
movq (%rax), %rdi
movq 0x19321(%rip), %rdx     # 0x1c300
movq 0x19382(%rip), %rcx     # 0x1c368
movq 0x19333(%rip), %r8      # 0x1c320
addq $0x8, %r8
leaq 0x152de(%rip), %rsi     # 0x182d6
movb $0x0, %al
callq 0x2240
movl $0x1, %edi
callq 0x23b0
jmp 0x32df
movq 0x1930b(%rip), %rdi     # 0x1c320
leaq 0x152dc(%rip), %rsi     # 0x182f8
movl $0x8, %edx
callq 0x2070
cmpl $0x0, %eax
jne 0x30c6
movq 0x192ea(%rip), %rdi     # 0x1c320
movq 0x192db(%rip), %rdx     # 0x1c318
movl $0xa, %esi
callq 0x21d0
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x3059
movq -0x8(%rbp), %rax
movb $0x0, (%rax)
movq 0x192c0(%rip), %rdi     # 0x1c320
addq $0x8, %rdi
leaq 0x15296(%rip), %rsi     # 0x18301
leaq 0x192b6(%rip), %rdx     # 0x1c328
addq $0x8, %rdx
movb $0x0, %al
callq 0x22a0
movl %eax, -0x10(%rbp)
cmpl $0x1, -0x10(%rbp)
je 0x30c1
movq 0x18f63(%rip), %rax     # 0x1bff0
movq (%rax), %rdi
movq 0x19269(%rip), %rdx     # 0x1c300
movq 0x192ca(%rip), %rcx     # 0x1c368
movq 0x1927b(%rip), %r8      # 0x1c320
addq $0x8, %r8
leaq 0x15255(%rip), %rsi     # 0x18305
movb $0x0, %al
callq 0x2240
movl $0x1, %edi
callq 0x23b0
jmp 0x32dd
movq 0x19253(%rip), %rdi     # 0x1c320
leaq 0x15253(%rip), %rsi     # 0x18327
movl $0xb, %edx
callq 0x2070
cmpl $0x0, %eax
jne 0x317e
movq 0x19232(%rip), %rdi     # 0x1c320
movq 0x19223(%rip), %rdx     # 0x1c318
movl $0xa, %esi
callq 0x21d0
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x3111
movq -0x8(%rbp), %rax
movb $0x0, (%rax)
movq 0x19208(%rip), %rdi     # 0x1c320
addq $0xb, %rdi
leaq 0x15210(%rip), %rsi     # 0x18333
leaq 0x191fe(%rip), %rdx     # 0x1c328
addq $0x20, %rdx
movb $0x0, %al
callq 0x22a0
movl %eax, -0x14(%rbp)
cmpl $0x1, -0x14(%rbp)
je 0x3179
movq 0x18eab(%rip), %rax     # 0x1bff0
movq (%rax), %rdi
movq 0x191b1(%rip), %rdx     # 0x1c300
movq 0x19212(%rip), %rcx     # 0x1c368
movq 0x191c3(%rip), %r8      # 0x1c320
addq $0xb, %r8
leaq 0x151ce(%rip), %rsi     # 0x18336
movb $0x0, %al
callq 0x2240
movl $0x1, %edi
callq 0x23b0
jmp 0x32db
movl $0x0, -0x18(%rbp)
movslq -0x18(%rbp), %rcx
leaq 0x190c0(%rip), %rax     # 0x1c250
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, (%rax)
je 0x3235
movq 0x19179(%rip), %rdi     # 0x1c320
movslq -0x18(%rbp), %rcx
leaq 0x1909e(%rip), %rax     # 0x1c250
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
movslq -0x18(%rbp), %rcx
leaq 0x19088(%rip), %rax     # 0x1c250
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movslq 0x10(%rax), %rdx
callq 0x2070
cmpl $0x0, %eax
jne 0x3225
movq 0x1913c(%rip), %rax     # 0x1c320
movslq -0x18(%rbp), %rdx
leaq 0x19061(%rip), %rcx     # 0x1c250
imulq $0x18, %rdx, %rdx
addq %rdx, %rcx
movslq 0x10(%rcx), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x3d, %eax
jne 0x3225
movslq -0x18(%rbp), %rcx
leaq 0x19042(%rip), %rax     # 0x1c250
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
orl 0x19147(%rip), %eax     # 0x1c364
movl %eax, 0x19141(%rip)     # 0x1c364
jmp 0x3235
jmp 0x3227
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x3185
movslq -0x18(%rbp), %rcx
leaq 0x19010(%rip), %rax     # 0x1c250
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, (%rax)
jne 0x32d9
movq 0x190c9(%rip), %rdi     # 0x1c320
movq 0x190ba(%rip), %rdx     # 0x1c318
movl $0x3d, %esi
callq 0x21d0
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x32a3
movq 0x18d76(%rip), %rax     # 0x1bff0
movq (%rax), %rdi
movq 0x1907c(%rip), %rdx     # 0x1c300
movq 0x190dd(%rip), %rcx     # 0x1c368
leaq 0x150c9(%rip), %rsi     # 0x1835b
movb $0x0, %al
callq 0x2240
movl $0x1, %edi
callq 0x23b0
movq -0x8(%rbp), %rax
movb $0x0, (%rax)
movq 0x18d3f(%rip), %rax     # 0x1bff0
movq (%rax), %rdi
movq 0x19045(%rip), %rdx     # 0x1c300
movq 0x190a6(%rip), %rcx     # 0x1c368
movq 0x19057(%rip), %r8      # 0x1c320
leaq 0x150ac(%rip), %rsi     # 0x1837c
movb $0x0, %al
callq 0x2240
jmp 0x32d9
jmp 0x32db
jmp 0x32dd
jmp 0x32df
jmp 0x32e1
jmp 0x32e3
jmp 0x32e5
jmp 0x32e7
jmp 0x32e9
jmp 0x2cd8
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)