LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: chopByWhite
int chopByWhite(char *in, char *outArray[], int outSize)
/* Like chopString, but specialized for white space separators. 
 * See the GOTCHA in chopString */
{
int recordCount = 0;
char c;
for (;;)
    {
    if (outArray != NULL && recordCount >= outSize)
	break;

    /* Skip initial separators. */
    while (isspace(*in)) ++in;
    if (*in == 0)
        break;

    /* Store start of word and look for end of word. */
    if (outArray != NULL)
        outArray[recordCount] = in;
    recordCount += 1;
    for (;;)
        {
        if ((c = *in) == 0)
            break;
        if (isspace(c))
            break;
        ++in;
        }
    if (*in == 0)
	break;

    /* Tag end of word with zero. */
    if (outArray != NULL)
	*in = 0;
    /* And skip over the zero. */
    in += 1;
    }
return recordCount;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rsi, %rsi
setne %al
testl %edx, %edx
setle %cl
xorl %r15d, %r15d
testb %cl, %al
jne 0x8be0
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r12
xorl %r15d, %r15d
callq 0x37a0
movq (%rax), %rsi
leaq -0x1(%r12), %rdx
incq %r12
movq %r12, %rdi
movq %rdi, %r12
movsbq 0x1(%rdx), %rcx
incq %rdx
incq %rdi
testb $0x20, 0x1(%rsi,%rcx,2)
jne 0x8b80
testb %cl, %cl
je 0x8be0
testq %r14, %r14
je 0x8bad
movq %rdx, (%r14,%r15,8)
movb (%rdx), %cl
incq %r15
testb %cl, %cl
jne 0x8bb0
jmp 0x8be0
incq %r15
movq (%rax), %rdx
movsbq %cl, %rcx
testb $0x20, 0x1(%rdx,%rcx,2)
jne 0x8bcb
movb (%r12), %cl
incq %r12
testb %cl, %cl
jne 0x8bb3
jmp 0x8be0
testq %r14, %r14
je 0x8bd6
movb $0x0, -0x1(%r12)
testq %r14, %r14
je 0x8b72
cmpl %ebx, %r15d
jl 0x8b72
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: chopByChar
int chopByChar(char *in, char chopper, char *outArray[], int outSize)
/* Chop based on a single character. */
{
int i;
char c;
if (*in == 0)
    return 0;
for (i=0; (i<outSize) || (outArray==NULL); ++i)
    {
    if (outArray != NULL)
        outArray[i] = in;
    for (;;)
	{
	if ((c = *in++) == 0)
	    return i+1;
	else if (c == chopper)
	    {
            if (outArray != NULL)
                in[-1] = 0;
	    break;
	    }
	}
    }
return i;
}

// Assembly:
xorl %eax, %eax
cmpb $0x0, (%rdi)
je 0x8d60
testq %rdx, %rdx
setne %r8b
testl %ecx, %ecx
setle %r9b
testb %r9b, %r8b
jne 0x8d60
xorl %eax, %eax
testq %rdx, %rdx
je 0x8d2e
movq %rdi, (%rdx,%rax,8)
movb (%rdi), %r8b
testb %r8b, %r8b
je 0x8d5e
incq %rdi
cmpb %sil, %r8b
jne 0x8d2e
testq %rdx, %rdx
je 0x8d47
movb $0x0, -0x1(%rdi)
testq %rdx, %rdx
sete %r8b
incq %rax
cmpl %ecx, %eax
setl %r9b
orb %r8b, %r9b
jne 0x8d25
jmp 0x8d60
incl %eax
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: skipBeyondDelimit
char *skipBeyondDelimit(char *s,char delimit)
/* Returns NULL or pointer to first char beyond one (or more contiguous) delimit char.
   If delimit is ' ' then skips beyond first patch of whitespace. */
{
if (s != NULL)
    {
    char *beyond = NULL;
    if (delimit == ' ')
        return skipLeadingSpaces(skipToSpaces(s));
    else
        beyond = strchr(s,delimit);
    if (beyond != NULL)
        {
        for (beyond++;*beyond == delimit;beyond++) ;
        if (*beyond != '\0')
            return beyond;
        }
    }
return NULL;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x8dc0
movl %esi, %ebp
cmpb $0x20, %bpl
jne 0x8d9a
callq 0x8dcc
testq %rax, %rax
je 0x8dc0
movq %rax, %rbx
callq 0x37a0
movq (%rax), %rax
decq %rbx
movsbq 0x1(%rbx), %rcx
incq %rbx
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x8d89
jmp 0x8dc2
movsbl %bpl, %esi
callq 0x3260
testq %rax, %rax
je 0x8dc0
movq %rax, %rbx
movb 0x1(%rbx), %al
incq %rbx
cmpb %bpl, %al
je 0x8dab
xorl %ecx, %ecx
testb %al, %al
cmoveq %rcx, %rbx
jmp 0x8dc2
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: skipToSpaces
char *skipToSpaces(char *s)
/* Return first white space or NULL if none.. */
{
char c;
if (s == NULL)
    return NULL;
for (;;)
    {
    c = *s;
    if (c == 0)
        return NULL;
    if (isspace(c))
	return s;
    ++s;
    }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x8dfe
movq %rdi, %rbx
movb (%rdi), %bpl
testb %bpl, %bpl
je 0x8dfe
callq 0x37a0
movq (%rax), %rax
movsbq %bpl, %rcx
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x8e00
movb 0x1(%rbx), %bpl
incq %rbx
testb %bpl, %bpl
jne 0x8de7
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: eraseTrailingSpaces
void eraseTrailingSpaces(char *s)
/* Replace trailing white space with zeroes. */
{
int len = strlen(s);
int i;
char c;

for (i=len-1; i>=0; --i)
    {
    c = s[i];
    if (isspace(c))
	s[i] = 0;
    else
	break;
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x3200
movq %rax, %r14
testl %r14d, %r14d
jle 0x8e4c
callq 0x37a0
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
incq %r14
movsbq -0x2(%rbx,%r14), %rcx
movq (%rax), %rdx
testb $0x20, 0x1(%rdx,%rcx,2)
je 0x8e4c
movb $0x0, -0x2(%rbx,%r14)
decq %r14
cmpq $0x1, %r14
ja 0x8e2d
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: eraseWhiteSpace
void eraseWhiteSpace(char *s)
{
char *in, *out;
char c;

in = out = s;
for (;;)
    {
    c = *in++;
    if (c == 0)
	break;
    if (!isspace(c))
	*out++ = c;
    }
*out++ = 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb (%rdi), %bpl
testb %bpl, %bpl
je 0x8e8a
callq 0x37a0
leaq 0x1(%rbx), %rcx
movq (%rax), %rdx
movsbq %bpl, %rsi
testb $0x20, 0x1(%rdx,%rsi,2)
jne 0x8e7f
movb %bpl, (%rbx)
incq %rbx
movb (%rcx), %bpl
incq %rcx
testb %bpl, %bpl
jne 0x8e6b
movb $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: eraseNonAlphaNum
void eraseNonAlphaNum(char *s)
{
char *in, *out;
char c;

in = out = s;
for (;;)
    {
    c = *in++;
    if (c == 0)
        break;
    if (isalnum(c))
        *out++ = c;
    }
*out = 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb (%rdi), %bpl
testb %bpl, %bpl
je 0x8ec9
callq 0x37a0
leaq 0x1(%rbx), %rcx
movq (%rax), %rdx
movsbq %bpl, %rsi
testb $0x8, (%rdx,%rsi,2)
je 0x8ebe
movb %bpl, (%rbx)
incq %rbx
movb (%rcx), %bpl
incq %rcx
testb %bpl, %bpl
jne 0x8eab
movb $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: trimSpaces
char *trimSpaces(char *s)
/* Remove leading and trailing white space. */
{
if (s != NULL)
    {
    s = skipLeadingSpaces(s);
    eraseTrailingSpaces(s);
    }
return s;
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x8f00
movq %rdi, %rbx
callq 0x37a0
movq (%rax), %rax
decq %rbx
movsbq 0x1(%rbx), %rcx
incq %rbx
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x8ee7
movq %rbx, %rdi
callq 0x8e0a
jmp 0x8f02
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: lastWordInLine
char *lastWordInLine(char *line)
/* Returns last word in line if any (white space separated).
 * Returns NULL if string is empty.  Removes any terminating white space
 * from line. */
{
char *s = line;
char *word = NULL, *wordEnd = NULL;
for (;;)
    {
    s = skipLeadingSpaces(s);
    if (s == NULL || s[0] == 0)
	break;
    word = s;
    s = wordEnd = skipToSpaces(s);
    if (s == NULL)
        break;
    }
if (wordEnd != NULL)
    *wordEnd = 0;
return word;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x90cf
movq %rdi, %r14
callq 0x37a0
movq (%rax), %r15
xorl %eax, %eax
xorl %ecx, %ecx
decq %r14
movq %r14, %rbx
movsbq 0x1(%rbx), %rdx
incq %rbx
testb $0x20, 0x1(%r15,%rdx,2)
jne 0x90a6
testb %dl, %dl
je 0x90d3
movq %rbx, %rdi
callq 0x8dcc
movq %rbx, %rcx
movq %rax, %r14
testq %rax, %rax
jne 0x90a0
jmp 0x90de
xorl %ebx, %ebx
jmp 0x90de
testq %rax, %rax
je 0x90db
movb $0x0, (%rax)
movq %rcx, %rbx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: nextTabWord
char *nextTabWord(char **pLine)
/* Return next tab-separated word. */
{
char *s = *pLine;
char *e;
if (s == NULL || *s == '\n' || *s == 0)
    {
    *pLine = NULL;
    return NULL;
    }
e = strchr(s, '\t');
if (e == NULL)
    {
    e = strchr(s, '\n');
    if (e != NULL)
        *e = 0;
    *pLine = NULL;
    }
else
    {
    *e++ = 0;
    *pLine = e;
    }
return s;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %r14
testq %r14, %r14
je 0x9124
movzbl (%r14), %edx
xorl %ecx, %ecx
testl %edx, %edx
je 0x9126
movl $0x0, %eax
cmpl $0xa, %edx
je 0x9144
movq %r14, %rdi
movl $0x9, %esi
callq 0x3260
testq %rax, %rax
je 0x912a
movq %rax, %rcx
incq %rcx
jmp 0x913e
xorl %ecx, %ecx
xorl %eax, %eax
jmp 0x9144
movq %r14, %rdi
movl $0xa, %esi
callq 0x3260
xorl %ecx, %ecx
testq %rax, %rax
je 0x9141
movb $0x0, (%rax)
movq %r14, %rax
movq %rcx, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: cloneFirstWordByDelimiter
char *cloneFirstWordByDelimiter(char *line,char delimit)
/* Returns a cloned first word, not harming the memory passed in */
{
if (line == NULL || *line == 0)
    return NULL;
line = skipLeadingSpaces(line);
if (*line == 0)
    return NULL;
int size=0;
char *e;
for (e=line;*e!=0;e++)
    {
    if (*e==delimit)
        break;
    else if (delimit == ' ' && isspace(*e))
        break;
    size++;
    }
if (size == 0)
    return NULL;
char *new = needMem(size + 2); // Null terminated by 2
memcpy(new, line, size);
return new;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x9193
movq %rdi, %rbx
movsbq (%rdi), %r14
testq %r14, %r14
je 0x9193
movl %esi, %ebp
callq 0x37a0
movq (%rax), %rax
testb $0x20, 0x1(%rax,%r14,2)
je 0x9183
movsbq 0x1(%rbx), %r14
incq %rbx
jmp 0x9171
testb %r14b, %r14b
sete %cl
cmpb %bpl, %r14b
sete %dl
orb %cl, %dl
je 0x91a0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
cmpb $0x20, %bpl
jne 0x91b4
movsbq %r14b, %rcx
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x91c8
movb 0x1(%rbx,%r15), %r14b
incq %r15
testb %r14b, %r14b
je 0x91cd
cmpb %bpl, %r14b
jne 0x91a3
jmp 0x91cd
testl %r15d, %r15d
je 0x9193
leal 0x2(%r15), %edi
callq 0xee10
movl %r15d, %edx
movq %rax, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x34a0
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: cloneNextWordByDelimiter
char *cloneNextWordByDelimiter(char **line,char delimit)
/* Returns a cloned first word, advancing the line pointer but not harming memory passed in */
{
char *new = cloneFirstWordByDelimiter(*line,delimit);
if (new != NULL)
    {
    *line = skipLeadingSpaces(*line);
    *line += strlen(new);
    if ( **line != 0)
        (*line)++;
    }
return new;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x914f
movq %rax, %r14
testq %rax, %rax
je 0x924c
movq (%rbx), %r15
testq %r15, %r15
je 0x922a
callq 0x37a0
movq (%rax), %rax
decq %r15
movsbq 0x1(%r15), %rcx
incq %r15
testb $0x20, 0x1(%rax,%rcx,2)
jne 0x9219
jmp 0x922d
xorl %r15d, %r15d
movq %r15, (%rbx)
movq %r14, %rdi
callq 0x3200
leaq (%r15,%rax), %rcx
movq %rcx, (%rbx)
cmpb $0x0, (%r15,%rax)
je 0x924c
incq %rcx
movq %rcx, (%rbx)
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: cntStringsInList
char *nextStringInList(char **pStrings)
/* returns pointer to the first string and advances pointer to next in
   list of strings dilimited by 1 null and terminated by 2 nulls. */
{
if (pStrings == NULL || *pStrings == NULL || **pStrings == 0)
    return NULL;
char *p=*pStrings;
*pStrings += strlen(p)+1;
return p;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x92b9
movq %rdi, %r14
xorl %ebx, %ebx
cmpb $0x0, (%r14)
je 0x92bb
movq %r14, %rdi
callq 0x3200
addq %r14, %rax
incl %ebx
incq %rax
movq %rax, %r14
jne 0x929c
jmp 0x92bb
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: stringArrayIx
int stringArrayIx(char *string, char *array[], int arraySize)

/* Return index of string in array or -1 if not there. */
{
int i;
for (i=0; i<arraySize; ++i)
    if (!differentWord(array[i], string))
        return i;
return -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testl %edx, %edx
jle 0x9300
movq %rsi, %r14
movq %rdi, %r15
movl %edx, %r13d
xorl %r12d, %r12d
movq (%r14,%r12,8), %rdi
movq %r15, %rsi
callq 0x6e58
testl %eax, %eax
je 0x92fd
incq %r12
cmpq %r12, %r13
jne 0x92e3
jmp 0x9300
movl %r12d, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: mustOpen
FILE *mustOpen(char *fileName, char *mode)
/* Open a file - or squawk and die. */
{
FILE *f;

if (sameString(fileName, "stdin"))
    return stdin;
if (sameString(fileName, "stdout"))
    return stdout;
if ((f = fopen(fileName, mode)) == NULL)
    {
    char *modeName = "";
    if (mode)
        {
        if (mode[0] == 'r')
            modeName = " to read";
        else if (mode[0] == 'w')
            modeName = " to write";
        else if (mode[0] == 'a')
            modeName = " to append";
        }
    errAbort("Can't open %s%s: %s", fileName, modeName, strerror(errno));
    }
return f;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x1208b(%rip), %rsi     # 0x1b3cb
callq 0x3440
testl %eax, %eax
je 0x9397
leaq 0x1208f(%rip), %rsi     # 0x1b3df
movq %rbx, %rdi
callq 0x3440
testl %eax, %eax
je 0x93a0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3480
movq %rax, %r12
testq %rax, %rax
jne 0x93aa
leaq 0x1095c(%rip), %r14     # 0x19cd2
testq %r15, %r15
je 0x93c9
movzbl (%r15), %eax
cmpl $0x61, %eax
je 0x93c2
cmpl $0x72, %eax
je 0x93b9
cmpl $0x77, %eax
jne 0x93c9
leaq 0x10179(%rip), %r14     # 0x1950e
jmp 0x93c9
movq 0x1dc32(%rip), %rax     # 0x26fd0
jmp 0x93a7
movq 0x1dc21(%rip), %rax     # 0x26fc8
movq (%rax), %r12
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x10145(%rip), %r14     # 0x19505
jmp 0x93c9
leaq 0x1014f(%rip), %r14     # 0x19518
callq 0x30c0
movl (%rax), %edi
callq 0x3720
leaq 0x10147(%rip), %rdi     # 0x19523
xorl %r12d, %r12d
movq %rbx, %rsi
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0xb6c8
jmp 0x93aa
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: mustRead
void mustRead(FILE *file, void *buf, size_t size)
/* Read size bytes from a file or squawk and die. */
{
if (size != 0 && fread(buf, size, 1, file) != 1)
    {
    if (ferror(file))
	errAbort("Error reading %lld bytes: %s", (long long)size, strerror(ferror(file)));
    else
	errAbort("End of file reading %lld bytes", (long long)size);
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdx, %rdx
je 0x9473
movq %rdx, %rbx
movq %rdi, %r14
movl $0x1, %edx
movq %rsi, %rdi
movq %rbx, %rsi
movq %r14, %rcx
callq 0x3150
cmpq $0x1, %rax
jne 0x947b
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
callq 0x3110
testl %eax, %eax
je 0x94a9
movl %eax, %edi
callq 0x3720
leaq 0x100c0(%rip), %rdi     # 0x19555
movq %rbx, %rsi
movq %rax, %rdx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xb6c8
leaq 0x100c2(%rip), %rdi     # 0x19572
movq %rbx, %rsi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0xb6c8
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: writeString
void writeString(FILE *f, char *s)
/* Write a 255 or less character string to a file.
 * This will write the length of the string in the first
 * byte then the string itself. */
{
UBYTE bLen;
int len = strlen(s);

if (len > 255)
    {
    warn("String too long in writeString (%d chars):\n%s", len, s);
    len = 255;
    }
bLen = len;
writeOne(f, bLen);
mustWrite(f, s, len);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x3200
movq %rax, %r15
cmpl $0x100, %r15d           # imm = 0x100
jl 0x94fe
leaq 0x100a6(%rip), %rdi     # 0x19591
movl %r15d, %esi
movq %rbx, %rdx
xorl %eax, %eax
callq 0xb41e
movl $0xff, %r15d
leaq 0xf(%rsp), %rsi
movb %r15b, (%rsi)
movl $0x1, %edx
movq %r14, %rdi
callq 0x93f1
movslq %r15d, %rdx
movq %r14, %rdi
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0x93f1
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: readString
char *readString(FILE *f)
/* Read a string (written with writeString) into
 * memory.  freeMem the result when done. */
{
UBYTE bLen;
int len;
char *s;

if (!readOne(f, bLen))
    return NULL;
len = bLen;
s = needMem(len+1);
if (len > 0)
    mustRead(f, s, len);
return s;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0xf(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x3150
cmpq $0x1, %rax
jne 0x957a
movzbl 0xf(%rsp), %r15d
leaq 0x1(%r15), %rdi
callq 0xee10
movq %rax, %r14
testq %r15, %r15
je 0x957d
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x944b
jmp 0x957d
xorl %r14d, %r14d
movq %r14, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: mustReadString
char *mustReadString(FILE *f)
/* Read a string.  Squawk and die at EOF or if any problem. */
{
char *s = readString(f);
if (s == NULL)
    errAbort("Couldn't read string");
return s;
}

// Assembly:
pushq %rbx
callq 0x952a
movq %rax, %rbx
testq %rax, %rax
jne 0x95a6
leaq 0x10020(%rip), %rdi     # 0x195bf
xorl %eax, %eax
callq 0xb6c8
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: fastReadString
boolean fastReadString(FILE *f, char buf[256])
/* Read a string into buffer, which must be long enough
 * to hold it.  String is in 'writeString' format. */
{
UBYTE bLen;
int len;
if (!readOne(f, bLen))
    return FALSE;
if ((len = bLen)> 0)
    mustRead(f, buf, len);
buf[len] = 0;
return TRUE;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xf(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
movq %r14, %rcx
callq 0x3150
movq %rax, %rcx
xorl %eax, %eax
cmpq $0x1, %rcx
jne 0x9604
movzbl 0xf(%rsp), %r15d
testq %r15, %r15
je 0x95f7
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x944b
jmp 0x95fa
xorl %r15d, %r15d
movb $0x0, (%rbx,%r15)
movl $0x1, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: msbFirstWriteBits64
void msbFirstWriteBits64(FILE *f, bits64 x)
/* Write out 64 bit number in manner that is portable across architectures */
{
int i;
UBYTE buf[8];
for (i=7; i>=0; --i)
    {
    buf[i] = (UBYTE)(x&0xff);
    x >>= 8;
    }
mustWrite(f, buf, 8);
}

// Assembly:
pushq %rax
movl $0x8, %eax
movb %sil, -0x1(%rsp,%rax)
shrq $0x8, %rsi
decq %rax
jne 0x9614
movq %rsp, %rsi
movl $0x8, %edx
callq 0x93f1
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: msbFirstReadBits64
bits64 msbFirstReadBits64(FILE *f)
/* Write out 64 bit number in manner that is portable across architectures */
{
int i;
UBYTE buf[8];
bits64 x = 0;
mustRead(f, buf, 8);
for (i=0; i<8; ++i)
    {
    x <<= 8;
    x |= buf[i];
    }
return x;
}

// Assembly:
pushq %rax
movq %rsp, %rsi
movl $0x8, %edx
callq 0x944b
xorl %ecx, %ecx
xorl %eax, %eax
movq %rax, %rdx
shlq $0x8, %rdx
movzbl (%rsp,%rcx), %eax
orq %rdx, %rax
incq %rcx
cmpq $0x8, %rcx
jne 0x9643
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: mustGetLine
void mustGetLine(FILE *file, char *buf, int charCount)
/* Read at most charCount-1 bytes from file, but stop after newline if one is
 * encountered.  The string in buf is '\0'-terminated.  (See man 3 fgets.)
 * Die if there is an error. */
{
char *success = fgets(buf, charCount, file);
if (success == NULL && charCount > 0)
    buf[0] = '\0';
if (ferror(file))
    errAbort("mustGetLine: fgets failed: %s", strerror(ferror(file)));
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
movl %edx, %esi
movq %rbx, %rdx
callq 0x3400
testl %ebp, %ebp
jle 0x9682
testq %rax, %rax
jne 0x9682
movb $0x0, (%r14)
movq %rbx, %rdi
callq 0x3110
testl %eax, %eax
je 0x96aa
movl %eax, %edi
callq 0x3720
leaq 0xff38(%rip), %rdi      # 0x195d4
movq %rax, %rsi
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0xb6c8
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: mustOpenFd
int mustOpenFd(char *fileName, int flags)
/* Open a file descriptor (see man 2 open) or squawk and die. */
{
if (sameString(fileName, "stdin"))
    return STDIN_FILENO;
if (sameString(fileName, "stdout"))
    return STDOUT_FILENO;
// mode is necessary when O_CREAT is given, ignored otherwise
int mode = 00664;
int fd = open(fileName, flags, mode);
if (fd < 0)
    {
    char *modeName = "";
    if ((flags & (O_WRONLY | O_CREAT | O_TRUNC)) == (O_WRONLY | O_CREAT | O_TRUNC))
	modeName = " to create and truncate";
    else if ((flags & (O_WRONLY | O_CREAT)) == (O_WRONLY | O_CREAT))
	modeName = " to create";
    else if ((flags & O_WRONLY) == O_WRONLY)
	modeName = " to write";
    else if ((flags & O_RDWR) == O_RDWR)
	modeName = " to append";
    else
	modeName = " to read";
    errnoAbort("Can't open %s%s", fileName, modeName);
    }
return fd;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
leaq 0x11d0b(%rip), %rsi     # 0x1b3cb
callq 0x3440
testl %eax, %eax
je 0x9709
leaq 0x11d0f(%rip), %rsi     # 0x1b3df
movq %rbx, %rdi
callq 0x3440
testl %eax, %eax
je 0x970d
movq %rbx, %rdi
movl %r14d, %esi
movl $0x1b4, %edx            # imm = 0x1B4
xorl %eax, %eax
callq 0x35b0
movl %eax, %ebp
testl %eax, %eax
jns 0x9757
movl %r14d, %eax
notl %eax
testl $0x241, %eax            # imm = 0x241
jne 0x9714
leaq 0xfeeb(%rip), %rdx      # 0x195f2
jmp 0x9746
xorl %ebp, %ebp
jmp 0x9757
movl $0x1, %ebp
jmp 0x9757
testb $0x41, %al
jne 0x9721
leaq 0xfeeb(%rip), %rdx      # 0x1960a
jmp 0x9746
testb $0x1, %r14b
jne 0x973f
testb $0x2, %r14b
leaq 0xfdd3(%rip), %rax      # 0x19505
leaq 0xfddf(%rip), %rdx      # 0x19518
cmoveq %rax, %rdx
jmp 0x9746
leaq 0xfdc8(%rip), %rdx      # 0x1950e
leaq 0xfec8(%rip), %rdi      # 0x19615
movq %rbx, %rsi
xorl %eax, %eax
callq 0xb7f4
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: mustReadFd
void mustReadFd(int fd, void *buf, size_t size)
/* Read size bytes from a file or squawk and die. */
{
ssize_t actualSize;
char *cbuf = buf;
// using a loop because linux was not returning all data in a single request when request size exceeded 2GB.
while (size > 0)
    {
    actualSize = read(fd, cbuf, size);
    if (actualSize < 0)
	errnoAbort("Error reading %lld bytes", (long long)size);
    if (actualSize == 0)
	errAbort("End of file reading %llu bytes (got %lld)", (unsigned long long)size, (long long)actualSize);
    cbuf += actualSize;
    size -= actualSize;
    }
}

// Assembly:
testq %rdx, %rdx
je 0x97cf
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
leaq 0xfea8(%rip), %r15      # 0x19625
leaq 0xfeba(%rip), %r12      # 0x1963e
movl %ebp, %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x33d0
movq %rax, %r13
testq %rax, %rax
js 0x97ac
jne 0x97b9
movq %r12, %rdi
movq %rbx, %rsi
xorl %edx, %edx
xorl %eax, %eax
callq 0xb6c8
jmp 0x97b9
movq %r15, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0xb7f4
addq %r13, %r14
subq %r13, %rbx
jne 0x9784
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: mustWriteFd
void mustWriteFd(int fd, void *buf, size_t size)
/* Write size bytes to file descriptor fd or die.  (See man 2 write.) */
{
ssize_t result = write(fd, buf, size);
if (result < size)
    {
    if (result < 0)
	errnoAbort("mustWriteFd: write failed");
    else 
        errAbort("mustWriteFd only wrote %lld of %lld bytes. Likely the disk is full.",
	    (long long)result, (long long)size);
    }
}

// Assembly:
pushq %rbx
movq %rdx, %rbx
callq 0x31a0
cmpq %rbx, %rax
jae 0x97f8
testq %rax, %rax
js 0x97fa
leaq 0xfe98(%rip), %rdi      # 0x19682
movq %rax, %rsi
movq %rbx, %rdx
xorl %eax, %eax
popq %rbx
jmp 0xb6c8
popq %rbx
retq
leaq 0xfe67(%rip), %rdi      # 0x19668
xorl %eax, %eax
popq %rbx
jmp 0xb7f4
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: mustLseek
off_t mustLseek(int fd, off_t offset, int whence)
/* Seek to given offset, relative to whence (see man lseek) in file descriptor fd or errAbort.
 * Return final offset (e.g. if this is just an (fd, 0, SEEK_CUR) query for current position). */
{
off_t ret = lseek(fd, offset, whence);
if (ret < 0)
    errnoAbort("lseek(%d, %lld, %s (%d)) failed", fd, (long long)offset,
	       ((whence == SEEK_SET) ? "SEEK_SET" : (whence == SEEK_CUR) ? "SEEK_CUR" :
		(whence == SEEK_END) ? "SEEK_END" : "invalid 'whence' value"), whence);
return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movl %edi, %ebp
callq 0x3700
movq %rax, %r15
testq %rax, %rax
jns 0x986a
testl %ebx, %ebx
je 0x9836
cmpl $0x1, %ebx
jne 0x983f
leaq 0xfebb(%rip), %rcx      # 0x196ef
jmp 0x9854
leaq 0xfea9(%rip), %rcx      # 0x196e6
jmp 0x9854
cmpl $0x2, %ebx
leaq 0xfeaf(%rip), %rax      # 0x196f8
leaq 0xfeb1(%rip), %rcx      # 0x19701
cmoveq %rax, %rcx
leaq 0xfe6b(%rip), %rdi      # 0x196c6
movl %ebp, %esi
movq %r14, %rdx
movl %ebx, %r8d
xorl %eax, %eax
callq 0xb7f4
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: mustCloseFd
void mustCloseFd(int *pFd)
/* Close file descriptor *pFd if >= 0, abort if there's an error, set *pFd = -1. */
{
if (pFd != NULL && *pFd >= 0)
    {
    if (close(*pFd) < 0)
	errnoAbort("close failed");
    *pFd = -1;
    }
}

// Assembly:
testq %rdi, %rdi
je 0x98a5
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %edi
testl %edi, %edi
js 0x98a4
callq 0x3350
testl %eax, %eax
jns 0x989e
leaq 0xfe82(%rip), %rdi      # 0x19719
xorl %eax, %eax
callq 0xb7f4
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: addSuffix
char *addSuffix(char *head, char *suffix)
/* Return a needMem'd string containing "headsuffix". Should be free'd
 when finished. */
{
char *ret = NULL;
int size = strlen(head) + strlen(suffix) +1;
ret = needMem(sizeof(char)*size);
snprintf(ret, size, "%s%s", head, suffix);
return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x3200
movq %rax, %r15
movq %rbx, %rdi
callq 0x3200
addl %r15d, %eax
incl %eax
movslq %eax, %r15
movq %r15, %rdi
callq 0xee10
movq %rax, %r12
leaq 0x108c9(%rip), %rdx     # 0x1a1a7
movq %rax, %rdi
movq %r15, %rsi
movq %r14, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x32a0
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: carefulCloseWarn
boolean carefulCloseWarn(FILE **pFile)
/* Close file if open and null out handle to it.
 * Return FALSE and print a warning message if there
 * is a problem.*/
{
FILE *f;
boolean ok = TRUE;
if ((pFile != NULL) && ((f = *pFile) != NULL))
    {
    if (f != stdin && f != stdout)
        {
        if (fclose(f) != 0)
	    {
            errnoWarn("fclose failed");
	    ok = FALSE;
	    }
        }
    *pFile = NULL;
    }
return ok;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl $0x1, %ebp
testq %rdi, %rdi
je 0x99b2
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0x99b2
movq 0x1d64f(%rip), %rax     # 0x26fd0
cmpq (%rax), %rdi
je 0x99ab
movq 0x1d63b(%rip), %rax     # 0x26fc8
cmpq (%rax), %rdi
je 0x99ab
callq 0x31c0
testl %eax, %eax
je 0x99ab
leaq 0xfd76(%rip), %rdi      # 0x19718
xorl %ebp, %ebp
xorl %eax, %eax
callq 0xb5aa
movq $0x0, (%rbx)
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: firstWordInFile
char *firstWordInFile(char *fileName, char *wordBuf, int wordBufSize)
/* Read the first word in file into wordBuf. */
{
FILE *f = mustOpen(fileName, "r");
mustGetLine(f, wordBuf, wordBufSize);
fclose(f);
return trimSpaces(wordBuf);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %ebx
movq %rsi, %r14
leaq 0x12e50(%rip), %rsi     # 0x1c830
callq 0x932b
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x965c
movq %r15, %rdi
callq 0x31c0
movq %r14, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x8ed3
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: fileOffsetSizeMerge
struct fileOffsetSize *fileOffsetSizeMerge(struct fileOffsetSize *inList)
/* Returns a new list which is inList transformed to have adjacent blocks
 * merged.  Best to use this with a sorted list. */
{
struct fileOffsetSize *newList = NULL, *newEl = NULL, *oldEl, *nextOld;

for (oldEl = inList; oldEl != NULL; oldEl = nextOld)
    {
    nextOld = oldEl->next;
    if (nextOld != NULL && nextOld->offset < oldEl->offset)
        errAbort("Unsorted inList in fileOffsetSizeMerge %llu %llu", oldEl->offset, nextOld->offset);
    if (newEl == NULL || newEl->offset + newEl->size < oldEl->offset)
        {
	newEl = CloneVar(oldEl);
	slAddHead(&newList, newEl);
	}
    else
        {
	newEl->size = oldEl->offset + oldEl->size - newEl->offset;
	}
    }
slReverse(&newList);
return newList;
}

// Assembly:
testq %rdi, %rdi
je 0x9ada
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %r15
leaq 0xfcdc(%rip), %rbx      # 0x19726
xorl %r14d, %r14d
xorl %r12d, %r12d
movq (%r15), %r13
testq %r13, %r13
je 0x9a6f
movq 0x8(%r13), %rdx
movq 0x8(%r15), %rsi
cmpq %rsi, %rdx
jae 0x9a6f
movq %rbx, %rdi
xorl %eax, %eax
callq 0xb6c8
testq %r14, %r14
je 0x9a88
movq 0x8(%r14), %rax
movq 0x10(%r14), %rdx
addq %rax, %rdx
movq 0x8(%r15), %rcx
cmpq %rcx, %rdx
jae 0x9aac
movl $0x18, %edi
callq 0xec18
movq %rax, %r14
movups (%r15), %xmm0
movups %xmm0, (%rax)
movq 0x10(%r15), %rax
movq %rax, 0x10(%r14)
movq %r12, (%r14)
movq %r14, %r12
jmp 0x9ab7
subq %rax, %rcx
addq 0x10(%r15), %rcx
movq %rcx, 0x10(%r14)
movq %r13, %r15
testq %r13, %r13
jne 0x9a50
testq %r12, %r12
je 0x9add
xorl %ecx, %ecx
movq %r12, %rax
movq (%r12), %r12
movq %rcx, (%rax)
movq %rax, %rcx
testq %r12, %r12
jne 0x9ac6
jmp 0x9adf
xorl %eax, %eax
retq
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: mustSystem
void mustSystem(char *cmd)
/* Execute cmd using "sh -c" or die.  (See man 3 system.) fail on errors */
{
if (cmd == NULL) // don't allow (system() supports testing for shell this way)
    errAbort("mustSystem: called with NULL command.");
int status = system(cmd);
if (status == -1)
    errnoAbort("error starting command: %s", cmd);
else if (WIFSIGNALED(status))
    errAbort("command terminated by signal %d: %s", WTERMSIG(status), cmd);
else if (WIFEXITED(status))
    {
    if (WEXITSTATUS(status) != 0)
        errAbort("command exited with %d: %s", WEXITSTATUS(status), cmd);
    }
else
    errAbort("bug: invalid exit status for command: %s", cmd);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
testq %rdi, %rdi
jne 0x9b20
leaq 0xfc3e(%rip), %rdi      # 0x19757
xorl %eax, %eax
callq 0xb6c8
movq %rbx, %rdi
callq 0x3230
cmpl $-0x1, %eax
je 0x9b57
movl %eax, %esi
andl $0x7f, %esi
movl %esi, %ecx
shll $0x18, %ecx
addl $0x1000000, %ecx        # imm = 0x1000000
cmpl $0x2000000, %ecx        # imm = 0x2000000
jl 0x9b69
leaq 0xfc4c(%rip), %rdi      # 0x19798
movq %rbx, %rdx
xorl %eax, %eax
popq %rbx
jmp 0xb6c8
leaq 0xfc1f(%rip), %rdi      # 0x1977d
movq %rbx, %rsi
xorl %eax, %eax
popq %rbx
jmp 0xb7f4
testl %esi, %esi
je 0x9b7f
leaq 0xfc63(%rip), %rdi      # 0x197d7
movq %rbx, %rsi
xorl %eax, %eax
popq %rbx
jmp 0xb6c8
shrl $0x8, %eax
andl $0xff, %eax
je 0x9b94
leaq 0xfc2c(%rip), %rdi      # 0x197bc
movl %eax, %esi
jmp 0x9b4c
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: roundingScale
int roundingScale(int a, int p, int q)
/* returns rounded a*p/q */
{
if (a > 100000 || p > 100000)
    {
    double x = a;
    x *= p;
    x /= q;
    return round(x);
    }
else
    return (a*p + q/2)/q;
}

// Assembly:
movl %edx, %ecx
movl $0x186a1, %eax          # imm = 0x186A1
cmpl %eax, %edi
setl %dl
cmpl %eax, %esi
setl %al
testb %al, %dl
jne 0x9bcf
cvtsi2sd %edi, %xmm0
cvtsi2sd %esi, %xmm1
mulsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
divsd %xmm0, %xmm1
addsd 0xe43e(%rip), %xmm1     # 0x18008
cvttsd2si %xmm1, %eax
retq
imull %edi, %esi
movl %ecx, %eax
shrl $0x1f, %eax
addl %ecx, %eax
sarl %eax
addl %esi, %eax
cltd
idivl %ecx
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: readBits64
bits64 readBits64(FILE *f, boolean isSwapped)
/* Read and optionally byte-swap 64 bit entity. */
{
bits64 val;
mustReadOne(f, val);
if (isSwapped)
    val = byteSwap64(val);
return val;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rsp, %r14
movl $0x8, %edx
movq %r14, %rsi
callq 0x944b
movq (%r14), %rcx
movq %rcx, %rax
bswapq %rax
testl %ebx, %ebx
cmoveq %rcx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: fdReadBits64
bits64 fdReadBits64(int fd, boolean isSwapped)
/* Read and optionally byte-swap 64 bit entity. */
{
bits64 val;
mustReadOneFd(fd, val);
if (isSwapped)
    val = byteSwap64(val);
return val;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rsp, %r14
movl $0x8, %edx
movq %r14, %rsi
callq 0x975e
movq (%r14), %rcx
movq %rcx, %rax
bswapq %rax
testl %ebx, %ebx
cmoveq %rcx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: readBits32
bits32 readBits32(FILE *f, boolean isSwapped)
/* Read and optionally byte-swap 32 bit entity. */
{
bits32 val;
mustReadOne(f, val);
if (isSwapped)
    val = byteSwap32(val);
return val;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
leaq 0x4(%rsp), %r14
movl $0x4, %edx
movq %r14, %rsi
callq 0x944b
testl %ebx, %ebx
movl (%r14), %ecx
movl %ecx, %eax
bswapl %eax
cmovel %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: fdReadBits32
bits32 fdReadBits32(int fd, boolean isSwapped)
/* Read and optionally byte-swap 32 bit entity. */
{
bits32 val;
mustReadOneFd(fd, val);
if (isSwapped)
    val = byteSwap32(val);
return val;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
leaq 0x4(%rsp), %r14
movl $0x4, %edx
movq %r14, %rsi
callq 0x975e
testl %ebx, %ebx
movl (%r14), %ecx
movl %ecx, %eax
bswapl %eax
cmovel %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: readDouble
double readDouble(FILE *f, boolean isSwapped)
/* Read and optionally byte-swap double-precision floating point entity. */
{
double val;
mustReadOne(f, val);
if (isSwapped)
    val = byteSwapDouble(val);
return val;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebx
leaq 0x8(%rsp), %rsi
movl $0x8, %edx
callq 0x944b
testl %ebx, %ebx
je 0x9daf
movq 0x8(%rsp), %rax
bswapq %rax
movq %rax, %xmm0
jmp 0x9db5
movq 0x8(%rsp), %xmm0
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: memReadDouble
double memReadDouble(char **pPt, boolean isSwapped)
/* Read and optionally byte-swap double-precision floating point entity
 * from memory buffer pointed to by *pPt, and advance *pPt past read area. */
{
double val;
memcpy(&val, *pPt, sizeof(val));
if (isSwapped)
    val = byteSwapDouble(val);
*pPt += sizeof(val);
return val;
}

// Assembly:
movq (%rdi), %rax
movq (%rax), %xmm0
testl %esi, %esi
je 0x9dd3
movq %xmm0, %rcx
bswapq %rcx
movq %rcx, %xmm0
addq $0x8, %rax
movq %rax, (%rdi)
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: memReadFloat
float memReadFloat(char **pPt, boolean isSwapped)
/* Read and optionally byte-swap single-precision floating point entity
 * from memory buffer pointed to by *pPt, and advance *pPt past read area. */
{
float val;
memcpy(&val, *pPt, sizeof(val));
if (isSwapped)
    val = byteSwapFloat(val);
*pPt += sizeof(val);
return val;
}

// Assembly:
movq (%rdi), %rax
movd (%rax), %xmm0
testl %esi, %esi
je 0x9e2e
movd %xmm0, %ecx
bswapl %ecx
movd %ecx, %xmm0
addq $0x4, %rax
movq %rax, (%rdi)
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: readLine
char* readLine(FILE* fh)
/* Read a line of any size into dynamic memory, return null on EOF */
{
int bufCapacity = 256;
int bufSize = 0;
char* buf = needMem(bufCapacity);
int ch;

/* loop until EOF of EOLN */
while (((ch = getc(fh)) != EOF) && (ch != '\n'))
    {
    /* expand if almost full, always keep one extra char for
     * zero termination */
    if (bufSize >= bufCapacity-2)
        {
        bufCapacity *= 2;
        buf = realloc(buf, bufCapacity);
        if (buf == NULL)
            {
            errAbort("Out of memory in readline - request size %d bytes", bufCapacity);
            }
        }
    buf[bufSize++] = ch;
    }

/* only return EOF if no data was read */
if ((ch == EOF) && (bufSize == 0))
    {
    freeMem(buf);
    return NULL;
    }
buf[bufSize] = '\0';
return buf;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %r15
movl $0x100, %edi            # imm = 0x100
callq 0xee10
movq %rax, %rbx
movl $0x100, %r14d           # imm = 0x100
xorl %r12d, %r12d
movq %r15, %rdi
callq 0x3740
movl %eax, %ebp
cmpl $-0x1, %eax
je 0x9eb7
cmpl $0xa, %ebp
je 0x9eb7
leal -0x2(%r14), %eax
cltq
cmpq %rax, %r12
jl 0x9eae
addl %r14d, %r14d
movslq %r14d, %rsi
movq %rbx, %rdi
callq 0x3570
testq %rax, %rax
je 0x9ee9
movq %rax, %rbx
movb %bpl, (%rbx,%r12)
incq %r12
jmp 0x9e79
cmpl $-0x1, %ebp
sete %al
testq %r12, %r12
sete %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x9ed6
movq %rbx, %rdi
callq 0xeebc
xorl %ebx, %ebx
jmp 0x9edd
movl %r12d, %eax
movb $0x0, (%rbx,%rax)
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xf910(%rip), %rdi      # 0x19800
movl %r14d, %esi
xorl %eax, %eax
callq 0xb6c8
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: fileExists
boolean fileExists(char *fileName)
/* Return TRUE if file exists (may replace this with non-
 * portable faster way some day). */
{
/* To make piping easier stdin and stdout always exist. */
if (sameString(fileName, "stdin")) return TRUE;
if (sameString(fileName, "stdout")) return TRUE;

return fileSize(fileName) != -1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x114c3(%rip), %rsi     # 0x1b3cb
callq 0x3440
movl $0x1, %ebx
testl %eax, %eax
je 0x9f3a
leaq 0x114c2(%rip), %rsi     # 0x1b3df
movq %r14, %rdi
callq 0x3440
testl %eax, %eax
je 0x9f3a
movq %r14, %rdi
callq 0x10d40
xorl %ebx, %ebx
cmpq $-0x1, %rax
setne %bl
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: strstrNoCase
char *strstrNoCase(char *haystack, char *needle)
/*
  A case-insensitive strstr function
Will also robustly handle null strings
param haystack - The string to be searched
param needle - The string to look for in the haystack string

return - The position of the first occurence of the desired substring
or -1 if it is not found
 */
{
char *haystackCopy = NULL;
char *needleCopy = NULL;
int index = 0;
int haystackLen = 0;
int needleLen = 0;
char *p, *q;

if (NULL == haystack || NULL == needle)
    {
    return NULL;
    }

haystackLen = strlen(haystack);
needleLen = strlen(needle);

haystackCopy = (char*) needMem(haystackLen + 1);
needleCopy = (char*) needMem(needleLen + 1);

for(index = 0; index < haystackLen;  index++)
    {
    haystackCopy[index] = tolower(haystack[index]);
    }
haystackCopy[haystackLen] = 0; /* Null terminate */

for(index = 0; index < needleLen;  index++)
    {
    needleCopy[index] = tolower(needle[index]);
    }
needleCopy[needleLen] = 0; /* Null terminate */

p=strstr(haystackCopy, needleCopy);
q=haystackCopy;

freeMem(haystackCopy);
freeMem(needleCopy);

if(p==NULL) return NULL;

return p-q+haystack;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0xa063
movq %rsi, %r14
movq %rdi, %rbx
callq 0x3200
movq %rax, %rbp
movq %r14, %rdi
callq 0x3200
movq %rax, %r12
movq %rbp, %rax
shlq $0x20, %rax
movabsq $0x100000000, %r13      # imm = 0x100000000
movq %rax, 0x8(%rsp)
leaq (%rax,%r13), %rdi
sarq $0x20, %rdi
callq 0xee10
movq %rax, %r15
movq %r12, %rax
shlq $0x20, %rax
movq %rax, 0x10(%rsp)
addq %rax, %r13
sarq $0x20, %r13
movq %r13, %rdi
callq 0xee10
movq %rax, %r13
testl %ebp, %ebp
jle 0x9ff0
callq 0x3790
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
xorl %ecx, %ecx
movq (%rax), %rdx
movsbq (%rbx,%rcx), %rsi
movb (%rdx,%rsi,4), %dl
movb %dl, (%r15,%rcx)
incq %rcx
cmpq %rcx, %rbp
jne 0x9fd9
movq 0x8(%rsp), %rax
sarq $0x20, %rax
movb $0x0, (%r15,%rax)
testl %r12d, %r12d
jle 0xa029
callq 0x3790
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
xorl %ecx, %ecx
movq (%rax), %rdx
movsbq (%r14,%rcx), %rsi
movb (%rdx,%rsi,4), %dl
movb %dl, (%r13,%rcx)
incq %rcx
cmpq %rcx, %r12
jne 0xa011
movq 0x10(%rsp), %rax
sarq $0x20, %rax
movb $0x0, (%r13,%rax)
movq %r15, %rdi
movq %r13, %rsi
callq 0x3760
movq %rax, %r14
movq %r15, %rdi
callq 0xeebc
movq %r13, %rdi
callq 0xeebc
testq %r14, %r14
je 0xa063
subq %r15, %r14
addq %r14, %rbx
jmp 0xa065
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: vasafef
int vasafef(char* buffer, int bufSize, char *format, va_list args)
/* Format string to buffer, vsprintf style, only with buffer overflow
 * checking.  The resulting string is always terminated with zero byte. */
{
int sz = vsnprintf(buffer, bufSize, format, args);
/* note that some version return -1 if too small */
if ((sz < 0) || (sz >= bufSize))
    {
    buffer[bufSize-1] = (char) 0;
    errAbort("buffer overflow, size %d, format: %s, buffer: '%s'", bufSize, format, buffer);
    }
return sz;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
movslq %esi, %r15
movq %r15, %rsi
callq 0x3170
movl %eax, %ebp
testl %eax, %eax
setns %al
cmpl %r15d, %ebp
setl %cl
testb %cl, %al
jne 0xa0bd
movb $0x0, -0x1(%r14,%r15)
leaq 0xf785(%rip), %rdi      # 0x19832
movl %r15d, %esi
movq %rbx, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0xb6c8
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: safencpy
void safencpy(char *buf, size_t bufSize, const char *src, size_t n)
/* copy n characters from a string to a buffer, with bounds checking.
 * Unlike strncpy, always null terminates the result */
{
if (n > bufSize-1)
    errAbort("buffer overflow, size %lld, substring size: %lld", (long long)bufSize, (long long)n);
// strlen(src) can take a long time when src is for example a pointer into a chromosome sequence.
// Instead of setting slen to max(strlen(src), n), just stop counting length at n.
size_t slen = 0;
while (src[slen] != '\0' && slen < n)
    slen++;
strncpy(buf, src, n);
buf[slen] = '\0';
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdx, %r15
movq %rdi, %rbx
leaq -0x1(%rsi), %rax
cmpq %rcx, %rax
jae 0xa175
leaq 0xf728(%rip), %rdi      # 0x19893
movq %r14, %rdx
xorl %eax, %eax
callq 0xb6c8
xorl %eax, %eax
leaq 0x1(%rax), %r12
cmpq %r14, %rax
jae 0xa18a
cmpb $0x0, (%r15,%rax)
movq %r12, %rax
jne 0xa177
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x30d0
movb $0x0, -0x1(%rbx,%r12)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: safecat
void safecat(char *buf, size_t bufSize, const char *src)
/* Append  a string to a buffer, with bounds checking.*/
{
size_t blen = strlen(buf);
size_t slen = strlen(src);
if (blen+slen > bufSize-1)
    errAbort("buffer overflow, size %lld, new string size: %lld", (long long)bufSize, (long long)(blen+slen));
strcat(buf, src);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
callq 0x3200
movq %rax, %r12
movq %rbx, %rdi
callq 0x3200
addq %r12, %rax
leaq -0x1(%r15), %rcx
cmpq %rcx, %rax
jbe 0xa1eb
leaq 0xf6e6(%rip), %rdi      # 0x198c4
movq %r15, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0xb6c8
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x36b0
// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: safencat
void safencat(char *buf, size_t bufSize, const char *src, size_t n)
/* append n characters from a string to a buffer, with bounds checking. */
{
size_t blen = strlen(buf);
if (blen+n > bufSize-1)
    errAbort("buffer overflow, size %lld, new string size: %lld", (long long)bufSize, (long long)(blen+n));
size_t slen = strlen(src);
if (slen > n)
    slen = n;
strncat(buf, src, n);
buf[blen+slen] = '\0';
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r13
movq %rdi, %rbx
callq 0x3200
movq %rax, %r12
leaq (%rax,%r14), %rdx
leaq -0x1(%r13), %rax
cmpq %rax, %rdx
jbe 0xa23c
leaq 0xf692(%rip), %rdi      # 0x198c4
movq %r13, %rsi
xorl %eax, %eax
callq 0xb6c8
movq %r15, %rdi
callq 0x3200
movq %rax, %r13
cmpq %r14, %rax
cmovaeq %r14, %r13
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x3330
addq %rbx, %r12
movb $0x0, (%r13,%r12)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq