// File: /workspace/github_c_makefile_star2_O0/JimKent[P]linearSat/lib/mime.c
// Function: readPartHeaderMB
static void readPartHeaderMB(struct mimeBuf *b, struct mimePart *p, char *altHeader)
/* Reads the header lines of the mimePart,
   saves the header settings in a hash.  */
{
struct dyString *fullLine = dyStringNew(0);
char *key=NULL, *val=NULL;
struct lineFile *lf = NULL;
char *line = NULL;
char *lineAhead = NULL;
int size = 0;
p->hdr = newHash(3);
	//debug
    	//fprintf(stderr,"headers dumpMB: ");
	//dumpMB(b);  //debug
if (altHeader)
    {
    lf = lineFileOnString("MIME Header", TRUE, altHeader);
    }
/* read ahead one line, skipping any leading blanks lines */   
do
    {
    if (altHeader)
	lineFileNext(lf, &lineAhead, &size);
    else
	lineAhead = getLineMB(b);
    } 
    while (sameString(lineAhead,""));

do
    {
    /* accumulate a full header line - some emailers split into mpl lines */
    dyStringClear(fullLine);
    do 
	{
	line = lineAhead;
	if (altHeader)
	    lineFileNext(lf, &lineAhead, &size);
	else
	    lineAhead = getLineMB(b);
	dyStringAppend(fullLine,line);    
	if (!altHeader) 
	    freez(&line);
	} while (isspace(lineAhead[0]));
    line = fullLine->string;
    //fprintf(stderr,"found a line! [%s]\n",line);  //debug
    key = line;
    val = strchr(line,':');
    if (!val)
	errAbort("readPartHeaderMB error - header-line colon not found, line=[%s]",line);
    *val = 0;
    val++;
    key=trimSpaces(key);
    // since the hash is case-sensitive, convert to lower case for ease of matching
    tolowers(key);  
    val=trimSpaces(val);
    hashAdd(p->hdr,key,cloneString(val));
    
    //debug
    //fprintf(stderr,"MIME header: key=[%s], val=[%s]\n",key,val);
    //fflush(stderr); 
    
    } while (!sameString(lineAhead,""));
if (altHeader)
    {
    if (nlType == nlt_undet)
	nlType = lf->nlType;
    lineFileClose(&lf);
    }
else
    {
    freez(&lineAhead);
    }
dyStringFree(&fullLine);
    
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
xorl %edi, %edi
callq 0xf030
movq %rax, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movl $0x0, -0x4c(%rbp)
movl $0x3, %edi
movl $0x1, %esi
callq 0x10f70
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
cmpq $0x0, -0x18(%rbp)
je 0x21b08
movq -0x18(%rbp), %rdx
leaq 0x5d44(%rip), %rdi      # 0x2783e
movl $0x1, %esi
callq 0x121c0
movq %rax, -0x38(%rbp)
jmp 0x21b0a
cmpq $0x0, -0x18(%rbp)
je 0x21b24
movq -0x38(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0x4c(%rbp), %rdx
callq 0x12650
jmp 0x21b31
movq -0x8(%rbp), %rdi
callq 0x21940
movq %rax, -0x48(%rbp)
jmp 0x21b33
movq -0x48(%rbp), %rdi
leaq 0x31bc(%rip), %rsi      # 0x24cfa
callq 0x3410
cmpl $0x0, %eax
je 0x21b0a
jmp 0x21b4a
movq -0x20(%rbp), %rax
movl $0x0, 0x14(%rax)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movb $0x0, (%rax)
movq -0x48(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x21b82
movq -0x38(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0x4c(%rbp), %rdx
callq 0x12650
jmp 0x21b8f
movq -0x8(%rbp), %rdi
callq 0x21940
movq %rax, -0x48(%rbp)
movq -0x20(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0xf3c0
cmpq $0x0, -0x18(%rbp)
jne 0x21bac
leaq -0x40(%rbp), %rdi
callq 0x15410
jmp 0x21bae
callq 0x3760
movq (%rax), %rax
movq -0x48(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x2000, %eax           # imm = 0x2000
cmpl $0x0, %eax
jne 0x21b60
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x40(%rbp), %rdi
movl $0x3a, %esi
callq 0x3250
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x21c0d
movq -0x40(%rbp), %rsi
leaq 0x5c44(%rip), %rdi      # 0x2784a
movb $0x0, %al
callq 0xfd50
movq -0x30(%rbp), %rax
movb $0x0, (%rax)
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
callq 0xbee0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0xb160
movq -0x30(%rbp), %rdi
callq 0xbee0
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x30(%rbp), %rdi
callq 0x7530
movq -0x60(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq %rax, %rdx
callq 0x10900
movq -0x48(%rbp), %rdi
leaq 0x307f(%rip), %rsi      # 0x24cfa
callq 0x3410
cmpl $0x0, %eax
sete %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x21b4a
cmpq $0x0, -0x18(%rbp)
je 0x21cb8
cmpl $0x0, 0x2188e(%rip)     # 0x4352c
jne 0x21cad
movq -0x38(%rbp), %rax
movl 0x38(%rax), %eax
movl %eax, 0x2187f(%rip)     # 0x4352c
leaq -0x38(%rbp), %rdi
callq 0x12ea0
jmp 0x21cc1
leaq -0x48(%rbp), %rdi
callq 0x15410
leaq -0x20(%rbp), %rdi
callq 0xf090
addq $0x60, %rsp
popq %rbp
retq