// File: /workspace/github_c_makefile_star2_O3/JimKent[P]linearSat/lib/mime.c
// Function: parseMultiParts
struct mimePart *parseMultiParts(struct mimeBuf *b, char *altHeader)
/* This is a recursive function.  It parses multipart MIME messages.
   Data that are binary or too large will be saved in mimePart->filename
   otherwise saved as a c-string in mimePart->data.  If multipart,
   then first child is mimePart->child, subsequent sibs are in child->next.
   altHeader is a string of headers that can be fed in if the headers have
   already been read off the stream by an earlier process, i.e. apache.
 */
{ 
struct mimePart *p=AllocA(*p);
char *parentboundary = NULL, *boundary = NULL;
char *ct = NULL;
boolean autoBoundary = FALSE;


//debug
//fprintf(stderr,"altHeader=[%s]\n",altHeader);

if (sameOk(altHeader, "autoBoundary"))
    { /* process things with no explicit header.
       *  look for *MIME* \n\n-- */
    struct dyString *dy = dyStringNew(0);
    char *prevPrevLine = NULL;
    char *prevLine = NULL;
    char *line = NULL;
    boolean found = FALSE;
    autoBoundary = TRUE;
    while (TRUE)
	{
	if (b->i >= b->eoi && b->eoi < b->eom)  /* at end of input */
	    break;
	line = getLineMB(b);
	if (line && startsWith("--",line) // && 
	    //sameString(prevLine,"") && 
	    //prevPrevLine &&
	    //stringIn("MULTI",prevPrevLine) && 
	    //stringIn("MIME",prevPrevLine) 
	    )
	    {
	    found = TRUE;
	    break;
	    }
	freez(&prevPrevLine);
	prevPrevLine = prevLine;
	prevLine = line;
	if (prevPrevLine)
	    touppers(prevPrevLine);
	}
    if (!found)
	errAbort("autoBoundary: No initial boundary found.");

    dyStringPrintf(dy, "CONTENT-TYPE:multipart/form-data; boundary=%s%s%s", 
	line+2, getNewLineByType(), getNewLineByType() );
    altHeader = dyStringCannibalize(&dy); 
    
    //debug
    //fprintf(stderr,"autoBoundary altHeader = [%s]\n",altHeader);
    //fflush(stderr); 

    freez(&prevPrevLine);	    
    freez(&prevLine);	    
    freez(&line);	    
    }

//debug
//fprintf(stderr,"\n");
readPartHeaderMB(b,p,altHeader);

ct = hashFindVal(p->hdr,"content-type");  /* use lowercase key */
//debug
//fprintf(stderr,"ct from hash:%s\n",ct);
//fflush(stderr); 

if (ct && startsWith("multipart/",ct))
    {
    char bound[MAXBOUNDARY]; 
    char *bnd = NULL;
    struct mimePart *child = NULL;

    /* these 3 vars just for processing epilog chunk: */
    char *bp=NULL;
    int size=0;
    boolean hasZeros=FALSE;

    /* save */
    parentboundary = b->boundary;

    boundary = getMimeHeaderFieldVal(ct,"boundary");
    if (strlen(boundary) >= MAXBOUNDARY)
	errAbort("error: boundary= value too long in MIME header Content-type:%s",ct);
    safef(bound, sizeof(bound), "--%s",boundary);  /* do not prepend CRLF to boundary yet */
    freez(&boundary);
    boundary = cloneString(bound);
    //debug
    //fprintf(stderr,"initial boundary parsed:%s\n",boundary);
    //fflush(stderr); 

    if (!autoBoundary)
	{
	/* skip any extra "prolog" before the initial boundary marker */
	while (TRUE)
	    {
	    bnd = getLineMB(b);
	    if (sameString(bnd,boundary)) 
	       break;
	    freez(&bnd);
	    }
	    //debug
	    //fprintf(stderr,"initial boundary found:%s\n",bnd);
	    //fflush(stderr); 
	freez(&bnd);
	}

    /* include crlf in the boundary so bodies won't have trailing a CRLF
     * this is done here so that in case there's no extra CRLF
     * between the header and the boundary, it will still work,
     * so we only prepend the CRLF to the boundary after initial found */
    safef(bound,sizeof(bound),"%s%s", getNewLineByType(), boundary);
    freez(&boundary);
    boundary=cloneString(bound);
    
    setBoundaryMB(b, boundary);

    while(TRUE)
	{
	int i = 0;
	char c1 = ' ', c2 = ' ';
    	child = parseMultiParts(b,NULL);
	slAddHead(&p->multi,child);
	//call getLine, compare to boundary 
	/* skip extra initial boundary marker - it's moot anyway */
	freez(&bnd);
	    //debug
	    //fprintf(stderr,"post-parse pre-getLineMB dumpMB: ");
	    //dumpMB(b);  //debug
	for (i=0;i<strlen(boundary);++i)
	    bound[i] = getcMB(b);
	bound[i] = 0;    
	if (!sameString(bound,boundary))
	    errAbort("expected boundary %s, but found %s in MIME",boundary,bound);
	//debug
    	//fprintf(stderr,"\nfound boundary:%s\n",bound);
	//fflush(stderr); 
    	c1 = getcMB(b);
	if (c1 == '-')
	    {
	    c2 = getcMB(b);
	    if (c2 == '-')
    		break;  /* last boundary found */
	    else		    
	    	errAbort("expected -- after boundary %s, but found %c%c in MIME",boundary,c1,c2);
	    }
	if (nlType == nlt_dos)
	    c2 = getcMB(b);
	switch (nlType)
	    {
	    case nlt_dos:
		if (c1 == 0x0d && c2 == 0x0a)
		    break;
		else		    
		    errAbort("expected CRLF after boundary %s, but found %c%c in MIME",boundary,c1,c2);
	    case nlt_unix:
		if (c1 == 0x0a)
		    break;
		else		    
		    errAbort("expected LF after boundary %s, but found %c in MIME",boundary,c1);
	    case nlt_mac:
		if (c1 == 0x0d)
		    break;
		else		    
		    errAbort("expected CR after boundary %s, but found %c in MIME",boundary,c1);
	    default:
		    errAbort("unexpected nlType %d after boundary %s",nlType,boundary);
	    }
	setEopMB(b);
	}	
    freez(&bnd);
    slReverse(&p->multi);
    /* restore */
    freez(&boundary);
    boundary = parentboundary;
	//debug
    	//fprintf(stderr,"restoring parent boundary = %s\n",boundary);
    setBoundaryMB(b, boundary);

    /* dump any "epilog" that may be between the 
     * end of the child boundary and the parent boundary */
    getChunkMB(b, &bp, &size, &hasZeros);
    //debug
    //fprintf(stderr,"epilog size=%d\n",size);
    	   
    
    }
else
    {
    char *bp=NULL;
    int size=0;
    boolean hasZeros=FALSE;
    boolean toobig=FALSE;
    boolean asFile=FALSE;
    boolean convert=FALSE;
    FILE *f = NULL;
    struct dyString *dy=newDyString(1024);
    //debug
    //fprintf(stderr,"starting new part (non-multi), dumpMB: \n");
    //dumpMB(b);  //debug
    
    //debug
    //ct = hashFindVal(p->hdr,"content-transfer-encoding");  /* use lowercase key */
    //fprintf(stderr,"cte from hash:%s\n",ct);
	
    while(TRUE)
	{
	// break if eop, eod, eoi
    	getChunkMB(b, &bp, &size, &hasZeros);
	//debug
    	//fprintf(stderr,"bp=%lu size=%d, hasZeros=%d \n", 
	//    (unsigned long) bp,
	//    size,
	//    hasZeros);
	if (hasZeros)
	    {
	    p->binary=TRUE;
	    }
	//if (hasZeros && !asFile)
	//    {
	//    convert=TRUE;
	//    }
	if (!asFile && p->size+size > MAXPARTSIZE)
	    {
	    toobig = TRUE;
	    convert=TRUE;
	    }
	if (convert)
	    {
	    struct tempName uploadedData;
	    convert=FALSE;
	    asFile = TRUE;
	    makeTempName(&uploadedData, "hgSs", ".cgi");
	    p->fileName=cloneString(uploadedData.forCgi);
	    f = mustOpen(p->fileName,"w");
	    mustWrite(f,dy->string,dy->stringSize);
	    freeDyString(&dy);
	    }
	if (asFile)
	    {
	    mustWrite(f,bp,size);
	    }
	else
	    {
    	    dyStringAppendN(dy,bp,size);
	    }
	p->size+=size;
	if (p->size > MAXDATASIZE)
	    errAbort("max data size allowable for upload in MIME exceeded %llu",(unsigned long long)MAXDATASIZE);
	    
	
	if (b->eop && b->i == b->eop)  /* end of part */
	    {
	    break;
	    }
	if (b->i == b->eoi && b->eoi < b->eom) /* end of data */
	    {
	    break;
	    }
	moreMimeBuf(b);
	}
    if (dy)
	{
	p->data=needLargeMem(dy->stringSize+1);
	memcpy(p->data,dy->string,dy->stringSize);
	p->data[dy->stringSize] = 0;
    	freeDyString(&dy);
	}
    if (f)
	carefulClose(&f);

    //debug
    //fprintf(stderr,"p->fileName=%s p->data=[%s]\n",p->fileName,p->data);

    }

return p;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %rsi, %r12
movq %rdi, %r15
movl $0x38, %edi
callq 0xee10
movq %rax, 0x28(%rsp)
movq %rax, %rbx
movq $0x0, 0x10(%rsp)
leaq 0x5c8a(%rip), %rsi      # 0x1c545
movq %r12, %rdi
callq 0x8006
movl %eax, 0x44(%rsp)
testl %eax, %eax
movq %rbx, 0x20(%rsp)
jne 0x169e1
xorl %r14d, %r14d
xorl %edi, %edi
callq 0xad14
movq %rax, 0x50(%rsp)
leaq 0x8(%rsp), %rbx
movq %r14, (%rbx)
movq %r14, (%rsp)
movq %r14, 0x18(%rsp)
leaq 0x5c57(%rip), %r14      # 0x1c552
movq 0x8030(%r15), %rax
cmpq %rax, 0x8008(%r15)
jb 0x16914
cmpq 0x8038(%r15), %rax
jb 0x1695b
movq %r15, %rdi
callq 0x1712c
movq %rax, 0x18(%rsp)
testq %rax, %rax
je 0x16935
movq %r14, %rdi
movq %rax, %rsi
callq 0x8038
testl %eax, %eax
jne 0x16969
movq %rbx, %rdi
callq 0xeecc
movq (%rsp), %rdi
movq %rdi, 0x8(%rsp)
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
testq %rdi, %rdi
je 0x168fb
callq 0x84ff
jmp 0x168fb
leaq 0x5bf3(%rip), %rdi      # 0x1c555
xorl %eax, %eax
callq 0xb6c8
leaq 0x50(%rsp), %r14
movq (%r14), %rdi
leaq 0x18(%rsp), %rbx
movq (%rbx), %rdx
addq $0x2, %rdx
movl 0x21b79(%rip), %eax     # 0x384fc
cmpl $0x3, %eax
leaq 0x5bb6(%rip), %rcx      # 0x1c543
leaq 0x5b2c(%rip), %rsi      # 0x1c4c0
cmoveq %rcx, %rsi
cmpl $0x2, %eax
leaq 0x5b1d(%rip), %rcx      # 0x1c4bf
cmovneq %rsi, %rcx
leaq 0x5bd1(%rip), %rsi      # 0x1c57e
movq %rcx, %r8
xorl %eax, %eax
callq 0xb0b7
movq %r14, %rdi
callq 0xad70
movq %rax, %r12
leaq 0x8(%rsp), %rdi
callq 0xeecc
movq %rsp, %rdi
callq 0xeecc
movq %rbx, %rdi
callq 0xeecc
movq 0x20(%rsp), %rbx
xorl %r13d, %r13d
xorl %edi, %edi
callq 0xad14
movq %rax, %rbp
movq %rax, 0x50(%rsp)
movq %r13, 0x8(%rsp)
movq %r13, 0x18(%rsp)
movl $0x0, 0x34(%rsp)
movl $0x3, %edi
movl $0x1, %esi
callq 0xc1ee
movq %rax, 0x8(%rbx)
testq %r12, %r12
je 0x16a39
leaq 0x5e02(%rip), %rdi      # 0x1c826
movl $0x1, %esi
movq %r12, %rdx
callq 0xcd79
movq %rax, %r13
movq %rax, 0x8(%rsp)
leaq 0x18(%rsp), %rbx
leaq 0x34(%rsp), %r14
testq %r12, %r12
je 0x16a5d
movq %r13, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0xd043
movq 0x18(%rsp), %rax
jmp 0x16a6a
movq %r15, %rdi
callq 0x1712c
movq %rax, 0x18(%rsp)
cmpb $0x0, (%rax)
je 0x16a43
movq %rsp, %rbx
leaq 0x34(%rsp), %r14
movq %r15, 0x38(%rsp)
movl $0x0, 0x14(%rbp)
movq 0x8(%rbp), %rax
movb $0x0, (%rax)
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
testq %r12, %r12
je 0x16ab6
movq %r13, %rdi
leaq 0x18(%rsp), %rsi
movq %r14, %rdx
callq 0xd043
movq (%rsp), %rsi
movq %rbp, %rdi
callq 0xaf83
jmp 0x16ad7
movq %r15, %rdi
callq 0x1712c
movq %rax, 0x18(%rsp)
movq (%rsp), %rsi
movq %rbp, %rdi
callq 0xaf83
movq %rbx, %rdi
callq 0xeecc
callq 0x37a0
movq (%rax), %rcx
movq 0x18(%rsp), %rax
movsbq (%rax), %rdx
testb $0x20, 0x1(%rcx,%rdx,2)
jne 0x16a8f
movq 0x8(%rbp), %rbx
movq %rbx, (%rsp)
movq %rbx, %rdi
movl $0x3a, %esi
callq 0x3260
movq %rax, %r15
testq %rax, %rax
jne 0x16b1d
leaq 0x5d1f(%rip), %rdi      # 0x1c832
movq %rbx, %rsi
xorl %eax, %eax
callq 0xb6c8
movb $0x0, (%r15)
incq %r15
movq %rbx, %rdi
callq 0x8ed3
movq %rax, %rbx
movq %rax, %rdi
callq 0x877a
movq %r15, %rdi
callq 0x8ed3
movq 0x20(%rsp), %rcx
movq 0x8(%rcx), %r15
movq %rax, %rdi
callq 0x6402
movq %r15, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0xbe46
movq 0x18(%rsp), %rax
cmpb $0x0, (%rax)
movq 0x38(%rsp), %r15
movq %rsp, %rbx
jne 0x16a7c
testq %r12, %r12
je 0x16b98
cmpl $0x0, 0x2197c(%rip)     # 0x384fc
jne 0x16b8c
movl 0x38(%r13), %eax
movl %eax, 0x21970(%rip)     # 0x384fc
leaq 0x8(%rsp), %rdi
callq 0xd560
jmp 0x16ba2
leaq 0x18(%rsp), %rdi
callq 0xeecc
leaq 0x50(%rsp), %rdi
callq 0xad51
movq 0x20(%rsp), %rax
movq 0x8(%rax), %rdi
leaq 0x56d5(%rip), %rsi      # 0x1c291
callq 0xc0b1
testq %rax, %rax
je 0x16eb1
movq %rax, %rbx
leaq 0x59dc(%rip), %rdi      # 0x1c5b0
movq %rax, %rsi
callq 0x8038
testl %eax, %eax
je 0x16eb1
movq $0x0, 0x8(%rsp)
movq 0x8018(%r15), %rax
movq %rax, 0x48(%rsp)
leaq 0x59bb(%rip), %rsi      # 0x1c5bb
movq %rbx, %rdi
callq 0x1673b
movq %rax, %r14
movq %rax, 0x10(%rsp)
movq %rax, %rdi
callq 0x3200
cmpq $0x4d, %rax
jb 0x16c2f
leaq 0x599f(%rip), %rdi      # 0x1c5c4
movq %rbx, %rsi
xorl %eax, %eax
callq 0xb6c8
leaq 0x59cd(%rip), %rdx      # 0x1c603
leaq 0x50(%rsp), %rbx
movq %rbx, %rdi
movl $0x4d, %esi
movq %r14, %rcx
xorl %eax, %eax
callq 0xa0ca
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0xeecc
movq %rbx, %rdi
callq 0x6402
movq %rax, (%r14)
cmpl $0x0, 0x44(%rsp)
je 0x16cc4
movq %r15, %rdi
callq 0x1712c
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x3440
testl %eax, %eax
je 0x16cb5
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xeecc
movq %r15, %rdi
callq 0x1712c
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x3440
testl %eax, %eax
jne 0x16c8f
leaq 0x8(%rsp), %rdi
callq 0xeecc
movq 0x10(%rsp), %rax
movl 0x21832(%rip), %ecx     # 0x384fc
cmpl $0x3, %ecx
leaq 0x586f(%rip), %rdx      # 0x1c543
leaq 0x57e5(%rip), %rsi      # 0x1c4c0
cmoveq %rdx, %rsi
cmpl $0x2, %ecx
leaq 0x57d6(%rip), %rcx      # 0x1c4bf
cmovneq %rsi, %rcx
leaq 0x34b3(%rip), %rdx      # 0x1a1a7
leaq 0x50(%rsp), %r13
movq %r13, %rdi
movl $0x4d, %esi
movq %rax, %r8
xorl %eax, %eax
callq 0xa0ca
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0xeecc
movq %r13, %rdi
callq 0x6402
movq %rax, (%rbx)
movq %r15, %rdi
movq %rax, %rsi
callq 0x17218
addq $0x30, 0x28(%rsp)
leaq 0x8(%rsp), %rbp
leaq 0x58c8(%rip), %r12      # 0x1c608
movq %r15, %rdi
xorl %esi, %esi
callq 0x16882
movq 0x28(%rsp), %rdx
movq (%rdx), %rcx
movq %rcx, (%rax)
movq %rax, (%rdx)
movq %rbp, %rdi
callq 0xeecc
movq 0x10(%rsp), %rbx
cmpb $0x0, (%rbx)
movl $0x0, %r14d
je 0x16d95
xorl %r14d, %r14d
movq %r15, %rdi
callq 0x1726b
movb %al, 0x50(%rsp,%r14)
incq %r14
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x3200
cmpq %r14, %rax
ja 0x16d73
movb $0x0, 0x50(%rsp,%r14)
movq %r13, %rdi
movq %rbx, %rsi
callq 0x3440
testl %eax, %eax
je 0x16dba
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
xorl %eax, %eax
callq 0xb6c8
movq %r15, %rdi
callq 0x1726b
movl %eax, %ebx
movb $0x20, %r14b
cmpb $0x2d, %al
jne 0x16df9
movq %r15, %rdi
callq 0x1726b
cmpb $0x2d, %al
je 0x170ab
movl %eax, %r14d
movsbl %al, %ecx
movq 0x10(%rsp), %rsi
leaq 0x5846(%rip), %rdi      # 0x1c633
movl $0x2d, %edx
xorl %eax, %eax
callq 0xb6c8
movl 0x216fd(%rip), %esi     # 0x384fc
cmpl $0x2, %esi
jne 0x16e15
movq %r15, %rdi
callq 0x1726b
movl %eax, %r14d
movl 0x216e7(%rip), %esi     # 0x384fc
movsbl %bl, %r15d
cmpl $0x1, %esi
je 0x16e50
cmpl $0x3, %esi
je 0x16e6b
cmpl $0x2, %esi
jne 0x16e8c
movl %ebx, %eax
xorb $0xd, %al
movl %r14d, %ecx
xorb $0xa, %cl
orb %al, %cl
je 0x16e9f
movsbl %r14b, %ecx
movq 0x10(%rsp), %rsi
leaq 0x5823(%rip), %rdi      # 0x1c669
movl %r15d, %edx
xorl %eax, %eax
callq 0xb6c8
cmpb $0xa, %bl
je 0x16e9f
movq 0x10(%rsp), %rsi
leaq 0x5840(%rip), %rdi      # 0x1c6a1
movl %r15d, %edx
xorl %eax, %eax
callq 0xb6c8
cmpb $0xd, %bl
je 0x16e9f
movq 0x10(%rsp), %rsi
leaq 0x5859(%rip), %rdi      # 0x1c6d5
movl %r15d, %edx
xorl %eax, %eax
callq 0xb6c8
movl 0x21670(%rip), %esi     # 0x384fc
movq 0x10(%rsp), %rdx
leaq 0x5871(%rip), %rdi      # 0x1c709
xorl %eax, %eax
callq 0xb6c8
movq 0x38(%rsp), %r15
movq %r15, %rdi
callq 0x172d7
jmp 0x16d40
movabsq $0x1000000000, %rbx     # imm = 0x1000000000
movq $0x0, 0x8(%rsp)
movl $0x400, %edi            # imm = 0x400
callq 0xad14
movq %rsp, %rcx
movq %rax, (%rcx)
leaq 0x1(%rbx), %rax
movq %rax, 0x28(%rsp)
xorl %r12d, %r12d
xorl %ebp, %ebp
movq 0x8010(%r15), %r14
testq %r14, %r14
jne 0x16ef5
movq 0x8028(%r15), %r14
movq 0x8008(%r15), %rbx
movq %r14, %r13
subq %rbx, %r13
leaq 0x2dc9(%rip), %rdi      # 0x19cd2
movl $0x1, %esi
movq %rbx, %rdx
movl %r13d, %ecx
callq 0x83ca
movq %r14, 0x8008(%r15)
testq %rax, %rax
je 0x16f31
movq 0x20(%rsp), %rax
movl $0x1, 0x28(%rax)
testl %ebp, %ebp
je 0x16f42
movslq %r13d, %r14
movq 0x20(%rsp), %r13
jmp 0x16fda
movslq %r13d, %r14
movq 0x20(%rsp), %r15
movq 0x10(%r15), %rax
addq %r14, %rax
cmpq 0x28(%rsp), %rax
jge 0x16f73
movq (%rsp), %rdi
movq %rbx, %rsi
movl %r13d, %edx
callq 0xae1e
xorl %ebp, %ebp
movq %r15, %r13
movq 0x38(%rsp), %r15
jmp 0x16fe8
leaq 0x50(%rsp), %r12
movq %r12, %rdi
leaq 0x57ae(%rip), %rsi      # 0x1c730
leaq 0x57ac(%rip), %rdx      # 0x1c735
callq 0x17310
movq %r12, %rdi
callq 0x6402
movq %rax, 0x20(%r15)
movq %rax, %rdi
leaq 0x2a8f(%rip), %rsi      # 0x19a33
callq 0x932b
movq %rax, %r12
movq %rax, 0x8(%rsp)
movq (%rsp), %rax
movq 0x8(%rax), %rsi
movslq 0x14(%rax), %rdx
movq %r12, %rdi
callq 0x93f1
movq %rsp, %rdi
callq 0xad51
movl $0x1, %ebp
movq %r15, %r13
movq 0x38(%rsp), %r15
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x93f1
addq 0x10(%r13), %r14
movq %r14, 0x10(%r13)
movabsq $0x1000000000, %rax     # imm = 0x1000000000
cmpq %rax, %r14
jle 0x17017
leaq 0x5734(%rip), %rdi      # 0x1c73a
movabsq $0x1000000000, %rsi     # imm = 0x1000000000
xorl %eax, %eax
callq 0xb6c8
movq 0x8008(%r15), %rax
movq 0x8010(%r15), %rcx
testq %rcx, %rcx
setne %dl
cmpq %rcx, %rax
sete %cl
testb %cl, %dl
jne 0x17054
cmpq 0x8030(%r15), %rax
jne 0x17047
cmpq 0x8038(%r15), %rax
jb 0x17054
movq %r15, %rdi
callq 0x165b7
jmp 0x16ee2
movq (%rsp), %rax
testq %rax, %rax
je 0x1709a
movslq 0x14(%rax), %rdi
incq %rdi
callq 0xec18
movq %rax, 0x18(%r13)
movq %rsp, %rbx
movq (%rbx), %rcx
movq 0x8(%rcx), %rsi
movslq 0x14(%rcx), %rdx
movq %rax, %rdi
callq 0x34a0
movq 0x18(%r13), %rax
movq (%rbx), %rcx
movslq 0x14(%rcx), %rcx
movb $0x0, (%rax,%rcx)
movq %rbx, %rdi
callq 0xad51
testq %r12, %r12
je 0x17117
leaq 0x8(%rsp), %rdi
callq 0x99bb
jmp 0x17117
leaq 0x8(%rsp), %rdi
callq 0xeecc
movq 0x28(%rsp), %rdi
callq 0x66bb
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0xeecc
movq 0x48(%rsp), %rsi
movq %rsi, (%rbx)
movq %r15, %rdi
callq 0x17218
movq 0x8010(%r15), %rbx
testq %rbx, %rbx
jne 0x170ef
movq 0x8028(%r15), %rbx
movq 0x8008(%r15), %rdx
movl %ebx, %ecx
subl %edx, %ecx
leaq 0x2bd1(%rip), %rdi      # 0x19cd2
movl $0x1, %esi
callq 0x83ca
movq %rbx, 0x8008(%r15)
movq 0x20(%rsp), %r13
movq %r13, %rax
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq