// File: /workspace/github_c_makefile_star2_O1/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, 0x4(%rsp)
testq %rdi, %rdi
movq %rdi, 0x8(%rsp)
je 0x7e14
xorl %r13d, %r13d
movq %rdi, %r14
movq 0x8(%r14), %r12
testq %r12, %r12
je 0x7f73
movq 0x10(%r14), %r15
testq %r15, %r15
je 0x7f73
movq %r12, %rdi
callq 0x3200
addl %eax, %r13d
movq %r15, %rdi
callq 0x3200
leal (%rax,%r13), %ebp
addl $0x2, %ebp
cmpl $0x0, 0x4(%rsp)
je 0x7e03
addl %eax, %r13d
movsbq (%r12), %rbx
testq %rbx, %rbx
je 0x7dd4
incq %r12
callq 0x37a0
movq (%rax), %rax
testb $0x20, 0x1(%rax,%rbx,2)
je 0x7db8
addl $0x4, %r13d
testb %bl, %bl
cmovel %ebp, %r13d
movsbq (%r15), %rbx
testq %rbx, %rbx
je 0x7df9
incq %r15
callq 0x37a0
movq (%rax), %rax
testb $0x20, 0x1(%rax,%rbx,2)
je 0x7dde
leal 0x2(%r13), %ebp
testb %bl, %bl
cmovel %r13d, %ebp
movq (%r14), %r14
movl %ebp, %r13d
testq %r14, %r14
jne 0x7d7a
jmp 0x7e16
xorl %ebp, %ebp
testl %ebp, %ebp
je 0x7f62
addl $0x5, %ebp
movslq %ebp, %rdi
callq 0xf07d
movq 0x8(%rsp), %rbx
testq %rbx, %rbx
je 0x7f64
leaq 0x115e4(%rip), %r12     # 0x19422
movq %rax, 0x10(%rsp)
movq %rax, %r15
movq %rbx, %r14
cmpq %rbx, %r14
je 0x7e55
movb $0x20, (%r15)
incq %r15
movq 0x8(%r14), %r13
movq %r13, %rbx
movsbq (%rbx), %rbp
testq %rbp, %rbp
je 0x7e93
incq %rbx
callq 0x37a0
movq (%rax), %rax
testb $0x20, 0x1(%rax,%rbp,2)
je 0x7e5c
testb %bpl, %bpl
je 0x7e93
cmpl $0x0, 0x4(%rsp)
je 0x7f21
movq %r15, %rdi
leaq 0x11550(%rip), %rsi     # 0x193e1
jmp 0x7e99
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0x36d0
movq %r15, %rdi
callq 0x3200
movq %rax, %r13
addq %r15, %r13
movq 0x10(%r14), %r15
movq %r15, %rbx
movsbq (%rbx), %rbp
testq %rbp, %rbp
je 0x7ef5
incq %rbx
callq 0x37a0
movq (%rax), %rax
testb $0x20, 0x1(%rax,%rbp,2)
je 0x7eb8
testb %bpl, %bpl
je 0x7ef5
cmpl $0x0, 0x4(%rsp)
je 0x7f41
movq %r13, %rdi
leaq 0x12ce1(%rip), %rsi     # 0x1abca
movq %r15, %rdx
xorl %eax, %eax
callq 0x36d0
jmp 0x7f00
movq %r13, %rdi
movq %r15, %rsi
callq 0x30e0
movq 0x8(%rsp), %rbx
movq (%r14), %r14
movq %r13, %rdi
callq 0x3200
movq %rax, %r15
addq %r13, %r15
testq %r14, %r14
jne 0x7e49
jmp 0x7f5b
leaq 0x114bf(%rip), %rdi     # 0x193e7
movq %r13, %rsi
xorl %eax, %eax
callq 0xb632
movq 0x8(%r14), %rdx
movq %r15, %rdi
movq %r12, %rsi
jmp 0x7e9c
leaq 0x114de(%rip), %rdi     # 0x19426
movq %r15, %rsi
xorl %eax, %eax
callq 0xb632
movq 0x10(%r14), %rsi
movq %r13, %rdi
jmp 0x7efb
movq 0x10(%rsp), %rax
jmp 0x7f64
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x11407(%rip), %rdi     # 0x19381
leaq 0x11428(%rip), %rsi     # 0x193a9
leaq 0x1142a(%rip), %rcx     # 0x193b2
movl $0x472, %edx            # imm = 0x472
callq 0x32e0