// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movb %sil, %al
movq %rdi, -0x10(%rbp)
movb %al, -0x11(%rbp)
movl %edx, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0xa028
movq -0x28(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x9fb3
jmp 0x9fd2
leaq 0x1a4a6(%rip), %rdi     # 0x24460
leaq 0x1a3e8(%rip), %rsi     # 0x243a9
movl $0x4af, %edx            # imm = 0x4AF
leaq 0x1a4a6(%rip), %rcx     # 0x24473
callq 0x32d0
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x31f0
movq %rax, %rcx
movslq -0x20(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x18(%rbp)
je 0xa00d
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x9c80
cmpl $0x0, %eax
je 0xa00d
movl -0x20(%rbp), %eax
addl $0x2, %eax
movl %eax, -0x20(%rbp)
jmp 0xa00f
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x9f9b
movl -0x1c(%rbp), %eax
addl -0x20(%rbp), %eax
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x20(%rbp)
jne 0xa044
movq $0x0, -0x8(%rbp)
jmp 0xa143
movl -0x20(%rbp), %eax
addl $0x5, %eax
movslq %eax, %rdi
callq 0x152f0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0xa13b
movq -0x28(%rbp), %rax
cmpq -0x10(%rbp), %rax
je 0xa08f
movb -0x11(%rbp), %cl
movq -0x38(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x38(%rbp)
movb %cl, (%rax)
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x9c80
cmpl $0x0, %eax
je 0xa0fe
cmpl $0x0, -0x18(%rbp)
je 0xa0c3
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x1bb2e(%rip), %rsi     # 0x25be8
movb $0x0, %al
callq 0x36a0
jmp 0xa0fc
movsbl -0x11(%rbp), %eax
cmpl $0x20, %eax
jne 0xa0e2
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x1a3cd(%rip), %rdi     # 0x244a8
movb $0x0, %al
callq 0xf8f0
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x1a4b7(%rip), %rsi     # 0x245ac
movb $0x0, %al
callq 0x36a0
jmp 0xa118
movq -0x38(%rbp), %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x1a49b(%rip), %rsi     # 0x245ac
movb $0x0, %al
callq 0x36a0
jmp 0xa11a
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x38(%rbp), %rdi
callq 0x31f0
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0xa066
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax)