// File: /workspace/github_cpp_makefile_star2_O3/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
pushq %rax
movq %rsi, %rbx
movq %rdi, %r15
testb $0x2, 0x1105a(%rip)     # 0x14310
jne 0x3324
movq 0x10d09(%rip), %r14     # 0x13fc8
movq (%r14), %rdi
callq 0x21a0
cmpl $0x20, %eax
je 0x3324
movl %eax, %ebp
cmpl $-0x1, %eax
je 0x3468
incq 0x1108a(%rip)           # 0x14368
movq 0x8(%rbx), %rdi
movl (%rbx), %esi
movq (%r14), %rdx
callq 0x2200
cmpl $0x44, %ebp
jne 0x331a
testq %rax, %rax
je 0x331a
movq 0x8(%rbx), %rdi
leaq 0xc013(%rip), %rsi      # 0xf314
movl $0x7, %edx
callq 0x2070
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
je 0x3523
callq 0x2930
jmp 0x346f
movq 0x8(%rbx), %rdi
movl (%rbx), %esi
movq 0x10c97(%rip), %rbp     # 0x13fc8
movq (%rbp), %rdx
callq 0x2200
testq %rax, %rax
je 0x3468
movq %r15, (%rsp)
incq 0x1101a(%rip)           # 0x14368
movq 0x8(%rbx), %r15
movq %r15, %rdi
callq 0x2110
movq %rax, %r12
cmpb $0xa, -0x1(%r15,%rax)
je 0x33c3
movq (%rbx), %r13
movq 0x8(%rbx), %rdi
addq %r13, %r13
movq %r13, %rsi
callq 0x22b0
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x353c
movq %rax, %r15
addq %r12, %r15
movl (%rbx), %esi
incl %esi
movq (%rbp), %rdx
movq %r15, %rdi
callq 0x2200
testq %rax, %rax
je 0x3546
movq (%rbx), %r13
addq %r13, %r13
movq %r13, (%rbx)
movq %r15, %rdi
callq 0x2110
addq %rax, %r12
cmpb $0xa, -0x1(%r15,%rax)
jne 0x3368
movq 0x8(%rbx), %r15
leaq (%r15,%r12), %r13
decq %r13
decq %r12
movb $0x0, (%r13)
testb $0x1, 0x10f37(%rip)     # 0x14310
jne 0x3479
testb $0x1, %r12b
jne 0x3550
testq %r12, %r12
jle 0x350f
xorl %r12d, %r12d
callq 0x2460
movq (%rax), %rdi
movzbl (%r15,%r12,2), %edx
testb $0x10, 0x1(%rdi,%rdx,2)
je 0x3532
leaq (%r15,%r12,2), %rcx
movzbl 0x1(%rcx), %esi
testb $0x10, 0x1(%rdi,%rsi,2)
je 0x3532
andb $0x4f, %sil
leal -0x37(%rsi), %edi
cmpb $0x40, %sil
movzbl %sil, %esi
movzbl %dil, %edi
cmovbl %esi, %edi
movl %edx, %esi
shlb $0x4, %sil
leal -0x70(%rsi), %r8d
testb $0x40, %dl
movzbl %sil, %edx
movzbl %r8b, %esi
cmovel %edx, %esi
orl %edi, %esi
movb %sil, (%r15,%r12)
incq %r12
addq $0x2, %rcx
cmpq %r13, %rcx
jb 0x33fa
addq %r12, %r15
jmp 0x350f
movb $0x1, 0x10ef1(%rip)     # 0x14360
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x3523
testq %r12, %r12
jle 0x350f
movq %r15, %r12
leaq 0x1(%r12), %r14
cmpb $0x5c, (%r12)
jne 0x3500
movzbl (%r14), %ebp
cmpq $0x5c, %rbp
jne 0x34a4
addq $0x2, %r12
movq %r12, %r14
jmp 0x3500
leaq 0x3(%r12), %r14
cmpq %r13, %r14
ja 0x355a
callq 0x2460
movq (%rax), %rcx
testb $0x10, 0x1(%rcx,%rbp,2)
je 0x355a
movzbl 0x2(%r12), %eax
testb $0x10, 0x1(%rcx,%rax,2)
je 0x355a
andb $0x4f, %al
leal -0x37(%rax), %ecx
cmpb $0x40, %al
movzbl %al, %eax
movzbl %cl, %ecx
cmovbl %eax, %ecx
movl %ebp, %eax
shlb $0x4, %al
leal -0x70(%rax), %edx
testb $0x40, %bpl
movzbl %al, %eax
movzbl %dl, %edx
cmovel %eax, %edx
orl %ecx, %edx
movb %dl, (%r15)
incq %r15
movq %r14, %r12
cmpq %r13, %r14
jb 0x3485
movq 0x8(%rbx), %rax
movq (%rsp), %rcx
movq %rax, 0x8(%rcx)
subq %rax, %r15
movq %r15, (%rcx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x2903
jmp 0x346f
callq 0x287c
jmp 0x346f
callq 0x284f
jmp 0x346f
callq 0x28d6
jmp 0x346f
callq 0x28a9
jmp 0x346f