// File: /workspace/github_c_makefile_star2_O1/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 $0x1038, %rsp           # imm = 0x1038
movq %rsi, %r14
movl %edi, %ebp
xorl %ebx, %ebx
movq %rbx, 0xc811(%rip)      # 0x11310
movl $0x400, %edi            # imm = 0x400
callq 0x42ee
movq %rax, %r15
movq %rbx, (%rax)
movq %rax, 0xc802(%rip)      # 0x11318
addq $0x3f8, %rax            # imm = 0x3F8
movq %rax, 0xc7fd(%rip)      # 0x11320
movq (%r14), %r13
testq %r13, %r13
movq %r14, 0x20(%rsp)
je 0x4f4f
addl $-0x4, %ebp
movl %ebp, 0x1c(%rsp)
movabsq $0xe00000020000921, %r12 # imm = 0xE00000020000921
xorl %ebp, %ebp
movl $0x0, 0xc(%rsp)
movb $0x0, 0x30(%rsp)
xorl %ebx, %ebx
movq %r13, %rax
movb (%rax), %cl
movzbl %cl, %edx
cmpl $0x26, %edx
jle 0x4ba6
cmpl $0x27, %edx
je 0x4bab
cmpl $0x5c, %edx
jne 0x4c1e
leaq 0x1(%rax), %rcx
movzbl 0x1(%rax), %edx
leal -0x22(%rdx), %esi
cmpl $0x3b, %esi
ja 0x4c3f
btq %rsi, %r12
jae 0x4c3f
movb $0x5c, 0x30(%rsp,%rbx)
cmpq $0xfff, %rbx            # imm = 0xFFF
je 0x4c45
incq %rbx
jmp 0x4c21
cmpl $0x22, %edx
jne 0x4c16
leaq 0x1(%rax), %rdx
cmpq $0xfff, %rbx            # imm = 0xFFF
jg 0x4c11
movb 0x1(%rax), %sil
cmpb %cl, %sil
je 0x4c11
movzbl %sil, %eax
leal -0x22(%rax), %esi
cmpl $0x3b, %esi
ja 0x4c0b
btq %rsi, %r12
jae 0x4c0b
movb $0x5c, 0x30(%rsp,%rbx)
cmpq $0xffe, %rbx            # imm = 0xFFE
jg 0x4c45
incq %rbx
movq %rbx, %rsi
movb (%rdx), %al
movb %al, 0x30(%rsp,%rbx)
incq %rbx
leaq 0x1(%rdx), %rax
cmpq $0xffe, %rsi            # imm = 0xFFE
jg 0x4c2d
movb 0x1(%rdx), %sil
movq %rax, %rdx
cmpb %cl, %sil
jne 0x4bc1
jmp 0x4c2d
testl %eax, %eax
jne 0x4be4
jmp 0x4c45
movq %rdx, %rax
jmp 0x4c2d
testl %edx, %edx
je 0x4eff
movq %rax, %rcx
movb (%rcx), %al
movb %al, 0x30(%rsp,%rbx)
incq %rbx
movq %rcx, %rax
incq %rax
cmpq $0x1000, %rbx           # imm = 0x1000
jl 0x4b59
jmp 0x4c45
testl %edx, %edx
je 0x4c2d
jmp 0x4c21
callq 0x6b0f
movq %rax, %rbx
movq %r13, %rdi
callq 0x5c7c
leaq 0x471d(%rip), %rcx      # 0x9379
testq %rax, %rax
jne 0x4c6e
movl $0x24, %edi
callq 0x2380
movq %rax, %rcx
movl $0xfffffffe, %edi       # imm = 0xFFFFFFFE
leaq 0x46c3(%rip), %rsi      # 0x933d
movq %rbx, %rdx
xorl %eax, %eax
callq 0x68c8
xorl %r13d, %r13d
testq %r13, %r13
je 0x4f55
movq %r13, %rdi
callq 0x5c7c
testq %rax, %rax
je 0x4cd3
cmpq %r13, %rax
je 0x4d29
leaq -0x1(%rax), %rcx
cmpb $0x2f, -0x1(%rax)
movq %rcx, %rax
jne 0x4c9d
movb $0x0, (%rcx)
cmpq %r13, %rcx
setne %bpl
movq %r13, %rbx
leaq 0x46c3(%rip), %rax      # 0x938a
cmoveq %rax, %rbx
incq %rcx
movq %rcx, %r13
jmp 0x4d32
movq %r15, %rdi
callq 0x5cdd
movq %rax, %r15
cmpl $-0x3, 0x1c(%rsp)
ja 0x4ced
movq %r13, %rdi
callq 0x5d89
movq %r13, %rdi
leaq 0x45dc(%rip), %rsi      # 0x92d3
xorl %edx, %edx
callq 0x5e89
testq %rax, %rax
je 0x4ee3
movq 0xc60a(%rip), %rcx      # 0x11318
leaq 0x8(%rcx), %rdx
movq %rdx, 0xc5ff(%rip)      # 0x11318
movq %rax, (%rcx)
movq $0x0, 0x8(%rcx)
jmp 0x4ee6
xorl %ebp, %ebp
leaq 0x45a1(%rip), %rbx      # 0x92d3
cmpb $0x0, (%rbx)
movq %rbx, %rax
leaq 0x4ac2(%rip), %rcx      # 0x9801
cmoveq %rcx, %rax
movb $0x0, 0x30(%rsp)
movb (%rax), %cl
movb %cl, 0x30(%rsp)
testb %cl, %cl
je 0x4d6e
movl $0x1, %ecx
cmpq $0x1000, %rcx           # imm = 0x1000
je 0x4d8e
movb (%rax,%rcx), %dl
movb %dl, 0x30(%rsp,%rcx)
incq %rcx
testb %dl, %dl
jne 0x4d57
movq %r14, %r12
leaq 0x30(%rsp), %r14
movq %r14, %rdi
callq 0x5d89
movq %r14, %rdi
movq %r12, %r14
callq 0x2110
movq %rax, %r12
jmp 0x4d91
xorl %r12d, %r12d
testq %r12, %r12
je 0x4eb2
movl %ebp, 0x10(%rsp)
movq %r14, 0x28(%rsp)
cmpb $0x0, (%rbx)
leaq 0x30(%rsp), %rax
cmovneq %rax, %rbx
movq 0xc562(%rip), %r14      # 0x11318
subq %r15, %r14
sarq $0x3, %r14
movq %r12, %rdi
callq 0x22c0
testq %rax, %rax
je 0x4e2c
movq %rax, %rbp
cmpb $0x2e, 0x13(%rax)
jne 0x4dda
cmpb $0x2e, (%r13)
jne 0x4dbd
addq $0x13, %rbp
movq %rbp, %rdi
movq %r13, %rsi
callq 0x5fa2
testb %al, %al
je 0x4dbd
movq %r15, %rdi
callq 0x5cdd
movq %rax, %r15
movzbl 0x10(%rsp), %edx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x5e89
testq %rax, %rax
je 0x4f3f
movq 0xc500(%rip), %rcx      # 0x11318
leaq 0x8(%rcx), %rdx
movq %rdx, 0xc4f5(%rip)      # 0x11318
movq %rax, (%rcx)
incl 0xc(%rsp)
jmp 0x4dbd
movq %r12, %rdi
callq 0x21f0
movq %r15, 0x10(%rsp)
leaq (%r15,%r14,8), %r13
movq 0xc4d4(%rip), %r14      # 0x11318
movq %r14, %rax
subq %r13, %rax
cmpq $0x9, %rax
jl 0x4e93
leaq 0x8(%r13), %r15
cmpq %r14, %r15
jae 0x4e84
movq %r15, %rbp
movq (%r13), %rbx
movq (%rbp), %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2230
testl %eax, %eax
jle 0x4e7b
movq %r12, (%r13)
movq %rbx, (%rbp)
addq $0x8, %rbp
cmpq %r14, %rbp
jb 0x4e5c
movq %r14, %rax
subq %r15, %rax
movq %r15, %r13
cmpq $0x8, %rax
jg 0x4e50
movq $0x0, (%r14)
xorl %ebp, %ebp
movq 0x10(%rsp), %r15
movabsq $0xe00000020000921, %r12 # imm = 0xE00000020000921
movq 0x28(%rsp), %r14
jmp 0x4ee6
callq 0x6b0f
movl $0xfffffffe, %edi       # imm = 0xFFFFFFFE
leaq 0x447a(%rip), %rsi      # 0x933d
movq %rax, %rdx
leaq 0x44bf(%rip), %rcx      # 0x938c
xorl %eax, %eax
callq 0x68c8
movb $0x1, %bpl
movabsq $0xe00000020000921, %r12 # imm = 0xE00000020000921
jmp 0x4ee6
movb $0x1, %bpl
testb $0x1, %bpl
jne 0x4f58
movq 0x8(%r14), %r13
addq $0x8, %r14
testq %r13, %r13
jne 0x4b4f
jmp 0x4f58
movb $0x0, 0x30(%rsp,%rbx)
incq %rbx
movq %r13, %rdi
callq 0x2130
incq %rax
cmpq %rax, %rbx
jbe 0x4f2a
movq %r13, %rdi
callq 0x2050
movq %rbx, %rdi
callq 0x42ee
movq %rax, %r13
movq %r13, %rdi
leaq 0x30(%rsp), %rsi
movq %rbx, %rdx
callq 0x22a0
jmp 0x4c87
movq %r12, %rdi
callq 0x21f0
movb $0x1, %bpl
jmp 0x4ea1
movb $0x1, %al
xorl %ebp, %ebp
jmp 0x4f60
movb $0x1, %bpl
cmpl $0x0, 0xc(%rsp)
sete %al
movq $0x0, 0xc3ad(%rip) # 0x11318
testb %al, %al
je 0x4f9a
testb $0x1, %bpl
jne 0x4f9a
callq 0x6b0f
leaq 0x43bc(%rip), %rsi      # 0x933d
leaq 0x43e8(%rip), %rcx      # 0x9370
movl $0xfffffffe, %edi       # imm = 0xFFFFFFFE
movq %rax, %rdx
xorl %eax, %eax
callq 0x68c8
movb $0x1, %bpl
testb $0x1, %bpl
je 0x4fab
movq %r15, %rdi
callq 0x4a9f
xorl %r15d, %r15d
movq 0x20(%rsp), %rdi
callq 0x4a9f
movq %r15, %rax
addq $0x1038, %rsp           # imm = 0x1038
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq