// File: /workspace/github_c_makefile_star2_O0/NedFreed[P]msglint/msglint.c
// Function: parsemime
static int parsemime(msgcontext *ctx, const char **pmsg, int *plen, int htype)
{
    const static char pgpsig[] = "pgp-signature";
    const static char appl[] = "application/";
#define PGPLEN (sizeof (pgpsig) - 1)
#define APPLLEN (sizeof (appl) - 1)
    int r = 0, preamble = 0;
    MIMEinfo *mcur;

    /* loop for nested message/rfc822 parts: */
    for (;;) {
	if (parseheaders(ctx, pmsg, plen, htype) == -1) return (-1);
	MD5Init(&ctx->md5);
	if (htype == HEAD_EXTB) break;
	mcur = ctx->mcur;
	    
	if (!quiet) {
	    if (mcur->keep[K_CTYPE] != NULL &&
		mcur->keep[K_SUBTYPE] != NULL) {
		wprintf(NULL, w_ok, "found part %t/%t line %d",
			mcur->keep[K_CTYPE],
			mcur->keep[K_SUBTYPE], ctx->lineno);
	    } else {
		wprintf(NULL, w_ok, "found default part %s line %d",
			ctx->mpart != NULL && ctx->mpart->indigest ?
			"message/rfc822" : "text/plain", ctx->lineno);
	    }
	}
	
	/* handle subtypes with RFC 822/MIME headers */
	switch (mcur->typenum) {
	  case multipart:
	    preamble = 1;
	    break;

	  case application:
	    if (tokcomp(pgpsig, PGPLEN, mcur->keep[K_SUBTYPE]) == 0 &&
		ctx->mpart->keep[K_PROTO] != NULL &&
		(ctx->mpart->keep[K_PROTO]->len != PGPLEN+APPLLEN ||
		 strncasecmp(appl, ctx->mpart->keep[K_PROTO]->data, APPLLEN) ||
		 strncasecmp(pgpsig, ctx->mpart->keep[K_PROTO]->data
			     + APPLLEN, PGPLEN))) {
		wprintf(NULL, w_error, "mismatch of inner content subtype "
			"'%t' line %d with outer protocol parameter '%t'",
			mcur->keep[K_SUBTYPE], ctx->lineno,
			ctx->mpart->keep[K_PROTO]);
	    }
	    if (tokprefix("octet", 5, mcur->keep[K_SUBTYPE]) == 0 &&
		tokcomp("octet-stream", -1, mcur->keep[K_SUBTYPE]) != 0) {
		wprintf(NULL, w_warn, "possible misspelling of "
		       "'octet-stream' at '%t' in Content-Type header "
		       "before line %d", mcur->keep[K_SUBTYPE],
			ctx->lineno);
	    }
	    break;
	    
	  case message:

	    if (mcur->keep[K_SUBTYPE] == NULL ||
		tokcomp("rfc822", -1, mcur->keep[K_SUBTYPE]) == 0) {
		htype = HEAD_INNER;
		continue;
	    } else if (tokcomp("delivery-status", -1, mcur->keep[K_SUBTYPE])
		       == 0) {
		if (!ctx->mpart || !ctx->mpart->keep[K_REPTYPE]) {
		    wprintf(NULL, w_error, "missing report-type parameter on "
			    "multipart enclosing line %d", ctx->lineno);
		} else if (tokcomp("delivery-status", -1,
				   ctx->mpart->keep[K_REPTYPE]) != 0) {
		    wprintf(NULL, w_error, "mismatch of inner content "
			    "subtype '%t' line %d with outer report-type "
			    "parameter '%t'",
			   mcur->keep[K_SUBTYPE],
			   ctx->lineno,
			   ctx->mpart->keep[K_REPTYPE]);
		}
		r = parseheaders(ctx, pmsg, plen, HEAD_DSN);
		while (r == 0 && *plen > 0 &&
		       **pmsg != '-' && **pmsg != '\0') {
		    r = parseheaders(ctx, pmsg, plen, HEAD_RCPT);
		}
	    } else if (tokcomp("disposition-notification", -1,
			       mcur->keep[K_SUBTYPE])==0) {
		if (!ctx->mpart || !ctx->mpart->keep[K_REPTYPE]) {
		    wprintf(NULL, w_error, "missing report-type parameter on "
			    "multipart enclosing line %d", ctx->lineno);
		} else if (tokcomp("disposition-notification", -1,
				   ctx->mpart->keep[K_REPTYPE]) != 0) {
		    wprintf(NULL, w_error, "mismatch of inner content "
			    "subtype '%t' line %d with outer report-type "
			    "parameter '%t'",
			   mcur->keep[K_SUBTYPE],
			   ctx->lineno,
			   ctx->mpart->keep[K_REPTYPE]);
		}
		r = parseheaders(ctx, pmsg, plen, HEAD_MDN);
	    } else if (tokcomp("tracking-status", -1, mcur->keep[K_SUBTYPE])
		       == 0) {
		if (!ctx->mpart || !ctx->mpart->inrelated) {
		    wprintf(NULL, w_error, "tracking-status should only "
			    "appear in a multipart/related line %d",
			    ctx->lineno);
		} else if (!ctx->mpart->keep[K_RELTYPE]) {
		    wprintf(NULL, w_error, "Missing type parameter on "
			    "multipart enclosing line %d", ctx->lineno);
		} else if (tokcomp("message/tracking-status", -1,
				   ctx->mpart->keep[K_RELTYPE]) != 0) {
		    wprintf(NULL, w_error, "mismatch of inner content "
			    "type 'message/%t' line %d with outer "
			    "multipart/related type parameter '%t'",
			    mcur->keep[K_SUBTYPE],
			    ctx->lineno,
			    ctx->mpart->keep[K_RELTYPE]);
		}
		r = parseheaders(ctx, pmsg, plen, HEAD_MTRKM);
		while (r == 0 && *plen > 0 &&
		       **pmsg != '-' && **pmsg != '\0') {
		    r = parseheaders(ctx, pmsg, plen, HEAD_MTRKR);
		}
	    } else if (tokcomp("external-body", -1, mcur->keep[K_SUBTYPE])
		       == 0) {
		htype = HEAD_EXTB;
		continue;
	    }
	    break;
	    
	  case text:
	    if (mcur->keep[K_SUBTYPE] == NULL ||
	        tokcomp("plain", -1, mcur->keep[K_SUBTYPE]) == 0) {
	        mcur->textplain = 1;
	        if (mcur->keep[K_FORMAT] != NULL &&
	            tokcomp("flowed", -1, mcur->keep[K_FORMAT]) == 0) {
	            mcur->textplain = 2;
	        }
	    } else if (tokcomp("rfc822-headers", -1, mcur->keep[K_SUBTYPE])
		       == 0 &&
		       (mcur->cte == cte7bit || mcur->cte == cte8bit)) {
		r = parseheaders(ctx, pmsg, plen, HEAD_TEXT);
	    }
	    break;
	}
	if (r == -1) return (-1);
	break;
    }

    return (findboundary(ctx, pmsg, plen, preamble));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl -0x24(%rbp), %ecx
callq 0x4580
cmpl $-0x1, %eax
jne 0x535a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5a66
movq -0x10(%rbp), %rdi
addq $0x20, %rdi
callq 0xc6d0
cmpl $0x7, -0x24(%rbp)
jne 0x5372
jmp 0x5a4f
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
cmpl $0x0, 0xf960(%rip)      # 0x14ce4
jne 0x542e
movq -0x38(%rbp), %rax
cmpq $0x0, (%rax)
je 0x53d1
movq -0x38(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x53d1
movq -0x38(%rbp), %rax
movq (%rax), %rcx
movq -0x38(%rbp), %rax
movq 0x8(%rax), %r8
movq -0x10(%rbp), %rax
movl 0x10(%rax), %r9d
xorl %eax, %eax
movl %eax, %edi
leaq 0x9f4f(%rip), %rsi      # 0xf310
leaq 0xc7c1(%rip), %rdx      # 0x11b89
movb $0x0, %al
callq 0x2e50
jmp 0x542c
movq -0x10(%rbp), %rcx
xorl %eax, %eax
cmpq $0x0, 0x8(%rcx)
movb %al, -0x39(%rbp)
je 0x53f3
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x0, 0x50(%rax)
setne %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %dl
leaq 0xc7d2(%rip), %rcx      # 0x11bcf
leaq 0xc7bc(%rip), %rax      # 0x11bc0
testb $0x1, %dl
cmovneq %rax, %rcx
movq -0x10(%rbp), %rax
movl 0x10(%rax), %r8d
xorl %eax, %eax
movl %eax, %edi
leaq 0x9ef2(%rip), %rsi      # 0xf310
leaq 0xc77d(%rip), %rdx      # 0x11ba2
movb $0x0, %al
callq 0x2e50
jmp 0x542e
movq -0x38(%rbp), %rax
movl 0x74(%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x48(%rbp)
subl $0x6, %eax
ja 0x5a3e
movq -0x48(%rbp), %rax
leaq 0x8e1f(%rip), %rcx      # 0xe270
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x1, -0x2c(%rbp)
jmp 0x5a3e
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0xa368(%rip), %rdi      # 0xf7dd
movl $0xd, %esi
callq 0x60a0
cmpl $0x0, %eax
jne 0x5536
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpq $0x0, 0x18(%rax)
je 0x5536
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
movslq 0x14(%rax), %rax
cmpq $0x19, %rax
jne 0x5501
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rsi
leaq 0xa323(%rip), %rdi      # 0xf7eb
movl $0xc, %edx
callq 0x2140
cmpl $0x0, %eax
jne 0x5501
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rsi
addq $0xc, %rsi
leaq 0xa2eb(%rip), %rdi      # 0xf7dd
movl $0xd, %edx
callq 0x2140
cmpl $0x0, %eax
je 0x5536
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movl 0x10(%rax), %r8d
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %r9
xorl %eax, %eax
movl %eax, %edi
leaq 0xa1ee(%rip), %rsi      # 0xf716
leaq 0xc6ab(%rip), %rdx      # 0x11bda
movb $0x0, %al
callq 0x2e50
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0xc6e7(%rip), %rdi      # 0x11c2c
movl $0x5, %esi
callq 0x9a60
cmpl $0x0, %eax
jne 0x559b
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0xc6cf(%rip), %rdi      # 0x11c32
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x60a0
cmpl $0x0, %eax
je 0x559b
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movl 0x10(%rax), %r8d
xorl %eax, %eax
movl %eax, %edi
leaq 0x9de4(%rip), %rsi      # 0xf371
leaq 0xc6ab(%rip), %rdx      # 0x11c3f
movb $0x0, %al
callq 0x2e50
jmp 0x5a3e
movq -0x38(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x55c9
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0xc60e(%rip), %rdi      # 0x11bc8
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x60a0
cmpl $0x0, %eax
jne 0x55d5
movl $0x5, -0x24(%rbp)
jmp 0x5335
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0xc6b0(%rip), %rdi      # 0x11c94
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x60a0
cmpl $0x0, %eax
jne 0x570e
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x5611
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpq $0x0, 0x18(%rax)
jne 0x5633
movq -0x10(%rbp), %rax
movl 0x10(%rax), %ecx
xorl %eax, %eax
movl %eax, %edi
leaq 0xa0f3(%rip), %rsi      # 0xf716
leaq 0xc67a(%rip), %rdx      # 0x11ca4
movb $0x0, %al
callq 0x2e50
jmp 0x568c
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rdx
leaq 0xc64e(%rip), %rdi      # 0x11c94
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x60a0
cmpl $0x0, %eax
je 0x568a
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movl 0x10(%rax), %r8d
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %r9
xorl %eax, %eax
movl %eax, %edi
leaq 0xa09a(%rip), %rsi      # 0xf716
leaq 0xc65e(%rip), %rdx      # 0x11ce1
movb $0x0, %al
callq 0x2e50
jmp 0x568c
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl $0x2, %ecx
callq 0x4580
movl %eax, -0x28(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x28(%rbp)
movb %al, -0x49(%rbp)
jne 0x56e5
movq -0x20(%rbp), %rcx
xorl %eax, %eax
cmpl $0x0, (%rcx)
movb %al, -0x49(%rbp)
jle 0x56e5
movq -0x18(%rbp), %rax
movq (%rax), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x2d, %ecx
movb %al, -0x49(%rbp)
je 0x56e5
movq -0x18(%rbp), %rax
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x49(%rbp)
movb -0x49(%rbp), %al
testb $0x1, %al
jne 0x56ee
jmp 0x5709
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl $0x3, %ecx
callq 0x4580
movl %eax, -0x28(%rbp)
jmp 0x56a5
jmp 0x597e
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0xc619(%rip), %rdi      # 0x11d36
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x60a0
cmpl $0x0, %eax
jne 0x57e3
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x574a
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpq $0x0, 0x18(%rax)
jne 0x576c
movq -0x10(%rbp), %rax
movl 0x10(%rax), %ecx
xorl %eax, %eax
movl %eax, %edi
leaq 0x9fba(%rip), %rsi      # 0xf716
leaq 0xc541(%rip), %rdx      # 0x11ca4
movb $0x0, %al
callq 0x2e50
jmp 0x57c5
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rdx
leaq 0xc5b7(%rip), %rdi      # 0x11d36
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x60a0
cmpl $0x0, %eax
je 0x57c3
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movl 0x10(%rax), %r8d
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %r9
xorl %eax, %eax
movl %eax, %edi
leaq 0x9f61(%rip), %rsi      # 0xf716
leaq 0xc525(%rip), %rdx      # 0x11ce1
movb $0x0, %al
callq 0x2e50
jmp 0x57c5
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl $0x4, %ecx
callq 0x4580
movl %eax, -0x28(%rbp)
jmp 0x597c
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0xc5dd(%rip), %rdi      # 0x11dcf
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x60a0
cmpl $0x0, %eax
jne 0x594e
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x581e
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x0, 0x58(%rax)
jne 0x5843
movq -0x10(%rbp), %rax
movl 0x10(%rax), %ecx
xorl %eax, %eax
movl %eax, %edi
leaq 0x9ee6(%rip), %rsi      # 0xf716
leaq 0xc518(%rip), %rdx      # 0x11d4f
movb $0x0, %al
callq 0x2e50
jmp 0x58cf
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpq $0x0, 0x18(%rax)
jne 0x5874
movq -0x10(%rbp), %rax
movl 0x10(%rax), %ecx
xorl %eax, %eax
movl %eax, %edi
leaq 0x9eb2(%rip), %rsi      # 0xf716
leaq 0xc526(%rip), %rdx      # 0x11d91
movb $0x0, %al
callq 0x2e50
jmp 0x58cd
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %rdx
leaq 0xc540(%rip), %rdi      # 0x11dc7
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x60a0
cmpl $0x0, %eax
je 0x58cb
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x10(%rbp), %rax
movl 0x10(%rax), %r8d
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x18(%rax), %r9
xorl %eax, %eax
movl %eax, %edi
leaq 0x9e59(%rip), %rsi      # 0xf716
leaq 0xc51b(%rip), %rdx      # 0x11ddf
movb $0x0, %al
callq 0x2e50
jmp 0x58cd
jmp 0x58cf
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl $0x8, %ecx
callq 0x4580
movl %eax, -0x28(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x28(%rbp)
movb %al, -0x4a(%rbp)
jne 0x5928
movq -0x20(%rbp), %rcx
xorl %eax, %eax
cmpl $0x0, (%rcx)
movb %al, -0x4a(%rbp)
jle 0x5928
movq -0x18(%rbp), %rax
movq (%rax), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x2d, %ecx
movb %al, -0x4a(%rbp)
je 0x5928
movq -0x18(%rbp), %rax
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x4a(%rbp)
movb -0x4a(%rbp), %al
testb $0x1, %al
jne 0x5931
jmp 0x594c
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl $0x9, %ecx
callq 0x4580
movl %eax, -0x28(%rbp)
jmp 0x58e8
jmp 0x597a
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0xc4e7(%rip), %rdi      # 0x11e44
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x60a0
cmpl $0x0, %eax
jne 0x5978
movl $0x7, -0x24(%rbp)
jmp 0x5335
jmp 0x597a
jmp 0x597c
jmp 0x597e
jmp 0x5980
jmp 0x5a3e
movq -0x38(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x59ae
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0xc235(%rip), %rdi      # 0x11bd4
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x60a0
cmpl $0x0, %eax
jne 0x59ef
movq -0x38(%rbp), %rax
movl $0x1, 0x64(%rax)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x59ed
movq -0x38(%rbp), %rax
movq 0x28(%rax), %rdx
leaq 0xc47f(%rip), %rdi      # 0x11e52
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x60a0
cmpl $0x0, %eax
jne 0x59ed
movq -0x38(%rbp), %rax
movl $0x2, 0x64(%rax)
jmp 0x5a3c
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0xc45b(%rip), %rdi      # 0x11e59
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x60a0
cmpl $0x0, %eax
jne 0x5a3a
movq -0x38(%rbp), %rax
cmpl $0x1, 0x78(%rax)
je 0x5a21
movq -0x38(%rbp), %rax
cmpl $0x2, 0x78(%rax)
jne 0x5a3a
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl $0x6, %ecx
callq 0x4580
movl %eax, -0x28(%rbp)
jmp 0x5a3c
jmp 0x5a3e
cmpl $-0x1, -0x28(%rbp)
jne 0x5a4d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5a66
jmp 0x5a4f
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movl -0x2c(%rbp), %ecx
callq 0xaeb0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nop