// File: /workspace/github_c_makefile_star2_O0/s3lase[P]v6shell/osh.c
// Function: glob1
static const char **
glob1(enum sbikey key, const char **gav, char *as, int *pmc, bool *gerr)
{
	DIR *dirp;
	struct dirent *entry;
	ptrdiff_t gidx;
	bool slash;
	char dirbuf[PATHMAX], *p, *ps;
	const char *ds;

	ds = as;
	slash = false;
	if ((ps = gchar(as)) == NULL) {
		gav = gnew(gav);
		if (DO_TRIM(key))
			(void)atrim(UCPTR(as));
		if ((p = gcat(as, "", slash)) == NULL) {
			*gerr = true;
			return gav;
		}
		*gavp++ = p;
		*gavp = NULL;
		return gav;
	}
	for (;;) {
		if (ps == ds) {
			ds = "";
			break;
		}
		if (*--ps == SLASH) {
			*ps = EOS;
			if (ds == ps)
				ds = "/";
			else
				slash = true;
			ps++;
			break;
		}
	}
	if ((dirp = gopendir(dirbuf, *ds != EOS ? ds : ".")) == NULL) {
		err(-2, FMT2S, getmyname(), ERR_NODIR);
		*gerr = true;
		return gav;
	}
	if (*ds != EOS)
		ds = dirbuf;
	gidx = (ptrdiff_t)(gavp - gav);
	while ((entry = readdir(dirp)) != NULL) {
		if (entry->d_name[0] == DOT && *ps != DOT)
			continue;
		if (glob2(UCPTR(entry->d_name), UCPTR(ps))) {
			gav = gnew(gav);
			if ((p = gcat(ds, entry->d_name, slash)) == NULL) {
				(void)closedir(dirp);
				*gerr = true;
				return gav;
			}
			*gavp++ = p;
			(*pmc)++;
		}
	}
	(void)closedir(dirp);
	gsort(gav + gidx);
	*gavp = NULL;
	*gerr = false;
	return gav;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1080, %rsp           # imm = 0x1080
movl %edi, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x1068(%rbp)
movb $0x0, -0x49(%rbp)
movq -0x20(%rbp), %rdi
callq 0x6600
movq %rax, -0x1060(%rbp)
cmpq $0x0, %rax
jne 0x6bfc
movq -0x18(%rbp), %rdi
callq 0x6e60
movq %rax, -0x18(%rbp)
cmpl $0x2, -0xc(%rbp)
je 0x6b89
cmpl $0x3, -0xc(%rbp)
je 0x6b89
movq -0x20(%rbp), %rdi
callq 0x6f20
movq -0x20(%rbp), %rdi
movb -0x49(%rbp), %al
leaq 0x4ba0(%rip), %rsi      # 0xb737
andb $0x1, %al
movzbl %al, %edx
callq 0x71b0
movq %rax, -0x1058(%rbp)
cmpq $0x0, %rax
jne 0x6bc2
movq -0x30(%rbp), %rax
movb $0x1, (%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6e4e
movq -0x1058(%rbp), %rcx
movq 0xc748(%rip), %rax      # 0x13318
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0xc73a(%rip)      # 0x13318
movq %rcx, (%rax)
movq 0xc730(%rip), %rax      # 0x13318
movq $0x0, (%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6e4e
jmp 0x6bfe
movq -0x1060(%rbp), %rax
cmpq -0x1068(%rbp), %rax
jne 0x6c1e
leaq 0x4b22(%rip), %rax      # 0xb737
movq %rax, -0x1068(%rbp)
jmp 0x6c83
movq -0x1060(%rbp), %rax
movq %rax, %rcx
addq $-0x1, %rcx
movq %rcx, -0x1060(%rbp)
movsbl -0x1(%rax), %eax
cmpl $0x2f, %eax
jne 0x6c7e
movq -0x1060(%rbp), %rax
movb $0x0, (%rax)
movq -0x1068(%rbp), %rax
cmpq -0x1060(%rbp), %rax
jne 0x6c66
leaq 0x4b91(%rip), %rax      # 0xb7ee
movq %rax, -0x1068(%rbp)
jmp 0x6c6a
movb $0x1, -0x49(%rbp)
movq -0x1060(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1060(%rbp)
jmp 0x6c83
jmp 0x6bfe
leaq -0x1050(%rbp), %rax
movq %rax, -0x1070(%rbp)
movq -0x1068(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x6cb0
movq -0x1068(%rbp), %rax
movq %rax, -0x1078(%rbp)
jmp 0x6cc0
leaq 0x4fc6(%rip), %rax      # 0xbc7d
movq %rax, -0x1078(%rbp)
jmp 0x6cc0
movq -0x1070(%rbp), %rdi
movq -0x1078(%rbp), %rsi
callq 0x7410
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
jne 0x6d13
callq 0x8df0
movq %rax, %rdx
movl $0xfffffffe, %edi       # imm = 0xFFFFFFFE
leaq 0x4ab0(%rip), %rsi      # 0xb7a1
leaq 0x4af8(%rip), %rcx      # 0xb7f0
movb $0x0, %al
callq 0x8af0
movq -0x30(%rbp), %rax
movb $0x1, (%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6e4e
movq -0x1068(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x6d30
leaq -0x1050(%rbp), %rax
movq %rax, -0x1068(%rbp)
movq 0xc5e1(%rip), %rax      # 0x13318
movq -0x18(%rbp), %rcx
subq %rcx, %rax
sarq $0x3, %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rdi
callq 0x22c0
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0x6e14
movq -0x40(%rbp), %rax
movsbl 0x13(%rax), %eax
cmpl $0x2e, %eax
jne 0x6d7b
movq -0x1060(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2e, %eax
je 0x6d7b
jmp 0x6d46
movq -0x40(%rbp), %rdi
addq $0x13, %rdi
movq -0x1060(%rbp), %rsi
callq 0x74c0
testb $0x1, %al
jne 0x6d95
jmp 0x6e0f
movq -0x18(%rbp), %rdi
callq 0x6e60
movq %rax, -0x18(%rbp)
movq -0x1068(%rbp), %rdi
movq -0x40(%rbp), %rsi
addq $0x13, %rsi
movb -0x49(%rbp), %al
andb $0x1, %al
movzbl %al, %edx
callq 0x71b0
movq %rax, -0x1058(%rbp)
cmpq $0x0, %rax
jne 0x6de5
movq -0x38(%rbp), %rdi
callq 0x21f0
movq -0x30(%rbp), %rax
movb $0x1, (%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6e4e
movq -0x1058(%rbp), %rcx
movq 0xc525(%rip), %rax      # 0x13318
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0xc517(%rip)      # 0x13318
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
jmp 0x6d46
movq -0x38(%rbp), %rdi
callq 0x21f0
movq -0x18(%rbp), %rdi
movq -0x48(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
callq 0x77f0
movq 0xc4e0(%rip), %rax      # 0x13318
movq $0x0, (%rax)
movq -0x30(%rbp), %rax
movb $0x0, (%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x1080, %rsp           # imm = 0x1080
popq %rbp
retq
nopl (%rax,%rax)