// File: /workspace/github_cpp_makefile_star2_O2/jvanns[P]verbatim/sub/lmdb/libraries/liblmdb/mdb_load.c
// Function: readline
static int readline(MDB_val *out, MDB_val *buf)
{
	unsigned char *c1, *c2, *end;
	size_t len, l2;
	int c;

	if (!(mode & NOHDR)) {
		c = fgetc(stdin);
		if (c == EOF) {
			Eof = 1;
			return EOF;
		}
		if (c != ' ') {
			lineno++;
			if (fgets(buf->mv_data, buf->mv_size, stdin) == NULL) {
badend:
				Eof = 1;
				badend();
				return EOF;
			}
			if (c == 'D' && !strncmp(buf->mv_data, "ATA=END", STRLENOF("ATA=END")))
				return EOF;
			goto badend;
		}
	}
	if (fgets(buf->mv_data, buf->mv_size, stdin) == NULL) {
		Eof = 1;
		return EOF;
	}
	lineno++;

	c1 = buf->mv_data;
	len = strlen((char *)c1);
	l2 = len;

	/* Is buffer too short? */
	while (c1[len-1] != '\n') {
		buf->mv_data = realloc(buf->mv_data, buf->mv_size*2);
		if (!buf->mv_data) {
			Eof = 1;
			fprintf(stderr, "%s: line %" Z "d: out of memory, line too long\n",
				prog, lineno);
			return EOF;
		}
		c1 = buf->mv_data;
		c1 += l2;
		if (fgets((char *)c1, buf->mv_size+1, stdin) == NULL) {
			Eof = 1;
			badend();
			return EOF;
		}
		buf->mv_size *= 2;
		len = strlen((char *)c1);
		l2 += len;
	}
	c1 = c2 = buf->mv_data;
	len = l2;
	c1[--len] = '\0';
	end = c1 + len;

	if (mode & PRINT) {
		while (c2 < end) {
			if (*c2 == '\\') {
				if (c2[1] == '\\') {
					c1++; c2 += 2;
				} else {
					if (c2+3 > end || !isxdigit(c2[1]) || !isxdigit(c2[2])) {
						Eof = 1;
						badend();
						return EOF;
					}
					*c1++ = unhex(++c2);
					c2 += 2;
				}
			} else {
				c1++; c2++;
			}
		}
	} else {
		/* odd length not allowed */
		if (len & 1) {
			Eof = 1;
			badend();
			return EOF;
		}
		while (c2 < end) {
			if (!isxdigit(*c2) || !isxdigit(c2[1])) {
				Eof = 1;
				badend();
				return EOF;
			}
			*c1++ = unhex(c2);
			c2 += 2;
		}
	}
	c2 = out->mv_data = buf->mv_data;
	out->mv_size = c1 - c2;

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r15
testb $0x2, 0x103e5(%rip)     # 0x13310
jne 0x2f93
movq 0x10094(%rip), %r14     # 0x12fc8
movq (%r14), %rdi
callq 0x21a0
cmpl $0x20, %eax
je 0x2f93
movl %eax, %ebp
cmpl $-0x1, %eax
je 0x301f
incq 0x10415(%rip)           # 0x13368
movq 0x8(%rbx), %rdi
movl (%rbx), %esi
movq (%r14), %rdx
callq 0x2200
cmpl $0x44, %ebp
jne 0x3103
testq %rax, %rax
je 0x3103
movq 0x8(%rbx), %rdi
leaq 0xb396(%rip), %rsi      # 0xe314
pushq $0x7
popq %rdx
callq 0x2070
testl %eax, %eax
jne 0x3103
jmp 0x310f
movq 0x8(%rbx), %rdi
movl (%rbx), %esi
movq 0x10028(%rip), %r12     # 0x12fc8
movq (%r12), %rdx
callq 0x2200
testq %rax, %rax
je 0x301f
movq %r15, 0x10(%rsp)
incq 0x103ae(%rip)           # 0x13368
movq 0x8(%rbx), %r15
movq %r15, %rdi
callq 0x2110
movq %rax, %rbp
cmpb $0xa, -0x1(%rax,%r15)
movq 0x8(%rbx), %r15
je 0x302b
movq (%rbx), %rsi
addq %rsi, %rsi
movq %r15, %rdi
callq 0x22c0
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x3138
movq %rax, %r15
addq %rbp, %r15
movl (%rbx), %esi
incl %esi
movq (%r12), %rdx
movq %r15, %rdi
callq 0x2200
testq %rax, %rax
je 0x3103
shlq (%rbx)
movq %r15, %rdi
callq 0x2110
addq %rax, %rbp
jmp 0x2fc9
movb $0x1, 0x1033a(%rip)     # 0x13360
jmp 0x310f
leaq (%r15,%rbp), %rax
decq %rax
movb $0x0, (%rax)
testb $0x1, 0x102d4(%rip)     # 0x13310
movq %rax, 0x8(%rsp)
jne 0x309c
decq %rbp
testb $0x1, %bpl
jne 0x3103
movq %r15, %rbp
cmpq %rax, %r15
jae 0x3121
callq 0x2470
movq (%rax), %rax
movzbl (%r15), %ecx
testb $0x10, 0x1(%rax,%rcx,2)
je 0x3103
movzbl 0x1(%r15), %ecx
testb $0x10, 0x1(%rax,%rcx,2)
je 0x3103
movq %r15, %rdi
callq 0x318d
movb %al, (%rbp)
incq %rbp
addq $0x2, %r15
movq 0x8(%rsp), %rax
jmp 0x3053
movq %r15, %rbp
cmpq %rax, %r15
jae 0x3121
leaq 0x1(%r15), %r14
cmpb $0x5c, (%r15)
jne 0x30c1
movzbl (%r14), %r13d
cmpq $0x5c, %r13
jne 0x30c6
addq $0x2, %r15
movq %r15, %r12
jmp 0x30fb
movq %r14, %r12
jmp 0x30fb
leaq 0x3(%r15), %r12
cmpq %rax, %r12
ja 0x3103
callq 0x2470
movq (%rax), %rax
testb $0x10, 0x1(%rax,%r13,2)
je 0x3103
movzbl 0x2(%r15), %ecx
testb $0x10, 0x1(%rax,%rcx,2)
je 0x3103
movq %r14, %rdi
callq 0x318d
movb %al, (%rbp)
movq 0x8(%rsp), %rax
incq %rbp
movq %r12, %r15
jmp 0x309f
movb $0x1, 0x10256(%rip)     # 0x13360
callq 0x3167
pushq $-0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rbx), %rax
movq 0x10(%rsp), %rcx
movq %rax, 0x8(%rcx)
subq %rax, %rbp
movq %rbp, (%rcx)
xorl %eax, %eax
jmp 0x3112
movb $0x1, 0x10221(%rip)     # 0x13360
movq 0xfeb2(%rip), %rax      # 0x12ff8
movq (%rax), %rdi
movq 0x101b0(%rip), %rdx     # 0x13300
movq 0x10211(%rip), %rcx     # 0x13368
leaq 0xb1be(%rip), %rsi      # 0xe31c
xorl %eax, %eax
callq 0x2240
jmp 0x310f