// File: /workspace/github_c_makefile_star2_O0/JimKent[P]linearSat/lib/osunix.c
// Function: listDirXExt
struct fileInfo *listDirXExt(char *dir, char *pattern, boolean fullPath, boolean ignoreStatFailures)
/* Return list of files matching wildcard pattern with
 * extra info. If full path is true then the path will be
 * included in the name of each file. */
{
struct fileInfo *list = NULL, *el;
struct dirent *de;
DIR *d;
int dirNameSize = strlen(dir);
int fileNameOffset = dirNameSize+1;
char pathName[512];

if ((d = opendir(dir)) == NULL)
    return NULL;
memcpy(pathName, dir, dirNameSize);
pathName[dirNameSize] = '/';

while ((de = readdir(d)) != NULL)
    {
    char *fileName = de->d_name;
    if (differentString(fileName, ".") && differentString(fileName, ".."))
	{
	if (pattern == NULL || wildMatch(pattern, fileName))
	    {
	    struct stat st;
	    bool isDir = FALSE;
	    int statErrno = 0;
	    strcpy(pathName+fileNameOffset, fileName);
	    if (stat(pathName, &st) < 0)
		{
		if (ignoreStatFailures)
		    statErrno = errno;
		else
    		    errAbort("stat failed in listDirX");
		}
	    if (S_ISDIR(st.st_mode))
		isDir = TRUE;
	    if (fullPath)
		fileName = pathName;
	    el = newFileInfo(fileName, st.st_size, isDir, statErrno, st.st_atime);
	    slAddHead(&list, el);
	    }
	}
    }
closedir(d);
slSort(&list, cmpFileInfo);
return list;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2f0, %rsp            # imm = 0x2F0
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x10(%rbp), %rdi
callq 0x31f0
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
callq 0x31c0
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
jne 0x18866
movq $0x0, -0x8(%rbp)
jmp 0x189fb
leaq -0x250(%rbp), %rdi
movq -0x10(%rbp), %rsi
movslq -0x44(%rbp), %rdx
callq 0x3470
movslq -0x44(%rbp), %rax
movb $0x2f, -0x250(%rbp,%rax)
movq -0x40(%rbp), %rdi
callq 0x35b0
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x189da
movq -0x38(%rbp), %rax
addq $0x13, %rax
movq %rax, -0x258(%rbp)
movq -0x258(%rbp), %rdi
leaq 0xc102(%rip), %rsi      # 0x249bc
callq 0x3410
cmpl $0x0, %eax
je 0x189d5
movq -0x258(%rbp), %rdi
leaq 0xd7ab(%rip), %rsi      # 0x26081
callq 0x3410
cmpl $0x0, %eax
je 0x189d5
cmpq $0x0, -0x18(%rbp)
je 0x18904
movq -0x18(%rbp), %rdi
movq -0x258(%rbp), %rsi
callq 0x1b210
cmpl $0x0, %eax
je 0x189d3
movb $0x0, -0x2e9(%rbp)
movl $0x0, -0x2f0(%rbp)
leaq -0x250(%rbp), %rdi
movslq -0x48(%rbp), %rax
addq %rax, %rdi
movq -0x258(%rbp), %rsi
callq 0x30c0
leaq -0x250(%rbp), %rdi
leaq -0x2e8(%rbp), %rsi
callq 0x3240
cmpl $0x0, %eax
jge 0x1896c
cmpl $0x0, -0x20(%rbp)
je 0x1895c
callq 0x30a0
movl (%rax), %eax
movl %eax, -0x2f0(%rbp)
jmp 0x1896a
leaq 0xd4dd(%rip), %rdi      # 0x25e40
movb $0x0, %al
callq 0xfd50
jmp 0x1896c
movl -0x2d0(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0x4000, %eax           # imm = 0x4000
jne 0x18985
movb $0x1, -0x2e9(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x18999
leaq -0x250(%rbp), %rax
movq %rax, -0x258(%rbp)
movq -0x258(%rbp), %rdi
movq -0x2b8(%rbp), %rsi
movb -0x2e9(%rbp), %al
movl -0x2f0(%rbp), %ecx
movq -0x2a0(%rbp), %r8
movsbl %al, %edx
callq 0x186d0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rsi
leaq -0x28(%rbp), %rdi
callq 0x18550
jmp 0x189d5
jmp 0x18886
movq -0x40(%rbp), %rdi
callq 0x3360
leaq -0x28(%rbp), %rdi
leaq -0x29e(%rip), %rsi      # 0x18750
callq 0x7c70
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x2f0, %rsp            # imm = 0x2F0
popq %rbp
retq
nopl (%rax,%rax)