#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 mntent {
  char *mnt_fsname;
  char *mnt_dir;
  char *mnt_type;
  char *mnt_opts;
  int mnt_freq;
  int mnt_passno;
};
typedef int /*<<< orphan*/ buf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ addmntent(int /*<<< orphan*/ *, struct mntent *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
struct mntent *getmntent(int /*<<< orphan*/ *);
scalar_t__ hasmntopt(struct mntent *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
scalar_t__ strcmp(char *, char *);
void *strdupa(char *);
int /*<<< orphan*/ *tmpfile();
int main(int argc, char *argv[]) {
  int result = 0;
  struct mntent mef;
  struct mntent *mnt = &mef;
  FILE *fp;
  mef.mnt_fsname = strdupa("/dev/hda1");
  mef.mnt_dir = strdupa("/some dir");
  mef.mnt_type = strdupa("ext2");
  mef.mnt_opts = strdupa("defaults");
  mef.mnt_freq = 1;
  mef.mnt_passno = 2;
  if (hasmntopt(mnt, "defaults"))
    printf("Found!\n");
  else {
    printf("Didn't find it\n");
    result = 1;
  }
  fp = tmpfile();
  if (fp == NULL) {
    printf("Cannot open temporary file: %m\n");
    result = 1;
  } else {
    char buf[1024];
    addmntent(fp, &mef);
    rewind(fp);
    if (fgets(buf, sizeof(buf), fp) == NULL) {
      printf("Cannot read temporary file: %m");
      result = 1;
    } else if (strcmp(buf, "/dev/hda1 /some\\040dir ext2 defaults 1 2\n") !=
               0) {
      puts("Raw file data not correct");
      result = 1;
    }
    rewind(fp);
    mnt = getmntent(fp);
    if (strcmp(mnt->mnt_fsname, "/dev/hda1") != 0 ||
        strcmp(mnt->mnt_dir, "/some dir") != 0 ||
        strcmp(mnt->mnt_type, "ext2") != 0 ||
        strcmp(mnt->mnt_opts, "defaults") != 0 || mnt->mnt_freq != 1 ||
        mnt->mnt_passno != 2) {
      puts("Error while reading written entry back in");
      result = 1;
    }
    rewind(fp);
    fputs("/foo\\040dir /bar\\040dir auto bind \t \n", fp);
    rewind(fp);
    mnt = getmntent(fp);
    if (strcmp(mnt->mnt_fsname, "/foo dir") != 0 ||
        strcmp(mnt->mnt_dir, "/bar dir") != 0 ||
        strcmp(mnt->mnt_type, "auto") != 0 ||
        strcmp(mnt->mnt_opts, "bind") != 0 || mnt->mnt_freq != 0 ||
        mnt->mnt_passno != 0) {
      puts("Error while reading entry with trailing whitespaces");
      result = 1;
    }
  }
  return result;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    0xe21(%rip),%rdi
call   10c0 <strdupa@plt>
mov    %rax,-0x40(%rbp)
lea    0xe1b(%rip),%rdi
call   10c0 <strdupa@plt>
mov    %rax,-0x38(%rbp)
lea    0xe15(%rip),%rdi
call   10c0 <strdupa@plt>
mov    %rax,-0x30(%rbp)
lea    0xe0a(%rip),%rdi
call   10c0 <strdupa@plt>
mov    %rax,-0x28(%rbp)
movl   $0x1,-0x20(%rbp)
movl   $0x2,-0x1c(%rbp)
mov    -0x48(%rbp),%rdi
lea    0xde8(%rip),%rsi
call   10d0 <hasmntopt@plt>
cmp    $0x0,%rax
je     1251 <main+0xa1>
lea    0xddb(%rip),%rdi
call   1040 <printf@plt>
jmp    1264 <main+0xb4>
lea    0xdd2(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    $0x0,%al
call   1090 <tmpfile@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
jne    1292 <main+0xe2>
lea    0xdb9(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x14(%rbp)
jmp    14aa <main+0x2fa>
mov    -0x50(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1080 <addmntent@plt>
mov    -0x50(%rbp),%rdi
call   1050 <rewind@plt>
lea    -0x450(%rbp),%rdi
mov    -0x50(%rbp),%rdx
mov    $0x400,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
jne    12df <main+0x12f>
lea    0xd8c(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x14(%rbp)
jmp    1314 <main+0x164>
lea    -0x450(%rbp),%rdi
lea    0xd8c(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
je     130f <main+0x15f>
lea    0xda0(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x14(%rbp)
jmp    1314 <main+0x164>
mov    -0x50(%rbp),%rdi
call   1050 <rewind@plt>
mov    -0x50(%rbp),%rdi
call   10b0 <getmntent@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    (%rax),%rdi
lea    0xcc8(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    13bd <main+0x20d>
mov    -0x48(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xcb4(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    13bd <main+0x20d>
mov    -0x48(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xca0(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    13bd <main+0x20d>
mov    -0x48(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xc87(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    13bd <main+0x20d>
mov    -0x48(%rbp),%rax
cmpl   $0x1,0x20(%rax)
jne    13bd <main+0x20d>
mov    -0x48(%rbp),%rax
cmpl   $0x2,0x24(%rax)
je     13d0 <main+0x220>
lea    0xcf9(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x50(%rbp),%rdi
call   1050 <rewind@plt>
mov    -0x50(%rbp),%rsi
lea    0xd03(%rip),%rdi
call   1060 <fputs@plt>
mov    -0x50(%rbp),%rdi
call   1050 <rewind@plt>
mov    -0x50(%rbp),%rdi
call   10b0 <getmntent@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    (%rax),%rdi
lea    0xd00(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1492 <main+0x2e2>
mov    -0x48(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xceb(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1492 <main+0x2e2>
mov    -0x48(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xcd6(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1492 <main+0x2e2>
mov    -0x48(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xcbd(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    1492 <main+0x2e2>
mov    -0x48(%rbp),%rax
cmpl   $0x0,0x20(%rax)
jne    1492 <main+0x2e2>
mov    -0x48(%rbp),%rax
cmpl   $0x0,0x24(%rax)
je     14a5 <main+0x2f5>
lea    0xc90(%rip),%rdi
call   1030 <puts@plt>
movl   $0x1,-0x14(%rbp)
jmp    14aa <main+0x2fa>
mov    -0x14(%rbp),%eax
add    $0x450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x430,%rsp
lea    0xe3e(%rip),%rdi
call   10b0 <strdupa@plt>
mov    %rax,0x8(%rsp)
lea    0xe37(%rip),%rdi
call   10b0 <strdupa@plt>
mov    %rax,0x10(%rsp)
lea    0xe30(%rip),%rdi
call   10b0 <strdupa@plt>
mov    %rax,0x18(%rsp)
lea    0xe24(%rip),%rbx
mov    %rbx,%rdi
call   10b0 <strdupa@plt>
mov    %rax,0x20(%rsp)
movabs $0x200000001,%rax
mov    %rax,0x28(%rsp)
lea    0x8(%rsp),%rdi
mov    %rbx,%rsi
call   10d0 <hasmntopt@plt>
xor    %r14d,%r14d
test   %rax,%rax
sete   %bpl
lea    0xf16(%rip),%rax
lea    0xf1e(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1080 <tmpfile@plt>
test   %rax,%rax
je     129e <main+0xee>
mov    %rax,%rbx
lea    0x8(%rsp),%rsi
mov    %rax,%rdi
call   1070 <addmntent@plt>
mov    %rbx,%rdi
call   1050 <rewind@plt>
lea    0x30(%rsp),%rdi
mov    $0x400,%esi
mov    %rbx,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     12af <main+0xff>
lea    0xde0(%rip),%rsi
lea    0x30(%rsp),%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
je     12c3 <main+0x113>
lea    0xdf4(%rip),%rdi
call   1030 <puts@plt>
jmp    12bb <main+0x10b>
lea    0xd7d(%rip),%rdi
call   1040 <printf@plt>
jmp    13e9 <main+0x239>
lea    0xd8c(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%r14d
jmp    12c6 <main+0x116>
mov    %bpl,%r14b
mov    %rbx,%rdi
call   1050 <rewind@plt>
mov    %rbx,%rdi
call   10a0 <getmntent@plt>
mov    %rax,%rbp
mov    (%rax),%rdi
lea    0xd1d(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
jne    1338 <main+0x188>
mov    0x8(%rbp),%rdi
lea    0xd12(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
jne    1338 <main+0x188>
mov    0x10(%rbp),%rdi
lea    0xd07(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
jne    1338 <main+0x188>
mov    0x18(%rbp),%rdi
lea    0xcf7(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
jne    1338 <main+0x188>
cmpl   $0x1,0x20(%rbp)
jne    1338 <main+0x188>
cmpl   $0x2,0x24(%rbp)
je     134a <main+0x19a>
lea    0xd66(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%r14d
mov    %rbx,%rdi
call   1050 <rewind@plt>
lea    0xd76(%rip),%rdi
mov    $0x25,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10c0 <fwrite@plt>
mov    %rbx,%rdi
call   1050 <rewind@plt>
mov    %rbx,%rdi
call   10a0 <getmntent@plt>
mov    %rax,%rbx
mov    (%rax),%rdi
lea    0xd6d(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
jne    13dd <main+0x22d>
mov    0x8(%rbx),%rdi
lea    0xd61(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
jne    13dd <main+0x22d>
mov    0x10(%rbx),%rdi
lea    0xd55(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
jne    13dd <main+0x22d>
mov    0x18(%rbx),%rdi
lea    0xd45(%rip),%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
jne    13dd <main+0x22d>
cmpl   $0x0,0x20(%rbx)
jne    13dd <main+0x22d>
cmpl   $0x0,0x24(%rbx)
je     13ef <main+0x23f>
lea    0xd2d(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x430,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.mntent = type { i8*, i8*, i8*, i8*, i32, i32 }
@.str = [10 x i8] c"/dev/hda1\00"
@.str.1 = [10 x i8] c"/some dir\00"
@.str.2 = [5 x i8] c"ext2\00"
@.str.3 = [9 x i8] c"defaults\00"
@.str.4 = [8 x i8] c"Found!\0A\00"
@.str.5 = [16 x i8] c"Didn't find it\0A\00"
@.str.6 = [32 x i8] c"Cannot open temporary file: %m\0A\00"
@.str.7 = [31 x i8] c"Cannot read temporary file: %m\00"
@.str.8 = [42 x i8] c"/dev/hda1 /some\\040dir ext2 defaults 1 2\0A\00"
@.str.9 = [26 x i8] c"Raw file data not correct\00"
@.str.10 = [42 x i8] c"Error while reading written entry back in\00"
@.str.11 = [38 x i8] c"/foo\\040dir /bar\\040dir auto bind \09 \0A\00"
@.str.12 = [9 x i8] c"/foo dir\00"
@.str.13 = [9 x i8] c"/bar dir\00"
@.str.14 = [5 x i8] c"auto\00"
@.str.15 = [5 x i8] c"bind\00"
@.str.16 = [52 x i8] c"Error while reading entry with trailing whitespaces\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.mntent
%8 = alloca %struct.mntent*
%9 = alloca i32*
%10 = alloca [1024 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store %struct.mntent* %7, %struct.mntent** %8
%11 = call i8* @strdupa(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%12 = getelementptr inbounds %struct.mntent, %struct.mntent* %7, i32 0, i32 0
store i8* %11, i8** %12
%13 = call i8* @strdupa(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%14 = getelementptr inbounds %struct.mntent, %struct.mntent* %7, i32 0, i32 1
store i8* %13, i8** %14
%15 = call i8* @strdupa(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%16 = getelementptr inbounds %struct.mntent, %struct.mntent* %7, i32 0, i32 2
store i8* %15, i8** %16
%17 = call i8* @strdupa(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%18 = getelementptr inbounds %struct.mntent, %struct.mntent* %7, i32 0, i32 3
store i8* %17, i8** %18
%19 = getelementptr inbounds %struct.mntent, %struct.mntent* %7, i32 0, i32 4
store i32 1, i32* %19
%20 = getelementptr inbounds %struct.mntent, %struct.mntent* %7, i32 0, i32 5
store i32 2, i32* %20
%21 = load %struct.mntent*, %struct.mntent** %8
%22 = call i64 @hasmntopt(%struct.mntent* %21, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %2
%25 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
br label %28
26: ; preds = %2
%27 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0))
store i32 1, i32* %6
br label %28
28: ; preds = %26, %24
%29 = call i32* (...) @tmpfile()
store i32* %29, i32** %9
%30 = load i32*, i32** %9
%31 = icmp eq i32* %30, null
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %6
br label %137
34: ; preds = %28
%35 = load i32*, i32** %9
%36 = call i32 @addmntent(i32* %35, %struct.mntent* %7)
%37 = load i32*, i32** %9
%38 = call i32 @rewind(i32* %37)
%39 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%40 = load i32*, i32** %9
%41 = call i32* @fgets(i8* %39, i32 1024, i32* %40)
%42 = icmp eq i32* %41, null
br i1 %42, label %43, label %45
43: ; preds = %34
%44 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %6
br label %52
45: ; preds = %34
%46 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%47 = call i64 @strcmp(i8* %46, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.8, i64 0, i64 0))
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %45
%50 = call i32 @puts(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0))
store i32 1, i32* %6
br label %51
51: ; preds = %49, %45
br label %52
52: ; preds = %51, %43
%53 = load i32*, i32** %9
%54 = call i32 @rewind(i32* %53)
%55 = load i32*, i32** %9
%56 = call %struct.mntent* @getmntent(i32* %55)
store %struct.mntent* %56, %struct.mntent** %8
%57 = load %struct.mntent*, %struct.mntent** %8
%58 = getelementptr inbounds %struct.mntent, %struct.mntent* %57, i32 0, i32 0
%59 = load i8*, i8** %58
%60 = call i64 @strcmp(i8* %59, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%61 = icmp ne i64 %60, 0
br i1 %61, label %90, label %62
62: ; preds = %52
%63 = load %struct.mntent*, %struct.mntent** %8
%64 = getelementptr inbounds %struct.mntent, %struct.mntent* %63, i32 0, i32 1
%65 = load i8*, i8** %64
%66 = call i64 @strcmp(i8* %65, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%67 = icmp ne i64 %66, 0
br i1 %67, label %90, label %68
68: ; preds = %62
%69 = load %struct.mntent*, %struct.mntent** %8
%70 = getelementptr inbounds %struct.mntent, %struct.mntent* %69, i32 0, i32 2
%71 = load i8*, i8** %70
%72 = call i64 @strcmp(i8* %71, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%73 = icmp ne i64 %72, 0
br i1 %73, label %90, label %74
74: ; preds = %68
%75 = load %struct.mntent*, %struct.mntent** %8
%76 = getelementptr inbounds %struct.mntent, %struct.mntent* %75, i32 0, i32 3
%77 = load i8*, i8** %76
%78 = call i64 @strcmp(i8* %77, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%79 = icmp ne i64 %78, 0
br i1 %79, label %90, label %80
80: ; preds = %74
%81 = load %struct.mntent*, %struct.mntent** %8
%82 = getelementptr inbounds %struct.mntent, %struct.mntent* %81, i32 0, i32 4
%83 = load i32, i32* %82
%84 = icmp ne i32 %83, 1
br i1 %84, label %90, label %85
85: ; preds = %80
%86 = load %struct.mntent*, %struct.mntent** %8
%87 = getelementptr inbounds %struct.mntent, %struct.mntent* %86, i32 0, i32 5
%88 = load i32, i32* %87
%89 = icmp ne i32 %88, 2
br i1 %89, label %90, label %92
90: ; preds = %85, %80, %74, %68, %62, %52
%91 = call i32 @puts(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.10, i64 0, i64 0))
store i32 1, i32* %6
br label %92
92: ; preds = %90, %85
%93 = load i32*, i32** %9
%94 = call i32 @rewind(i32* %93)
%95 = load i32*, i32** %9
%96 = call i32 @fputs(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i32* %95)
%97 = load i32*, i32** %9
%98 = call i32 @rewind(i32* %97)
%99 = load i32*, i32** %9
%100 = call %struct.mntent* @getmntent(i32* %99)
store %struct.mntent* %100, %struct.mntent** %8
%101 = load %struct.mntent*, %struct.mntent** %8
%102 = getelementptr inbounds %struct.mntent, %struct.mntent* %101, i32 0, i32 0
%103 = load i8*, i8** %102
%104 = call i64 @strcmp(i8* %103, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0))
%105 = icmp ne i64 %104, 0
br i1 %105, label %134, label %106
106: ; preds = %92
%107 = load %struct.mntent*, %struct.mntent** %8
%108 = getelementptr inbounds %struct.mntent, %struct.mntent* %107, i32 0, i32 1
%109 = load i8*, i8** %108
%110 = call i64 @strcmp(i8* %109, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0))
%111 = icmp ne i64 %110, 0
br i1 %111, label %134, label %112
112: ; preds = %106
%113 = load %struct.mntent*, %struct.mntent** %8
%114 = getelementptr inbounds %struct.mntent, %struct.mntent* %113, i32 0, i32 2
%115 = load i8*, i8** %114
%116 = call i64 @strcmp(i8* %115, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
%117 = icmp ne i64 %116, 0
br i1 %117, label %134, label %118
118: ; preds = %112
%119 = load %struct.mntent*, %struct.mntent** %8
%120 = getelementptr inbounds %struct.mntent, %struct.mntent* %119, i32 0, i32 3
%121 = load i8*, i8** %120
%122 = call i64 @strcmp(i8* %121, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0))
%123 = icmp ne i64 %122, 0
br i1 %123, label %134, label %124
124: ; preds = %118
%125 = load %struct.mntent*, %struct.mntent** %8
%126 = getelementptr inbounds %struct.mntent, %struct.mntent* %125, i32 0, i32 4
%127 = load i32, i32* %126
%128 = icmp ne i32 %127, 0
br i1 %128, label %134, label %129
129: ; preds = %124
%130 = load %struct.mntent*, %struct.mntent** %8
%131 = getelementptr inbounds %struct.mntent, %struct.mntent* %130, i32 0, i32 5
%132 = load i32, i32* %131
%133 = icmp ne i32 %132, 0
br i1 %133, label %134, label %136
134: ; preds = %129, %124, %118, %112, %106, %92
%135 = call i32 @puts(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.16, i64 0, i64 0))
store i32 1, i32* %6
br label %136
136: ; preds = %134, %129
br label %137
137: ; preds = %136, %32
%138 = load i32, i32* %6
ret i32 %138
}

LLVM IR (-O2):
%struct.mntent = type { i8*, i8*, i8*, i8*, i32, i32 }
@.str = [10 x i8] c"/dev/hda1\00"
@.str.1 = [10 x i8] c"/some dir\00"
@.str.2 = [5 x i8] c"ext2\00"
@.str.3 = [9 x i8] c"defaults\00"
@.str.6 = [32 x i8] c"Cannot open temporary file: %m\0A\00"
@.str.7 = [31 x i8] c"Cannot read temporary file: %m\00"
@.str.8 = [42 x i8] c"/dev/hda1 /some\\040dir ext2 defaults 1 2\0A\00"
@.str.9 = [26 x i8] c"Raw file data not correct\00"
@.str.10 = [42 x i8] c"Error while reading written entry back in\00"
@.str.11 = [38 x i8] c"/foo\\040dir /bar\\040dir auto bind \09 \0A\00"
@.str.12 = [9 x i8] c"/foo dir\00"
@.str.13 = [9 x i8] c"/bar dir\00"
@.str.14 = [5 x i8] c"auto\00"
@.str.15 = [5 x i8] c"bind\00"
@.str.16 = [52 x i8] c"Error while reading entry with trailing whitespaces\00"
@str = [15 x i8] c"Didn't find it\00"
@str.17 = [7 x i8] c"Found!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.mntent
%4 = alloca [1024 x i8]
%5 = bitcast %struct.mntent* %3 to i8*
%6 = tail call i8* @strdupa(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds %struct.mntent, %struct.mntent* %3, i64 0, i32 0
store i8* %6, i8** %7
%8 = tail call i8* @strdupa(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%9 = getelementptr inbounds %struct.mntent, %struct.mntent* %3, i64 0, i32 1
store i8* %8, i8** %9
%10 = tail call i8* @strdupa(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%11 = getelementptr inbounds %struct.mntent, %struct.mntent* %3, i64 0, i32 2
store i8* %10, i8** %11
%12 = tail call i8* @strdupa(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%13 = getelementptr inbounds %struct.mntent, %struct.mntent* %3, i64 0, i32 3
store i8* %12, i8** %13
%14 = getelementptr inbounds %struct.mntent, %struct.mntent* %3, i64 0, i32 4
store i32 1, i32* %14
%15 = getelementptr inbounds %struct.mntent, %struct.mntent* %3, i64 0, i32 5
store i32 2, i32* %15
%16 = call i64 @hasmntopt(%struct.mntent* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
%18 = select i1 %17, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @str.17, i64 0, i64 0)
%19 = zext i1 %17 to i32
%20 = call i32 @puts(i8* dereferenceable(1) %18)
%21 = call i32* (...) @tmpfile()
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %25
23: ; preds = %2
%24 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0))
br label %108
25: ; preds = %2
%26 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%27 = call i32 @addmntent(i32* %21, %struct.mntent* %3)
%28 = call i32 @rewind(i32* %21)
%29 = call i32* @fgets(i8* %26, i32 1024, i32* %21)
%30 = icmp eq i32* %29, null
br i1 %30, label %31, label %33
31: ; preds = %25
%32 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
br label %38
33: ; preds = %25
%34 = call i64 @strcmp(i8* %26, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.8, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %38, label %36
36: ; preds = %33
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.9, i64 0, i64 0))
br label %38
38: ; preds = %33, %36, %31
%39 = phi i32 [ 1, %31 ], [ 1, %36 ], [ %19, %33 ]
%40 = call i32 @rewind(i32* %21)
%41 = call %struct.mntent* @getmntent(i32* %21)
%42 = getelementptr inbounds %struct.mntent, %struct.mntent* %41, i64 0, i32 0
%43 = load i8*, i8** %42
%44 = call i64 @strcmp(i8* %43, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %69
46: ; preds = %38
%47 = getelementptr inbounds %struct.mntent, %struct.mntent* %41, i64 0, i32 1
%48 = load i8*, i8** %47
%49 = call i64 @strcmp(i8* %48, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %69
51: ; preds = %46
%52 = getelementptr inbounds %struct.mntent, %struct.mntent* %41, i64 0, i32 2
%53 = load i8*, i8** %52
%54 = call i64 @strcmp(i8* %53, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %69
56: ; preds = %51
%57 = getelementptr inbounds %struct.mntent, %struct.mntent* %41, i64 0, i32 3
%58 = load i8*, i8** %57
%59 = call i64 @strcmp(i8* %58, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%60 = icmp eq i64 %59, 0
br i1 %60, label %61, label %69
61: ; preds = %56
%62 = getelementptr inbounds %struct.mntent, %struct.mntent* %41, i64 0, i32 4
%63 = load i32, i32* %62
%64 = icmp eq i32 %63, 1
br i1 %64, label %65, label %69
65: ; preds = %61
%66 = getelementptr inbounds %struct.mntent, %struct.mntent* %41, i64 0, i32 5
%67 = load i32, i32* %66
%68 = icmp eq i32 %67, 2
br i1 %68, label %71, label %69
69: ; preds = %65, %61, %56, %51, %46, %38
%70 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.10, i64 0, i64 0))
br label %71
71: ; preds = %69, %65
%72 = phi i32 [ 1, %69 ], [ %39, %65 ]
%73 = call i32 @rewind(i32* %21)
%74 = call i64 @fwrite(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i64 37, i64 1, i32* %21)
%75 = call i32 @rewind(i32* %21)
%76 = call %struct.mntent* @getmntent(i32* %21)
%77 = getelementptr inbounds %struct.mntent, %struct.mntent* %76, i64 0, i32 0
%78 = load i8*, i8** %77
%79 = call i64 @strcmp(i8* %78, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0))
%80 = icmp eq i64 %79, 0
br i1 %80, label %81, label %104
81: ; preds = %71
%82 = getelementptr inbounds %struct.mntent, %struct.mntent* %76, i64 0, i32 1
%83 = load i8*, i8** %82
%84 = call i64 @strcmp(i8* %83, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.13, i64 0, i64 0))
%85 = icmp eq i64 %84, 0
br i1 %85, label %86, label %104
86: ; preds = %81
%87 = getelementptr inbounds %struct.mntent, %struct.mntent* %76, i64 0, i32 2
%88 = load i8*, i8** %87
%89 = call i64 @strcmp(i8* %88, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
%90 = icmp eq i64 %89, 0
br i1 %90, label %91, label %104
91: ; preds = %86
%92 = getelementptr inbounds %struct.mntent, %struct.mntent* %76, i64 0, i32 3
%93 = load i8*, i8** %92
%94 = call i64 @strcmp(i8* %93, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0))
%95 = icmp eq i64 %94, 0
br i1 %95, label %96, label %104
96: ; preds = %91
%97 = getelementptr inbounds %struct.mntent, %struct.mntent* %76, i64 0, i32 4
%98 = load i32, i32* %97
%99 = icmp eq i32 %98, 0
br i1 %99, label %100, label %104
100: ; preds = %96
%101 = getelementptr inbounds %struct.mntent, %struct.mntent* %76, i64 0, i32 5
%102 = load i32, i32* %101
%103 = icmp eq i32 %102, 0
br i1 %103, label %106, label %104
104: ; preds = %100, %96, %91, %86, %81, %71
%105 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.16, i64 0, i64 0))
br label %106
106: ; preds = %104, %100
%107 = phi i32 [ 1, %104 ], [ %72, %100 ]
br label %108
108: ; preds = %106, %23
%109 = phi i32 [ 1, %23 ], [ %107, %106 ]
ret i32 %109
}