// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/common.c
// Function: slPairNameToString
char *slPairNameToString(struct slPair *list, char delimiter,boolean quoteIfSpaces)
// Return string created by joining all names (ignoring vals) with the delimiter.
// If requested, will wrap name in quotes if contain spaces: [name1,"name 2" ...]
{
int elCount = 0;
int count = 0;
struct slPair *pair = list;
for (; pair != NULL; pair = pair->next, elCount++)
    {
    assert(pair->name != NULL);
    count += strlen(pair->name);
    if (quoteIfSpaces && hasWhiteSpace(pair->name))
        count += 2;
    }
count += elCount;
if (count == 0)
    return NULL;

char *str = needMem(count+5); // A bit of slop

char *strPtr = str;
for (pair = list; pair != NULL; pair = pair->next, strPtr += strlen(strPtr))
    {
    if (pair != list)
        *strPtr++ = delimiter;
    if (hasWhiteSpace(pair->name))
        {
        if (quoteIfSpaces)
            sprintf(strPtr,"\"%s\"",pair->name);
        else
            {
            if (delimiter == ' ')  // if delimied by commas, this is entirely okay!
                warn("slPairListToString() Unexpected white space in name delimied by space: "
                     "[%s]\n", pair->name);
            sprintf(strPtr,"%s",pair->name); // warn but still make string
            }
        }
    else
        sprintf(strPtr,"%s",pair->name);
    }
return str;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, 0x10(%rsp)
xorl %r12d, %r12d
testq %rdi, %rdi
je 0x7f0c
movl %edx, %ebp
movq %rdi, 0x8(%rsp)
movq %rdi, %r13
xorl %r15d, %r15d
movq 0x8(%r13), %rbx
testq %rbx, %rbx
je 0x7f1e
movq %rbx, %rdi
callq 0x3200
addl %eax, %r12d
testl %ebp, %ebp
je 0x7e2b
movsbq (%rbx), %r14
testq %r14, %r14
je 0x7e2b
incq %rbx
callq 0x37a0
movq (%rax), %rax
testb $0x20, 0x1(%rax,%r14,2)
je 0x7e0b
addl $0x2, %r12d
movq (%r13), %r13
incl %r15d
testq %r13, %r13
jne 0x7def
addl %r15d, %r12d
je 0x7f09
addl $0x5, %r12d
movslq %r12d, %rdi
callq 0xee10
movq %rax, %r12
movq 0x8(%rsp), %r13
testq %r13, %r13
je 0x7f0c
movq %r12, %rbx
movq %r13, %r15
movl %ebp, 0x14(%rsp)
cmpq %r13, %r15
je 0x7e75
movl 0x10(%rsp), %eax
movb %al, (%rbx)
incq %rbx
movq 0x8(%r15), %r14
movq %r14, %r13
movsbq (%r13), %rbp
testq %rbp, %rbp
je 0x7eb6
incq %r13
callq 0x37a0
movq (%rax), %rax
testb $0x20, 0x1(%rax,%rbp,2)
je 0x7e7c
movl 0x14(%rsp), %ebp
testl %ebp, %ebp
je 0x7edb
movq %rbx, %rdi
leaq 0x12d30(%rip), %rsi     # 0x1abda
movq %r14, %rdx
xorl %eax, %eax
callq 0x36d0
jmp 0x7ec1
movq %rbx, %rdi
movq %r14, %rsi
callq 0x30e0
movq 0x8(%rsp), %r13
movq (%r15), %r15
movq %rbx, %rdi
callq 0x3200
addq %rax, %rbx
testq %r15, %r15
jne 0x7e67
jmp 0x7f0c
cmpb $0x20, 0x10(%rsp)
jne 0x7ef7
leaq 0x115cf(%rip), %rdi     # 0x194b8
movq %r14, %rsi
xorl %eax, %eax
callq 0xb41e
movq 0x8(%r15), %r14
movq 0x8(%rsp), %r13
movq %rbx, %rdi
movq %r14, %rsi
callq 0x30e0
jmp 0x7ec6
xorl %r12d, %r12d
movq %r12, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1154b(%rip), %rdi     # 0x19470
leaq 0x1148d(%rip), %rsi     # 0x193b9
leaq 0x11550(%rip), %rcx     # 0x19483
movl $0x4af, %edx            # imm = 0x4AF
callq 0x32e0