// File: /workspace/github_c_makefile_star2_O0/NedFreed[P]msglint/msglint.c
// Function: msglint_parsemessage
int msglint_parsemessage(const char *msg, int len)
{
    const char *fullmsg, *endmsg;
    msgcontext ctx;
    int r, htype, saw8bit, mlen;
    unsigned int bound;
    pid_t pid;
    char dbuf[N_MDATELEN];
    char hostname[1024];
    msgtoken *scan;

    saw8bit = 0;
    fullmsg = msg;
    mlen = len;
    endmsg = msg + len;
    
    ctx.mcur = NULL;
    ctx.mpart = NULL;
    ctx.lineno = 1;
    ctx.lines = 0;
    ctx.endhead = 0;

    if (web_cgi) {
	fprintf(outfile, "Content-Type: text/plain\n\n");
    }
    
    if (mime_msg) {
	reply_line = NULL;
	reply_len = 0;
	r = silent;
	silent = 1;
	parseheaders(&ctx, &msg, &len, HEAD_MSG);
	silent = r;
	if (reply_line == NULL && do_sendmail) return (-1);
    }
    
    if (outfile == NULL) {
	outfile = popen("/usr/lib/sendmail -t -oi", "w");
	if (outfile == NULL) return (-1);
    }

    if (mime_msg) {
	/* check for 8 bit (not efficient, but simple) */
	while (msg < endmsg && (unsigned char) *msg < 0x80)
	    ++msg;
	if (msg < endmsg) saw8bit = 1;
	msg = fullmsg;

	/* get system params */
	gethostname(hostname, sizeof (hostname));
	bound = (unsigned int)time(0);
	pid = getpid();
	n_maildate(dbuf);
	fprintf(outfile, "Date: %s\n", dbuf);
	if (from_addr != NULL) {
	    fprintf(outfile, "From: %s\n", from_addr);
	}
	fprintf(outfile, "Subject: validation of your message\n");
	ctx.lineno = 1;
	msg = fullmsg;
	len = mlen;
	disposeminfo(ctx.mcur);
	ctx.mcur = NULL;
	if (reply_line != NULL) {
	    wprintf(NULL, "To: ", "%.*s", reply_len, reply_line);
	}
	fprintf(outfile, "MIME-Version: 1.0\n");
	wprintf(NULL, "Content-Type: ",
		"multipart/mixed; boundary=\"%x=_%x\"",
		bound, (unsigned int)pid);
	if (saw8bit) {
	    fprintf(outfile, "Content-Transfer-Encoding: 8bit\n");
	}
	fprintf(outfile, "Message-ID: <mimelint.%x.%x@%s>\n",
                bound, (unsigned int)pid, hostname);
	fprintf(outfile, "\n");
	fprintf(outfile, "--%x=_%x\n", bound, (unsigned int)pid);
	fprintf(outfile, "\n");
    }
    
    if (web_cgi || mime_msg) {
	wprintf(NULL, w_none, text_para1, version);
	fprintf(outfile, "\n");
	fprintf(outfile, "-----------\n");
    }
    
    for (htype = HEAD_MSG;
	 (r = parsemime(&ctx, &msg, &len, htype)) == 1;
	 htype = HEAD_MIME)
	;
    if (ctx.lines) {
	if (ctx.lineno - ctx.endhead != ctx.lines) {
	    wprintf(NULL, w_warn, "'Lines' header value %d doesn't match "
		    "actual lines in body (%d)",
		    ctx.lines, ctx.lineno - ctx.endhead);
	} else if (!quiet) {
	    wprintf(NULL, w_ok, "Validated 'Lines' header (%d lines in body)",
		    ctx.lines);
	}
    }
    if (verbose) {
	wprintf(NULL, w_ok, "scanned %d lines", ctx.lineno - 1);
    }

    if (mime_msg || web_cgi) {
	fprintf(outfile, "-----------\n");
	fprintf(outfile, "\n");
	wprintf(NULL, w_none, text_para2, version);
	fprintf(outfile, "\n");
	wprintf(NULL, w_none, text_para3);
    }

    if (mime_msg) {
	fprintf(outfile, "\n");
	wprintf(NULL, w_none, text_para4);
	fprintf(outfile, "\n");
	fprintf(outfile, "--%x=_%x\n", bound, (unsigned int)pid);
	fprintf(outfile, "Content-Type: message/rfc822\n");
	if (saw8bit) {
	    fprintf(outfile, "Content-Transfer-Encoding: 8bit\n");
	}
	fprintf(outfile, "\n");
    }

    if (web_cgi) {
	fprintf(outfile, "\n");
	fprintf(outfile, "Input message follows:\n");
	fprintf(outfile, "-----------\n");
    }

    if (mime_msg || web_cgi) {
	fprintf(outfile, "%.*s\n", mlen, fullmsg);
    }

    if (mime_msg) {
	fprintf(outfile, "--%x=_%x--\n", bound, (unsigned int)pid);
    }

    if (outfile != stdout) {
	r = pclose(outfile);
	outfile = NULL;
    }

    while (msgfree != NULL) {
	scan = msgfree;
	msgfree = msgfree->next;
	free(scan);
    }
    
    return (r);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x520, %rsp            # imm = 0x520
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl $0x0, -0xc4(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0xc8(%rbp)
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq $0x0, -0xb8(%rbp)
movq $0x0, -0xb0(%rbp)
movl $0x1, -0xa8(%rbp)
movl $0x0, -0xa4(%rbp)
movl $0x0, -0xa0(%rbp)
cmpl $0x0, 0x112dd(%rip)     # 0x14cf4
je 0x3a2e
movq 0x112e8(%rip), %rdi     # 0x14d08
leaq 0xce19(%rip), %rsi      # 0x10840
movb $0x0, %al
callq 0x2100
cmpl $0x0, 0x112b7(%rip)     # 0x14cec
je 0x3aa5
movq $0x0, 0x114de(%rip) # 0x14f20
movl $0x0, 0x114dc(%rip)     # 0x14f28
movl 0x11296(%rip), %eax     # 0x14ce8
movl %eax, -0xbc(%rbp)
movl $0x1, 0x11286(%rip)     # 0x14ce8
leaq -0xb8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
leaq -0x14(%rbp), %rdx
xorl %ecx, %ecx
callq 0x4580
movl -0xbc(%rbp), %eax
movl %eax, 0x11264(%rip)     # 0x14ce8
cmpq $0x0, 0x11494(%rip)     # 0x14f20
jne 0x3aa3
cmpl $0x0, 0x11263(%rip)     # 0x14cf8
je 0x3aa3
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x409d
jmp 0x3aa5
cmpq $0x0, 0x1125b(%rip)     # 0x14d08
jne 0x3ae1
leaq 0xcda5(%rip), %rdi      # 0x1085b
leaq 0xcdb7(%rip), %rsi      # 0x10874
callq 0x2160
movq %rax, 0x1123f(%rip)     # 0x14d08
cmpq $0x0, 0x11237(%rip)     # 0x14d08
jne 0x3adf
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x409d
jmp 0x3ae1
cmpl $0x0, 0x11204(%rip)     # 0x14cec
je 0x3d09
jmp 0x3af0
movq -0x10(%rbp), %rcx
xorl %eax, %eax
cmpq -0x28(%rbp), %rcx
movb %al, -0x519(%rbp)
jae 0x3b17
movq -0x10(%rbp), %rax
movzbl (%rax), %eax
cmpl $0x80, %eax
setl %al
movb %al, -0x519(%rbp)
movb -0x519(%rbp), %al
testb $0x1, %al
jne 0x3b23
jmp 0x3b31
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x3af0
movq -0x10(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x3b45
movl $0x1, -0xc4(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x10(%rbp)
leaq -0x510(%rbp), %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x21a0
xorl %eax, %eax
movl %eax, %edi
callq 0x2120
movl %eax, -0xcc(%rbp)
callq 0x2090
movl %eax, -0xd0(%rbp)
leaq -0x110(%rbp), %rdi
callq 0xc470
movq 0x1117d(%rip), %rdi     # 0x14d08
leaq -0x110(%rbp), %rdx
leaq 0xccdd(%rip), %rsi      # 0x10876
movb $0x0, %al
callq 0x2100
cmpq $0x0, 0x11158(%rip)     # 0x14d00
je 0x3bc6
movq 0x11157(%rip), %rdi     # 0x14d08
movq 0x11148(%rip), %rdx     # 0x14d00
leaq 0xccc1(%rip), %rsi      # 0x10880
movb $0x0, %al
callq 0x2100
movq 0x1113b(%rip), %rdi     # 0x14d08
leaq 0xccb6(%rip), %rsi      # 0x1088a
movb $0x0, %al
callq 0x2100
movl $0x1, -0xa8(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x10(%rbp)
movl -0xc8(%rbp), %eax
movl %eax, -0x14(%rbp)
movq -0xb8(%rbp), %rdi
callq 0x52a0
movq $0x0, -0xb8(%rbp)
cmpq $0x0, 0x1130b(%rip)     # 0x14f20
je 0x3c3d
movl 0x1130b(%rip), %ecx     # 0x14f28
movq 0x112fc(%rip), %r8      # 0x14f20
xorl %eax, %eax
movl %eax, %edi
leaq 0xcc80(%rip), %rsi      # 0x108af
leaq 0xe7ac(%rip), %rdx      # 0x123e2
movb $0x0, %al
callq 0x2e50
movq 0x110c4(%rip), %rdi     # 0x14d08
leaq 0xcc69(%rip), %rsi      # 0x108b4
movb $0x0, %al
callq 0x2100
movl -0xcc(%rbp), %ecx
movl -0xd0(%rbp), %r8d
xorl %eax, %eax
movl %eax, %edi
leaq 0xcc5d(%rip), %rsi      # 0x108c7
leaq 0xcc65(%rip), %rdx      # 0x108d6
movb $0x0, %al
callq 0x2e50
cmpl $0x0, -0xc4(%rbp)
je 0x3c96
movq 0x11080(%rip), %rdi     # 0x14d08
leaq 0xcc6a(%rip), %rsi      # 0x108f9
movb $0x0, %al
callq 0x2100
movq 0x1106b(%rip), %rdi     # 0x14d08
movl -0xcc(%rbp), %edx
movl -0xd0(%rbp), %ecx
leaq -0x510(%rbp), %r8
leaq 0xcc63(%rip), %rsi      # 0x1091a
movb $0x0, %al
callq 0x2100
movq 0x11043(%rip), %rdi     # 0x14d08
leaq 0xcb8d(%rip), %rsi      # 0x10859
movb $0x0, %al
callq 0x2100
movq 0x1102e(%rip), %rdi     # 0x14d08
movl -0xcc(%rbp), %edx
movl -0xd0(%rbp), %ecx
leaq 0xcc4e(%rip), %rsi      # 0x1093b
movb $0x0, %al
callq 0x2100
movq 0x1100d(%rip), %rdi     # 0x14d08
leaq 0xcb57(%rip), %rsi      # 0x10859
movb $0x0, %al
callq 0x2100
cmpl $0x0, 0x10fe4(%rip)     # 0x14cf4
jne 0x3d1b
cmpl $0x0, 0x10fd3(%rip)     # 0x14cec
je 0x3d65
xorl %eax, %eax
movl %eax, %edi
leaq 0xb66f(%rip), %rsi      # 0xf395
leaq 0xb673(%rip), %rdx      # 0xf3a0
leaq 0xb72c(%rip), %rcx      # 0xf460
movb $0x0, %al
callq 0x2e50
movq 0x10fc6(%rip), %rdi     # 0x14d08
leaq 0xcb10(%rip), %rsi      # 0x10859
movb $0x0, %al
callq 0x2100
movq 0x10fb1(%rip), %rdi     # 0x14d08
leaq 0xcbe7(%rip), %rsi      # 0x10945
movb $0x0, %al
callq 0x2100
movl $0x0, -0xc0(%rbp)
movl -0xc0(%rbp), %ecx
leaq -0xb8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
leaq -0x14(%rbp), %rdx
callq 0x5310
movl %eax, -0xbc(%rbp)
cmpl $0x1, %eax
jne 0x3da2
jmp 0x3d96
movl $0x1, -0xc0(%rbp)
jmp 0x3d6f
cmpl $0x0, -0xa4(%rbp)
je 0x3e1a
movl -0xa8(%rbp), %eax
subl -0xa0(%rbp), %eax
cmpl -0xa4(%rbp), %eax
je 0x3dee
movl -0xa4(%rbp), %ecx
movl -0xa8(%rbp), %r8d
subl -0xa0(%rbp), %r8d
xorl %eax, %eax
movl %eax, %edi
leaq 0xb593(%rip), %rsi      # 0xf371
leaq 0xcb6d(%rip), %rdx      # 0x10952
movb $0x0, %al
callq 0x2e50
jmp 0x3e18
cmpl $0x0, 0x10eef(%rip)     # 0x14ce4
jne 0x3e16
movl -0xa4(%rbp), %ecx
xorl %eax, %eax
movl %eax, %edi
leaq 0xb508(%rip), %rsi      # 0xf310
leaq 0xcb83(%rip), %rdx      # 0x10992
movb $0x0, %al
callq 0x2e50
jmp 0x3e18
jmp 0x3e1a
cmpl $0x0, 0x10ebf(%rip)     # 0x14ce0
je 0x3e45
movl -0xa8(%rbp), %ecx
subl $0x1, %ecx
xorl %eax, %eax
movl %eax, %edi
leaq 0xb4d9(%rip), %rsi      # 0xf310
leaq 0xcb80(%rip), %rdx      # 0x109be
movb $0x0, %al
callq 0x2e50
cmpl $0x0, 0x10ea0(%rip)     # 0x14cec
jne 0x3e57
cmpl $0x0, 0x10e9f(%rip)     # 0x14cf4
je 0x3ecf
movq 0x10eaa(%rip), %rdi     # 0x14d08
leaq 0xcae0(%rip), %rsi      # 0x10945
movb $0x0, %al
callq 0x2100
movq 0x10e95(%rip), %rdi     # 0x14d08
leaq 0xc9df(%rip), %rsi      # 0x10859
movb $0x0, %al
callq 0x2100
xorl %eax, %eax
movl %eax, %edi
leaq 0xb509(%rip), %rsi      # 0xf395
leaq 0xb5ed(%rip), %rdx      # 0xf480
leaq 0xb5c6(%rip), %rcx      # 0xf460
movb $0x0, %al
callq 0x2e50
movq 0x10e60(%rip), %rdi     # 0x14d08
leaq 0xc9aa(%rip), %rsi      # 0x10859
movb $0x0, %al
callq 0x2100
xorl %eax, %eax
movl %eax, %edi
leaq 0xb4d4(%rip), %rsi      # 0xf395
leaq 0xb738(%rip), %rdx      # 0xf600
movb $0x0, %al
callq 0x2e50
cmpl $0x0, 0x10e16(%rip)     # 0x14cec
je 0x3f88
movq 0x10e25(%rip), %rdi     # 0x14d08
leaq 0xc96f(%rip), %rsi      # 0x10859
movb $0x0, %al
callq 0x2100
xorl %eax, %eax
movl %eax, %edi
leaq 0xb499(%rip), %rsi      # 0xf395
leaq 0xb7dd(%rip), %rdx      # 0xf6e0
movb $0x0, %al
callq 0x2e50
movq 0x10df7(%rip), %rdi     # 0x14d08
leaq 0xc941(%rip), %rsi      # 0x10859
movb $0x0, %al
callq 0x2100
movq 0x10de2(%rip), %rdi     # 0x14d08
movl -0xcc(%rbp), %edx
movl -0xd0(%rbp), %ecx
leaq 0xca02(%rip), %rsi      # 0x1093b
movb $0x0, %al
callq 0x2100
movq 0x10dc1(%rip), %rdi     # 0x14d08
leaq 0xca81(%rip), %rsi      # 0x109cf
movb $0x0, %al
callq 0x2100
cmpl $0x0, -0xc4(%rbp)
je 0x3f73
movq 0x10da3(%rip), %rdi     # 0x14d08
leaq 0xc98d(%rip), %rsi      # 0x108f9
movb $0x0, %al
callq 0x2100
movq 0x10d8e(%rip), %rdi     # 0x14d08
leaq 0xc8d8(%rip), %rsi      # 0x10859
movb $0x0, %al
callq 0x2100
cmpl $0x0, 0x10d65(%rip)     # 0x14cf4
je 0x3fd0
movq 0x10d70(%rip), %rdi     # 0x14d08
leaq 0xc8ba(%rip), %rsi      # 0x10859
movb $0x0, %al
callq 0x2100
movq 0x10d5b(%rip), %rdi     # 0x14d08
leaq 0xca39(%rip), %rsi      # 0x109ed
movb $0x0, %al
callq 0x2100
movq 0x10d46(%rip), %rdi     # 0x14d08
leaq 0xc97c(%rip), %rsi      # 0x10945
movb $0x0, %al
callq 0x2100
cmpl $0x0, 0x10d15(%rip)     # 0x14cec
jne 0x3fe2
cmpl $0x0, 0x10d14(%rip)     # 0x14cf4
je 0x4001
movq 0x10d1f(%rip), %rdi     # 0x14d08
movl -0xc8(%rbp), %edx
movq -0x20(%rbp), %rcx
leaq 0xe3fa(%rip), %rsi      # 0x123f4
movb $0x0, %al
callq 0x2100
cmpl $0x0, 0x10ce4(%rip)     # 0x14cec
je 0x402b
movq 0x10cf7(%rip), %rdi     # 0x14d08
movl -0xcc(%rbp), %edx
movl -0xd0(%rbp), %ecx
leaq 0xc9e1(%rip), %rsi      # 0x10a05
movb $0x0, %al
callq 0x2100
movq 0x10cd6(%rip), %rax     # 0x14d08
movq 0xff97(%rip), %rcx      # 0x13fd0
cmpq (%rcx), %rax
je 0x405b
movq 0x10cc3(%rip), %rdi     # 0x14d08
callq 0x20c0
movl %eax, -0xbc(%rbp)
movq $0x0, 0x10cad(%rip) # 0x14d08
jmp 0x405d
cmpq $0x0, 0x10ecb(%rip)     # 0x14f30
je 0x4094
movq 0x10ec2(%rip), %rax     # 0x14f30
movq %rax, -0x518(%rbp)
movq 0x10eb4(%rip), %rax     # 0x14f30
movq (%rax), %rax
movq %rax, 0x10eaa(%rip)     # 0x14f30
movq -0x518(%rbp), %rdi
callq 0x2040
jmp 0x405d
movl -0xbc(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x520, %rsp            # imm = 0x520
popq %rbp
retq
nopl (%rax)