#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 stat {
  int dummy;
};
struct mntent {
  int /*<<< orphan*/ mnt_fsname;
  int /*<<< orphan*/ mnt_dir;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ EINVAL;
scalar_t__ ENODEV;
scalar_t__ ENOENT;
int /*<<< orphan*/ endmntent(int /*<<< orphan*/ *);
scalar_t__ errno;
int /*<<< orphan*/ free(char *);
struct mntent *getmntent(int /*<<< orphan*/ *);
char *malloc(scalar_t__);
char *realloc(char *, scalar_t__);
char *realpath(char const *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *setmntent(char *, char *);
scalar_t__ stat(char *, struct stat *);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
scalar_t__ strlen(int /*<<< orphan*/);
int /*<<< orphan*/ strncmp(int /*<<< orphan*/, char *, scalar_t__);
char *get_block_device(const char *path) {
  char *mnt_dir = NULL, *mnt_fsname = NULL;
  char *resolved_path = NULL;
  FILE *mtab_f;
  int done = 0;
  struct mntent *entry;
  struct stat junk;
  if (path == NULL) {
    errno = EINVAL;
  } else if ((resolved_path = realpath(path, NULL)) != NULL &&
             (mtab_f = setmntent("/etc/mtab", "r")) != NULL) {
    do {
      entry = getmntent(mtab_f);
      if (entry != NULL) {
        if (!strncmp(entry->mnt_dir, resolved_path, strlen(entry->mnt_dir))) {
          char copy_string = 0;
          if (mnt_dir == NULL) {
            mnt_dir = malloc(strlen(entry->mnt_dir) + 1);
            mnt_fsname = malloc(strlen(entry->mnt_fsname) + 1);
            copy_string = mnt_dir != NULL && mnt_fsname != NULL;
          } else {
            if (!strncmp(entry->mnt_dir, mnt_dir, strlen(entry->mnt_dir))) {
              mnt_dir = realloc(mnt_dir, strlen(entry->mnt_dir));
              mnt_fsname = realloc(mnt_fsname, strlen(entry->mnt_fsname));
              copy_string = 1;
            }
          }
          if (copy_string != 0) {
            strcpy(mnt_dir, entry->mnt_dir);
            strcpy(mnt_fsname, entry->mnt_fsname);
          }
        }
      }
    } while (done == 0 && entry != NULL);
    endmntent(mtab_f);
  }
  if (mnt_dir != NULL) {
    free(mnt_dir);
  }
  if (resolved_path != NULL) {
    free(resolved_path);
  }
  if (mnt_fsname != NULL && stat(mnt_fsname, &junk) < 0 && errno == ENOENT) {
    free(mnt_fsname);
    mnt_fsname = NULL;
    errno = ENODEV;
  }
  return mnt_fsname;
}


x86 assembly (clang, -O0):
<get_block_device>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1202 <get_block_device+0x52>
mov    0x2de8(%rip),%rax
mov    (%rax),%rcx
mov    0x2de6(%rip),%rax
mov    %rcx,(%rax)
jmp    13f6 <get_block_device+0x246>
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1090 <realpath@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     13f1 <get_block_device+0x241>
lea    0xddc(%rip),%rdi
lea    0xddf(%rip),%rsi
call   10c0 <setmntent@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     13f1 <get_block_device+0x241>
jmp    1243 <get_block_device+0x93>
mov    -0x28(%rbp),%rdi
call   10b0 <getmntent@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     13be <get_block_device+0x20e>
mov    -0x38(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x54(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x38(%rbp),%rax
mov    0x4(%rax),%edi
call   1070 <strlen@plt>
mov    -0x54(%rbp),%edi
mov    -0x50(%rbp),%rsi
mov    %rax,%rdx
call   1050 <strncmp@plt>
cmp    $0x0,%eax
jne    13b9 <get_block_device+0x209>
movb   $0x0,-0x41(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1302 <get_block_device+0x152>
mov    -0x38(%rbp),%rax
mov    0x4(%rax),%edi
call   1070 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   10a0 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x38(%rbp),%rax
mov    (%rax),%edi
call   1070 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   10a0 <malloc@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x55(%rbp)
je     12f2 <get_block_device+0x142>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x55(%rbp)
mov    -0x55(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %al,-0x41(%rbp)
jmp    1388 <get_block_device+0x1d8>
mov    -0x38(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x64(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x38(%rbp),%rax
mov    0x4(%rax),%edi
call   1070 <strlen@plt>
mov    -0x64(%rbp),%edi
mov    -0x60(%rbp),%rsi
mov    %rax,%rdx
call   1050 <strncmp@plt>
cmp    $0x0,%eax
jne    1383 <get_block_device+0x1d3>
mov    -0x10(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x38(%rbp),%rax
mov    0x4(%rax),%edi
call   1070 <strlen@plt>
mov    -0x78(%rbp),%rdi
mov    %rax,%rsi
call   10d0 <realloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x70(%rbp)
mov    -0x38(%rbp),%rax
mov    (%rax),%edi
call   1070 <strlen@plt>
mov    -0x70(%rbp),%rdi
mov    %rax,%rsi
call   10d0 <realloc@plt>
mov    %rax,-0x18(%rbp)
movb   $0x1,-0x41(%rbp)
jmp    1388 <get_block_device+0x1d8>
movsbl -0x41(%rbp),%eax
cmp    $0x0,%eax
je     13b4 <get_block_device+0x204>
mov    -0x10(%rbp),%rdi
mov    -0x38(%rbp),%rax
mov    0x4(%rax),%esi
call   1060 <strcpy@plt>
mov    -0x18(%rbp),%rdi
mov    -0x38(%rbp),%rax
mov    (%rax),%esi
call   1060 <strcpy@plt>
jmp    13b9 <get_block_device+0x209>
jmp    13be <get_block_device+0x20e>
jmp    13c3 <get_block_device+0x213>
xor    %eax,%eax
cmpl   $0x0,-0x2c(%rbp)
mov    %al,-0x79(%rbp)
jne    13dd <get_block_device+0x22d>
cmpq   $0x0,-0x38(%rbp)
setne  %al
mov    %al,-0x79(%rbp)
mov    -0x79(%rbp),%al
test   $0x1,%al
jne    1243 <get_block_device+0x93>
mov    -0x28(%rbp),%rdi
call   1040 <endmntent@plt>
jmp    13f6 <get_block_device+0x246>
cmpq   $0x0,-0x10(%rbp)
je     140a <get_block_device+0x25a>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x20(%rbp)
je     141e <get_block_device+0x26e>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x18(%rbp)
je     147f <get_block_device+0x2cf>
mov    -0x18(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1080 <stat@plt>
cmp    $0x0,%rax
jge    147f <get_block_device+0x2cf>
mov    0x2b99(%rip),%rax
mov    (%rax),%rax
mov    0x2b6f(%rip),%rcx
cmp    (%rcx),%rax
jne    147f <get_block_device+0x2cf>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
movq   $0x0,-0x18(%rbp)
mov    0x2b5e(%rip),%rax
mov    (%rax),%rcx
mov    0x2b64(%rip),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_block_device>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rdi,%rdi
je     12e8 <get_block_device+0x138>
xor    %r14d,%r14d
xor    %esi,%esi
call   1090 <realpath@plt>
test   %rax,%rax
je     1370 <get_block_device+0x1c0>
mov    %rax,%r15
lea    0xe1f(%rip),%rdi
lea    0xe22(%rip),%rsi
call   10c0 <setmntent@plt>
test   %rax,%rax
je     1365 <get_block_device+0x1b5>
mov    %rax,%r12
mov    %rax,%rdi
call   10b0 <getmntent@plt>
test   %rax,%rax
je     135d <get_block_device+0x1ad>
mov    %rax,%rbx
xor    %r13d,%r13d
xor    %r14d,%r14d
jmp    1244 <get_block_device+0x94>
mov    0x4(%rbx),%esi
mov    %r13,%rdi
call   1060 <strcpy@plt>
mov    (%rbx),%esi
mov    %r14,%rdi
call   1060 <strcpy@plt>
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   10b0 <getmntent@plt>
mov    %rax,%rbx
test   %rax,%rax
je     12fe <get_block_device+0x14e>
mov    0x4(%rbx),%ebp
mov    %ebp,%edi
call   1070 <strlen@plt>
mov    %ebp,%edi
mov    %r15,%rsi
mov    %rax,%rdx
call   1050 <strncmp@plt>
test   %eax,%eax
jne    1230 <get_block_device+0x80>
mov    0x4(%rbx),%ebp
mov    %ebp,%edi
call   1070 <strlen@plt>
test   %r13,%r13
je     12af <get_block_device+0xff>
mov    %ebp,%edi
mov    %r13,%rsi
mov    %rax,%rdx
call   1050 <strncmp@plt>
test   %eax,%eax
jne    1230 <get_block_device+0x80>
mov    0x4(%rbx),%edi
call   1070 <strlen@plt>
mov    %r13,%rdi
mov    %rax,%rsi
call   10d0 <realloc@plt>
mov    %rax,%r13
mov    (%rbx),%edi
call   1070 <strlen@plt>
mov    %r14,%rdi
mov    %rax,%rsi
call   10d0 <realloc@plt>
mov    %rax,%r14
jmp    1215 <get_block_device+0x65>
add    $0x1,%rax
mov    %rax,%rdi
call   10a0 <malloc@plt>
mov    %rax,%r13
mov    (%rbx),%edi
call   1070 <strlen@plt>
lea    0x1(%rax),%rdi
call   10a0 <malloc@plt>
mov    %rax,%r14
test   %r13,%r13
je     1230 <get_block_device+0x80>
test   %r14,%r14
jne    1215 <get_block_device+0x65>
jmp    1230 <get_block_device+0x80>
mov    0x2ce9(%rip),%rax
mov    (%rax),%rax
mov    0x2ce7(%rip),%rcx
mov    %rax,(%rcx)
jmp    136d <get_block_device+0x1bd>
mov    %r12,%rdi
call   1040 <endmntent@plt>
test   %r13,%r13
je     1313 <get_block_device+0x163>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
test   %r14,%r14
je     136d <get_block_device+0x1bd>
mov    %rsp,%rsi
mov    %r14,%rdi
call   1080 <stat@plt>
test   %rax,%rax
jns    1370 <get_block_device+0x1c0>
mov    0x2ca9(%rip),%rbx
mov    (%rbx),%rax
mov    0x2c7f(%rip),%rcx
cmp    (%rcx),%rax
jne    1370 <get_block_device+0x1c0>
mov    %r14,%rdi
call   1030 <free@plt>
mov    0x2c7b(%rip),%rax
mov    (%rax),%rax
mov    %rax,(%rbx)
jmp    136d <get_block_device+0x1bd>
mov    %r12,%rdi
call   1040 <endmntent@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %r14d,%r14d
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.mntent = type { i32, i32 }
%struct.stat = type { i32 }
@EINVAL = global i64 0
@errno = global i64 0
@.str = [10 x i8] c"/etc/mtab\00"
@.str.1 = [2 x i8] c"r\00"
@ENOENT = global i64 0
@ENODEV = global i64 0
define i8* @get_block_device(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca %struct.mntent*
%9 = alloca %struct.stat
%10 = alloca i8
store i8* %0, i8** %2
store i8* null, i8** %3
store i8* null, i8** %4
store i8* null, i8** %5
store i32 0, i32* %7
%11 = load i8*, i8** %2
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %15
13: ; preds = %1
%14 = load i64, i64* @EINVAL
store i64 %14, i64* @errno
br label %119
15: ; preds = %1
%16 = load i8*, i8** %2
%17 = call i8* @realpath(i8* %16, i32* null)
store i8* %17, i8** %5
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %118
19: ; preds = %15
%20 = call i32* @setmntent(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %20, i32** %6
%21 = icmp ne i32* %20, null
br i1 %21, label %22, label %118
22: ; preds = %19
br label %23
23: ; preds = %113, %22
%24 = load i32*, i32** %6
%25 = call %struct.mntent* @getmntent(i32* %24)
store %struct.mntent* %25, %struct.mntent** %8
%26 = load %struct.mntent*, %struct.mntent** %8
%27 = icmp ne %struct.mntent* %26, null
br i1 %27, label %28, label %106
28: ; preds = %23
%29 = load %struct.mntent*, %struct.mntent** %8
%30 = getelementptr inbounds %struct.mntent, %struct.mntent* %29, i32 0, i32 1
%31 = load i32, i32* %30
%32 = load i8*, i8** %5
%33 = load %struct.mntent*, %struct.mntent** %8
%34 = getelementptr inbounds %struct.mntent, %struct.mntent* %33, i32 0, i32 1
%35 = load i32, i32* %34
%36 = call i64 @strlen(i32 %35)
%37 = call i32 @strncmp(i32 %31, i8* %32, i64 %36)
%38 = icmp ne i32 %37, 0
br i1 %38, label %105, label %39
39: ; preds = %28
store i8 0, i8* %10
%40 = load i8*, i8** %3
%41 = icmp eq i8* %40, null
br i1 %41, label %42, label %64
42: ; preds = %39
%43 = load %struct.mntent*, %struct.mntent** %8
%44 = getelementptr inbounds %struct.mntent, %struct.mntent* %43, i32 0, i32 1
%45 = load i32, i32* %44
%46 = call i64 @strlen(i32 %45)
%47 = add nsw i64 %46, 1
%48 = call i8* @malloc(i64 %47)
store i8* %48, i8** %3
%49 = load %struct.mntent*, %struct.mntent** %8
%50 = getelementptr inbounds %struct.mntent, %struct.mntent* %49, i32 0, i32 0
%51 = load i32, i32* %50
%52 = call i64 @strlen(i32 %51)
%53 = add nsw i64 %52, 1
%54 = call i8* @malloc(i64 %53)
store i8* %54, i8** %4
%55 = load i8*, i8** %3
%56 = icmp ne i8* %55, null
br i1 %56, label %57, label %60
57: ; preds = %42
%58 = load i8*, i8** %4
%59 = icmp ne i8* %58, null
br label %60
60: ; preds = %57, %42
%61 = phi i1 [ false, %42 ], [ %59, %57 ]
%62 = zext i1 %61 to i32
%63 = trunc i32 %62 to i8
store i8 %63, i8* %10
br label %89
64: ; preds = %39
%65 = load %struct.mntent*, %struct.mntent** %8
%66 = getelementptr inbounds %struct.mntent, %struct.mntent* %65, i32 0, i32 1
%67 = load i32, i32* %66
%68 = load i8*, i8** %3
%69 = load %struct.mntent*, %struct.mntent** %8
%70 = getelementptr inbounds %struct.mntent, %struct.mntent* %69, i32 0, i32 1
%71 = load i32, i32* %70
%72 = call i64 @strlen(i32 %71)
%73 = call i32 @strncmp(i32 %67, i8* %68, i64 %72)
%74 = icmp ne i32 %73, 0
br i1 %74, label %88, label %75
75: ; preds = %64
%76 = load i8*, i8** %3
%77 = load %struct.mntent*, %struct.mntent** %8
%78 = getelementptr inbounds %struct.mntent, %struct.mntent* %77, i32 0, i32 1
%79 = load i32, i32* %78
%80 = call i64 @strlen(i32 %79)
%81 = call i8* @realloc(i8* %76, i64 %80)
store i8* %81, i8** %3
%82 = load i8*, i8** %4
%83 = load %struct.mntent*, %struct.mntent** %8
%84 = getelementptr inbounds %struct.mntent, %struct.mntent* %83, i32 0, i32 0
%85 = load i32, i32* %84
%86 = call i64 @strlen(i32 %85)
%87 = call i8* @realloc(i8* %82, i64 %86)
store i8* %87, i8** %4
store i8 1, i8* %10
br label %88
88: ; preds = %75, %64
br label %89
89: ; preds = %88, %60
%90 = load i8, i8* %10
%91 = sext i8 %90 to i32
%92 = icmp ne i32 %91, 0
br i1 %92, label %93, label %104
93: ; preds = %89
%94 = load i8*, i8** %3
%95 = load %struct.mntent*, %struct.mntent** %8
%96 = getelementptr inbounds %struct.mntent, %struct.mntent* %95, i32 0, i32 1
%97 = load i32, i32* %96
%98 = call i32 @strcpy(i8* %94, i32 %97)
%99 = load i8*, i8** %4
%100 = load %struct.mntent*, %struct.mntent** %8
%101 = getelementptr inbounds %struct.mntent, %struct.mntent* %100, i32 0, i32 0
%102 = load i32, i32* %101
%103 = call i32 @strcpy(i8* %99, i32 %102)
br label %104
104: ; preds = %93, %89
br label %105
105: ; preds = %104, %28
br label %106
106: ; preds = %105, %23
br label %107
107: ; preds = %106
%108 = load i32, i32* %7
%109 = icmp eq i32 %108, 0
br i1 %109, label %110, label %113
110: ; preds = %107
%111 = load %struct.mntent*, %struct.mntent** %8
%112 = icmp ne %struct.mntent* %111, null
br label %113
113: ; preds = %110, %107
%114 = phi i1 [ false, %107 ], [ %112, %110 ]
br i1 %114, label %23, label %115
115: ; preds = %113
%116 = load i32*, i32** %6
%117 = call i32 @endmntent(i32* %116)
br label %118
118: ; preds = %115, %19, %15
br label %119
119: ; preds = %118, %13
%120 = load i8*, i8** %3
%121 = icmp ne i8* %120, null
br i1 %121, label %122, label %125
122: ; preds = %119
%123 = load i8*, i8** %3
%124 = call i32 @free(i8* %123)
br label %125
125: ; preds = %122, %119
%126 = load i8*, i8** %5
%127 = icmp ne i8* %126, null
br i1 %127, label %128, label %131
128: ; preds = %125
%129 = load i8*, i8** %5
%130 = call i32 @free(i8* %129)
br label %131
131: ; preds = %128, %125
%132 = load i8*, i8** %4
%133 = icmp ne i8* %132, null
br i1 %133, label %134, label %146
134: ; preds = %131
%135 = load i8*, i8** %4
%136 = call i64 @stat(i8* %135, %struct.stat* %9)
%137 = icmp slt i64 %136, 0
br i1 %137, label %138, label %146
138: ; preds = %134
%139 = load i64, i64* @errno
%140 = load i64, i64* @ENOENT
%141 = icmp eq i64 %139, %140
br i1 %141, label %142, label %146
142: ; preds = %138
%143 = load i8*, i8** %4
%144 = call i32 @free(i8* %143)
store i8* null, i8** %4
%145 = load i64, i64* @ENODEV
store i64 %145, i64* @errno
br label %146
146: ; preds = %142, %138, %134, %131
%147 = load i8*, i8** %4
ret i8* %147
}

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.mntent = type { i32, i32 }
@EINVAL = global i64 0
@errno = global i64 0
@.str = [10 x i8] c"/etc/mtab\00"
@.str.1 = [2 x i8] c"r\00"
@ENOENT = global i64 0
@ENODEV = global i64 0
define i8* @get_block_device(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = icmp eq i8* %0, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = load i64, i64* @EINVAL
store i64 %6, i64* @errno
br label %86
7: ; preds = %1
%8 = tail call i8* @realpath(i8* %0, i32* null)
%9 = icmp eq i8* %8, null
br i1 %9, label %86, label %10
10: ; preds = %7
%11 = tail call i32* @setmntent(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %71, label %13
13: ; preds = %10
%14 = tail call %struct.mntent* @getmntent(i32* %11)
%15 = icmp eq %struct.mntent* %14, null
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = tail call i32 @endmntent(i32* %11)
br label %71
18: ; preds = %13, %61
%19 = phi %struct.mntent* [ %64, %61 ], [ %14, %13 ]
%20 = phi i8* [ %63, %61 ], [ null, %13 ]
%21 = phi i8* [ %62, %61 ], [ null, %13 ]
%22 = getelementptr inbounds %struct.mntent, %struct.mntent* %19, i64 0, i32 1
%23 = load i32, i32* %22
%24 = tail call i64 @strlen(i32 %23)
%25 = tail call i32 @strncmp(i32 %23, i8* %8, i64 %24)
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %61
27: ; preds = %18
%28 = icmp eq i8* %20, null
%29 = load i32, i32* %22
%30 = tail call i64 @strlen(i32 %29)
br i1 %28, label %42, label %31
31: ; preds = %27
%32 = tail call i32 @strncmp(i32 %29, i8* %20, i64 %30)
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %61
34: ; preds = %31
%35 = load i32, i32* %22
%36 = tail call i64 @strlen(i32 %35)
%37 = tail call i8* @realloc(i8* %20, i64 %36)
%38 = getelementptr inbounds %struct.mntent, %struct.mntent* %19, i64 0, i32 0
%39 = load i32, i32* %38
%40 = tail call i64 @strlen(i32 %39)
%41 = tail call i8* @realloc(i8* %21, i64 %40)
br label %53
42: ; preds = %27
%43 = add nsw i64 %30, 1
%44 = tail call i8* @malloc(i64 %43)
%45 = getelementptr inbounds %struct.mntent, %struct.mntent* %19, i64 0, i32 0
%46 = load i32, i32* %45
%47 = tail call i64 @strlen(i32 %46)
%48 = add nsw i64 %47, 1
%49 = tail call i8* @malloc(i64 %48)
%50 = icmp eq i8* %44, null
%51 = icmp eq i8* %49, null
%52 = or i1 %50, %51
br i1 %52, label %61, label %53
53: ; preds = %34, %42
%54 = phi i8* [ %37, %34 ], [ %44, %42 ]
%55 = phi i8* [ %41, %34 ], [ %49, %42 ]
%56 = load i32, i32* %22
%57 = tail call i32 @strcpy(i8* %54, i32 %56)
%58 = getelementptr inbounds %struct.mntent, %struct.mntent* %19, i64 0, i32 0
%59 = load i32, i32* %58
%60 = tail call i32 @strcpy(i8* %55, i32 %59)
br label %61
61: ; preds = %31, %42, %53, %18
%62 = phi i8* [ %21, %18 ], [ %55, %53 ], [ %49, %42 ], [ %21, %31 ]
%63 = phi i8* [ %20, %18 ], [ %54, %53 ], [ %44, %42 ], [ %20, %31 ]
%64 = tail call %struct.mntent* @getmntent(i32* %11)
%65 = icmp eq %struct.mntent* %64, null
br i1 %65, label %66, label %18
66: ; preds = %61
%67 = tail call i32 @endmntent(i32* %11)
%68 = icmp eq i8* %63, null
br i1 %68, label %73, label %69
69: ; preds = %66
%70 = tail call i32 @free(i8* %63)
br label %73
71: ; preds = %10, %16
%72 = tail call i32 @free(i8* %8)
br label %86
73: ; preds = %66, %69
%74 = tail call i32 @free(i8* %8)
%75 = icmp eq i8* %62, null
br i1 %75, label %86, label %76
76: ; preds = %73
%77 = call i64 @stat(i8* %62, %struct.stat* %2)
%78 = icmp slt i64 %77, 0
br i1 %78, label %79, label %86
79: ; preds = %76
%80 = load i64, i64* @errno
%81 = load i64, i64* @ENOENT
%82 = icmp eq i64 %80, %81
br i1 %82, label %83, label %86
83: ; preds = %79
%84 = call i32 @free(i8* %62)
%85 = load i64, i64* @ENODEV
store i64 %85, i64* @errno
br label %86
86: ; preds = %71, %7, %5, %83, %79, %76, %73
%87 = phi i8* [ null, %83 ], [ %62, %79 ], [ %62, %76 ], [ null, %73 ], [ null, %5 ], [ null, %7 ], [ null, %71 ]
ret i8* %87
}