// File: /workspace/github_c_makefile_star2_O2/JimKent[P]linearSat/lib/common.c
// Function: slPairListToString
char *slPairListToString(struct slPair *list,boolean quoteIfSpaces)
// Returns an allocated string of pairs in form of [name1=val1 name2=val2 ...]
// If requested, will wrap name or val in quotes if contain spaces: [name1="val 1" "name 2"=val2]
{
// Don't rely on dyString.  We should do the accounting ourselves and not create extra dependencies.
int count = 0;
struct slPair *pair = list;
for (;pair != NULL; pair = pair->next)
    {
    assert(pair->name != NULL && pair->val != NULL); // Better assert and get this over with,
                                                     // complete with stack
    count += strlen(pair->name);
    count += strlen((char *)(pair->val));
    count += 2; // = and ' ' delimit
    if (quoteIfSpaces)
        {
        if (hasWhiteSpace(pair->name))
            count += 2; // " and "
        if (hasWhiteSpace((char *)(pair->val)))
            count += 2; // " and "
        }
    }
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) // Not first cycle
        *strPtr++ = ' ';
    if (hasWhiteSpace(pair->name))
        {
        if (quoteIfSpaces)
            sprintf(strPtr,"\"%s\"=",pair->name);
        else
            {
            warn("slPairListToString() Unexpected white space in name: [%s]\n", pair->name);
            sprintf(strPtr,"%s=",pair->name); // warn but still make string
            }
        }
    else
        sprintf(strPtr,"%s=",pair->name);
    strPtr += strlen(strPtr);
    if (hasWhiteSpace((char *)(pair->val)))
        {
        if (quoteIfSpaces)
            sprintf(strPtr,"\"%s\"",(char *)(pair->val));
        else
            {
            warn("slPairListToString() Unexpected white space in val: [%s]\n", (char *)(pair->val));
            sprintf(strPtr,"%s",(char *)(pair->val)); // warn but still make string
            }
        }
    else
        sprintf(strPtr,"%s",(char *)(pair->val));
    }
return str;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
xorl %r14d, %r14d
movq %rdi, (%rsp)
movq %rdi, %rbp
testq %rbp, %rbp
je 0x7354
movq 0x8(%rbp), %r12
testq %r12, %r12
je 0x7465
movq 0x10(%rbp), %r15
testq %r15, %r15
je 0x7465
movq %r12, %rdi
callq 0x3200
addl %eax, %r14d
movq %r15, %rdi
callq 0x3200
leal (%rax,%r14), %r13d
addl $0x2, %r13d
testl %ebx, %ebx
je 0x734b
addl %eax, %r14d
movq %r12, %rdi
callq 0x729c
addl $0x4, %r14d
testl %eax, %eax
cmovel %r13d, %r14d
movq %r15, %rdi
callq 0x729c
leal 0x2(%r14), %r13d
testl %eax, %eax
cmovel %r14d, %r13d
movq (%rbp), %rbp
movl %r13d, %r14d
jmp 0x72e6
testl %r14d, %r14d
je 0x7450
addl $0x5, %r14d
movslq %r14d, %rdi
callq 0xd87c
movq %rax, %r13
leaq 0x100bf(%rip), %r12     # 0x17432
movq (%rsp), %r14
movq %rax, %r15
testq %r14, %r14
je 0x7453
cmpq (%rsp), %r14
je 0x7390
movb $0x20, (%r15)
incq %r15
movq 0x8(%r14), %rbp
movq %rbp, %rdi
callq 0x729c
testl %eax, %eax
je 0x73b0
testl %ebx, %ebx
je 0x73bb
movq %r15, %rdi
leaq 0x10043(%rip), %rsi     # 0x173f1
jmp 0x73b6
movq %r15, %rdi
movq %r12, %rsi
movq %rbp, %rdx
jmp 0x73d6
leaq 0x10035(%rip), %rdi     # 0x173f7
movq %rbp, %rsi
xorl %eax, %eax
callq 0xa3aa
movq 0x8(%r14), %rdx
movq %r15, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x36d0
movq %r15, %rdi
callq 0x3200
movq %rax, %rbp
addq %r15, %rbp
movq 0x10(%r14), %r15
movq %r15, %rdi
callq 0x729c
testl %eax, %eax
je 0x7415
testl %ebx, %ebx
je 0x741d
movq %rbp, %rdi
leaq 0x117d1(%rip), %rsi     # 0x18bda
movq %r15, %rdx
xorl %eax, %eax
callq 0x36d0
jmp 0x743a
movq %rbp, %rdi
movq %r15, %rsi
jmp 0x7435
leaq 0x10012(%rip), %rdi     # 0x17436
movq %r15, %rsi
xorl %eax, %eax
callq 0xa3aa
movq 0x10(%r14), %rsi
movq %rbp, %rdi
callq 0x30e0
movq (%r14), %r14
movq %rbp, %rdi
callq 0x3200
movq %rax, %r15
addq %rbp, %r15
jmp 0x737a
xorl %r13d, %r13d
movq %r13, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xff25(%rip), %rdi      # 0x17391
leaq 0xff46(%rip), %rsi      # 0x173b9
leaq 0xff48(%rip), %rcx      # 0x173c2
movl $0x472, %edx            # imm = 0x472
callq 0x32e0