// File: /workspace/github_c_makefile_star2_O3/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
subq $0x18, %rsp
movl %esi, 0xc(%rsp)
xorl %ebp, %ebp
testq %rdi, %rdi
je 0x7d93
movq %rdi, 0x10(%rsp)
movq %rdi, %r14
movq 0x8(%r14), %r12
testq %r12, %r12
je 0x7da5
movq 0x10(%r14), %r15
testq %r15, %r15
je 0x7da5
movq %r12, %rdi
callq 0x3200
addl %eax, %ebp
movq %r15, %rdi
callq 0x3200
leal (%rax,%rbp), %r13d
addl $0x2, %r13d
cmpl $0x0, 0xc(%rsp)
je 0x7c53
addl %eax, %ebp
movsbq (%r12), %rbx
testq %rbx, %rbx
je 0x7c34
incq %r12
callq 0x37a0
movq (%rax), %rax
testb $0x20, 0x1(%rax,%rbx,2)
je 0x7c12
addl $0x4, %ebp
movl %ebp, %r13d
movsbq (%r15), %rbx
testq %rbx, %rbx
je 0x7c53
incq %r15
callq 0x37a0
movq (%rax), %rax
testb $0x20, 0x1(%rax,%rbx,2)
je 0x7c34
addl $0x2, %r13d
movl %r13d, %ebp
movq (%r14), %r14
testq %r14, %r14
jne 0x7bd5
testl %ebp, %ebp
je 0x7d91
addl $0x5, %ebp
movslq %ebp, %rdi
callq 0xee10
movq %rax, %rbp
movq 0x10(%rsp), %r14
testq %r14, %r14
je 0x7d93
movq %rbp, %r15
cmpq 0x10(%rsp), %r14
je 0x7c97
movb $0x20, (%r15)
incq %r15
movq 0x8(%r14), %r12
movq %r12, %r13
movsbq (%r13), %rbx
testq %rbx, %rbx
je 0x7ccd
incq %r13
callq 0x37a0
movq (%rax), %rax
testb $0x20, 0x1(%rax,%rbx,2)
je 0x7c9e
cmpl $0x0, 0xc(%rsp)
je 0x7d37
movq %r15, %rdi
leaq 0x11726(%rip), %rsi     # 0x193f1
jmp 0x7cd7
movq %r15, %rdi
leaq 0x1175b(%rip), %rsi     # 0x19432
movq %r12, %rdx
xorl %eax, %eax
callq 0x36d0
movq %r15, %rdi
callq 0x3200
movq %rax, %r13
addq %r15, %r13
movq 0x10(%r14), %r15
movq %r15, %r12
movsbq (%r12), %rbx
testq %rbx, %rbx
je 0x7d2f
incq %r12
callq 0x37a0
movq (%rax), %rax
testb $0x20, 0x1(%rax,%rbx,2)
je 0x7cf6
cmpl $0x0, 0xc(%rsp)
je 0x7d58
movq %r13, %rdi
leaq 0x12eb7(%rip), %rsi     # 0x1abda
movq %r15, %rdx
xorl %eax, %eax
callq 0x36d0
jmp 0x7d75
movq %r13, %rdi
movq %r15, %rsi
jmp 0x7d70
leaq 0x116b9(%rip), %rdi     # 0x193f7
movq %r12, %rsi
xorl %eax, %eax
callq 0xb41e
movq 0x8(%r14), %rdx
movq %r15, %rdi
leaq 0x116dc(%rip), %rsi     # 0x19432
jmp 0x7cda
leaq 0x116d7(%rip), %rdi     # 0x19436
movq %r15, %rsi
xorl %eax, %eax
callq 0xb41e
movq 0x10(%r14), %rsi
movq %r13, %rdi
callq 0x30e0
movq (%r14), %r14
movq %r13, %rdi
callq 0x3200
movq %rax, %r15
addq %r13, %r15
testq %r14, %r14
jne 0x7c89
jmp 0x7d93
xorl %ebp, %ebp
movq %rbp, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x115e5(%rip), %rdi     # 0x19391
leaq 0x11606(%rip), %rsi     # 0x193b9
leaq 0x11608(%rip), %rcx     # 0x193c2
movl $0x472, %edx            # imm = 0x472
callq 0x32e0