// File: /workspace/github_c_makefile_star2_O0/JimKent[P]linearSat/lib/cheapcgi.c
// Function: parseCookies
static void parseCookies(struct hash **retHash, struct cgiVar **retList)
/* parses any cookies and puts them into the given hash and list */
{
char* str;
char *namePt, *dataPt, *nextNamePt;
struct hash *hash;
struct cgiVar *list = NULL, *el;

/* don't build the hash table again */
if(haveCookiesHash == TRUE)
	return;

str = cloneString(getenv("HTTP_COOKIE"));
if(str == NULL) /* don't have a cookie */
	return;

hash = newHash(6);

namePt = str;
while (isNotEmpty(namePt))
    {
    dataPt = strchr(namePt, '=');
    if (dataPt == NULL)
	errAbort("Mangled Cookie input string: no = in '%s' (offset %d in complete cookie string: '%s')",
		 namePt, (int)(namePt - str), getenv("HTTP_COOKIE"));
    *dataPt++ = 0;
    nextNamePt = strchr(dataPt, ';');
    if (nextNamePt != NULL)
	{
         *nextNamePt++ = 0;
	 if (*nextNamePt == ' ')
	     nextNamePt++;
	}
    cgiDecode(dataPt,dataPt,strlen(dataPt));
    AllocVar(el);
    el->val = dataPt;
    slAddHead(&list, el);
    hashAddSaveName(hash, namePt, el, &el->name);
    namePt = nextNamePt;
    }

haveCookiesHash = TRUE;

slReverse(&list);
*retList = list;
*retHash = hash;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x40(%rbp)
cmpl $0x1, 0x27931(%rip)     # 0x43510
jne 0x1bbe6
jmp 0x1bd97
leaq 0xb4ed(%rip), %rdi      # 0x270da
callq 0x3030
movq %rax, %rdi
callq 0x7530
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x1bc0a
jmp 0x1bd97
movl $0x6, %edi
movl $0x1, %esi
callq 0x10f70
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movb $0x1, %al
cmpq $0x0, -0x20(%rbp)
movb %al, -0x49(%rbp)
je 0x1bc41
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
sete %al
movb %al, -0x49(%rbp)
movb -0x49(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x1bc4f
jmp 0x1bd6e
movq -0x20(%rbp), %rdi
movl $0x3d, %esi
callq 0x3250
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x1bca2
movq -0x20(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movl %eax, -0x50(%rbp)
leaq 0xb455(%rip), %rdi      # 0x270da
callq 0x3030
movq -0x58(%rbp), %rsi
movl -0x50(%rbp), %edx
movq %rax, %rcx
leaq 0xb44b(%rip), %rdi      # 0x270e6
movb $0x0, %al
callq 0xfd50
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
movb $0x0, (%rax)
movq -0x28(%rbp), %rdi
movl $0x3b, %esi
callq 0x3250
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x1bcf9
movq -0x30(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x30(%rbp)
movb $0x0, (%rax)
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x20, %eax
jne 0x1bcf7
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x1bcf9
movq -0x28(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rdi
callq 0x31f0
movq -0x68(%rbp), %rdi
movq -0x60(%rbp), %rsi
movl %eax, %edx
callq 0x1bf60
movl $0x20, %edi
callq 0x152f0
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x48(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x1c050
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq -0x48(%rbp), %rcx
addq $0x8, %rcx
callq 0x10b20
movq -0x30(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x1bc25
movl $0x1, 0x27798(%rip)     # 0x43510
leaq -0x40(%rbp), %rdi
callq 0x7bb0
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)