#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
struct passwd {
  char *pw_name;
};
typedef int /*<<< orphan*/ buf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int BUFSIZ;
char *_PATH_MAILDIR;
int /*<<< orphan*/ errx(int, char *, ...);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
char *getenv(char *);
int getopt(int, char **, char *);
struct passwd *getpwuid(int /*<<< orphan*/);
int /*<<< orphan*/ getuid();
int /*<<< orphan*/ isupper(char);
scalar_t__ match(char *, char *);
void *optarg;
scalar_t__ optind;
int /*<<< orphan*/ printf(char *, char *, ...);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char const *);
int /*<<< orphan*/ *stdin;
scalar_t__ strcmp(char const *, char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
char tolower(char);
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  FILE *mbox;
  struct passwd *pwd;
  int ch, count, newline;
  const char *file;
  char *sender, *p;
  char buf[BUFSIZ];
  file = sender = NULL;
  count = -1;
  while ((ch = getopt(argc, argv, "cf:s:")) != -1)
    switch (ch) {
    case 'c':
      count = 0;
      break;
    case 'f':
      file = optarg;
      break;
    case 's':
      sender = optarg;
      for (p = sender; *p; ++p)
        if (isupper(*p))
          *p = tolower(*p);
      break;
    case '?':
    default:
      usage();
    }
  argc -= optind;
  argv += optind;
  if (file == NULL) {
    if (argc) {
      (void)snprintf(buf, sizeof(buf), "%s/%s", _PATH_MAILDIR, *argv);
      file = buf;
    } else {
      if (!(file = getenv("MAIL"))) {
        if (!(pwd = getpwuid(getuid())))
          errx(1, "no password file entry for you");
        file = pwd->pw_name;
        (void)snprintf(buf, sizeof(buf), "%s/%s", _PATH_MAILDIR, file);
        file = buf;
      }
    }
  }
  if (strcmp(file, "-") == 0) {
    mbox = stdin;
  } else if ((mbox = fopen(file, "r")) == NULL) {
    errx(1, "can't read %s", file);
  }
  for (newline = 1; fgets(buf, sizeof(buf), mbox);) {
    if (*buf == '\n') {
      newline = 1;
      continue;
    }
    if (newline && !strncmp(buf, "From ", 5) &&
        (!sender || match(buf + 5, sender))) {
      if (count != -1)
        count++;
      else
        printf("%s", buf);
    }
    newline = 0;
  }
  if (count != -1)
    printf("There %s %d message%s in your incoming mailbox.\n",
           count == 1 ? "is" : "are", count, count == 1 ? "" : "s");
  fclose(mbox);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2d9b(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x68(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x60(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x58(%rbp)
movq   $0x0,-0x40(%rbp)
movq   $0x0,-0x38(%rbp)
movl   $0xffffffff,-0x28(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xd85(%rip),%rdx
call   1120 <getopt@plt>
mov    %eax,-0x24(%rbp)
cmp    $0xffffffff,%eax
je     136a <main+0x15a>
mov    -0x24(%rbp),%eax
mov    %eax,-0x6c(%rbp)
sub    $0x3f,%eax
je     1359 <main+0x149>
jmp    12a0 <main+0x90>
mov    -0x6c(%rbp),%eax
sub    $0x63,%eax
je     12d3 <main+0xc3>
jmp    12b1 <main+0xa1>
mov    -0x6c(%rbp),%eax
sub    $0x66,%eax
je     12df <main+0xcf>
jmp    12c2 <main+0xb2>
mov    -0x6c(%rbp),%eax
sub    $0x73,%eax
je     12f2 <main+0xe2>
jmp    135e <main+0x14e>
movl   $0x0,-0x28(%rbp)
jmp    1365 <main+0x155>
mov    0x2d12(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
jmp    1365 <main+0x155>
mov    0x2cff(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
cmpb   $0x0,(%rax)
je     1354 <main+0x144>
mov    -0x48(%rbp),%rax
movsbl (%rax),%edi
call   10e0 <isupper@plt>
cmp    $0x0,%eax
je     133e <main+0x12e>
mov    -0x48(%rbp),%rax
movsbl (%rax),%edi
call   10d0 <tolower@plt>
mov    %al,%cl
mov    -0x48(%rbp),%rax
mov    %cl,(%rax)
jmp    1343 <main+0x133>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    1308 <main+0xf8>
jmp    1365 <main+0x155>
jmp    135e <main+0x14e>
mov    $0x0,%al
call   1100 <usage@plt>
jmp    126d <main+0x5d>
mov    0x2c67(%rip),%rax
mov    (%rax),%rcx
movslq -0x8(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    0x2c53(%rip),%rax
mov    (%rax),%rax
shl    $0x3,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1467 <main+0x257>
cmpl   $0x0,-0x8(%rbp)
je     13dd <main+0x1cd>
mov    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%rax
mov    %eax,%esi
mov    0x2c06(%rip),%rax
mov    (%rax),%rcx
mov    -0x10(%rbp),%rax
mov    (%rax),%r8
lea    0xc3b(%rip),%rdx
call   10a0 <snprintf@plt>
mov    -0x60(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    1462 <main+0x252>
lea    0xc28(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    145d <main+0x24d>
mov    $0x0,%al
call   1070 <getuid@plt>
mov    %eax,%edi
call   1060 <getpwuid@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1426 <main+0x216>
mov    $0x1,%edi
lea    0xbf2(%rip),%rsi
mov    $0x0,%al
call   1080 <errx@plt>
mov    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    (%rcx),%rcx
mov    %rcx,-0x38(%rbp)
mov    %eax,%esi
mov    0x2b7e(%rip),%rax
mov    (%rax),%rcx
mov    -0x38(%rbp),%r8
lea    0xbb6(%rip),%rdx
call   10a0 <snprintf@plt>
mov    -0x60(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    1462 <main+0x252>
jmp    1467 <main+0x257>
mov    -0x38(%rbp),%rdi
lea    0xbbe(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    1494 <main+0x284>
mov    0x2b58(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    14ce <main+0x2be>
mov    -0x38(%rbp),%rdi
lea    0xb93(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    14c9 <main+0x2b9>
mov    -0x38(%rbp),%rdx
mov    $0x1,%edi
lea    0xb72(%rip),%rsi
mov    $0x0,%al
call   1080 <errx@plt>
jmp    14ce <main+0x2be>
movl   $0x1,-0x2c(%rbp)
mov    -0x60(%rbp),%rdi
mov    -0x68(%rbp),%rax
mov    %eax,%esi
mov    -0x18(%rbp),%rdx
call   10b0 <fgets@plt>
cmp    $0x0,%rax
je     1597 <main+0x387>
mov    -0x60(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    150e <main+0x2fe>
movl   $0x1,-0x2c(%rbp)
jmp    14d5 <main+0x2c5>
cmpl   $0x0,-0x2c(%rbp)
je     158b <main+0x37b>
mov    -0x60(%rbp),%rdi
lea    0xb1f(%rip),%rsi
mov    $0x5,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
jne    158b <main+0x37b>
cmpq   $0x0,-0x40(%rbp)
je     155c <main+0x34c>
mov    -0x60(%rbp),%rdi
add    $0x5,%rdi
mov    -0x40(%rbp),%rsi
call   10f0 <match@plt>
cmp    $0x0,%rax
je     158b <main+0x37b>
cmpl   $0xffffffff,-0x28(%rbp)
je     1574 <main+0x364>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1586 <main+0x376>
mov    -0x60(%rbp),%rsi
lea    0xac0(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    158b <main+0x37b>
movl   $0x0,-0x2c(%rbp)
jmp    14d5 <main+0x2c5>
cmpl   $0xffffffff,-0x28(%rbp)
je     15e2 <main+0x3d2>
mov    -0x28(%rbp),%ecx
lea    0xad1(%rip),%rsi
lea    0xac7(%rip),%rax
cmp    $0x1,%ecx
cmove  %rax,%rsi
mov    -0x28(%rbp),%edx
mov    -0x28(%rbp),%edi
lea    0xa7a(%rip),%rcx
lea    0xaab(%rip),%rax
cmp    $0x1,%edi
cmove  %rax,%rcx
lea    0xa6d(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
xor    %edi,%edi
call   1130 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
mov    0x2d9b(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r13
mov    %rax,-0x48(%rbp)
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
movl   $0xffffffff,-0x2c(%rbp)
lea    0xdae(%rip),%r12
xor    %eax,%eax
mov    %rax,-0x40(%rbp)
xor    %r15d,%r15d
jmp    1275 <main+0x65>
nopl   (%rax)
cmp    $0x63,%eax
je     12a1 <main+0x91>
cmp    $0xffffffff,%eax
je     1300 <main+0xf0>
xor    %eax,%eax
call   1100 <usage@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %r12,%rdx
call   1120 <getopt@plt>
cmp    $0x65,%eax
jle    1260 <main+0x50>
cmp    $0x73,%eax
je     12aa <main+0x9a>
cmp    $0x66,%eax
jne    126e <main+0x5e>
mov    0x2d60(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x40(%rbp)
jmp    1275 <main+0x65>
movl   $0x0,-0x2c(%rbp)
jmp    1275 <main+0x65>
mov    0x2d47(%rip),%rax
mov    (%rax),%r15
mov    (%r15),%al
test   %al,%al
je     1275 <main+0x65>
mov    %r15,-0x38(%rbp)
jmp    12dd <main+0xcd>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl 0x1(%r15),%eax
add    $0x1,%r15
test   %al,%al
je     12f7 <main+0xe7>
movsbl %al,%edi
call   10e0 <isupper@plt>
test   %eax,%eax
je     12d0 <main+0xc0>
movsbl (%r15),%edi
call   10d0 <tolower@plt>
mov    %al,(%r15)
jmp    12d0 <main+0xc0>
mov    -0x38(%rbp),%r15
jmp    1275 <main+0x65>
mov    -0x40(%rbp),%r12
test   %r12,%r12
jne    137d <main+0x16d>
mov    0x2cc8(%rip),%rax
mov    (%rax),%rax
cmp    %ebx,%eax
jne    1356 <main+0x146>
lea    0xcee(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%r12
test   %rax,%rax
jne    137d <main+0x16d>
xor    %eax,%eax
call   1070 <getuid@plt>
mov    %eax,%edi
call   1060 <getpwuid@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    135a <main+0x14a>
lea    0xcc9(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   1080 <errx@plt>
jmp    135a <main+0x14a>
lea    (%r14,%rax,8),%rbx
mov    0x2c5f(%rip),%rax
mov    (%rax),%rcx
mov    (%rbx),%r8
lea    0xc98(%rip),%rdx
mov    %r13,%rdi
mov    -0x48(%rbp),%rsi
call   10a0 <snprintf@plt>
mov    %r13,%r12
lea    0xcac(%rip),%rsi
mov    %r12,%rdi
call   10c0 <strcmp@plt>
test   %rax,%rax
jne    139d <main+0x18d>
mov    0x2c48(%rip),%rax
mov    (%rax),%r14
jmp    13cd <main+0x1bd>
lea    0xc8e(%rip),%rsi
mov    %r12,%rdi
call   1110 <fopen@plt>
mov    %rax,%r14
test   %rax,%rax
jne    13cd <main+0x1bd>
lea    0xc79(%rip),%rsi
xor    %r14d,%r14d
mov    $0x1,%edi
mov    %r12,%rdx
xor    %eax,%eax
call   1080 <errx@plt>
lea    0x5(%r13),%rax
mov    %rax,-0x38(%rbp)
xor    %r12d,%r12d
jmp    13f0 <main+0x1e0>
mov    -0x2c(%rbp),%eax
cmp    $0xffffffff,%eax
je     1449 <main+0x239>
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    $0x1,%r12b
nopl   0x0(%rax,%rax,1)
mov    %r12d,%ebx
mov    %r13,%rdi
mov    -0x48(%rbp),%rsi
mov    %r14,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
je     1466 <main+0x256>
xor    %r12d,%r12d
cmpb   $0xa,0x0(%r13)
je     13f0 <main+0x1e0>
mov    $0x1,%r12b
test   $0x1,%bl
jne    13f0 <main+0x1e0>
mov    %r13,%rdi
lea    0xc1f(%rip),%rsi
mov    $0x5,%edx
call   1040 <strncmp@plt>
test   %eax,%eax
jne    13f0 <main+0x1e0>
test   %r15,%r15
je     13da <main+0x1ca>
mov    -0x38(%rbp),%rdi
mov    %r15,%rsi
call   10f0 <match@plt>
test   %rax,%rax
je     13f0 <main+0x1e0>
jmp    13da <main+0x1ca>
lea    0xbef(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%r12b
movl   $0xffffffff,-0x2c(%rbp)
jmp    13f0 <main+0x1e0>
mov    -0x2c(%rbp),%edx
cmp    $0xffffffff,%edx
je     14a3 <main+0x293>
cmp    $0x1,%edx
lea    0xc01(%rip),%rax
lea    0xbfd(%rip),%rsi
cmove  %rax,%rsi
lea    0xbee(%rip),%rax
lea    0xbaf(%rip),%rcx
cmove  %rax,%rcx
lea    0xbac(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
xor    %edi,%edi
call   1130 <exit@plt>

LLVM IR (-O0):
%struct.passwd = type { i8* }
@BUFSIZ = global i32 0
@.str = [6 x i8] c"cf:s:\00"
@optarg = global i8* null
@optind = global i64 0
@.str.1 = [6 x i8] c"%s/%s\00"
@_PATH_MAILDIR = global i8* null
@.str.2 = [5 x i8] c"MAIL\00"
@.str.3 = [31 x i8] c"no password file entry for you\00"
@.str.4 = [2 x i8] c"-\00"
@stdin = global i32* null
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [14 x i8] c"can't read %s\00"
@.str.7 = [6 x i8] c"From \00"
@.str.8 = [3 x i8] c"%s\00"
@.str.9 = [49 x i8] c"There %s %d message%s in your incoming mailbox.\0A\00"
@.str.10 = [3 x i8] c"is\00"
@.str.11 = [4 x i8] c"are\00"
@.str.12 = [1 x i8] zeroinitializer
@.str.13 = [2 x i8] c"s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca %struct.passwd*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* @BUFSIZ
%17 = zext i32 %16 to i64
%18 = call i8* @llvm.stacksave()
store i8* %18, i8** %14
%19 = alloca i8, i64 %17
store i64 %17, i64* %15
store i8* null, i8** %12
store i8* null, i8** %11
store i32 -1, i32* %9
br label %20
20: ; preds = %55, %2
%21 = load i32, i32* %4
%22 = load i8**, i8*** %5
%23 = call i32 @getopt(i32 %21, i8** %22, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32 %23, i32* %8
%24 = icmp ne i32 %23, -1
br i1 %24, label %25, label %56
25: ; preds = %20
%26 = load i32, i32* %8
switch i32 %26, label %53 [
i32 99, label %27
i32 102, label %28
i32 115, label %30
i32 63, label %52
]
27: ; preds = %25
store i32 0, i32* %9
br label %55
28: ; preds = %25
%29 = load i8*, i8** @optarg
store i8* %29, i8** %11
br label %55
30: ; preds = %25
%31 = load i8*, i8** @optarg
store i8* %31, i8** %12
%32 = load i8*, i8** %12
store i8* %32, i8** %13
br label %33
33: ; preds = %48, %30
%34 = load i8*, i8** %13
%35 = load i8, i8* %34
%36 = icmp ne i8 %35, 0
br i1 %36, label %37, label %51
37: ; preds = %33
%38 = load i8*, i8** %13
%39 = load i8, i8* %38
%40 = call i32 @isupper(i8 signext %39)
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %47
42: ; preds = %37
%43 = load i8*, i8** %13
%44 = load i8, i8* %43
%45 = call signext i8 @tolower(i8 signext %44)
%46 = load i8*, i8** %13
store i8 %45, i8* %46
br label %47
47: ; preds = %42, %37
br label %48
48: ; preds = %47
%49 = load i8*, i8** %13
%50 = getelementptr inbounds i8, i8* %49, i32 1
store i8* %50, i8** %13
br label %33
51: ; preds = %33
br label %55
52: ; preds = %25
br label %53
53: ; preds = %25, %52
%54 = call i32 (...) @usage()
br label %55
55: ; preds = %53, %51, %28, %27
br label %20
56: ; preds = %20
%57 = load i64, i64* @optind
%58 = load i32, i32* %4
%59 = sext i32 %58 to i64
%60 = sub nsw i64 %59, %57
%61 = trunc i64 %60 to i32
store i32 %61, i32* %4
%62 = load i64, i64* @optind
%63 = load i8**, i8*** %5
%64 = getelementptr inbounds i8*, i8** %63, i64 %62
store i8** %64, i8*** %5
%65 = load i8*, i8** %11
%66 = icmp eq i8* %65, null
br i1 %66, label %67, label %95
67: ; preds = %56
%68 = load i32, i32* %4
%69 = icmp ne i32 %68, 0
br i1 %69, label %70, label %76
70: ; preds = %67
%71 = trunc i64 %17 to i32
%72 = load i8*, i8** @_PATH_MAILDIR
%73 = load i8**, i8*** %5
%74 = load i8*, i8** %73
%75 = call i32 @snprintf(i8* %19, i32 %71, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %72, i8* %74)
store i8* %19, i8** %11
br label %94
76: ; preds = %67
%77 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
store i8* %77, i8** %11
%78 = icmp ne i8* %77, null
br i1 %78, label %93, label %79
79: ; preds = %76
%80 = call i32 (...) @getuid()
%81 = call %struct.passwd* @getpwuid(i32 %80)
store %struct.passwd* %81, %struct.passwd** %7
%82 = icmp ne %struct.passwd* %81, null
br i1 %82, label %85, label %83
83: ; preds = %79
%84 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %85
85: ; preds = %83, %79
%86 = load %struct.passwd*, %struct.passwd** %7
%87 = getelementptr inbounds %struct.passwd, %struct.passwd* %86, i32 0, i32 0
%88 = load i8*, i8** %87
store i8* %88, i8** %11
%89 = trunc i64 %17 to i32
%90 = load i8*, i8** @_PATH_MAILDIR
%91 = load i8*, i8** %11
%92 = call i32 @snprintf(i8* %19, i32 %89, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %90, i8* %91)
store i8* %19, i8** %11
br label %93
93: ; preds = %85, %76
br label %94
94: ; preds = %93, %70
br label %95
95: ; preds = %94, %56
%96 = load i8*, i8** %11
%97 = call i64 @strcmp(i8* %96, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%98 = icmp eq i64 %97, 0
br i1 %98, label %99, label %101
99: ; preds = %95
%100 = load i32*, i32** @stdin
store i32* %100, i32** %6
br label %109
101: ; preds = %95
%102 = load i8*, i8** %11
%103 = call i32* @fopen(i8* %102, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %103, i32** %6
%104 = icmp eq i32* %103, null
br i1 %104, label %105, label %108
105: ; preds = %101
%106 = load i8*, i8** %11
%107 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* %106)
br label %108
108: ; preds = %105, %101
br label %109
109: ; preds = %108, %99
store i32 1, i32* %10
br label %110
110: ; preds = %143, %119, %109
%111 = trunc i64 %17 to i32
%112 = load i32*, i32** %6
%113 = call i64 @fgets(i8* %19, i32 %111, i32* %112)
%114 = icmp ne i64 %113, 0
br i1 %114, label %115, label %144
115: ; preds = %110
%116 = load i8, i8* %19
%117 = sext i8 %116 to i32
%118 = icmp eq i32 %117, 10
br i1 %118, label %119, label %120
119: ; preds = %115
store i32 1, i32* %10
br label %110
120: ; preds = %115
%121 = load i32, i32* %10
%122 = icmp ne i32 %121, 0
br i1 %122, label %123, label %143
123: ; preds = %120
%124 = call i32 @strncmp(i8* %19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 5)
%125 = icmp ne i32 %124, 0
br i1 %125, label %143, label %126
126: ; preds = %123
%127 = load i8*, i8** %12
%128 = icmp ne i8* %127, null
br i1 %128, label %129, label %134
129: ; preds = %126
%130 = getelementptr inbounds i8, i8* %19, i64 5
%131 = load i8*, i8** %12
%132 = call i64 @match(i8* %130, i8* %131)
%133 = icmp ne i64 %132, 0
br i1 %133, label %134, label %143
134: ; preds = %129, %126
%135 = load i32, i32* %9
%136 = icmp ne i32 %135, -1
br i1 %136, label %137, label %140
137: ; preds = %134
%138 = load i32, i32* %9
%139 = add nsw i32 %138, 1
store i32 %139, i32* %9
br label %142
140: ; preds = %134
%141 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %19)
br label %142
142: ; preds = %140, %137
br label %143
143: ; preds = %142, %129, %123, %120
store i32 0, i32* %10
br label %110
144: ; preds = %110
%145 = load i32, i32* %9
%146 = icmp ne i32 %145, -1
br i1 %146, label %147, label %158
147: ; preds = %144
%148 = load i32, i32* %9
%149 = icmp eq i32 %148, 1
%150 = zext i1 %149 to i64
%151 = select i1 %149, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0)
%152 = load i32, i32* %9
%153 = load i32, i32* %9
%154 = icmp eq i32 %153, 1
%155 = zext i1 %154 to i64
%156 = select i1 %154, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0)
%157 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.9, i64 0, i64 0), i8* %151, i32 %152, i8* %156)
br label %158
158: ; preds = %147, %144
%159 = load i32*, i32** %6
%160 = call i32 @fclose(i32* %159)
%161 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.passwd = type { i8* }
@BUFSIZ = global i32 0
@.str = [6 x i8] c"cf:s:\00"
@optarg = global i8* null
@optind = global i64 0
@.str.1 = [6 x i8] c"%s/%s\00"
@_PATH_MAILDIR = global i8* null
@.str.2 = [5 x i8] c"MAIL\00"
@.str.3 = [31 x i8] c"no password file entry for you\00"
@.str.4 = [2 x i8] c"-\00"
@stdin = global i32* null
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [14 x i8] c"can't read %s\00"
@.str.7 = [6 x i8] c"From \00"
@.str.8 = [3 x i8] c"%s\00"
@.str.9 = [49 x i8] c"There %s %d message%s in your incoming mailbox.\0A\00"
@.str.10 = [3 x i8] c"is\00"
@.str.11 = [4 x i8] c"are\00"
@.str.12 = [1 x i8] zeroinitializer
@.str.13 = [2 x i8] c"s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = load i32, i32* @BUFSIZ
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
br label %6
6: ; preds = %12, %2
%7 = phi i32 [ -1, %2 ], [ 0, %12 ]
%8 = phi i8* [ null, %2 ], [ %17, %12 ]
%9 = phi i8* [ null, %2 ], [ %11, %12 ]
br label %16
10: ; preds = %23, %16
%11 = phi i8* [ %18, %16 ], [ %20, %23 ]
br label %12
12: ; preds = %10, %36
%13 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
switch i32 %13, label %36 [
i32 -1, label %38
i32 99, label %6
i32 102, label %14
i32 115, label %19
]
14: ; preds = %12
%15 = load i8*, i8** @optarg
br label %16
16: ; preds = %6, %14
%17 = phi i8* [ %8, %6 ], [ %15, %14 ]
%18 = phi i8* [ %9, %6 ], [ %11, %14 ]
br label %10
19: ; preds = %12
%20 = load i8*, i8** @optarg
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %32, %19
br label %10
24: ; preds = %19, %32
%25 = phi i8 [ %34, %32 ], [ %21, %19 ]
%26 = phi i8* [ %33, %32 ], [ %20, %19 ]
%27 = tail call i32 @isupper(i8 signext %25)
%28 = icmp eq i32 %27, 0
br i1 %28, label %32, label %29
29: ; preds = %24
%30 = load i8, i8* %26
%31 = tail call signext i8 @tolower(i8 signext %30)
store i8 %31, i8* %26
br label %32
32: ; preds = %24, %29
%33 = getelementptr inbounds i8, i8* %26, i64 1
%34 = load i8, i8* %33
%35 = icmp eq i8 %34, 0
br i1 %35, label %23, label %24
36: ; preds = %12
%37 = tail call i32 (...) @usage()
br label %12
38: ; preds = %12
%39 = load i64, i64* @optind
%40 = icmp eq i8* %17, null
br i1 %40, label %41, label %61
41: ; preds = %38
%42 = getelementptr inbounds i8*, i8** %1, i64 %39
%43 = trunc i64 %39 to i32
%44 = icmp eq i32 %43, %0
br i1 %44, label %45, label %56
45: ; preds = %41
%46 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%47 = icmp eq i8* %46, null
br i1 %47, label %48, label %61
48: ; preds = %45
%49 = tail call i32 (...) @getuid()
%50 = tail call %struct.passwd* @getpwuid(i32 %49)
%51 = icmp eq %struct.passwd* %50, null
br i1 %51, label %52, label %54
52: ; preds = %48
%53 = tail call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %54
54: ; preds = %52, %48
%55 = getelementptr inbounds %struct.passwd, %struct.passwd* %50, i64 0, i32 0
br label %56
56: ; preds = %41, %54
%57 = phi i8** [ %55, %54 ], [ %42, %41 ]
%58 = load i8*, i8** @_PATH_MAILDIR
%59 = load i8*, i8** %57
%60 = call i32 @snprintf(i8* %5, i32 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %58, i8* %59)
br label %61
61: ; preds = %56, %45, %38
%62 = phi i8* [ %46, %45 ], [ %17, %38 ], [ %5, %56 ]
%63 = call i64 @strcmp(i8* %62, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%64 = icmp eq i64 %63, 0
br i1 %64, label %65, label %67
65: ; preds = %61
%66 = load i32*, i32** @stdin
br label %72
67: ; preds = %61
%68 = call i32* @fopen(i8* %62, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%69 = icmp eq i32* %68, null
br i1 %69, label %70, label %72
70: ; preds = %67
%71 = call i32 (i32, i8*, ...) @errx(i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* %62)
br label %72
72: ; preds = %67, %70, %65
%73 = phi i32* [ %66, %65 ], [ null, %70 ], [ %68, %67 ]
%74 = icmp eq i8* %11, null
%75 = getelementptr inbounds i8, i8* %5, i64 5
br label %76
76: ; preds = %101, %72
%77 = phi i32 [ %7, %72 ], [ %102, %101 ]
%78 = phi i1 [ false, %72 ], [ true, %101 ]
br label %79
79: ; preds = %96, %76
%80 = phi i1 [ %78, %76 ], [ true, %96 ]
br label %81
81: ; preds = %79, %85
%82 = phi i1 [ false, %85 ], [ %80, %79 ]
%83 = call i64 @fgets(i8* %5, i32 %3, i32* %73)
%84 = icmp eq i64 %83, 0
br i1 %84, label %105, label %85
85: ; preds = %81
%86 = load i8, i8* %5
%87 = icmp eq i8 %86, 10
br i1 %87, label %81, label %88
88: ; preds = %85
br i1 %82, label %96, label %89
89: ; preds = %88
%90 = call i32 @strncmp(i8* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0), i32 5)
%91 = icmp eq i32 %90, 0
br i1 %91, label %92, label %96
92: ; preds = %89
br i1 %74, label %97, label %93
93: ; preds = %92
%94 = call i64 @match(i8* %75, i8* %11)
%95 = icmp eq i64 %94, 0
br i1 %95, label %96, label %97
96: ; preds = %93, %89, %88
br label %79
97: ; preds = %93, %92
%98 = icmp eq i32 %77, -1
br i1 %98, label %103, label %99
99: ; preds = %97
%100 = add nuw nsw i32 %77, 1
br label %101
101: ; preds = %99, %103
%102 = phi i32 [ -1, %103 ], [ %100, %99 ]
br label %76
103: ; preds = %97
%104 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %5)
br label %101
105: ; preds = %81
%106 = icmp eq i32 %77, -1
br i1 %106, label %112, label %107
107: ; preds = %105
%108 = icmp eq i32 %77, 1
%109 = select i1 %108, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0)
%110 = select i1 %108, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0)
%111 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.9, i64 0, i64 0), i8* %109, i32 %77, i8* %110)
br label %112
112: ; preds = %107, %105
%113 = call i32 @fclose(i32* %73)
%114 = call i32 @exit(i32 0)
unreachable
}