// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x11412(%rip), %rdi     # 0x14320
movl 0x11404(%rip), %esi     # 0x14318
movq 0x110ad(%rip), %rax     # 0x13fc8
movq (%rax), %rdx
callq 0x2200
testq %rax, %rax
je 0x3261
movq 0x11435(%rip), %r12     # 0x14368
incq %r12
movq %r12, 0x1142b(%rip)     # 0x14368
movq 0x113dc(%rip), %r13     # 0x14320
movl $0x8, %edx
movq %r13, %rdi
leaq 0xc22f(%rip), %rsi      # 0xf182
callq 0x2070
testl %eax, %eax
je 0x3075
movl $0xa, %edx
movq %r13, %rdi
leaq 0xc242(%rip), %rsi      # 0xf1b1
callq 0x2070
testl %eax, %eax
je 0x3261
movl $0x7, %edx
movq %r13, %rdi
leaq 0xc231(%rip), %rsi      # 0xf1bc
callq 0x2070
testl %eax, %eax
je 0x308f
movl $0x9, %edx
movq %r13, %rdi
leaq 0xc252(%rip), %rsi      # 0xf1f9
callq 0x2070
testl %eax, %eax
je 0x30d0
movl $0x5, %edx
movq %r13, %rdi
leaq 0xc240(%rip), %rsi      # 0xf203
callq 0x2070
testl %eax, %eax
je 0x3119
movl $0x8, %edx
movq %r13, %rdi
leaq 0xc253(%rip), %rsi      # 0xf232
callq 0x2070
testl %eax, %eax
je 0x314a
movl $0x8, %edx
movq %r13, %rdi
leaq 0xc265(%rip), %rsi      # 0xf260
callq 0x2070
testl %eax, %eax
je 0x3194
movl $0xb, %edx
movq %r13, %rdi
leaq 0xc278(%rip), %rsi      # 0xf28f
callq 0x2070
testl %eax, %eax
je 0x3217
movl 0x11225(%rip), %r14d    # 0x14250
testl %r14d, %r14d
sete %bl
je 0x31ee
leaq 0x1122a(%rip), %r15     # 0x14268
movq -0x10(%r15), %rsi
movslq -0x8(%r15), %rbp
movq %r13, %rdi
movq %rbp, %rdx
callq 0x2070
testl %eax, %eax
jne 0x3061
cmpb $0x3d, (%r13,%rbp)
je 0x31de
movl (%r15), %r14d
addq $0x18, %r15
testl %r14d, %r14d
sete %bl
jne 0x303e
jmp 0x31ee
addq $0x8, %r13
movq %r13, %rdi
callq 0x2380
cmpl $0x4, %eax
jl 0x2f07
jmp 0x3270
addq $0x7, %r13
movl $0x5, %edx
movq %r13, %rdi
leaq 0xc122(%rip), %rsi      # 0xf1c4
callq 0x2070
testl %eax, %eax
je 0x313e
movl $0x9, %edx
movq %r13, %rdi
leaq 0xc10c(%rip), %rsi      # 0xf1ca
callq 0x2070
testl %eax, %eax
je 0x2f07
jmp 0x327a
movq 0x11241(%rip), %rdx     # 0x14318
movq %r13, %rdi
movl $0xa, %esi
callq 0x21d0
testq %rax, %rax
je 0x30ec
movb $0x0, (%rax)
movq 0x11215(%rip), %rdi     # 0x14308
testq %rdi, %rdi
je 0x30fd
callq 0x2030
movq 0x1121c(%rip), %rdi     # 0x14320
addq $0x9, %rdi
callq 0x23f0
movq %rax, 0x111f4(%rip)     # 0x14308
jmp 0x2f07
addq $0x5, %r13
movl $0x5, %edx
movq %r13, %rdi
leaq 0xc0dd(%rip), %rsi      # 0xf209
callq 0x2070
testl %eax, %eax
je 0x2f07
jmp 0x328d
orb $0x1, 0x111cb(%rip)     # 0x14310
jmp 0x2f07
movq 0x111c7(%rip), %rdx     # 0x14318
movq %r13, %rdi
movl $0xa, %esi
callq 0x21d0
testq %rax, %rax
je 0x3166
movb $0x0, (%rax)
movq 0x111b3(%rip), %rdi     # 0x14320
addq $0x8, %rdi
leaq 0xc0c3(%rip), %rsi      # 0xf23b
leaq 0x111a9(%rip), %rdx     # 0x14328
xorl %eax, %eax
callq 0x22a0
cmpl $0x1, %eax
je 0x2f07
jmp 0x3298
movq 0x1117d(%rip), %rdx     # 0x14318
movq %r13, %rdi
movl $0xa, %esi
callq 0x21d0
testq %rax, %rax
je 0x31b0
movb $0x0, (%rax)
movq 0x11169(%rip), %rdi     # 0x14320
addq $0x8, %rdi
leaq 0xc0a7(%rip), %rsi      # 0xf269
leaq 0x11167(%rip), %rdx     # 0x14330
xorl %eax, %eax
callq 0x22a0
cmpl $0x1, %eax
je 0x2f07
jmp 0x329d
orl %r14d, 0x1117f(%rip)    # 0x14364
testb $0x1, %bl
je 0x2f07
movq 0x11123(%rip), %rdx     # 0x14318
movq %r13, %rdi
movl $0x3d, %esi
callq 0x21d0
testq %rax, %rax
je 0x3285
movq %rax, %rdi
movq %r12, %rsi
callq 0x272b
jmp 0x2f07
movq 0x110fa(%rip), %rdx     # 0x14318
movq %r13, %rdi
movl $0xa, %esi
callq 0x21d0
testq %rax, %rax
je 0x3233
movb $0x0, (%rax)
movq 0x110e6(%rip), %rdi     # 0x14320
addq $0xb, %rdi
leaq 0xc056(%rip), %rsi      # 0xf29b
leaq 0x110fc(%rip), %rdx     # 0x14348
xorl %eax, %eax
callq 0x22a0
cmpl $0x1, %eax
je 0x2f07
callq 0x2782
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
movl %eax, %esi
callq 0x288c
movq %r12, %rdi
movq %r13, %rsi
callq 0x285e
movq %r12, %rdi
callq 0x2757
movq %r12, %rdi
movq %r13, %rsi
callq 0x2830
callq 0x27f6
callq 0x27bc