// File: /workspace/github_c_makefile_star2_O0/jarun[P]nnn/src/nnn.c
// Function: parsekvpair
static bool parsekvpair(kv **arr, char **envcpy, const uchar_t id, uchar_t *items)
{
	bool new = TRUE;
	const uchar_t INCR = 8;
	uint_t i = 0;
	kv *kvarr = NULL;
	char *ptr = getenv(env_cfg[id]);

	if (!ptr || !*ptr)
		return TRUE;

	*envcpy = xstrdup(ptr);
	if (!*envcpy) {
		xerror();
		return FALSE;
	}

	ptr = *envcpy;

	while (*ptr && i < 100) {
		if (new) {
			if (!(i & (INCR - 1))) {
				kvarr = xrealloc(kvarr, sizeof(kv) * (i + INCR));
				*arr = kvarr;
				if (!kvarr) {
					xerror();
					return FALSE;
				}
				memset(kvarr + i, 0, sizeof(kv) * INCR);
			}
			kvarr[i].key = (uchar_t)*ptr;
			if (*++ptr != ':' || *++ptr == '\0' || *ptr == ';')
				return FALSE;
			kvarr[i].off = ptr - *envcpy;
			++i;

			new = FALSE;
		}

		if (*ptr == ';') {
			*ptr = '\0';
			new = TRUE;
		}

		++ptr;
	}

	*items = i;
	return (i != 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movb %dl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movb %al, -0x19(%rbp)
movq %rcx, -0x28(%rbp)
movb $0x1, -0x29(%rbp)
movb $0x8, -0x2a(%rbp)
movl $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movzbl -0x19(%rbp), %eax
movl %eax, %ecx
leaq 0x18ab3(%rip), %rax     # 0x1f940
movq (%rax,%rcx,8), %rdi
callq 0x4050
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x6eaa
movq -0x40(%rbp), %rax
cmpb $0x0, (%rax)
jne 0x6eb3
movb $0x1, -0x1(%rbp)
jmp 0x704e
movq -0x40(%rbp), %rdi
callq 0x7190
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x6eeb
movl $0xf85, %edi            # imm = 0xF85
callq 0x5df0
movq %rax, %rdi
callq 0x4750
movb $0x0, -0x1(%rbp)
jmp 0x704e
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x41(%rbp)
je 0x6f11
cmpl $0x64, -0x30(%rbp)
setb %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
testb $0x1, %al
jne 0x6f1d
jmp 0x7037
testb $0x1, -0x29(%rbp)
je 0x700f
movl -0x30(%rbp), %eax
andl $0x7, %eax
cmpl $0x0, %eax
jne 0x6f94
movq -0x38(%rbp), %rdi
movl -0x30(%rbp), %eax
addl $0x8, %eax
movl %eax, %eax
movl %eax, %esi
shlq $0x3, %rsi
callq 0xcb00
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, -0x38(%rbp)
jne 0x6f7a
movl $0xf91, %edi            # imm = 0xF91
callq 0x5df0
movq %rax, %rdi
callq 0x4750
movb $0x0, -0x1(%rbp)
jmp 0x704e
movq -0x38(%rbp), %rdi
movl -0x30(%rbp), %eax
shlq $0x3, %rax
addq %rax, %rdi
xorl %esi, %esi
movl $0x40, %edx
callq 0x4380
movq -0x40(%rbp), %rax
movzbl (%rax), %edx
movq -0x38(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %edx, (%rax,%rcx,8)
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x40(%rbp)
movsbl 0x1(%rax), %eax
cmpl $0x3a, %eax
jne 0x6fe1
movq -0x40(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x40(%rbp)
movsbl 0x1(%rax), %eax
cmpl $0x0, %eax
je 0x6fe1
movq -0x40(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3b, %eax
jne 0x6fe7
movb $0x0, -0x1(%rbp)
jmp 0x704e
movq -0x40(%rbp), %rax
movq -0x18(%rbp), %rcx
movq (%rcx), %rcx
subq %rcx, %rax
movl %eax, %edx
movq -0x38(%rbp), %rax
movl -0x30(%rbp), %ecx
movl %edx, 0x4(%rax,%rcx,8)
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movb $0x0, -0x29(%rbp)
movq -0x40(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3b, %eax
jne 0x7026
movq -0x40(%rbp), %rax
movb $0x0, (%rax)
movb $0x1, -0x29(%rbp)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x6ef6
movl -0x30(%rbp), %eax
movb %al, %cl
movq -0x28(%rbp), %rax
movb %cl, (%rax)
cmpl $0x0, -0x30(%rbp)
setne %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)