#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;

/* Variables and functions */
int BUFSIZ;
char *_PATH_MAILDIR;
int /*<<< orphan*/ err(int, char *, char *);
int /*<<< orphan*/ errx(int, char *);
int /*<<< orphan*/ exit(int);
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ freopen(char *, char *, int /*<<< orphan*/);
char *getenv(char *);
int getopt(int, char **, char *);
struct passwd *getpwuid(int /*<<< orphan*/);
int /*<<< orphan*/ getuid();
scalar_t__ match(char *, char *);
char *optarg;
int /*<<< orphan*/ optind;
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strncmp(char *, char *, int);
char tolower(unsigned char);
int main(int argc, char **argv) {
  struct passwd *pwd;
  int ch, newline;
  char *file, *sender, *p;
  char buf[BUFSIZ];
  file = sender = NULL;
  while ((ch = getopt(argc, argv, "f:s:")) != -1)
    switch ((char)ch) {
    case 'f':
      file = optarg;
      break;
    case 's':
      sender = optarg;
      for (p = sender; *p; ++p)
        *p = tolower((unsigned char)*p);
      break;
    default:
      fprintf(stderr, "usage: from [-f file] [-s sender] [user]\n");
      exit(1);
    }
  argv += optind;
  if (!file) {
    if (!(file = *argv)) {
      if (!(file = getenv("MAIL"))) {
        if (!(pwd = getpwuid(getuid())))
          errx(1, "no password file entry for you");
        if ((file = getenv("LOGNAME")) != NULL ||
            (file = getenv("USER")) != NULL) {
          (void)snprintf(buf, sizeof(buf), "%s/%s", _PATH_MAILDIR, file);
          file = buf;
        } else
          (void)snprintf(file = buf, sizeof(buf), "%s/%s", _PATH_MAILDIR,
                         pwd->pw_name);
      }
    } else {
      (void)snprintf(buf, sizeof(buf), "%s/%s", _PATH_MAILDIR, file);
      file = buf;
    }
  }
  if (!freopen(file, "r", stdin))
    err(1, "can't read %s", file);
  for (newline = 1; fgets(buf, sizeof(buf), stdin);) {
    if (*buf == '\n') {
      newline = 1;
      continue;
    }
    if (newline && !strncmp(buf, "From ", 5) &&
        (!sender || match(buf + 5, sender)))
      printf("%s", buf);
    newline = 0;
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2db3(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x58(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdac(%rip),%rdx
call   1100 <getopt@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
je     130f <main+0x11f>
movsbl -0x1c(%rbp),%eax
mov    %eax,-0x5c(%rbp)
sub    $0x66,%eax
je     128b <main+0x9b>
jmp    127a <main+0x8a>
mov    -0x5c(%rbp),%eax
sub    $0x73,%eax
je     129e <main+0xae>
jmp    12eb <main+0xfb>
mov    0x2d66(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
jmp    130a <main+0x11a>
mov    0x2d53(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmpb   $0x0,(%rax)
je     12e6 <main+0xf6>
mov    -0x38(%rbp),%rax
movzbl (%rax),%edi
call   10d0 <tolower@plt>
mov    %al,%cl
mov    -0x38(%rbp),%rax
mov    %cl,(%rax)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    12b4 <main+0xc4>
jmp    130a <main+0x11a>
mov    0x2cd6(%rip),%rax
mov    (%rax),%edi
lea    0xd0a(%rip),%rsi
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
jmp    1246 <main+0x56>
mov    0x2cc2(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    145c <main+0x26c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    142b <main+0x23b>
lea    0xcde(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1426 <main+0x236>
mov    $0x0,%al
call   1060 <getuid@plt>
mov    %eax,%edi
call   1050 <getpwuid@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1391 <main+0x1a1>
mov    $0x1,%edi
lea    0xca8(%rip),%rsi
call   1070 <errx@plt>
lea    0xcbb(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    13c5 <main+0x1d5>
lea    0xca9(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     13f6 <main+0x206>
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rax
mov    %eax,%esi
mov    0x2be2(%rip),%rax
mov    (%rax),%rcx
mov    -0x28(%rbp),%r8
lea    0xc7c(%rip),%rdx
call   1090 <snprintf@plt>
mov    -0x50(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    1421 <main+0x231>
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rax
mov    %rdi,-0x28(%rbp)
mov    %eax,%esi
mov    0x2bad(%rip),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    (%rax),%r8
lea    0xc44(%rip),%rdx
call   1090 <snprintf@plt>
jmp    1426 <main+0x236>
jmp    1457 <main+0x267>
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rax
mov    %eax,%esi
mov    0x2b7c(%rip),%rax
mov    (%rax),%rcx
mov    -0x28(%rbp),%r8
lea    0xc16(%rip),%rdx
call   1090 <snprintf@plt>
mov    -0x50(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    145c <main+0x26c>
mov    -0x28(%rbp),%rdi
mov    0x2b79(%rip),%rax
mov    (%rax),%edx
lea    0xbf6(%rip),%rsi
call   10a0 <freopen@plt>
cmp    $0x0,%eax
jne    1493 <main+0x2a3>
mov    -0x28(%rbp),%rdx
mov    $0x1,%edi
lea    0xbda(%rip),%rsi
call   10e0 <err@plt>
movl   $0x1,-0x20(%rbp)
mov    -0x50(%rbp),%rdi
mov    -0x58(%rbp),%rax
mov    %eax,%esi
mov    0x2b35(%rip),%rax
mov    (%rax),%edx
call   10b0 <fgets@plt>
cmp    $0x0,%rax
je     1542 <main+0x352>
mov    -0x50(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
jne    14d8 <main+0x2e8>
movl   $0x1,-0x20(%rbp)
jmp    149a <main+0x2aa>
cmpl   $0x0,-0x20(%rbp)
je     1536 <main+0x346>
mov    -0x50(%rbp),%rdi
lea    0xb89(%rip),%rsi
mov    $0x5,%edx
call   1040 <strncmp@plt>
cmp    $0x0,%eax
jne    1536 <main+0x346>
cmpq   $0x0,-0x30(%rbp)
je     1526 <main+0x336>
mov    -0x50(%rbp),%rdi
add    $0x5,%rdi
mov    -0x30(%rbp),%rsi
call   10f0 <match@plt>
cmp    $0x0,%rax
je     1536 <main+0x346>
mov    -0x50(%rbp),%rsi
lea    0xb42(%rip),%rdi
call   1080 <printf@plt>
movl   $0x0,-0x20(%rbp)
jmp    149a <main+0x2aa>
xor    %edi,%edi
call   1110 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r13
mov    %edi,%r14d
mov    0x2db2(%rip),%rax
mov    (%rax),%r15d
mov    %rsp,%r12
mov    %r15,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
lea    0xdd4(%rip),%rdx
call   1100 <getopt@plt>
cmp    $0xffffffff,%eax
jne    1241 <main+0x51>
xor    %eax,%eax
mov    %rax,-0x38(%rbp)
jmp    12e4 <main+0xf4>
xor    %ecx,%ecx
mov    %rcx,-0x38(%rbp)
mov    0x2daa(%rip),%rbx
xor    %ecx,%ecx
mov    %rcx,-0x30(%rbp)
mov    %r12,-0x40(%rbp)
jmp    128a <main+0x9a>
nopw   0x0(%rax,%rax,1)
movsbl %al,%eax
cmp    $0x66,%eax
jne    137e <main+0x18e>
mov    (%rbx),%rax
mov    %rax,-0x30(%rbp)
mov    %r14d,%edi
mov    %r13,%rsi
lea    0xd80(%rip),%rdx
call   1100 <getopt@plt>
cmp    $0xffffffff,%eax
je     12d7 <main+0xe7>
cmp    $0x73,%al
jne    1260 <main+0x70>
mov    (%rbx),%rcx
mov    (%rcx),%al
test   %al,%al
mov    %rcx,-0x38(%rbp)
je     1273 <main+0x83>
mov    %r14d,%r12d
mov    %r13,%r14
mov    %r15,%r13
lea    0x1(%rcx),%r15
nopl   0x0(%rax,%rax,1)
movzbl %al,%edi
call   10d0 <tolower@plt>
mov    %al,-0x1(%r15)
movzbl (%r15),%eax
add    $0x1,%r15
test   %al,%al
jne    12b0 <main+0xc0>
mov    %r13,%r15
mov    %r14,%r13
mov    %r12d,%r14d
mov    -0x40(%rbp),%r12
jmp    1273 <main+0x83>
mov    -0x30(%rbp),%r14
test   %r14,%r14
jne    13c4 <main+0x1d4>
mov    0x2ced(%rip),%rax
movslq (%rax),%rax
mov    0x0(%r13,%rax,8),%r8
test   %r8,%r8
jne    1365 <main+0x175>
lea    0xd30(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
jne    139d <main+0x1ad>
xor    %eax,%eax
call   1060 <getuid@plt>
mov    %eax,%edi
call   1050 <getpwuid@plt>
mov    %rax,%r14
test   %rax,%rax
jne    1334 <main+0x144>
lea    0xd0a(%rip),%rsi
mov    $0x1,%edi
call   1070 <errx@plt>
lea    0xd18(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
jne    13a2 <main+0x1b2>
lea    0xd0f(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
jne    13a2 <main+0x1b2>
mov    0x2c5b(%rip),%rax
mov    (%rax),%rcx
mov    (%r14),%r8
jmp    136f <main+0x17f>
mov    0x2c4c(%rip),%rax
mov    (%rax),%rcx
lea    0xcea(%rip),%rdx
mov    %r12,%rdi
mov    %r15d,%esi
jmp    13bc <main+0x1cc>
mov    0x2c43(%rip),%rax
mov    (%rax),%edi
lea    0xc77(%rip),%rsi
call   10c0 <fprintf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    %rax,%r14
jmp    13c4 <main+0x1d4>
mov    0x2c0f(%rip),%rcx
mov    (%rcx),%rcx
lea    0xcad(%rip),%rdx
mov    %r12,%rdi
mov    %r15d,%esi
mov    %rax,%r8
call   1090 <snprintf@plt>
mov    %r12,%r14
mov    0x2c15(%rip),%r13
mov    0x0(%r13),%edx
lea    0xc90(%rip),%rsi
mov    %r14,%rdi
call   10a0 <freopen@plt>
test   %eax,%eax
jne    13f6 <main+0x206>
lea    0xc7f(%rip),%rsi
mov    $0x1,%edi
mov    %r14,%rdx
call   10e0 <err@plt>
mov    0x0(%r13),%edx
mov    %r12,%rdi
mov    %r15d,%esi
call   10b0 <fgets@plt>
test   %rax,%rax
jne    1411 <main+0x221>
xor    %edi,%edi
call   1110 <exit@plt>
lea    0x5(%r12),%rax
mov    %rax,-0x30(%rbp)
xor    %ecx,%ecx
lea    0xc53(%rip),%rbx
jmp    1457 <main+0x267>
lea    0xc47(%rip),%rdi
mov    %r12,%rsi
call   1080 <printf@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x0(%r13),%edx
mov    %r12,%rdi
mov    %r15d,%esi
call   10b0 <fgets@plt>
mov    %r14d,%ecx
test   %rax,%rax
je     140a <main+0x21a>
cmpb   $0xa,(%r12)
setne  %r14b
je     1440 <main+0x250>
test   $0x1,%cl
jne    1440 <main+0x250>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0x5,%edx
call   1040 <strncmp@plt>
mov    $0x1,%r14b
test   %eax,%eax
jne    1440 <main+0x250>
mov    -0x38(%rbp),%rsi
test   %rsi,%rsi
je     1425 <main+0x235>
mov    -0x30(%rbp),%rdi
call   10f0 <match@plt>
test   %rax,%rax
jne    1425 <main+0x235>
jmp    1440 <main+0x250>

LLVM IR (-O0):
%struct.passwd = type { i8* }
@BUFSIZ = global i32 0
@.str = [5 x i8] c"f:s:\00"
@optarg = global i8* null
@stderr = global i32 0
@.str.1 = [42 x i8] c"usage: from [-f file] [-s sender] [user]\0A\00"
@optind = global i32 0
@.str.2 = [5 x i8] c"MAIL\00"
@.str.3 = [31 x i8] c"no password file entry for you\00"
@.str.4 = [8 x i8] c"LOGNAME\00"
@.str.5 = [5 x i8] c"USER\00"
@.str.6 = [6 x i8] c"%s/%s\00"
@_PATH_MAILDIR = global i8* null
@.str.7 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.8 = [14 x i8] c"can't read %s\00"
@.str.9 = [6 x i8] c"From \00"
@.str.10 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.passwd*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* @BUFSIZ
%15 = zext i32 %14 to i64
%16 = call i8* @llvm.stacksave()
store i8* %16, i8** %12
%17 = alloca i8, i64 %15
store i64 %15, i64* %13
store i8* null, i8** %10
store i8* null, i8** %9
br label %18
18: ; preds = %49, %2
%19 = load i32, i32* %4
%20 = load i8**, i8*** %5
%21 = call i32 @getopt(i32 %19, i8** %20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %21, i32* %7
%22 = icmp ne i32 %21, -1
br i1 %22, label %23, label %50
23: ; preds = %18
%24 = load i32, i32* %7
%25 = trunc i32 %24 to i8
%26 = sext i8 %25 to i32
switch i32 %26, label %45 [
i32 102, label %27
i32 115, label %29
]
27: ; preds = %23
%28 = load i8*, i8** @optarg
store i8* %28, i8** %9
br label %49
29: ; preds = %23
%30 = load i8*, i8** @optarg
store i8* %30, i8** %10
%31 = load i8*, i8** %10
store i8* %31, i8** %11
br label %32
32: ; preds = %41, %29
%33 = load i8*, i8** %11
%34 = load i8, i8* %33
%35 = icmp ne i8 %34, 0
br i1 %35, label %36, label %44
36: ; preds = %32
%37 = load i8*, i8** %11
%38 = load i8, i8* %37
%39 = call signext i8 @tolower(i8 zeroext %38)
%40 = load i8*, i8** %11
store i8 %39, i8* %40
br label %41
41: ; preds = %36
%42 = load i8*, i8** %11
%43 = getelementptr inbounds i8, i8* %42, i32 1
store i8* %43, i8** %11
br label %32
44: ; preds = %32
br label %49
45: ; preds = %23
%46 = load i32, i32* @stderr
%47 = call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%48 = call i32 @exit(i32 1)
unreachable
49: ; preds = %44, %27
br label %18
50: ; preds = %18
%51 = load i32, i32* @optind
%52 = load i8**, i8*** %5
%53 = sext i32 %51 to i64
%54 = getelementptr inbounds i8*, i8** %52, i64 %53
store i8** %54, i8*** %5
%55 = load i8*, i8** %9
%56 = icmp ne i8* %55, null
br i1 %56, label %96, label %57
57: ; preds = %50
%58 = load i8**, i8*** %5
%59 = load i8*, i8** %58
store i8* %59, i8** %9
%60 = icmp ne i8* %59, null
br i1 %60, label %90, label %61
61: ; preds = %57
%62 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
store i8* %62, i8** %9
%63 = icmp ne i8* %62, null
br i1 %63, label %89, label %64
64: ; preds = %61
%65 = call i32 (...) @getuid()
%66 = call %struct.passwd* @getpwuid(i32 %65)
store %struct.passwd* %66, %struct.passwd** %6
%67 = icmp ne %struct.passwd* %66, null
br i1 %67, label %70, label %68
68: ; preds = %64
%69 = call i32 @errx(i32 1, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %70
70: ; preds = %68, %64
%71 = call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
store i8* %71, i8** %9
%72 = icmp ne i8* %71, null
br i1 %72, label %76, label %73
73: ; preds = %70
%74 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
store i8* %74, i8** %9
%75 = icmp ne i8* %74, null
br i1 %75, label %76, label %81
76: ; preds = %73, %70
%77 = trunc i64 %15 to i32
%78 = load i8*, i8** @_PATH_MAILDIR
%79 = load i8*, i8** %9
%80 = call i32 @snprintf(i8* %17, i32 %77, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %78, i8* %79)
store i8* %17, i8** %9
br label %88
81: ; preds = %73
store i8* %17, i8** %9
%82 = trunc i64 %15 to i32
%83 = load i8*, i8** @_PATH_MAILDIR
%84 = load %struct.passwd*, %struct.passwd** %6
%85 = getelementptr inbounds %struct.passwd, %struct.passwd* %84, i32 0, i32 0
%86 = load i8*, i8** %85
%87 = call i32 @snprintf(i8* %17, i32 %82, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %83, i8* %86)
br label %88
88: ; preds = %81, %76
br label %89
89: ; preds = %88, %61
br label %95
90: ; preds = %57
%91 = trunc i64 %15 to i32
%92 = load i8*, i8** @_PATH_MAILDIR
%93 = load i8*, i8** %9
%94 = call i32 @snprintf(i8* %17, i32 %91, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %92, i8* %93)
store i8* %17, i8** %9
br label %95
95: ; preds = %90, %89
br label %96
96: ; preds = %95, %50
%97 = load i8*, i8** %9
%98 = load i32, i32* @stdin
%99 = call i32 @freopen(i8* %97, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 %98)
%100 = icmp ne i32 %99, 0
br i1 %100, label %104, label %101
101: ; preds = %96
%102 = load i8*, i8** %9
%103 = call i32 @err(i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8* %102)
br label %104
104: ; preds = %101, %96
store i32 1, i32* %8
br label %105
105: ; preds = %131, %114, %104
%106 = trunc i64 %15 to i32
%107 = load i32, i32* @stdin
%108 = call i64 @fgets(i8* %17, i32 %106, i32 %107)
%109 = icmp ne i64 %108, 0
br i1 %109, label %110, label %132
110: ; preds = %105
%111 = load i8, i8* %17
%112 = sext i8 %111 to i32
%113 = icmp eq i32 %112, 10
br i1 %113, label %114, label %115
114: ; preds = %110
store i32 1, i32* %8
br label %105
115: ; preds = %110
%116 = load i32, i32* %8
%117 = icmp ne i32 %116, 0
br i1 %117, label %118, label %131
118: ; preds = %115
%119 = call i32 @strncmp(i8* %17, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i32 5)
%120 = icmp ne i32 %119, 0
br i1 %120, label %131, label %121
121: ; preds = %118
%122 = load i8*, i8** %10
%123 = icmp ne i8* %122, null
br i1 %123, label %124, label %129
124: ; preds = %121
%125 = getelementptr inbounds i8, i8* %17, i64 5
%126 = load i8*, i8** %10
%127 = call i64 @match(i8* %125, i8* %126)
%128 = icmp ne i64 %127, 0
br i1 %128, label %129, label %131
129: ; preds = %124, %121
%130 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %17)
br label %131
131: ; preds = %129, %124, %118, %115
store i32 0, i32* %8
br label %105
132: ; preds = %105
%133 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.passwd = type { i8* }
@BUFSIZ = global i32 0
@.str = [5 x i8] c"f:s:\00"
@optarg = global i8* null
@stderr = global i32 0
@.str.1 = [42 x i8] c"usage: from [-f file] [-s sender] [user]\0A\00"
@optind = global i32 0
@.str.2 = [5 x i8] c"MAIL\00"
@.str.3 = [31 x i8] c"no password file entry for you\00"
@.str.4 = [8 x i8] c"LOGNAME\00"
@.str.5 = [5 x i8] c"USER\00"
@.str.6 = [6 x i8] c"%s/%s\00"
@_PATH_MAILDIR = global i8* null
@.str.7 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.8 = [14 x i8] c"can't read %s\00"
@.str.9 = [6 x i8] c"From \00"
@.str.10 = [3 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
%6 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32 %6, -1
br i1 %7, label %38, label %8
8: ; preds = %2, %31
%9 = phi i32 [ %34, %31 ], [ %6, %2 ]
%10 = phi i8* [ %33, %31 ], [ null, %2 ]
%11 = phi i8* [ %32, %31 ], [ null, %2 ]
%12 = shl i32 %9, 24
%13 = ashr exact i32 %12, 24
switch i32 %13, label %27 [
i32 102, label %14
i32 115, label %16
]
14: ; preds = %8
%15 = load i8*, i8** @optarg
br label %31
16: ; preds = %8
%17 = load i8*, i8** @optarg
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %31, label %20
20: ; preds = %16, %20
%21 = phi i8 [ %25, %20 ], [ %18, %16 ]
%22 = phi i8* [ %24, %20 ], [ %17, %16 ]
%23 = tail call signext i8 @tolower(i8 zeroext %21)
store i8 %23, i8* %22
%24 = getelementptr inbounds i8, i8* %22, i64 1
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 0
br i1 %26, label %31, label %20
27: ; preds = %8
%28 = load i32, i32* @stderr
%29 = tail call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0))
%30 = tail call i32 @exit(i32 1)
unreachable
31: ; preds = %20, %16, %14
%32 = phi i8* [ %15, %14 ], [ %11, %16 ], [ %11, %20 ]
%33 = phi i8* [ %10, %14 ], [ %17, %16 ], [ %17, %20 ]
%34 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%35 = icmp eq i32 %34, -1
br i1 %35, label %36, label %8
36: ; preds = %31
%37 = icmp eq i8* %32, null
br i1 %37, label %38, label %72
38: ; preds = %2, %36
%39 = phi i8* [ %33, %36 ], [ null, %2 ]
%40 = load i32, i32* @optind
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8*, i8** %1, i64 %41
%43 = load i8*, i8** %42
%44 = icmp eq i8* %43, null
br i1 %44, label %45, label %69
45: ; preds = %38
%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 %72
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 @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 = tail call i8* @getenv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%56 = icmp eq i8* %55, null
br i1 %56, label %57, label %60
57: ; preds = %54
%58 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%59 = icmp eq i8* %58, null
br i1 %59, label %64, label %60
60: ; preds = %57, %54
%61 = phi i8* [ %55, %54 ], [ %58, %57 ]
%62 = load i8*, i8** @_PATH_MAILDIR
%63 = call i32 @snprintf(i8* %5, i32 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %62, i8* %61)
br label %72
64: ; preds = %57
%65 = load i8*, i8** @_PATH_MAILDIR
%66 = getelementptr inbounds %struct.passwd, %struct.passwd* %50, i64 0, i32 0
%67 = load i8*, i8** %66
%68 = call i32 @snprintf(i8* %5, i32 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %65, i8* %67)
br label %72
69: ; preds = %38
%70 = load i8*, i8** @_PATH_MAILDIR
%71 = call i32 @snprintf(i8* %5, i32 %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.6, i64 0, i64 0), i8* %70, i8* %43)
br label %72
72: ; preds = %69, %60, %64, %45, %36
%73 = phi i8* [ %33, %36 ], [ %39, %69 ], [ %39, %45 ], [ %39, %60 ], [ %39, %64 ]
%74 = phi i8* [ %32, %36 ], [ %5, %69 ], [ %46, %45 ], [ %5, %60 ], [ %5, %64 ]
%75 = load i32, i32* @stdin
%76 = call i32 @freopen(i8* %74, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 %75)
%77 = icmp eq i32 %76, 0
br i1 %77, label %78, label %80
78: ; preds = %72
%79 = call i32 @err(i32 1, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.8, i64 0, i64 0), i8* %74)
br label %80
80: ; preds = %78, %72
%81 = load i32, i32* @stdin
%82 = call i64 @fgets(i8* %5, i32 %3, i32 %81)
%83 = icmp eq i64 %82, 0
br i1 %83, label %107, label %84
84: ; preds = %80
%85 = icmp eq i8* %73, null
%86 = getelementptr inbounds i8, i8* %5, i64 5
br label %87
87: ; preds = %84, %102
%88 = phi i1 [ false, %84 ], [ %103, %102 ]
%89 = load i8, i8* %5
%90 = icmp eq i8 %89, 10
%91 = or i1 %90, %88
%92 = xor i1 %90, true
br i1 %91, label %102, label %93
93: ; preds = %87
%94 = call i32 @strncmp(i8* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i32 5)
%95 = icmp eq i32 %94, 0
br i1 %95, label %96, label %102
96: ; preds = %93
br i1 %85, label %100, label %97
97: ; preds = %96
%98 = call i64 @match(i8* %86, i8* %73)
%99 = icmp eq i64 %98, 0
br i1 %99, label %102, label %100
100: ; preds = %97, %96
%101 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i64 0, i64 0), i8* %5)
br label %102
102: ; preds = %87, %93, %97, %100
%103 = phi i1 [ %92, %87 ], [ true, %100 ], [ true, %97 ], [ true, %93 ]
%104 = load i32, i32* @stdin
%105 = call i64 @fgets(i8* %5, i32 %3, i32 %104)
%106 = icmp eq i64 %105, 0
br i1 %106, label %107, label %87
107: ; preds = %102, %80
%108 = call i32 @exit(i32 0)
unreachable
}