// File: /workspace/github_c_makefile_star2_O2/s3lase[P]v6shell/osh.c
// Function: glob
static const char **
glob(enum sbikey key, char **av)
{
	char *gp, **sav;
	const char **gav;	/* points to generated argument vector */
	int pmc = 0;		/* pattern-match count                 */
	bool gerr = false;	/* glob error flag                     */

	gavtot = 0;

	sav  = av;
	gav  = xmalloc(GAVNEW * sizeof(char *));
	*gav = NULL, gavp = gav;
	gave = &gav[GAVNEW - 1];
	while (*av != NULL) {
		if ((gp = gtrim(UCPTR(*av))) == NULL) {
			gerr = true;
			break;
		}
		gav = glob1(key, gav, gp, &pmc, &gerr);
		if (gerr)
			break;
		av++;
	}
	gavp = NULL;

	if (pmc == 0 && !gerr) {
		err(-2, FMT2S, getmyname(), ERR_NOMATCH);
		gerr = true;
	}
	if (gerr)
		vfree((char **)gav);
	vfree(sav);

	return gerr ? NULL : gav;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1048, %rsp           # imm = 0x1048
movq %rsi, %r14
movl %edi, %ebx
andq $0x0, 0xbe16(%rip)      # 0x11310
movl $0x400, %edi            # imm = 0x400
callq 0x4f10
movq %rax, %rbp
andq $0x0, (%rax)
movq %rax, 0xbe06(%rip)      # 0x11318
addq $0x3f8, %rax            # imm = 0x3F8
movq %rax, 0xbe01(%rip)      # 0x11320
addl $-0x4, %ebx
movl %ebx, 0x24(%rsp)
movq $0x0, 0x18(%rsp)
movabsq $0xe00000020000921, %rbx # imm = 0xE00000020000921
movq %r14, %rax
movq (%rax), %r13
testq %r13, %r13
setne %r15b
je 0x590b
movq %rax, 0x28(%rsp)
movb $0x0, 0x40(%rsp)
movq %r13, %rax
xorl %r12d, %r12d
cmpq $0xfff, %r12            # imm = 0xFFF
jg 0x589f
movzbl (%rax), %ecx
cmpl $0x22, %ecx
je 0x558b
cmpl $0x27, %ecx
je 0x558b
cmpl $0x5c, %ecx
je 0x55dd
testl %ecx, %ecx
je 0x5626
movq %rax, %rdx
jmp 0x560d
incq %rax
movb (%rax), %dl
cmpb %cl, %dl
je 0x5618
cmpq $0xfff, %r12            # imm = 0xFFF
jg 0x5618
movzbl %dl, %esi
leal -0x22(%rsi), %edi
cmpl $0x3b, %edi
ja 0x55d4
btq %rdi, %rbx
jae 0x55d4
movb $0x5c, 0x40(%rsp,%r12)
cmpq $0xffe, %r12            # imm = 0xFFE
jg 0x589f
incq %r12
movb (%rax), %dl
movb %dl, 0x40(%rsp,%r12)
incq %r12
jmp 0x558b
testl %esi, %esi
jne 0x55ca
jmp 0x589f
leaq 0x1(%rax), %rdx
movb 0x1(%rax), %cl
movzbl %cl, %esi
leal -0x22(%rsi), %edi
cmpl $0x3b, %edi
ja 0x5620
btq %rdi, %rbx
jae 0x5620
movb $0x5c, 0x40(%rsp,%r12)
cmpq $0xfff, %r12            # imm = 0xFFF
je 0x589f
incq %r12
movb (%rdx), %cl
movb %cl, 0x40(%rsp,%r12)
incq %r12
movq %rdx, %rax
incq %rax
jmp 0x555c
testl %esi, %esi
je 0x5618
jmp 0x560d
movb $0x0, 0x40(%rsp,%r12)
incq %r12
movq %r13, %rdi
callq 0x2130
incq %rax
cmpq %rax, %r12
jbe 0x5652
movq %r13, %rdi
callq 0x2050
movq %r12, %rdi
callq 0x4f10
movq %rax, %r13
movq %r13, %rdi
leaq 0x40(%rsp), %rsi
movq %r12, %rdx
callq 0x22a0
testq %r13, %r13
je 0x590e
movq %r13, %rdi
callq 0x5ac2
testq %rax, %rax
je 0x56b1
cmpq %r13, %rax
je 0x5704
leaq -0x1(%rax), %rcx
cmpb $0x2f, -0x1(%rax)
movq %rcx, %rax
jne 0x5678
movb $0x0, (%rcx)
cmpq %r13, %rcx
setne %al
movl %eax, 0x8(%rsp)
movq %r13, %rsi
leaq 0x2ce5(%rip), %rax      # 0x838a
cmoveq %rax, %rsi
incq %rcx
movq %rcx, %r13
jmp 0x5713
movq %rbp, %rdi
callq 0x5b21
movq %rax, %rbp
cmpl $-0x3, 0x24(%rsp)
ja 0x56cb
movq %r13, %rdi
callq 0x5bd6
movq %r13, %rdi
leaq 0x2bfe(%rip), %rsi      # 0x82d3
xorl %edx, %edx
callq 0x5c9f
testq %rax, %rax
je 0x58dc
movq 0xbc2c(%rip), %rcx      # 0x11318
leaq 0x8(%rcx), %rdx
movq %rdx, 0xbc21(%rip)      # 0x11318
movq %rax, (%rcx)
andq $0x0, 0x8(%rcx)
jmp 0x5891
movl $0x0, 0x8(%rsp)
leaq 0x2bc0(%rip), %rsi      # 0x82d3
cmpb $0x0, (%rsi)
movq %rsi, %rax
leaq 0x30da(%rip), %rcx      # 0x87fa
cmoveq %rcx, %rax
movb $0x0, 0x40(%rsp)
xorl %ecx, %ecx
cmpq $0x1000, %rcx           # imm = 0x1000
je 0x594c
movb (%rax,%rcx), %dl
movb %dl, 0x40(%rsp,%rcx)
testb %dl, %dl
je 0x5748
incq %rcx
jmp 0x572b
leaq 0x40(%rsp), %r15
movq %rsi, %r12
movq %r15, %rdi
callq 0x5bd6
movq %r15, %rdi
callq 0x2110
testq %rax, %rax
je 0x594c
movq %r12, %rcx
movq %rax, %r12
cmpb $0x0, (%rcx)
leaq 0x40(%rsp), %rax
cmovneq %rax, %rcx
movq %rcx, 0x10(%rsp)
movq 0xbb91(%rip), %rax      # 0x11318
subq %rbp, %rax
sarq $0x3, %rax
movq %rax, 0x38(%rsp)
movq %r12, %rdi
callq 0x22c0
testq %rax, %rax
je 0x580c
movq %rax, %r15
cmpb $0x2e, 0x13(%rax)
jne 0x57b0
cmpb $0x2e, (%r13)
jne 0x5793
addq $0x13, %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0x5d9c
testb %al, %al
je 0x5793
movq %rbp, %rdi
callq 0x5b21
movq %rax, %rbp
movzbl 0x8(%rsp), %edx
movq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x5c9f
testq %rax, %rax
je 0x596a
movq 0xbb28(%rip), %rcx      # 0x11318
leaq 0x8(%rcx), %rdx
movq %rdx, 0xbb1d(%rip)      # 0x11318
movq %rax, (%rcx)
movq 0x18(%rsp), %rax
incl %eax
movq %rax, 0x18(%rsp)
jmp 0x5793
movq %r14, 0x10(%rsp)
movq %r12, %rdi
callq 0x21f0
movq %rbp, %rax
movq 0x38(%rsp), %rcx
leaq (%rbp,%rcx,8), %rbp
movq 0xbaeb(%rip), %r13      # 0x11318
movq %rax, 0x30(%rsp)
leaq (%rax,%rcx,8), %r14
addq $0x8, %r14
movq %r13, %rax
subq %rbp, %rax
cmpq $0x9, %rax
jl 0x5882
movq %r14, 0x8(%rsp)
cmpq %r13, %r14
jae 0x5873
movq (%rbp), %r15
movq (%r14), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x2230
testl %eax, %eax
jle 0x586d
movq %r12, (%rbp)
movq %r15, (%r14)
addq $0x8, %r14
jmp 0x584b
addq $0x8, %rbp
movq 0x8(%rsp), %r14
addq $0x8, %r14
jmp 0x583a
andq $0x0, (%r13)
movq 0x10(%rsp), %r14
movq 0x30(%rsp), %rbp
movq 0x28(%rsp), %rax
addq $0x8, %rax
jmp 0x553c
callq 0x6455
movq %rax, %r15
movq %r13, %rdi
callq 0x5ac2
testq %rax, %rax
je 0x58bd
leaq 0x2abe(%rip), %rcx      # 0x8379
jmp 0x58c8
pushq $0x24
popq %rdi
callq 0x2380
movq %rax, %rcx
leaq 0x2a6e(%rip), %rsi      # 0x833d
pushq $-0x2
popq %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x6218
andq $0x0, 0xba34(%rip)      # 0x11318
movq %rbp, %rdi
callq 0x54a6
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x54a6
movq %rbp, %rax
addq $0x1048, %rsp           # imm = 0x1048
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
andq $0x0, 0xba02(%rip)      # 0x11318
cmpl $0x0, 0x18(%rsp)
setne %al
orb %r15b, %al
je 0x592a
testb %r15b, %r15b
jne 0x58e4
jmp 0x58ee
callq 0x6455
leaq 0x2a07(%rip), %rsi      # 0x833d
leaq 0x2a33(%rip), %rcx      # 0x8370
pushq $-0x2
popq %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x6218
jmp 0x58e4
callq 0x6455
leaq 0x29e5(%rip), %rsi      # 0x833d
leaq 0x2a2d(%rip), %rcx      # 0x838c
pushq $-0x2
popq %rdi
movq %rax, %rdx
jmp 0x58d5
movq %r12, %rdi
callq 0x21f0
jmp 0x58dc