// File: /workspace/github_c_makefile_star2_O3/rakitzis[P]rc/glob.c
// Function: doglob
static List *doglob(char *w, char *m) {
	static char *dir = NULL, *pattern = NULL, *metadir = NULL, *metapattern = NULL;
	static size_t dsize = 0;
	char *d, *p, *md, *mp;
	size_t psize;
	char *s = w;
	List firstdir;
	List *matched;
	if ((psize = strlen(w) + 1) > dsize || dir == NULL) {
		efree(dir); efree(pattern); efree(metadir); efree(metapattern);
		dir = ealloc(psize);
		pattern = ealloc(psize);
		metadir = ealloc(psize);
		metapattern = ealloc(psize);
		dsize = psize;
	}
	d = dir;
	p = pattern;
	md = metadir;
	mp = metapattern;
	while (*s != '/' && *s != '\0') {
		*d++ = *s++; /* get first directory component */
		*md++ = *m++;
	}
	*d = '\0';
	/*
	   Special case: no slashes in the pattern, i.e., open the current directory.
	   Remember that w cannot consist of slashes alone (the other way *s could be
	   zero) since doglob gets called iff there's a metacharacter to be matched
	*/
	if (*s == '\0') {
		matched = dmatch(".", dir, metadir);
		goto end;
	}
	if (*w == '/') {
		firstdir.w = dir;
		firstdir.m = metadir;
		firstdir.n = NULL;
		matched = &firstdir;
	} else {
		/*
		   we must glob against current directory,
		   since the first character is not a slash.
		*/
		matched = dmatch(".", dir, metadir);
	}
	do {
		size_t slashcount;
		sigchk();
		for (slashcount = 0; *s == '/'; s++, m++)
			slashcount++; /* skip slashes */
		while (*s != '/' && *s != '\0')
			*p++ = *s++, *mp++ = *m++; /* get pattern */
		*p = '\0';
		matched = lglob(matched, pattern, metapattern, slashcount);
		p = pattern, mp = metapattern;
	} while (*s != '\0');
end:	if (matched == NULL) {
		matched = nnew(List);
		matched->w = w;
		matched->m = NULL;
		matched->n = NULL;
	}
	return matched;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, (%rsp)
movq %rdi, %r15
callq 0x30f0
movq %rax, %rbx
incq %rbx
cmpq 0x13878(%rip), %rbx     # 0x19a00
seta %al
movq 0x1384e(%rip), %rsi     # 0x199e0
testq %rsi, %rsi
sete %cl
orb %al, %cl
je 0x6217
movq %rsi, %rdi
callq 0x9fde
movq 0x1383d(%rip), %rdi     # 0x199e8
callq 0x9fde
movq 0x13839(%rip), %rdi     # 0x199f0
callq 0x9fde
movq 0x13835(%rip), %rdi     # 0x199f8
callq 0x9fde
movq %rbx, %rdi
callq 0xa00d
movq %rax, 0x13809(%rip)     # 0x199e0
movq %rbx, %rdi
callq 0xa00d
movq %rax, 0x13802(%rip)     # 0x199e8
movq %rbx, %rdi
callq 0xa00d
movq %rax, 0x137fb(%rip)     # 0x199f0
movq %rbx, %rdi
callq 0xa00d
movq %rax, %rbp
movq %rax, 0x137f1(%rip)     # 0x199f8
movq %rbx, 0x137f2(%rip)     # 0x19a00
movq 0x137cb(%rip), %rsi     # 0x199e0
jmp 0x621e
movq 0x137da(%rip), %rbp     # 0x199f8
movq 0x137c3(%rip), %rbx     # 0x199e8
movq 0x137c4(%rip), %rdx     # 0x199f0
xorl %r14d, %r14d
movzbl (%r15,%r14), %eax
testl %eax, %eax
je 0x6252
cmpl $0x2f, %eax
je 0x6252
movb %al, (%rsi,%r14)
movq (%rsp), %rax
movb (%rax,%r14), %al
movb %al, (%rdx,%r14)
incq %r14
jmp 0x622f
movb $0x0, (%rsi,%r14)
cmpb $0x0, (%r15,%r14)
movq %r15, 0x10(%rsp)
je 0x6282
cmpb $0x2f, (%r15)
jne 0x6296
leaq 0x30(%rsp), %r12
movq %rsi, (%r12)
movq %rdx, 0x8(%r12)
movq $0x0, 0x10(%r12)
jmp 0x62a5
leaq 0x8e25(%rip), %rdi      # 0xf0ae
callq 0x6448
movq %rax, %rcx
jmp 0x6415
leaq 0x8e11(%rip), %rdi      # 0xf0ae
callq 0x6448
movq %rax, %r12
addq %r14, %r15
addq %r14, (%rsp)
callq 0xb9f9
movb (%r15), %al
xorl %r14d, %r14d
cmpb $0x2f, %al
jne 0x62ce
movb 0x1(%r15,%r14), %al
incq %r14
cmpb $0x2f, %al
je 0x62bb
addq %r14, %r15
addq %r14, (%rsp)
xorl %r13d, %r13d
testb %al, %al
je 0x62f8
movzbl %al, %ecx
cmpl $0x2f, %ecx
je 0x62f8
movb %al, (%rbx,%r13)
movq (%rsp), %rax
movb (%rax,%r13), %al
movb %al, (%rbp,%r13)
movb 0x1(%r15,%r13), %al
incq %r13
jmp 0x62d1
movb $0x0, (%rbx,%r13)
movq 0x136e4(%rip), %rbp     # 0x199e8
movq 0x136ed(%rip), %rbx     # 0x199f8
leaq 0x1(%r14), %rsi
movq 0x13792(%rip), %rax     # 0x19aa8
cmpq 0x137a3(%rip), %rsi     # 0x19ac0
jbe 0x6338
addq %rsi, %rsi
movq %rsi, 0x13797(%rip)     # 0x19ac0
movq %rax, %rdi
callq 0xa05a
movq %rax, 0x13770(%rip)     # 0x19aa8
movb $0x0, (%rax,%r14)
testq %r14, %r14
je 0x6354
movq 0x1375f(%rip), %rax     # 0x19aa8
movb $0x2f, -0x1(%rax,%r14)
decq %r14
jne 0x6342
testq %r12, %r12
jne 0x6367
movq $0x0, 0x8(%rsp)
jmp 0x63ee
movq $0x0, 0x8(%rsp)
xorl %r14d, %r14d
movq (%r12), %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0x6448
testq %rax, %rax
je 0x63e4
movq (%r12), %rcx
movq %rcx, 0x18(%rsp)
leaq 0x20(%rsp), %rdx
xorps %xmm0, %xmm0
movups %xmm0, (%rdx)
cmpb $0x2f, (%rcx)
jne 0x63a6
cmpb $0x0, 0x1(%rcx)
je 0x63b5
leaq 0x136fb(%rip), %rdi     # 0x19aa8
movq %rax, %rsi
callq 0x66ee
leaq 0x18(%rsp), %rdi
movq %rax, %rsi
callq 0x66ee
testq %r14, %r14
je 0x63cd
movq %rax, 0x10(%r14)
jmp 0x63d5
movq %rax, %r14
movq %rax, 0x8(%rsp)
movq %r14, %rax
movq %rax, %r14
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x63d8
movq 0x10(%r12), %r12
testq %r12, %r12
jne 0x6373
addq %r13, (%rsp)
addq %r13, %r15
movq 0x135ec(%rip), %rbx     # 0x199e8
movq 0x135f5(%rip), %rbp     # 0x199f8
cmpb $0x0, (%r15)
movq 0x8(%rsp), %rcx
movq %rcx, %r12
jne 0x62ac
testq %rcx, %rcx
jne 0x6436
movl $0x18, %edi
callq 0x9e80
movq %rax, %rcx
movq 0x10(%rsp), %rax
movq %rax, (%rcx)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rcx)
movq %rcx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq