// File: 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
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl 0x18ffa(%rip), %eax     # 0x1c310
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x33e3
movq 0x18c97(%rip), %rax     # 0x1bfc0
movq (%rax), %rdi
callq 0x21a0
movl %eax, -0x44(%rbp)
cmpl $-0x1, -0x44(%rbp)
jne 0x3350
movl $0x1, 0x1901c(%rip)     # 0x1c360
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x379d
cmpl $0x20, -0x44(%rbp)
je 0x33e1
movq 0x19007(%rip), %rax     # 0x1c368
addq $0x1, %rax
movq %rax, 0x18ffc(%rip)     # 0x1c368
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rax
movl %eax, %esi
movq 0x18c3c(%rip), %rax     # 0x1bfc0
movq (%rax), %rdx
callq 0x2200
cmpq $0x0, %rax
jne 0x33af
jmp 0x3394
movl $0x1, 0x18fc2(%rip)     # 0x1c360
callq 0x37b0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x379d
cmpl $0x44, -0x44(%rbp)
jne 0x33df
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x14fe8(%rip), %rsi     # 0x183ac
movl $0x7, %edx
callq 0x2070
cmpl $0x0, %eax
jne 0x33df
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x379d
jmp 0x3394
jmp 0x33e3
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rax
movl %eax, %esi
movq 0x18bc5(%rip), %rax     # 0x1bfc0
movq (%rax), %rdx
callq 0x2200
cmpq $0x0, %rax
jne 0x341f
movl $0x1, 0x18f4d(%rip)     # 0x1c360
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x379d
movq 0x18f42(%rip), %rax     # 0x1c368
addq $0x1, %rax
movq %rax, 0x18f37(%rip)     # 0x1c368
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x2100
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq -0x38(%rbp), %rcx
subq $0x1, %rcx
movzbl (%rax,%rcx), %eax
cmpl $0xa, %eax
je 0x3558
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rsi
shlq %rsi
callq 0x22b0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x34d4
movl $0x1, 0x18ebe(%rip)     # 0x1c360
movq 0x18b47(%rip), %rax     # 0x1bff0
movq (%rax), %rdi
movq 0x18e4d(%rip), %rdx     # 0x1c300
movq 0x18eae(%rip), %rcx     # 0x1c368
leaq 0x14ef3(%rip), %rsi     # 0x183b4
movb $0x0, %al
callq 0x2240
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x379d
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x40(%rbp), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rax
movq (%rax), %rax
addq $0x1, %rax
movl %eax, %esi
movq 0x18abc(%rip), %rax     # 0x1bfc0
movq (%rax), %rdx
callq 0x2200
cmpq $0x0, %rax
jne 0x352d
movl $0x1, 0x18e44(%rip)     # 0x1c360
callq 0x37b0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x379d
movq -0x18(%rbp), %rax
movq (%rax), %rcx
shlq %rcx
movq %rcx, (%rax)
movq -0x20(%rbp), %rdi
callq 0x2100
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
addq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0x3452
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq %rax, -0x20(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rcx, %rdx
addq $-0x1, %rdx
movq %rdx, -0x38(%rbp)
movb $0x0, -0x1(%rax,%rcx)
movq -0x20(%rbp), %rax
addq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
movl 0x18d76(%rip), %eax     # 0x1c310
andl $0x1, %eax
cmpl $0x0, %eax
je 0x36af
jmp 0x35a8
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x36aa
movq -0x28(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x5c, %eax
jne 0x368d
movq -0x28(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x5c, %eax
jne 0x35f0
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x28(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x28(%rbp)
jmp 0x368b
movq -0x28(%rbp), %rax
addq $0x3, %rax
cmpq -0x30(%rbp), %rax
ja 0x3640
callq 0x2460
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x3640
callq 0x2460
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
jne 0x365b
movl $0x1, 0x18d16(%rip)     # 0x1c360
callq 0x37b0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x379d
movq -0x28(%rbp), %rdi
addq $0x1, %rdi
movq %rdi, -0x28(%rbp)
callq 0x37e0
movb %al, %cl
movq -0x20(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
movb %cl, (%rax)
movq -0x28(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x28(%rbp)
jmp 0x36a5
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x35a8
jmp 0x3770
movq -0x38(%rbp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x36d8
movl $0x1, 0x18c99(%rip)     # 0x1c360
callq 0x37b0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x379d
jmp 0x36da
movq -0x28(%rbp), %rax
cmpq -0x30(%rbp), %rax
jae 0x376e
callq 0x2460
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movzbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
je 0x3729
callq 0x2460
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movzbl 0x1(%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x1000, %eax           # imm = 0x1000
cmpl $0x0, %eax
jne 0x3741
movl $0x1, 0x18c2d(%rip)     # 0x1c360
callq 0x37b0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x379d
movq -0x28(%rbp), %rdi
callq 0x37e0
movb %al, %cl
movq -0x20(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x20(%rbp)
movb %cl, (%rax)
movq -0x28(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x28(%rbp)
jmp 0x36da
jmp 0x3770
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
movq %rax, 0x8(%rcx)
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %rax
subq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)