// File: /workspace/github_c_makefile_star2_O0/NedFreed[P]msglint/msglint.c
// Function: main
int main(int argc, char **argv)
{
    int r = 0;
    const char *name;
    char *buf, *basebuf, *src, *dst;
    size_t used, count, unused;
    FILE *infile = stdin;
    
    msglint_initialize();

    name = strrchr(*argv, '/');
    name = name == NULL ? *argv : name + 1;
    if (strncmp("web", name, 3) == 0
	|| getenv("GATEWAY_INTERFACE") != (char *)0)
	web_cgi = 1;
    
    /* parse args */
    while (*++argv != NULL && **argv == '-') switch ((*argv)[1]) {
      case 'v':
	verbose = 1;
	break;

      case 'w':
	web_cgi = 1;
	break;

      case '5':
	show_md5 = 1;
	break;

      case 'm':
	mime_msg = 1;
	break;

      case 't':
	do_sendmail = 1;
	break;

      case 'q':
	quiet = 1;
	break;

      case 's':
	silent = 1;
	break;

      case 'f':
	if (argv[1] != NULL) {
	    from_addr = *++argv;
	    mime_msg = 1;
	}
	break;

      default:
	usage(name);
    }
    if (!do_sendmail || !mime_msg) {
	outfile = stdout;
    }
    
    do {
	if (*argv != NULL) {
	    if (outfile != NULL && (infile != stdin || argv[1] != NULL)) {
		fprintf(outfile, "---%s\n", *argv);
	    }
	    infile = fopen(*argv, "r");
	    if (infile == NULL) {
		perror(*argv);
		exit(1);
	    }
	    ++argv;
	}
    
	/* read in the data */
	basebuf = buf = malloc(unused = BUFSIZE);
	if (buf == NULL) {
	    perror("malloc");
	    exit(1);
	}
	used = 0;
	while ((count = fread(buf + used, 1, unused, infile)) > 0) {
	    used += count;
	    unused -= count;
	    if (unused == 0) {
		basebuf = buf = realloc(buf, used * 2);
		if (buf == NULL) {
		    perror("realloc");
		    exit(1);
		}
		unused += used;
	    }
	}
	buf[used] = '\0';
	if (infile != stdin) fclose(infile);
	
	/* remove web CGI grunge */
	if (web_cgi) {
	    for (src = buf; *src != '\0' && !isspace(*src) &&
		 *src != ':' && *src != '='; ++src)
		;
	    if (*src == '=') {
		++src;
		for (dst = buf; *src != '&' && *src != '\0'; ++src, ++dst) {
		    if (*src == '%') {
			*dst = (hex_table[(unsigned char)src[1]] << 4) +
			    hex_table[(unsigned char)src[2]];
			src += 2;
		    } else if (*src == '+') {
			*dst = ' ';
		    } else {
			*dst = *src;
		    }
		}
		*dst = '\0';
		used = dst - buf;
	    }
	} else if (used > 5 && strncmp(buf, "From ", 5) == 0) {
	    /* remove "From " grunge */
	    while (used > 0 && *buf != '\n' && *buf != '\r') {
		--used, ++buf;
	    }
	    while (used > 0 && (*buf == '\n' || *buf == '\r')) {
		--used, ++buf;
	    }
	}
	
	/* parse the data */
	if (verbose) wprintf(NULL, w_ok, "read message of size %d", used);

	r = msglint_parsemessage(buf, used);

	/* close file */
	if (infile != stdin) fclose(infile);

	/* release buffer */
	free(basebuf);
    } while (r == 0 && *argv != NULL);

    return (r);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movq 0x11881(%rip), %rax     # 0x13fd8
movq (%rax), %rax
movq %rax, -0x60(%rbp)
callq 0x40b0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl $0x2f, %esi
callq 0x20d0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x278c
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x68(%rbp)
jmp 0x2798
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rsi
leaq 0xde61(%rip), %rdi      # 0x1060c
movl $0x3, %edx
callq 0x2050
cmpl $0x0, %eax
je 0x27cc
leaq 0xde4f(%rip), %rdi      # 0x10610
callq 0x2030
cmpq $0x0, %rax
je 0x27d6
movl $0x1, 0x1251e(%rip)     # 0x14cf4
jmp 0x27d8
movq -0x10(%rbp), %rcx
movq %rcx, %rax
addq $0x8, %rax
movq %rax, -0x10(%rbp)
xorl %eax, %eax
cmpq $0x0, 0x8(%rcx)
movb %al, -0x69(%rbp)
je 0x2806
movq -0x10(%rbp), %rax
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
sete %al
movb %al, -0x69(%rbp)
movb -0x69(%rbp), %al
testb $0x1, %al
jne 0x2812
jmp 0x28d9
movq -0x10(%rbp), %rax
movq (%rax), %rax
movsbl 0x1(%rax), %eax
addl $-0x35, %eax
movl %eax, %ecx
movq %rcx, -0x78(%rbp)
subl $0x42, %eax
ja 0x28cb
movq -0x78(%rbp), %rax
leaq 0xb7d6(%rip), %rcx      # 0xe010
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x1, 0x12493(%rip)     # 0x14ce0
jmp 0x28d4
movl $0x1, 0x12498(%rip)     # 0x14cf4
jmp 0x28d4
movl $0x1, 0x12488(%rip)     # 0x14cf0
jmp 0x28d4
movl $0x1, 0x12478(%rip)     # 0x14cec
jmp 0x28d4
movl $0x1, 0x12478(%rip)     # 0x14cf8
jmp 0x28d4
movl $0x1, 0x12458(%rip)     # 0x14ce4
jmp 0x28d4
movl $0x1, 0x12450(%rip)     # 0x14ce8
jmp 0x28d4
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x28c9
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x10(%rbp)
movq 0x8(%rax), %rax
movq %rax, 0x12441(%rip)     # 0x14d00
movl $0x1, 0x12423(%rip)     # 0x14cec
jmp 0x28d4
movq -0x20(%rbp), %rdi
callq 0x2d70
jmp 0x27d8
cmpl $0x0, 0x12418(%rip)     # 0x14cf8
je 0x28eb
cmpl $0x0, 0x12403(%rip)     # 0x14cec
jne 0x28fc
movq 0x116de(%rip), %rax     # 0x13fd0
movq (%rax), %rax
movq %rax, 0x1240c(%rip)     # 0x14d08
jmp 0x28fe
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
je 0x298d
cmpq $0x0, 0x123f4(%rip)     # 0x14d08
je 0x294d
movq -0x60(%rbp), %rax
movq 0x116b7(%rip), %rcx     # 0x13fd8
cmpq (%rcx), %rax
jne 0x2931
movq -0x10(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x294d
movq 0x123d0(%rip), %rdi     # 0x14d08
movq -0x10(%rbp), %rax
movq (%rax), %rdx
leaq 0xdcdc(%rip), %rsi      # 0x10622
movb $0x0, %al
callq 0x2100
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0xf187(%rip), %rsi      # 0x11ae2
callq 0x2170
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
jne 0x2981
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2180
movl $0x1, %edi
callq 0x21c0
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x10(%rbp)
movq $0x4000, -0x58(%rbp)    # imm = 0x4000
movl $0x4000, %edi           # imm = 0x4000
callq 0x2130
movq %rax, -0x28(%rbp)
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x29c4
leaq 0xdc74(%rip), %rdi      # 0x10629
callq 0x2180
movl $0x1, %edi
callq 0x21c0
movq $0x0, -0x48(%rbp)
movq -0x28(%rbp), %rdi
addq -0x48(%rbp), %rdi
movq -0x58(%rbp), %rdx
movq -0x60(%rbp), %rcx
movl $0x1, %esi
callq 0x2080
movq %rax, -0x50(%rbp)
cmpq $0x0, %rax
jbe 0x2a58
movq -0x50(%rbp), %rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rcx
movq -0x58(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
jne 0x2a53
movq -0x28(%rbp), %rdi
movq -0x48(%rbp), %rsi
shlq %rsi
callq 0x2150
movq %rax, -0x28(%rbp)
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x2a47
leaq 0xdbf8(%rip), %rdi      # 0x10630
callq 0x2180
movl $0x1, %edi
callq 0x21c0
movq -0x48(%rbp), %rax
addq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
jmp 0x29cc
movq -0x28(%rbp), %rax
movq -0x48(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x60(%rbp), %rax
movq 0x11569(%rip), %rcx     # 0x13fd8
cmpq (%rcx), %rax
je 0x2a7d
movq -0x60(%rbp), %rdi
callq 0x20a0
cmpl $0x0, 0x12270(%rip)     # 0x14cf4
je 0x2c02
movq -0x28(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x79(%rbp)
je 0x2aea
callq 0x21d0
movq (%rax), %rax
movq -0x38(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %ecx
andl $0x2000, %ecx           # imm = 0x2000
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x79(%rbp)
jne 0x2aea
movq -0x38(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x3a, %ecx
movb %al, -0x79(%rbp)
je 0x2aea
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3d, %eax
setne %al
movb %al, -0x79(%rbp)
movb -0x79(%rbp), %al
testb $0x1, %al
jne 0x2af3
jmp 0x2b03
jmp 0x2af5
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x2a92
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x3d, %eax
jne 0x2bfd
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x26, %ecx
movb %al, -0x7a(%rbp)
je 0x2b48
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x7a(%rbp)
movb -0x7a(%rbp), %al
testb $0x1, %al
jne 0x2b54
jmp 0x2be7
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x25, %eax
jne 0x2ba5
movq -0x38(%rbp), %rax
movzbl 0x1(%rax), %eax
movl %eax, %ecx
leaq 0x1219f(%rip), %rax     # 0x14d10
movzbl (%rax,%rcx), %eax
shll $0x4, %eax
movq -0x38(%rbp), %rcx
movzbl 0x2(%rcx), %ecx
movl %ecx, %edx
leaq 0x12187(%rip), %rcx     # 0x14d10
movzbl (%rcx,%rdx), %ecx
addl %ecx, %eax
movb %al, %cl
movq -0x40(%rbp), %rax
movb %cl, (%rax)
movq -0x38(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x38(%rbp)
jmp 0x2bc8
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
jne 0x2bba
movq -0x40(%rbp), %rax
movb $0x20, (%rax)
jmp 0x2bc6
movq -0x38(%rbp), %rax
movb (%rax), %cl
movq -0x40(%rbp), %rax
movb %cl, (%rax)
jmp 0x2bc8
jmp 0x2bca
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x2b27
movq -0x40(%rbp), %rax
movb $0x0, (%rax)
movq -0x40(%rbp), %rax
movq -0x28(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x48(%rbp)
jmp 0x2cd9
cmpq $0x5, -0x48(%rbp)
jbe 0x2cd7
movq -0x28(%rbp), %rdi
leaq 0xda20(%rip), %rsi      # 0x10638
movl $0x5, %edx
callq 0x2050
cmpl $0x0, %eax
jne 0x2cd7
jmp 0x2c2d
xorl %eax, %eax
cmpq $0x0, -0x48(%rbp)
movb %al, -0x7b(%rbp)
jbe 0x2c5a
movq -0x28(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0xa, %ecx
movb %al, -0x7b(%rbp)
je 0x2c5a
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xd, %eax
setne %al
movb %al, -0x7b(%rbp)
movb -0x7b(%rbp), %al
testb $0x1, %al
jne 0x2c63
jmp 0x2c7d
movq -0x48(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x2c2d
jmp 0x2c7f
xorl %eax, %eax
cmpq $0x0, -0x48(%rbp)
movb %al, -0x7c(%rbp)
jbe 0x2cb2
movq -0x28(%rbp), %rax
movsbl (%rax), %ecx
movb $0x1, %al
cmpl $0xa, %ecx
movb %al, -0x7d(%rbp)
je 0x2cac
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0xd, %eax
sete %al
movb %al, -0x7d(%rbp)
movb -0x7d(%rbp), %al
movb %al, -0x7c(%rbp)
movb -0x7c(%rbp), %al
testb $0x1, %al
jne 0x2cbb
jmp 0x2cd5
movq -0x48(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x2c7f
jmp 0x2cd7
jmp 0x2cd9
cmpl $0x0, 0x12000(%rip)     # 0x14ce0
je 0x2cff
movq -0x48(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edi
leaq 0xc61f(%rip), %rsi      # 0xf310
leaq 0xd946(%rip), %rdx      # 0x1063e
movb $0x0, %al
callq 0x2e50
movq -0x28(%rbp), %rdi
movq -0x48(%rbp), %rax
movl %eax, %esi
callq 0x39a0
movl %eax, -0x14(%rbp)
movq -0x60(%rbp), %rax
movq 0x112bc(%rip), %rcx     # 0x13fd8
cmpq (%rcx), %rax
je 0x2d2a
movq -0x60(%rbp), %rdi
callq 0x20a0
movq -0x30(%rbp), %rdi
callq 0x2040
xorl %eax, %eax
cmpl $0x0, -0x14(%rbp)
movb %al, -0x7e(%rbp)
jne 0x2d4c
movq -0x10(%rbp), %rax
cmpq $0x0, (%rax)
setne %al
movb %al, -0x7e(%rbp)
movb -0x7e(%rbp), %al
testb $0x1, %al
jne 0x28fe
movl -0x14(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)